1

I would like to show product discount percentage on email template. i am using this code but its showing discount on product details page not on order email.

<?php // Display Discount percents start ?>
    <?php if($_finalPrice < $_price): ?>
    <?php $_savingPercent = 100 - round(($_finalPrice / $_price)*100); ?>
        <p class="special-price yoursaving">
            <span class="label"><?php echo $this->__('Your Saving:') ?></span>
            <span class="price">
                <?php echo $_savingPercent; ?>%
            </span>
        </p>
    <?php endif; ?>
<?php // Display Discount percent end ?>
  • 1
    This code should be in your question, not in an ephemeral comment. Use the edit link to edit your question. – grg Oct 25 '16 at 7:08
  • i am adding this code on App/design/frontend/base/default/template/email/order/items/order/default.phtml but its not working – Sarvesh Tiwari Oct 25 '16 at 7:13
  • @grgarside <?php $originalPrice = $_product->getPrice(); $finalPrice = $_product->getFinalPrice(); $percentage = 0; if ($originalPrice > $finalPrice) { $percentage = round(($originalPrice - $finalPrice) * 100 / $originalPrice); } if ($percentage) { echo $this->__('%s', $percentage . '%'. 'Off'); } ?> – Sarvesh Tiwari Oct 25 '16 at 9:45

Your Answer

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

Browse other questions tagged or ask your own question.