Wednesday , December 19 2018
Home >> All tutorial >> Show product discount percent in Magento

Show product discount percent in Magento

It is known that for many customers the main factor for making an order is the possibility to have a discount. It is enough to state both a product’s retail price and its special price to make a customer happy.

Unfortunately this approach doesn’t work well with all customers, as people want to know not only how much they will pay for a certain product but the percentage of the discount they will receive as well. One of the main principles that determines the work of deal sites such as Groupon is to offer various products and services with a discount of 40% and higher. In this case a psychological factor works and it is not important what the initial cost of a product was but the amount of the discount that a customer gains.

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

<?php endif; /* if ($_finalPrice == $_price): */ ?>

Add 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; ?>%
    <?php endif; ?>
<?php // Discount percent output end ?>
The result will be:
You can also spice it up with CSS and achieve something like this:

Here is the library of Magento Download for FREE (all versions)

Your Magento website needs a powerful Magento ERP for stock control.


magento erp

About Champ

Leave a Reply

Your email address will not be published. Required fields are marked *

Heap | Mobile and Web Analytics