jwd19 Posted August 12, 2016 Share Posted August 12, 2016 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 More sharing options...
NemoPS Posted August 15, 2016 Share Posted August 15, 2016 I guess you can use smarty's mathhttp://www.smarty.net/docsv2/en/language.function.math.tpluse $product.price and $product.price_without_reduction Link to comment Share on other sites More sharing options...
jwd19 Posted August 15, 2016 Author Share Posted August 15, 2016 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 More sharing options...
vekia Posted August 15, 2016 Share Posted August 15, 2016 {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 More sharing options...
jwd19 Posted August 15, 2016 Author Share Posted August 15, 2016 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 More sharing options...
vekia Posted August 15, 2016 Share Posted August 15, 2016 no, there is nothing to replace. all what you have to do i just copy-paste it there where you want to display the text "you save: XX" Link to comment Share on other sites More sharing options...
jwd19 Posted August 15, 2016 Author Share Posted August 15, 2016 Dear sir, If i paste this in product.tpl i will get a blanco page Link to comment Share on other sites More sharing options...
lira Posted September 10, 2016 Share Posted September 10, 2016 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 More sharing options...
jwd19 Posted September 10, 2016 Author Share Posted September 10, 2016 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 More sharing options...
lira Posted September 12, 2016 Share Posted September 12, 2016 Hi Janine, The website work still in progress but you can see the result here: http://www.pressstart.pt/ The discount is in €. My client only wants price in €, so in the product-list.tpl file I'v comment out the code related to percentage. Regards, Link to comment Share on other sites More sharing options...
jwd19 Posted September 12, 2016 Author Share Posted September 12, 2016 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 More sharing options...
lira Posted September 13, 2016 Share Posted September 13, 2016 Hi Janine, The file to change is the file product-list.tpl not product.tpl Link to comment Share on other sites More sharing options...
Vali Iacobescu Posted October 8, 2019 Share Posted October 8, 2019 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now