Skip to main content
1 of 2
Ramya
  • 1.1k
  • 2
  • 19
  • 48

How to hide the empty product-collateral tab in details page?

I want to hide the product-collateral tab present in product details page when no value is entered for that attribute. am stuck here.

The tab coding in view.phtml is 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):?>
                <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>

In catalog.xml it is called like:

<block type="catalog/product_view_description" name="product.description" as="description" template="catalog/product/view/description.phtml">  
    <action method="addToParentGroup"><group>detailed_info</group></action>
    <action method="setTitle" translate="value"><value>Description</value></action>
</block>

The description.phtml is this:

  <?php $_description = Mage::registry('current_product')->getDescription(); ?>
    <?php if ($_description): ?> 
        <div class="std">
            <?php echo $this->helper('catalog/output')->productAttribute(Mage::registry('current_product'), $_description, 'description') ?>
        </div>                            
    <?php endif; ?>

Please guide me how to hide the tab when no value is entered in description attribute field.I dont exactly know the jquery responsible for this.

Ramya
  • 1.1k
  • 2
  • 19
  • 48