0

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%)

amazon.com

what changes I have to do for this.

please help me to find solution.

thanks in advance

2

goto app/design/frontend/base/default/template/catalog/product/ and copy price.phtmlto 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; ?>
  • for this line : <strong class="save-amount">$<?php echo $_saveAmount; ?></strong> (<?php echo $_savePercent; ?>%) , I want to use only one echo statement with smae output. please edit the code and paste here.... thanks a lot in advance.... – Baby in Magento Jan 7 '15 at 4:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.