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?

2
  • The main question here is to "display" only or also to use in all calculations? Commented Apr 1, 2014 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
    Commented Apr 1, 2014 at 21:04

1 Answer 1

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()) : ?>

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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