Display both reduced amount and also percentage in cart page
-
12-12-2019 - |
Question
http://www.customy.com/blog/show-product-discount-percent-in-magento/
The amount reduced will be shown in percentage in above link.
I need to display percentage of discount along with "HOW MUCH PRICE SAVED
IN NUMBER", as like this :
You Save: 5,810.00 (18%)
what changes I have to do for this.
please help me to find solution.
thanks in advance
Solution
goto
app/design/frontend/base/default/template/catalog/product/
and copy price.phtml
to app/design/frontend/Your_theme/default/template/catalog/product/
now in price.phtml
find for this code
<?php endif; /* if ($_finalPrice == $_price): */ ?>
above this code add following code
<?php if($_finalPrice < $_price): ?>
<?php
$_savePercent = 100 - round(($_finalPrice / $_price) * 100);
$_saveAmount = number_format(($_price - $_finalPrice), 2);
?>
<p class="yousave">
<span class="price-label label">You Save: </span>
<span class="price">
<strong class="save-amount">$<?php echo $_saveAmount; ?></strong> (<?php echo $_savePercent; ?>%)
</span>
</p>
<?php endif; ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange