문제

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>
</reference>

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">
   <catalog_category_layered>
      <reference name="root">
         <action method="setTemplate"><template>page/product_view_custom.phtml</template></action>
      </reference>
   </catalog_category_layered>
</layout>

[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

$this->getLayout()->helper('page/layout')->applyTemplate($settings->getPageLayo‌​ut());
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top