Jump to content

Display unit price or other in product list


Gaëtan

Recommended Posts

Hi,

I'm searching how to display product unit price in product list frontend on prestashop 1.6

 

I try to add this code in themes/mytheme/product-list.tpl

(This is the code I found in themes/mytheme/product.tpl...)

{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}

But it does'nt work... and I don't know why...

 

After that, I would like to add in product list : quantity box (with + and -) like in product page...

But, it's the same problem, it does'nt work.

 

Could someone help me please ?

Link to comment
Share on other sites

try this code in product-list.tpl. i used this code for 1.5 project and not tested 1.6 if not work say me.

{if $product.unit_price_ratio}
        {l s="Unit Price = "} {math equation="b/a" a=$product.unit_price_ratio b=$product.price_without_reduction assign=realunit}
        {convertPrice price=$realunit} {$product.unity}
    {/if}
 
Edited by safa (see edit history)
Link to comment
Share on other sites

Thanks for your reply, but nothing happened with this code.... no changes on my frontend.

 

I can't understand how the code in tpl files works... even if I add just <p>TEST</p>.... it don't appear in frontend... why ? Is there others files where we have to add code to display something in frontend?

 

It happen something only if I delete a large part of code.

Link to comment
Share on other sites

Thanks for your reply, but nothing happened with this code.... no changes on my frontend.

 

I can't understand how the code in tpl files works... even if I add just <p>TEST</p>.... it don't appear in frontend... why ? Is there others files where we have to add code to display something in frontend?

 

It happen something only if I delete a large part of code.

 

 

hello

it's probably because of caching in your shop.

go to preferences > performance tab and clear shop cache (there is a button for that)

 

you can even disable it and turn on force compile (do it temporarily, while you work on your template)

Link to comment
Share on other sites

  • 1 month later...

Cant get myself around this issue either. Gaetan - i have the same issue, like you do, and i tried both things you did - and I have the same problem. I messaged to Nemo1 about this issue, but have not got a reply yet... 

 

Please post here if there is a solution!!!! >.<

Link to comment
Share on other sites

  • 2 years 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...