Reputation: 101
I've installed magento 1.9.0.1 with sample data. Trying to add additional tab to product page by updating layout via my module's layout xml. Added following changes to my module's xml but it doesn't work - meaning my tab wasn't added to product page.
<catalog_product_view>
<reference name="product.info">
<block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml">
<action method="addTab" translate="title" module="catalog">
<alias>Discussions</alias><title>Product Discussions</title>
<block>discussions/discussions</block>
<template>discussions/discussions.phtml</template></action>
</block>
</reference>
</catalog_product_view>
Also when I looking on default catalog.xml ( app/design/frontend/base/default/layout/catalog.xml) I don't see there any tabs block element but when I browse to product page there're default tabs for description, additional info and reviews.Tried to find additional places where it could be configured but without success.
Upvotes: 2
Views: 6549
Reputation: 101
Thanks for your time and comments. I found out the root cause of my issue.
1.Magento 1.9.0.1 changed default package
Magento 1.9.0.1 changed default package to rwd (Responsive Web Design) so all changes I did under app/design/frontend/base/default/layout/catalog.xml were not relevant for rwd package.
2.Magento using tab class to present "detailed_info" elements
In app/design/frontend/rwd/default/template/catalog/product/view.phtml following code is responsible for displaying "detailed_info" elements
<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>
3.How to add additional tab to product page?
So in order to add additional tab to product page just mark it as detailed_info, see my example:
<catalog_product_view>
<reference name="product.info">
<block type="discussions/discussions" name="product.discussions" as="discussions" template="discussions/discussions.phtml">
<action method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle" translate="value"><value>Product Discussions</value></action>
</block>
</reference>
</catalog_product_view>
Upvotes: 6