Pages

Magento 1.9 - Add Discount Percentage Below Price

Copy price.phtml from :

app/design/frontend/base/default/template/catalog/product/price.phtml

Paste price.phtml to :

app/design/frontend/default/theme/template/catalog/product/price.phtml

Find :

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

Add above it:

    <!-- start custom code  -->

     <?php // Discount percents output start 
     $_finalPrice=$_product->getFinalPrice(); 
     $_price=$_product->getPrice();?>

    <?php if($_finalPrice < $_price): ?>
    <?php $_savePercent = 100 - round(($_finalPrice / $_price)*100); ?>
    <?php echo "Your Savings ".$_savePercent; ?>%
    <?php endif; ?>
    <?php // Discount percent output end ?>


    <!-- end custom code  -->





No comments:

Post a Comment