Search code examples
magentomagento-layout-xml

How can I move Magento's layered Navigation block from left column to right column?


I know that this question has been asked, but I have been unable to find answers that work for me. I have a custom module that I built that also searches for CMS Static pages when giving search results. Within this module, I have a file that updays the layout xml. I am sure that my xml is being loaded. For some reason, my attempts at removing or unsetting the Layered navigation and moving it to the right column have been fruitless. Below is my code, I was hoping that someone could help point out my mistake. Thank you!

<layout version = "0.1.0">

<catalog_category_default>
    <reference name="left">
        <action method="unsetChild"><name>catalog.leftnav</name></action>
    </reference>
    <reference name="right">
        <action method="insert"><child>catalog.leftnav</child></action>
    </reference>
</catalog_category_default>

<catalogsearch_result_index>
    <reference name="content">
        <block type="cmssearch/results" name="cms-search-results-view" after="search.result" template="cmssearch/cmssearchview.phtml">
        </block>
    </reference>
    <reference name="left">
        <!-- <remove name = "catalogsearch.leftnav" /> -->
        <action method="unsetChild"><name>catalogsearch.leftnav</name></action>
    </reference>
    <reference name="right">
        <!--  <block type="catalogsearch/layer" name="catalogsearch.leftnav" before="+" template="catalog/layer/view.phtml"/> -->
        <action method="insert"><child>catalogsearch.leftnav</child></action>
    </reference>
</catalogsearch_result_index>

<catalog_category_layered>
    <reference name="left">
        <action method="unsetChild"><name>catalog.leftnav</name></action>
    </reference>
    <reference name="right">
        <action method="insert"><child>catalog.leftnav</child></action>
    </reference>
</catalog_category_layered>


Solution

  • So I actually figured out the issue. I am working with Magento Enterprise Edition, and Enterprise Edition explicitly removes layered navigation in order to add its own layered navigation. I should have caught this, since I had template path hints on and it was showing layered navigation as a Enterprise Block. Anyhow, here is the code that causes the issue:

    <catalogsearch_result_index>
        <reference name="left">
            <remove name="catalogsearch.leftnav"/>
            <block type="enterprise_search/catalogsearch_layer" name="enterprisesearch.leftnav" before="-" template="catalog/layer/view.phtml"/>
        </reference>
    </catalogsearch_result_index>
    
    <catalog_category_layered>
        <reference name="left">
            <remove name="catalog.leftnav"/>
            <block type="enterprise_search/catalog_layer_view" name="enterprisecatalog.leftnav" before="-" template="catalog/layer/view.phtml"/>
        </reference>
    </catalog_category_layered>
    

    I simply had to change my name references to enterprisecatalog.leftnav to fix the issue.