I created a module as per the steps described in the accepted answer from the following question:
Adding custom layouts for CMS and Category use with custom module trouble
However, the block updates that should be applied to the left section of the page as defined in isn_layouts.xml
do not get applied.
Even if I change the template filename to a non-existent file it still does not produce an error which suggests to me that Magento is not seeing the layout updates in the app/design/frontend/base/default/layout/isn_layouts.xml
file.
The code for the module is as follows:
app/etc/modules/ISN_Layouts.xml:
<?xml version="1.0"?>
<config>
<modules>
<ISN_Layouts>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</ISN_Layouts>
</modules>
</config>
app/code/local/ISN/Layouts/etc/config.xml:
<?xml version="1.0"?>
<config>
<modules>
<ISN_Layouts>
<version>0.0.1</version>
</ISN_Layouts>
</modules>
<global>
<page>
<layouts>
<noanchor module="page" translate="label">
<label>Anchor Override</label>
<template>page/3columns.phtml</template>
<layout_handle>noanchor</layout_handle>
</noanchor>
</layouts>
</page>
</global>
<frontend>
<layout>
<updates>
<isn_layouts>
<file>isn_layouts.xml</file>
</isn_layouts>
</updates>
</layout>
</frontend>
</config>
app/design/frontend/base/default/layout/isn_layouts.xml:
<?xml version="1.0"?>
<layout>
<noanchor translate="label">
<label>Anchor Override</label>
<reference name="root">
<action method="setTemplate"><template>page/3columns.phtml</template></action>
<action method="setIsHandle"><applied>1</applied></action>
</reference>
<reference name="left">
<action method="unsetChild"><name>catalog.leftnav</name></action>
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
</noanchor>
</layout>
What am I doing wrong?
Best Answer
If you just want to avoid layered navigation for a category, then you can go with one of following options:
Make your category a default category. You can do this by setting
isAnchor
toNo
from admin side by selecting the categories that you need. Now your category will not use layered navigation and thus you will get required behaviour.Put this code inside
Custom Layout Update
section inside your category page (by editing via admin)File :
app\design\frontend\{package}\{theme}\layout\local.xml
where
{ID}
should replace with category-id of your specific category. For an example, if category id is 15, then layout update handle will beCATEGORY_15
Hope that makes sense.
EDIT - 1
This is the final solution which came to my mind.You need to include page layout handle as one of the layout update handle for category page.
For this, observe to the event
controller_action_layout_load_before
and put this inside your observerYou are done. Now clear your cache and you will see the changes that you have specified within your page layout handle, ie
noanchor
EDIT - 2
Here is your full extension. Please checkout and feel free to use it.
EDIT - 3
For category pages, you can use the following condition check
See the changes in Observer.php in github.
Note : Out of 3 options, use only one option at a time. Dont forget to clear your cache after changes made.