francesco.venica
francesco.venica

Reputation: 1721

Magento template for each category/product

I need to change category and product view for each category/product, for change category list I have add into local.xml:

<layouts>
<CATEGORY_3> 
    <reference name="product_list">
        <action method="setTemplate">
            <name>catalog/product/list-1.phtml</name>
       </action>
    </reference>
</CATEGORY_3>
</layouts>

but I don't know how to change layout from product of category_3, I try adding

<reference name="product.info">
    <action method="setTemplate">
        <action method="setTemplate">
            <template>catalog/product/view-1.phtml</template>
        </action>
    </action>
</reference>

inside tag but nothing, where is the mistake?

Upvotes: 0

Views: 480

Answers (1)

Seth Malaki
Seth Malaki

Reputation: 4486

First off, your second XML config block seems to be missing a .phtml extension inside <template></template>.

Second, your action method="setTemplate" is nested twice. Remove the first one

<reference name="product.info">
<!-- action method="setTemplate" REMOVED-->
    <action method="setTemplate">
        <template>catalog/product/view-1.phtml</template>
    </action>
<!-- /action REMOVED-->
</reference>

Also the template you're trying to call Additionally, Please don't do this from local.xml. You will have caching issues. I guarantee it. This is probably one of the reasons why you're not seeing changes. We did a similar thing last month and it bit us in the arse.

Instead go to Catalog > Manage Categories > (Click on/Select a Category) > Custom Design Tab and then enter your XML layout changes at the Custom Layout Update box. This worked for us better and thus it might give you a better chance of success, too.

Per-category custom layout updates

Upvotes: 1

Related Questions