2

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>

Emil Stewart
  • 488
  • 1
  • 7
  • 17
  • Try `` to remove it, then insert it into `` in the same manner that it is inserted by the catalog.xml layout file. – pspahn Feb 12 '13 at 17:48
  • Hey there, Thanks for your response! I tried this initially, but it didn't work either (this approach was commented out in the code example). The issue turned out to be that Enterprise Edition overwrites the catalog.leftnav and catalogsearch.leftnav block. Instead, since I am working with Enterprise Edition, I had to overwrite enterprisecatalog.leftnav. – Emil Stewart Feb 12 '13 at 17:56

2 Answers2

6

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>
ruuter
  • 2,453
  • 2
  • 30
  • 44
5

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.

Emil Stewart
  • 488
  • 1
  • 7
  • 17