php - Add custom tab to Magento product detail pages depending on category -


in our magento store offer 2 kinds of products, each own root categories. want add cms static blocks custom tabs on product detail pages dependent on category product under.

i know how create tabs in view.phtml template, how can make that:

  • block 1 appears on product detail pages under root category 1
  • block 2 appears on product detail pages under root category 2

i think possible xml layout updates remove , append tabs, how append blocks layout?

overview

if understanding question correctly, want add custom tab on product detail page when viewing product under 2 special categories (category1 , category2).

the tabs on product detail page of type catalog/product_view_tabs maps class mage_catalog_block_product_view_tabs. block provide way add new tabs through addtab() method, seems method assumes template used, unfortunately prevents using cms static block method.

a possible solution

if able put content 2 static blocks 2 template files instead, using layout xml updates on categories themselves. outline process use in scenario:

  1. navigate catalog > categories > manage categories in magento admin , click on category1 in tree.
  2. open custom design tab.
  3. set “apply products” yes.
  4. now add layout update category’s products should have custom tab under “custom layout update”:

<reference name="content">     <reference name="product.info.tabs">         <action method="addtab" translate="title">             <alias>block1</alias>             <title>block 1</title>             <block>core/template</block>             <template>catalog/product/view/block1.phtml</template>         </action>     </reference> </reference> 

it should this: enter image description here

then repeat same steps category2. key solution working 2 template files block1.phtml , block2.phtml path: app/design/frontend/base/default/template/catalog/product/view/.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -