Jump to content

show percentage reduction AND reducted price toghether


Recommended Posts

Dear members!


 


I cant find anywhere where to set (only on productpage) the reducted amount next to the reduction in percentage.


 


EXAMPLE


 


Old price : € 100


New price: € 50    -50%   YOU SAVE € 50


 


How can i set this ? or which module can i use to set this ?


 


Kindest regards,


Janin


 


Link to comment
Share on other sites

I guess you can use smarty's math

http://www.smarty.net/docsv2/en/language.function.math.tpl

 

use $product.price and $product.price_without_reduction

 

Dear NemoPS,

 

Thank you very much for your answer!

I appreciate your help but I'm sorry to say that i have no knowledge of scripting :(

 

Is there a way you could tell me which code i need to place where ?

 

Kindest regards,

Janine

Link to comment
Share on other sites

                    {if ($product.price|number_format:2:".":"" != $product.price_without_reduction|number_format:2:".":"")}
                        {l s='You save:'} {math equation="x-y" x=$product.price y=$product.price_without_reduction format='%.2f'}
                    {/if} 

you can use something like code above

Link to comment
Share on other sites

Dear Vekia,

 

Thank you for the code!

 

Do i need to replace your code somewhere within the following code ? (i find this in product.tpl) 

 

 

{if !isset($priceDisplayPrecision)}
{assign var='priceDisplayPrecision' value=2}
{/if}
{if !$priceDisplay || $priceDisplay == 2}
{assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)}
{assign var='productPriceWithoutReduction' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL, $priceDisplayPrecision)}
{elseif $priceDisplay == 1}
{assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL, $priceDisplayPrecision)}
{assign var='productPriceWithoutReduction' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL, $priceDisplayPrecision)}
{/if}
 
I use prestashop 1.6.1.6
 
Thanks for your help!
 
Kindest regards,
Janine
Link to comment
Share on other sites

  • 4 weeks later...

Hi there,

 

I've been using Vekia's code but on file product-list.tpl.

 

Around line 89, after or before (depending the order you want) this code:

 

if $product.specific_prices.reduction_type == 'percentage'}  *}
<span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span> {/if}
 
It's working like a charm! :)
Link to comment
Share on other sites

Dear Lira,

 

Thank you for your response!

Do you have a link where i can see your result ? :)

 

Can you see the discounted price in euro or dollar ? or just the percentage ?

 

Hope to hear from you! ^_^ 

 

Kindest regards,

Janine 

Link to comment
Share on other sites

Dear Lira!

 

Thank you for your reply!

It looks great and is exactly what i'm looking for, but in mu product.tpl i only found this code:

 

 

 

{if !$priceDisplay || $priceDisplay == 2}
{assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)}
{assign var='productPriceWithoutReduction' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL, $priceDisplayPrecision)}
{elseif $priceDisplay == 1}
{assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL, $priceDisplayPrecision)}
{assign var='productPriceWithoutReduction' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL, $priceDisplayPrecision)}
{/if}
 
 
Can you please help me change this code in order to get the same result ?
 
Kindest regards,
Janine
Link to comment
Share on other sites

  • 3 years later...

Hi jwd19,

If you want the code to work in product page, just add this in product.tpl:

{if ($productPrice|number_format:2:".":"" != $productPriceWithoutReduction|number_format:2:".":"")}
	{l s='You save:'}{math equation="x-y" x=$productPrice y=$productPriceWithoutReduction format='%.2f'}
{/if}

 

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