当自定义属性值为空时隐藏前视图特定属性

Hide frontview specific attribute when empty value on custom attribute value

我创建了自定义属性值以连接外部 link 在产品视图中显示。我的自定义属性作为按钮连接到我的 public 市场商店,如 lazada。问题是当后端没有值时如何隐藏属性。

属性值"shoopee"这是我的代码

<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 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; ?>