Guest Posted May 24, 2018 Share Posted May 24, 2018 Hi, I need to see a percentage discount on the product page, but it counts me wrong.Where am I making mistake ?Thank you ../themes/theme_name/templates/catalog/_partials/miniatures/_partials/product-miniature-1.tpl ../themes/theme_name/templates/catalog/_partials/product-prices.tpl {if $product.discount_type === 'percentage'} <span class="badge badge-discount discount discount-percentage">-{$product.discount_percentage_absolute}</span> {else} <span style="color:#000; font-weight:600;font-size: 1.2em;"><!--{$product.discount_to_display}--> -{round(($product.price / $product.regular_price) * 100,2)} %</span> {/if} Link to comment Share on other sites More sharing options...
Esther Posted August 20, 2018 Share Posted August 20, 2018 Hi I know it is old post but I found the solution and I want share it here. Maybe someone needs it. {if $product.discount_type === 'percentage'} <span class="badge badge-discount discount discount-percentage">-{$product.discount_percentage_absolute}</span> {else} <span style="color:#000; font-weight:600;font-size: 1.2em;"><!--{$product.discount_to_display}--> -{round((1-$product.price/$product.regular_price)*100,2)} %</span> {/if} -{ROUND((1-$product.price/$product.regular_price)*100,2)} % Link to comment Share on other sites More sharing options...
pfalomo Posted August 23, 2018 Share Posted August 23, 2018 I purpose also my solution : -{((($product.price_without_reduction - $product.price_with_reduction)*100)/$product.price_without_reduction)|round:0}% This is also a more precise calculation with a round of 0. BTW this is still a bug in ps 1.7.3.4 Link to comment Share on other sites More sharing options...
HeineFR Posted June 7, 2019 Share Posted June 7, 2019 Thanks pfalomo! this solve today my problem i had with quantity discount that didn't refresh on cart when i update quantity. (PS 1.7.5.1) If it can help somebody, i replaced in my template: \themes\*****\templates\checkout\_partials\cart-detailed-product-line.tpl Line 45 : -{$product.discount_percentage_absolute} By this line: -{((($product.price_without_reduction - $product.price_with_reduction)*100)/$product.price_without_reduction)|round:0}% in my product-price.tpl the $product.discount_percentage_absolute value was greatly updating with quantity, but not on the cart. Link to comment Share on other sites More sharing options...
victormesiasg Posted February 26, 2020 Share Posted February 26, 2020 Can you help me correct this position error? 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