I have added size chart tabs in magento 1.9.1 using the code below to call a CMS block into the product detail, but would like to hide the tab, if there is no data.
I am stuck and can't seem to find a method to hide the tab, if the attribute is empty.
I'm not to good with conditionals, I've tried (!empty) but maybe I'm trying the wrong place.
Any assistance is greatly appreciated.
Here's the code I am using:
catalog.xml
<block type="catalog/product_view_attributes" name="product.sizes" as="sizes" template="catalog/product/view/sizes.phtml">
<action method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle" translate="value"><value>Size Guide</value></action>
</block>
And here's the size.phtml
<?php
$_product = $this->getProduct();
$attribute = $_product->getResource()->getAttribute('sizes_table');
if ( is_object($attribute) ) {
$identifier = $_product->getData("sizes_table");
}
?>
<?php if ($_sizeBlock = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId($identifier)): ?>
<div class="std">
<?php echo $_sizeBlock->toHtml() ?>
</div>
<?php endif; ?>