Jump to content

How to show reduction percent in home featured products


Recommended Posts

I can´t get this thing working on prestashop 1.4.0.17. Before everything worked fine. Is there anybody, who can help me with this?

{if $product.reduction_percent != 0}
-{$product.reduction_percent}%{/if}

{if $product.reduction_price != 0}
-{$product.reduction_price}{$currency->sign}{/if}


Thanks

Link to comment
Share on other sites

  • 3 weeks later...

Try this, it works fine for me.
I try to get both reductions and here is the code:

{if isset($product.reduction) && $product.reduction}  
 {math assign="reduction_amount" equation="(x - y)" x=$product.price_without_reduction y=$product.price}    
 {math assign="reduction_perc" equation="(x / y) * 100" x=$reduction_amount y=$product.price_without_reduction format="%.0f"}

 -{convertPrice price=$reduction_amount} (-{$reduction_perc} %)    
{/if}


I hope it helps

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Try this, it works fine for me.<br/>I try to get both reductions and here is the code:<br/>

<br/>{if isset($product.reduction) && $product.reduction}  <br/>  {math assign="reduction_amount" equation="(x - y)" x=$product.price_without_reduction y=$product.price}    <br/>  {math assign="reduction_perc" equation="(x / y) * 100" x=$reduction_amount y=$product.price_without_reduction format="%.0f"}<br/>  <br/>  -{convertPrice price=$reduction_amount} (-{$reduction_perc} %)    <br/>{/if}<br/>

<br/>I hope it helps

 

 

My code in order-details is:

 

{if ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))}

{assign var='special' value='1'}

{else}

{assign var='special' value='0'}

{/if}

{if !$priceDisplay || $priceDisplay == 2}

{if $special}

	{if $product.reduction_price != 0}

		1/{convertPrice price=$product.product_price + $product.reduction_price}

	{elseif $product.reduction_percent != 0}

		{math assign='product_price' equation='p * (1 - (r / 100))' p=$product.product_price r=$product.reduction_percent}
		2/{convertPrice price=$product_price}

	{/if}

{/if}
{/if}									

 

But {if $product.reduction_price != 0} doesn't work! I have spent hours but i can't see how to do it!

 

{elseif $product.reduction_percent != 0} works perfectly, but not when it is a reduction.

 

I have tried your code but it isn't work in my PrestaShop™ 1.4.0.10. Do you have any idea?

Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...