Jump to content

Display Unit Price Next to Attribute


Recommended Posts

I want to display the unit price for each combination next to the attribute value.  I've managed to get the correct placement but It only displays unit price for attribute selected.

 

PrestaShop version 1.6.0.11  default template

 

http://karmelcollections.com/clean-and-fresh/clean-cotton#/size-16oz_bottle

 

post-881620-0-58898100-1430070935_thumb.jpg

Edited by karmelsc (see edit history)
Link to comment
Share on other sites

In the pic I have the unit price to the right of the attribute value. Right now if you select attribute, the unit price changes for the 1oz value. I want to display static unit price next to attribute value

 
you can any display price that you want to display.
you can put following code any where in the product.tpl file.
 
$product->price
$product->wholesale_price
$product->unit_price
Link to comment
Share on other sites

I may not have explained this clearly. I have thousands of products to add that have a unit price and the unit price varies.  I would like the unit price to display next to the attribute label.  Right now the unit price is next to the attribute but its not the correct unit price for the attribute for that item.  It looks like there is a loop in the product.tpl that gets the attribute value but i don't know enough to program the unit price in that loop.   I have added the unit price to the attribute name to show what i'm trying to do.

 

post-881620-0-13877000-1430312057_thumb.png

Link to comment
Share on other sites

If I set the unit per ounce in the product combination then it display

Size

1oz: attribute : 2.99 unit price: 2.99÷1 = 2.99

2oz: attribute : 5 unit price: 5÷2 = 2.5

4oz: attribute : 9 unit price: 9÷4 = 2.25

 

If I set the unit price in product combination it shows the value I set but only for the radio button of the selected attribute. I want the product combination unit price to show for each attribute all the time.

Link to comment
Share on other sites

If I set the unit per ounce in the product combination then it display

Size

1oz: attribute : 2.99 unit price: 2.99÷1 = 2.99

2oz: attribute : 5 unit price: 5÷2 = 2.5

4oz: attribute : 9 unit price: 9÷4 = 2.25

 

If I set the unit price in product combination it shows the value I set but only for the radio button of the selected attribute. I want the product combination unit price to show for each attribute all the time.

Let me give some time to work.

Link to comment
Share on other sites

If I set the unit per ounce in the product combination then it display

Size

1oz: attribute : 2.99 unit price: 2.99÷1 = 2.99

2oz: attribute : 5 unit price: 5÷2 = 2.5

4oz: attribute : 9 unit price: 9÷4 = 2.25

 

If I set the unit price in product combination it shows the value I set but only for the radio button of the selected attribute. I want the product combination unit price to show for each attribute all the time.

 

2.99/1

5/2 is what attribute size?

You can't change price from the front end ?

 

display in product.tpl following code and make a search for what you want to display?

 

{$product@var_dump}

Link to comment
Share on other sites

I don't understand what your asking

 

Code in product.tplto display unit price {if !empty($product->unity) && $product->unit_price_ratio > 0.000000}

{math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
<p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'html':'UTF-8'}</p>
{hook h="displayProductPriceBlock" product=$product type="unit_price"}
{/if}
 
what it does
post-881620-0-89125800-1430448661_thumb.jpg
 
what I want it to do
post-881620-0-99806500-1430448679_thumb.png
 
Link to comment
Share on other sites

  • 6 months later...

 

I don't understand what your asking

 

Code in product.tplto display unit price {if !empty($product->unity) && $product->unit_price_ratio > 0.000000}

{math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
<p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'html':'UTF-8'}</p>
{hook h="displayProductPriceBlock" product=$product type="unit_price"}
{/if}
 
what it does
 
what I want it to do

 

Did you found a solution for this?

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...