Emi*_*art 2 magento magento-layout-xml
我知道这个问题已被提出,但我一直无法找到对我有用的答案.我有一个我自己构建的自定义模块,它在搜索结果时也会搜索CMS静态页面.在这个模块中,我有一个更新布局xml的文件.我确信我的xml正在加载.出于某种原因,我尝试删除或取消设置分层导航并将其移动到右列没有结果.下面是我的代码,我希望有人能指出我的错误.谢谢!
<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>
Run Code Online (Sandbox Code Playgroud)
我和Community Edition有类似的问题.试图将分层导航'catalog.leftnav'移动到mycustomblock成功,但后来出错了
您不能多次定义相关名称'customattribute'
做<remove name="catalog.leftnav" />删除它也mycustomblock.unsetChild根本没用.Emil Stewart解决方案,重命名块,工作得很好.谢谢!因此,如果任何人在CE中遇到相同问题,请执行以下操作.
<remove name="catalog.leftnav" />
<block type="catalog/layer_view" name="yourname.catalog.leftnav" template="catalog/layer/view.phtml"/>
但我在这里找到了更好,更清洁的解决方案
<reference name="left">
<action method="unsetChild"><name>catalog.leftnav</name></action>
</reference>
<reference name="right">
<action method="insert"><child>catalog.leftnav</child></action>
</reference>
Run Code Online (Sandbox Code Playgroud)
所以我实际上发现了这个问题.我正在使用Magento Enterprise Edition,Enterprise Edition明确删除了分层导航,以便添加自己的分层导航.我应该抓住这个,因为我有模板路径提示,它显示分层导航作为企业块.无论如何,这是导致问题的代码:
<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>
Run Code Online (Sandbox Code Playgroud)
我只需要更改我对enterprisecatalog.leftnav的名称引用来解决问题.
| 归档时间: |
|
| 查看次数: |
16522 次 |
| 最近记录: |