1

I would like to have a condition that MSRP be only displayed when the value is greater than the price in my store.

I've played around and managed to get this to work:

<?php if($_product->msrp<price): ?>
 <?php echo $this->__('MSRP: ') ?> <?php echo Mage::helper('core')->currency($_product->getMsrp(),true,false); ?>  
         <?php endif; ?>

However, on products that the MSRP is not present displays as 0$ and also displays for products that have a higher price than MSRP.

How can I display the MSRP: and the MSRP value when the price is lower?

  • The main question here is to "display" only or also to use in all calculations? – user487772 Apr 1 '14 at 19:02
  • It is to display only. So basically if the condition is met, then it will show "MSRP: 999$" - if the price is higher than 999$ then do not display. – SR_Magento Apr 1 '14 at 21:04
2

It seems like your condition is faulty. You are comparing $_product->msrp with price (without a $ sign before). Maybe you are looking for something like:

<?php if ($_product->getMsrp() > $_product->getPrice()) : ?>

  • 2
    Beautiful! Learned something new. Just correct the < to > for future visitors. Thanks! SR – SR_Magento Apr 1 '14 at 21:09

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.