I am trying to set up the root template of <catalog_category_layered> from catalog.xml

I know how to use admin to change the root template for categories, but i want to change it from 'catalog.xml'. I added

<reference name="root">
            <action method="setTemplate"><template>page/product_view_custom.phtml</template></action>

in <catalog_category_layered> just after the node starts. But it is not taking that template.

EDIT: IS the final say which layout is to be loaded for a category page is decided by magento admin? I guess YES.

If YES is there any way i can hard code my required layout to magento. Even if it means editing the core file i don't mind as this is for a internal beta release of an existing website. Why I am trying to do this is if i change anything in Admin it screws the live site

NOTE : The answer below was accepted as my question was slightly different initially. and for that it works fine.


Try and add the template overwrite to your templates local.xml

<?xml version="1.0"?>
<layout version="0.1.0">
      <reference name="root">
         <action method="setTemplate"><template>page/product_view_custom.phtml</template></action>

[EDIT] Zamil pointed out he also requested a way of overwriting the Category layout updates and provided the solution for this. In my opinion this should be done by overwriting the controller from a custom extension but can be done by copying the CategoryController.php to app/code/local/Mage/Catalog/controllers/ and commenting out the following on line 149

| improve this answer | |
  • but these updates will not work when u give any layout updates form admin side.any method to override the layout updates given frm admin side using catalog or local xml file?. The actual question i meant to ask was that – zamil Feb 20 '14 at 16:09
  • you mean from the layout tab in a category? – Sander Mangel Feb 20 '14 at 16:26
  • yes.there is layout update from layout tab in category. So site loads that template which is a fair thing when shop owner is concerned.But i cannot do it as i am releasing an internal beta of an existing high traffic website.So is there any way in which i can hard code the template i want in magento? Even if it editing the core files i don't mind.audience are limited to a few 100s – zamil Feb 21 '14 at 5:09
  • hm disabling You can probably prevent the layout update from the category layout tab but I wouldn't know how. You should probably check the category view controller if a layout update is performed – Sander Mangel Feb 21 '14 at 9:50
  • One thing i understood, The layout updates that are coming from the Admin has preference. And @Sander Mangel. please update your answer with this comment out this $this->getLayout()->helper('page/layout')->applyTemplate($settings->getPageLayout()); in line # 149 in CategoryController.php to disable the layout updates coming from admin. please add this in your answer so in future it may help somebody. – zamil Feb 21 '14 at 10:17

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.