0

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.

  • can you tell me what you want with this code ? – Prashant Barot Aug 9 '16 at 9:09
  • I want to use catalog/product/list-sub-categories.phtml template file for this category. Even though it's last in the XML, Magento is still loading catalog/product/list.phtml. Just wondered if anyone else had had an issue like this and how to approach solving it. – Weaves81 Aug 9 '16 at 9:10
  • so use {{block}} in cms block and set this block in category – Prashant Barot Aug 9 '16 at 9:11
  • what's the complete path of list-sub-categories.phtml file ? – Anil Suthar Aug 9 '16 at 9:14
  • app/design/frontend/pass-rwd/default/template/catalog/product/list-sub-categories.phtml – Weaves81 Aug 9 '16 at 9:17
1

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.

  • Thanks for the suggestion, I'll take a look at third party extensions. I've already got a CATEGORY_110 layout handle in place set for a one off style change. Was hoping to avoid this as there's a lot of categories and all the xml template changes are already in place in the admin. (It's a reskin of an exisiting site we inherited). – Weaves81 Aug 9 '16 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.