tags:

views:

21

answers:

2

Hi,

Let's say I have two categegories, A and B.

I set A to use 'layout_a' on Catalog -> Catalog Categories -> Click a category -> click custom design tab

I set B to use 'layout_b' on Catalog -> Catalog Categories -> Click a category -> click custom design tab

When I visit category A and B, theydisplays products using their own layout that I set on the admin panel. When I click an item on the product listing page, product view page does not use custom design.

How do I enforce product view page to use its category's custom design?

A: 

You can apply the Custom Design updates on the product Catalog>Manage Products>Design and then apply as per the Categories

Does that achieve what you need?

Jonathan Day
Almost, but not pefect. I want to apply a custom design as per the categories only. If I set custom design on the product catalog->manage products->design, the product is going to use a layout that I set. Let's say I have a product that belongs to category A and B. If I set layout B for the product, how can I make it use layout A when a customer clicks category-> the product?
Moon
+2  A: 

Hi Guys,

I found an aswer myself.

  1. Open product controller located in /app/code/Mage/Catalog/controllers/ProductController.php

  2. add the following code into _initProductLayout method

    $update->addHandle('CATEGORY_'.$product->getCategoryId());

  3. Open catalog layout xml located in /app/design/frontend/default/default/layout/catalog.xml

  4. add

<CATEGORY_"your category id">
    <reference name="root">
  <action method="setTemplate"><template>yourtemplate here</template></action>
    </reference>
</CATEGORY_"your category id">
Moon