We are working on a Magento webshop which has two categories.
We would like to use the default product view template for category one, and a custom product view template for category two.
Is this possible and how we can achieve this?
* EDIT - SOLUTION *
For anyone who is curious about this. The solution was a lot easier than I thought.
I only had to place this piece of code in the custom layout update section of the relevant category and i had to set the option 'Apply to products' to yes!
<reference name="product.info">
<action method="setTemplate"> <template>catalog/product/view-recipe.phtml</template></action>
</reference>
* EDIT * I have tried adding this code to the catalog.xml.
<CATEGORY_5>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view-recipe.phtml</template></action>
</reference>
</CATEGORY_5>
* EDIT * I have tried adding this code to the catalog.xml:
<CATEGORY_5>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view-recipe.phtml</template></action>
</reference>
</CATEGORY_5>
And this code to the Custom Layout Update section:
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view-recipe.phtml</template></action>
</reference>
I installed the patch but unfortunately still no results.
Did you mean category catalog list? Then you can try "Custom Layout Update".
<reference name="product_list">
<action method="setTemplate">
<template>catalog/product/custom-theme.phtml</template>
</action>
</reference>
Of course, you should create first custom layout
, you can take reference from the base list.phtml
* EDIT *
If you want customize specific products/categories then you can use custom layout handle
. Take consider the following links.
* EDIT *
First you should modify CategoryController.php
viewAction()
method from /app/code/core/Mage/Catalog/Controllers
folder ( as specified in Inchoo sample ).
Then, you should do something like that :
<CATEGORY_20>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/custom-theme.phtml</template></action>
</reference>
</CATEGORY_20>
* EDIT *
Magento has a bug about Custom Layout Update which is issue id 7625. They specified fixed in next release over Bug Track but still has a problem. So, Ingo Weseloh
made a patch which you can find the following link.
Exanto Reclayup 7625
* EDIT *
Michael, could you please try this ( it's Alan Storm's sugestion )
<CATEGORY_20>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/custom-theme.phtml</template></action>
<action method="setIsHandle"><applied>1</applied></action>
</reference>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With