Source : Alternative way of adding tabs to the Magento product page.
Afin que cette technique fonctionne, il faut d’abord vérifier que le template phtml
qui injecte les onglets ait le code adéquat. C’est normalement le cas avec le thème rwd. Ouvrir le fichier app/design/frontend/<mon_package>/<mon_theme>/template/catalog/product/view.phtml
et vérifier la présence du code suivant :
1 2 3 4 5 6 7 8 9 10 11 12 |
<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> |
Dans app/design/frontend/<mon_package>/<mon_theme>/template/catalog/product/view/
créer un fichier newtab.phtml
.
1 |
<h1>NewTab</h1> |
Dans app/design/frontend/<mon_package>/<mon_theme>/layout/local.xml
ajouter ceci :
1 2 3 4 5 6 7 8 9 10 11 |
<?xml version="1.0"?> <layout version="0.1.0"> <catalog_product_view> <reference name="product.info"> <block type="core/template" name="the_new_tab" as="the_new_tab" template="catalog/product/view/newtab.phtml"> <action method="addToParentGroup"><group>detailed_info</group></action> <action method="setTitle" translate="value"><value>The New Tab</value></action> </block> </reference> </catalog_product_view> </layout> |