Reputation: 177
I'm trying to display a custom yes/no product attribute only if "yes" is selected. Here's my code so far:
<?php $freeship = Mage::getModel('catalog/product')->load($this->getProduct()->getId())->getAttributeText('free_shipping_discount');
if ($freeship == "yes")
echo '<span class="free-ship">FREE SHIPPING</span>'; ?>
It doesn't produce errors but it doesn't display anything either. Any suggestions?
Thanks
Upvotes: 1
Views: 1582
Reputation: 283
This works for me:
<?php if ($_product->getFreeShippingDiscount()):?>
<span class="free-ship">FREE SHIPPING</span>
<?php endif;?>
Upvotes: 0
Reputation: 4022
Maybe it is an uppercase Yes? I would try to use var_dump($freeship) to see whether your variable returns what you expect.
Upvotes: 0