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>
                        <?php endforeach;?>
                <?php endif; ?>

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

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

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.

  • Thanks. Any specific place I should put the block file? And would the update go in local.xml please? Oct 6 '15 at 5:54
  • @YorkieMagento Yes... your layout update goes on Local.xml, the template can be any folder you're keeping your updated templates. The Block class has to be within your custom extension.
    – user12795
    Oct 6 '15 at 6:46
  • So update local.xml, create a phtml file with the dimensions attribute echoed. Anything else I've missed? Oct 6 '15 at 11:12
  • @YorkieMagento Yeap... pretty much. You might be able to get away using block type "core/template" on your layout xml and just the template file. This way you don't need to create a custom block, just the template.
    – user12795
    Oct 6 '15 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.