Reputation: 17
I created custom attribute value to connect external link show on product view. My custom attribute as button connecting to my public marketplace store like lazada. The problem is how to hide attribute when there'no value on back end.
Attribute value "shoopee" it's my code
<button type="button" onclick="window.open('','_new').location.href = '<?php echo $_helper->productAttribute($_product, $_product->getshopee(), 'shopee') ?>'; return false;" class="button" role="button"><span><span><?php echo $this->__('beli shopee') ?></span></span></button>
I want to hide button when there's empty value on attribute.
Upvotes: 1
Views: 67
Reputation: 565
Try something like:
<?php if ($_helper->productAttribute($_product, $_product->getshopee(), 'shopee')) : ?>
<button type="button" onclick="window.open('','_new').location.href = '<?php echo $_helper->productAttribute($_product, $_product->getshopee(), 'shopee') ?>'; return false;" class="button" role="button"><span><span><?php echo $this->__('beli shopee') ?></span></span></button>
<?php endif; ?>
Upvotes: 2