Jump to content

[1.7] [How-To] Change default price reduction to Percentage instead of amount


Dimitrios Karvounis

Recommended Posts

Hello,

 

 

If you want to display percentage instead of discount amount at products, you have to edit the following files

 

1) /themes/classic/templates/catalog/_partials/miniatures.tpl

 

Change:


                {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}

 

To:


                {if $product.discount_type === 'percentage'}
                  <span class="discount-percentage discount-product">{$product.discount_percentage|round:0}%</span>
                {elseif $product.discount_type === 'amount'}
                  <span class="discount-amount discount-product">{$product.discount_percentage|round:0}%</span>
                {/if}

 

2) /themes/classic/templates/catalog/_partials/product-prices.tpl

Change:


          {if $product.has_discount}
            {if $product.discount_type === 'percentage'}
              <span class="discount discount-percentage">{l s='Save %percentage%' d='Shop.Theme.Catalog' sprintf=['%percentage%' => $product.discount_percentage_absolute]}</span>
            {else}
              <span class="discount discount-amount">
                  {l s='Save %amount%' d='Shop.Theme.Catalog' sprintf=['%amount%' => $product.discount_to_display]}
              </span>
            {/if}
          {/if}

to:

{if $product.has_discount}
            {if $product.discount_type === 'percentage'}
              <span class="discount discount-percentage">{l s='Save %percentage%' d='Shop.Theme.Catalog' sprintf=['%percentage%' => $product.discount_percentage_absolute|round:0]}%</span>
            {else}
              <span class="discount discount-percentage">{l s='Save %percentage%' d='Shop.Theme.Catalog' sprintf=['%percentage%' => $product.discount_percentage_absolute|round:0]}%</span>
            {/if}
          {/if}

 

If you have any comments or suggestions, please feel free to let me know

Link to comment
Share on other sites

  • Dimitrios Karvounis changed the title to [1.7] [How-To] Change default price reduction to Percentage instead of amount
  • 1 year later...
On 8/7/2018 at 1:40 AM, Dimitrios Karvounis said:

If you have any comments or suggestions, please feel free to let me know

Could you advise please. if product has a percentage discount - how to show exact discount amount e.g. product price 1000 EUR discount 3% - PS shows "Save 3%" but I would like to see "Save 30 EUR"

Edited by 884483048 (see edit history)
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...