I have made an attribute called replacement_sku to be show on the product page. My problem is that I would like it only to be visible if there is content and not visible if empty.

Hope someone can help me with some kind of if statement for that. I use the Ultimo template and Magento 1.9


Heres an example that should work for this:

<?php if($attrValue = $_product->getData('replacement_sku')): ?>
    <p><?php echo $this->__('Replacement Sku') ?>: <span><?php echo $attrValue ?></span></p>
<?php endif; ?>
  • Have tried to use the if statement, but it does not seem to work. My product page gets blank. – Kasper Elund Feb 10 '16 at 21:38
  • sry! there was actually one closing brace missing. just upadted it! – David Verholen Feb 10 '16 at 21:41
  • It is inserted in the view.phtml file correct? know some about magento but much to learn. Good someone will help – Kasper Elund Feb 10 '16 at 21:48
  • What if I only wants replacement_sku to be shown if there are content and not shown if empty? – Kasper Elund Feb 10 '16 at 21:57
  • You solved my problem. The last was my own mistake. – Kasper Elund Feb 10 '16 at 22:01

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.