Created
September 29, 2015 14:14
-
-
Save ViniciusAugusto/b8294e56bfcbde8456d3 to your computer and use it in GitHub Desktop.
Magento: Show product discount percent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you wish to show product discount percent next to product price or somewhere on a product page, here’s how you do it. | |
Open app/design/frontend/yourpackage/yourtheme/template/catalog/product/price.phtml | |
Find: | |
<?php endif; /* if ($_finalPrice == $_price): */ ?> | |
Past above it: | |
<?php // Discount percents output start ?> | |
<?php if($_finalPrice < $_price): ?> | |
<?php $_savePercent = 100 - round(($_finalPrice / $_price)*100); ?> | |
<p class="special-price yousave"> | |
<span class="label"><?php echo $this->__('You Save:') ?></span> | |
<span class="price"> | |
<?php echo $_savePercent; ?>% | |
</span> | |
</p> | |
<?php endif; ?> | |
<?php // Discount percent output end ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment