cancel
Showing results for 
Search instead for 
Did you mean: 

How to get which catalog price rule applied on particulate product list or product view page?

Highlighted
Occasional Contributor

How to get which catalog price rule applied on particulate product list or product view page?

We need to displayed Discount % as per applied catalog rule on that product in product view page or product listing page in Magento 1.9 version 

1 REPLY
Contributor

Re: How to get which catalog price rule applied on particulate product list or product view page?

To make it a bit simpler, you could compare $_product->getPrice() against $_product->getFinalPrice();

 

<?php  $_price = $_product->getPrice();
       $finalPrice = $_product->getFinalPrice();
?>

    <?php if($_finalPrice < $_price): ?>
    <?php $_savingPercent = 100 - round(($_finalPrice / $_price)*100); ?>
        <p class="special-price savings">
            <span class="label"><?php echo $this->__('You Save!') ?></span>
            <span class="price">
                <?php echo $_savingPercent; ?>%
            </span>
        </p>
    <?php endif; ?>