Jump to content

Show unit price on product-list.tpl


davidmr92

Recommended Posts

Hello,

I wanna know how to show the field unit price from the admin view of a product (I attach an image)

 

2rclf7d.jpg

 

I want to show it in product.tpl and product-list.tpl

 

I have found some tutorials about this but they calculate the unit price with a math equation between product price / units

{if $product.unit_price_ratio}
        {math equation="b/a" a=$product.unit_price_ratio b=$product.price assign=realunit}
        {convertPrice price=$realunit} {l s="per"} {$product.unity}
    {/if}

I think there must be a variable or some way to show this value. 

If someone can help me.

 

Thanks for all, regards.

Link to comment
Share on other sites

  • 9 months later...
On 5/28/2017 at 1:41 AM, shokinro said:

The question is very confusing - at least I am confused, not sure what you really want to do.

You asked how to show unit price, but you give an example code that has nothing to do with that.

I have hard time to explain this as well

he asked to show UNIT PRICE

not a PRODUCT price - and this is the terminology that is not standardized in Prestashop and ecommerce

PRODUCT  can have multiple UNITS or PIECES  like a cardbox of milk has 12 milks right ?

My Question is how to display this UNIT PIECE price in checkout on  shopping-cart-product-line.tpl

Answer  to the question is go to www/themes/YOUR-THEME-NAME/product-list.tpl

and  on line 260

edit it to look something like this

 {hook h="displayProductPriceBlock" product=$product type="price"}
                        {hook h="displayProductPriceBlock" product=$product type="unit_price"}
                        {if $product.unit_price_ratio > 0}
   {math equation="pprice / punit_price"  pprice=$product.price  punit_price=$product.unit_price_ratio assign=unit_price}
   <span class="unit_price">{convertPrice price=$unit_price} / {$product.unity|escape:'html':'UTF-8'}</span>

 

 

Link to comment
Share on other sites

to whom it my concern

I just found a way to display product price per unit

so not the PRODUCT PRICE but small product portions  price on Product list with tax excluded

FINALLY ~!

 

here is a  PS 1.6.* code

 

           {hook h="displayProductPriceBlock" product=$product type="price"}
						{hook h="displayProductPriceBlock" product=$product type="unit_price"}
						{if $product.unit_price_ratio > 0} {math equation="pprice / punit_price" 
						pprice=$product.price_tax_exc punit_price=$product.unit_price_ratio assign=unit_price}
   <span class="unit_price">
       {convertPrice price=$unit_price} / {$product.unity|escape:'html':'UTF-8'}
       </span>

 

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

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...