I created multi-select attribute to display the accessories in product collateral tab in details page. I added the accessories block like below:
<block type="catalog/product_view" name="catalog.product.accessories" template="catalog/product/accessories.phtml"> <action method="addToParentGroup"><group>detailed_info</group></action> <action method="setTitle" translate="value"><value>Accessories</value></action> </block> Content in the accessories.phtml file to display the image of the accessories selected is below:
<?php $_helper = $this->helper('catalog/output'); ?> <?php $_product = $this->getProduct(); ?> <script type="text/javascript"> var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>); </script> <div class="feature"> <span> <?php $Feature = explode(",",$_product->getResource() ->getAttribute('standard_accessories')->getFrontend() ->getValue($_product)); foreach($Feature as $key => $value): ?> <a href="<?php echo Mage::getBaseUrl().$value ?>" ?> <?php echo "<img src='".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."wysiwyg/".trim($value).".png'/>"; ?> </a> <?php /*echo $value; */?> <?php endforeach; ?> </span> </div> Now when no accessories are selected for particular product the accessories tab should not be displayed.but it is displayed with broken image like below:
Someone kindly help me with this issue like Where and how should the condition be given to hide the tab when it is empty?
