Magento 1.7 – Hiding Part of Price.phtml

  • by

In my previous post I showed you some code discovered in a website, which would show you how much you were saving in both currency and percentage on the price output.

However my client wanted to only show this if it was showing on the product page, not on category pages.  Here's the code!

if(Mage::app()->getRequest()->getControllerName() != "category"){
 ?>
 <?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">&pound;<?php echo $_saveAmount; ?></strong> (<?php echo $_savePercent; ?>%)
 </span>
 </p>
 <?php } ?>
 <?php endif; ?>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

This site uses Akismet to reduce spam. Learn how your comment data is processed.