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

17,061

Solution 1

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.

Solution 2

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>
Share:
17,061
Emil Stewart
Author by

Emil Stewart

Updated on June 04, 2022

Comments

  • Emil Stewart
    Emil Stewart almost 2 years

    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>