Magento 1.9 RWD Theme – Add to Product Collateral Tabs

magento-1.9product-viewrwd-theme

I have the following code in the RWD theme product view page – it currently displays the long description and 'reviews' tab. How can I add additional tabs? For example, I'd like to add the 'dimensions' attribute as a separate tab.

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

Best Answer

Try creating a new block for your Dimensions Attribute and update your layout xml file with the code below:

<catalog_product_view>
    <reference name="product.info">
        <block type="{{module}}/{{Block}}" name="product.dimensions" as="dimensions" template="path/to/template/dimensions.phtml">
            <action method="addToParentGroup"><group>detailed_info</group></action>
            <action method="setTitle" translate="value"><value>Dimensions</value></action>
        </block>
    </reference>
</catalog_product_view>

Don't forget the update the Block Type with the new block you'll create and the path for your template on the snippet above. That should do the trick.

The important line is:

<action method="addToParentGroup"><group>detailed_info</group></action>

This will add your new block to the "detailed_info" group, making it available on your loop described above.

Related Topic