Skip to content

Instantly share code, notes, and snippets.

@ravixp
Last active July 12, 2017 17:46
Show Gist options
  • Select an option

  • Save ravixp/14cc69e7d87e768cbe12d73e279cfd3c to your computer and use it in GitHub Desktop.

Select an option

Save ravixp/14cc69e7d87e768cbe12d73e279cfd3c to your computer and use it in GitHub Desktop.
Magento 1: Add the saving amount and the discounted percentage
<?php if($_finalPrice < $_price): ?>
<?php
$_discounted_percentage = 100 - round(($_finalPrice / $_price) * 100);
$_saving_amount = number_format(($_price - $_finalPrice), 2);
?>
<p class="saving-price">
<span class="price-label"><?php echo $this->__('Your Save: '); ?></span>
<span class="price">
<span class="saving-amount">
<?php echo $_coreHelper->formatPrice($_saving_amount, false) ?>
</span>
<span class="discounted-percentage">
<?php echo $_discounted_percentage; ?>%
</span>
</span>
</p>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment