Jump to content

Show special price in percentage % instead of the discount amount €..


Prestan0ob

Recommended Posts

In prestashop 1.7 I have declared products discount in amount and not in percentage.

1429113771_.png.2e074d73bb00d32809a834c2a5fc65b1.png

But in product page i want to show the corresponding percentage instead of the discount amount.
The lines of code that show a percentage or amount of discount depending on what you put in the admin are:
 

 <!-- {if $product.discount_type === 'percentage'}
                  <span class="discount-percentage discount-product">{$product.discount_percentage}</span>
                {elseif $product.discount_type === 'amount'}
                  <span class="discount-amount discount-product">{$product.discount_amount_to_display}</span>
                {/if} -->

Any idea how i can calculate the discount rate from the discount amount and show it in place of discount amount?

Edited by Prestan0ob (see edit history)
Link to comment
Share on other sites

  • 3 months 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...