2

I have created a custom tab. I want to show different content in this custom tab.

If product type is simple show simple product

If product type is virtual show virtual product

How can i achieve this?

1
  • Please post some code with your question of what you have done so far to add the tab to make it easier for us to answer the question
    – Sander Mangel
    Feb 26 '15 at 12:38
1

If it is on a productpage, you can add it in a local.xml

<PRODUCT_TYPE_simple> or <PRODUCT_TYPE_configurable>

or you could

$product = $this->getProduct() ? $this->getProduct() : Mage::registry('current_product');

if ($product->getTypeId() === 'simple') {
    // do something
} elseif ($product->getTypeId() === 'configurable') {
    // do something else
}
1

mkgarg,You can don this by layout handler.When a product page is rendered the magento create a dynamic handler using below code:$update->addHandle('PRODUCT_TYPE_' . $product->getTypeId());

So ,on simple product page,magento is called layout handler PRODUCT_TYPE_simple

and on virtual product page,magento is called layout handler PRODUCT_TYPE_virtual.

In default catalog.xml file you can see lot work depends on product type:

<PRODUCT_TYPE_simple translate="label" module="catalog">
    <label>Catalog Product View (Simple)</label>
    .....
</reference>
</PRODUCT_TYPE_simple>
<PRODUCT_TYPE_configurable translate="label" module="catalog">
    <label>Catalog Product View (Configurable)</label>
    <reference name="product.info">
       ......      </reference>
    <reference name="product.info.options.wrapper">
.....
</reference>
</PRODUCT_TYPE_configurable>

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.