0

I have successfully created some custom tabs on my product pages via my local.xml file. However, I would like to show/hide different tabs based on the parent category of the product.

Can this be done in the local.xml file or do I have to create some if/else statements in my template files?

Any suggestions?

Here is my local.xml code:

<?xml version="1.0"?>

<catalog_product_view>
    <reference name="product.info">
        <block type="core/template" name="safety_data" as="safety_data" template="peptide/safety_data.phtml">
            <action method="addToParentGroup"><group>detailed_info</group></action>
            <action method="setTitle" translate="value"><value>Safety Data</value></action>
        </block>
    </reference>
</catalog_product_view>

<catalog_product_view>
    <reference name="product.info">
        <block type="core/template" name="quality_control" as="quality_control" template="peptide/quality_control.phtml">
            <action method="addToParentGroup"><group>detailed_info</group></action>
            <action method="setTitle" translate="value"><value>Quality Control</value></action>
        </block>
    </reference>
</catalog_product_view>

  • show custom tab code? – Amit Bera Jan 29 '15 at 3:54
0

You can try using the magento category handle in local.xml but I dont know if that handler is called in product page

You may use the category "Custom Design" to update the layout of the child products

You can found the "Custom Design" tab in the Admin menu Catalog->Manage Categories

0

Thanks for the help and suggestions.

Upon researching the methods further, I ended-up just adding conditionals to my custom phtml files that the local.xml file reference like so:

    <?php $category = Mage::getModel('catalog/layer')->getCurrentCategory();?>
<?php if($category->getId()==15): ?>

<h3>Show content for Category ID15</h3>

<?php else: ?>

<h3>Show content for other categories</h3>
<p>consectetuer adipiscing elit. </p>

<?php endif; ?>

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.