I have created an Multiselect
attribute featuredetail
in magento 1.9.2.4.
Then mapping is done with an image for every attribute value.
My phtml file for calling this attribute is:
<div class="feature">
<?php
$Feature = explode(",",$_product->getResource()
->getAttribute('featuredetail')->getFrontend()
->getValue($_product));
foreach($Feature as $key => $value): ?>
<a href="<?php echo $_product->getProductUrl() ?>" ?>
<?php echo "<img src='".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."wysiwyg/feature/detail/".trim($value).".png'/>"; ?>
</a>
<?php echo $value; ?>
<?php endforeach; ?>
</div>
Then I called this attribute to be displayed in product-collateral
tab in product details page. When value is not entered for any attribute that is included inside the product collateral tab, the tab should be hidden. So I modified the product-collateral
tab code in view.phtml
like this:
<div class="product-collateral toggle-content tabs">
<?php if ($detailedInfoGroup = $this->getChildGroup('detailed_info', 'getChildHtml')):?>
<dl id="collateral-tabs" class="collateral-tabs">
<?php foreach ($detailedInfoGroup as $alias => $html):?>
<?php
**if(trim($html)=="") continue;**
?>
<dt class="tab"><span><?php echo $this->escapeHtml($this->getChildData($alias, 'title')) ?></span></dt>
<dd class="tab-container">
<div class="tab-content"><?php echo $html ?></div>
</dd>
<?php endforeach;?>
</dl>
<?php endif; ?>
</div>
This modified code is working well for the description
attribute. But for the multiselect attribute with mapped image, when no value is selected for this attribute it is displaying broken image instead of hiding the tab.
What modification should be done to resolve this?