Sunday 8 July 2012

How to set different layout in product page for specific category in Magento

In magento by default there is same layout in all product page for all category.

But if you want to give different layout to product view page for specific category then here is code for it.

But you have to create view.phtml with different layout design which you want in specific ategory.
Suppose i  created file with name viewbulkflowers.phtml

You have to write this code in admin side. So first open your admin.
First go to
Catalog / Manage Category
=>Select specefic category
=>Select Custom Design tab from right side
=>Make Yes to Apply to Products  
=>Add below xml code to Custom Layout Update.

=>XML Code

<reference name="product.info">
    <action method="setTemplate">
        <template>catalog/product/viewbulkflowers.phtml</template>
    </action>
    <block type="catalog/product_view" name="product.info" template="catalog/product/viewbulkflowers.phtml" />
</reference>

Now save category.