Jump to content
jwd19

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


 


Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

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! :)

Share this post


Link to post
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 

Share this post


Link to post
Share on other sites

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,

 

:)  :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi Janine,

 

 

The file to change is the file product-list.tpl not product.tpl

 

:)

 

:)

Share this post


Link to post
Share on other sites

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}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More