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

Emil Stewart picture Emil Stewart · Feb 12, 2013 · Viewed 17.1k times · Source

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>

Answer

ruuter picture ruuter · Mar 13, 2013

I had similar issue with Community Edition. Tried to move layered navigation 'catalog.leftnav' to mycustomblock with success, but then got error

You cannot define a correlation name 'customattribute' more than once

Doing <remove name="catalog.leftnav" /> removed it also from mycustomblock. unsetChild did not work at all. Emil Stewart solution, renaming block, worked nicely. Thank You! So if anyone having same issue in CE, do the following.

  1. In your local.xml add <remove name="catalog.leftnav" />
  2. and then add catalog/layer_view block where you want to, but change the name

<block type="catalog/layer_view" name="yourname.catalog.leftnav" template="catalog/layer/view.phtml"/>

BUT I found even better and cleaner solution here

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