Magento – Layout XML – Custom Layout Update not being used

layoutmagento-1.9

I have set a layout update for a category in the admin (Custom Layout Update).

enter image description here
Here is the code incase that is not legible

<reference name="product_list">
    <action method="setTemplate"><template>catalog/product/list-sub-categories.phtml</template></action>
</reference>
<reference name="left">
    <block type="catalog/navigation" name="catalog.leftnav" before="-promo.container.1" template="catalog/navigation/left-main.phtml"/>
</reference>

This isn't reflected on that category page. The template used is still the default catalog/product/list.phtml

enter image description here

I have written an observer on "controller_action_layout_generate_blocks_before" to log the layout xml. At the very end of the log file the custom xml is present.

<reference name="product_list">
    <action method="setTemplate"><template>catalog/product/list-sub-categories.phtml</template></action>
</reference>
<reference name="left">
    <block type="catalog/navigation" name="catalog.leftnav" before="-promo.container.1" template="catalog/navigation/left-main.phtml"/>
</reference>

Caching is switched off and I've flushed the cache a few time to make sure. I'm a bit puzzled on this one. Anyone come across something similar? Or suggest further debugging steps.

Best Answer

Your code seems correct, check logs or third party extensions.

There is also one other way to do this by local.xml . You can use a handle like <CATEGORY_[ID]> :

<CATEGORY_4>
    <reference name="product_list">
        <action method="setTemplate"><template>catalog/product/list-sub-categories.phtml</template></action>
    </reference>
</CATEGORY_4>

<CATEGORY_20>
    <reference name="product_list">
        <action method="setTemplate"><template>catalog/product/list-sub-categories.phtml</template></action>
    </reference>
</CATEGORY_20>

Here, 4 and 20 are category_id for which you want to use list-sub-categories.phtml template. You can add as many handles as you want.

Related Topic