Magento分层导航“您不能多次定义相关名称'mycustomattribute'”

时间:2012-05-09 21:02:36

标签: magento filter navigation

我正在使用Magento的分层导航功能和我的自定义属性和价格。如果我按价格过滤它有效;但是当按我的自定义属性进行过滤时,它会显示:

  

您不能多次定义相关名称'mycustomattribute'

迹:

#0 /home/coloresh/public_html/ColoreSG.com/lib/Varien/Db/Select.php(281):
Zend_Db_Select->_join('inner join', Array, 'metal_idx.entit...', Array, NULL)
#1 /home/coloresh/public_html/ColoreSG.com/lib/Zend/Db/Select.php(336):          Varien_Db_Select->_join('inner join', Array, 'metal_idx.entit...', Array, NULL)
#2 /home/coloresh/public_html/ColoreSG.com/lib/Zend/Db/Select.php(315): Zend_Db_Select->joinInner(Array, 'metal_idx.entit...', Array, NULL)
#3 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Attribute.php(70): Zend_Db_Select->join(Array, 'metal_idx.entit...', Array)
#4 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php(94): Mage_Catalog_Model_Resource_Layer_Filter_Attribute->applyFilterToCollection(Object(Mage_Catalog_Model_Layer_Filter_Attribute), '49')
#5  /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(91): Mage_Catalog_Model_Layer_Filter_Attribute->apply(Object(Mage_Core_Controller_Request_Http), Object(Mage_Catalog_Block_Layer_Filter_Attribute))
#6 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(73): Mage_Catalog_Block_Layer_Filter_Abstract->_initFilter()
#7 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Catalog/Block/Layer/View.php(136): Mage_Catalog_Block_Layer_Filter_Abstract->init()
#8 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Block/Abstract.php(238): Mage_Catalog_Block_Layer_View->_prepareLayout()
#9 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#10 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('catalog/layer_v...', 'catalog.leftnav')
#11 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('catalog/layer_v...', 'catalog.leftnav')
#12 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#13 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Model/Layout.php(210):  Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#14 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#15 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Catalog/controllers/CategoryController.php(146): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#16 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Catalog_CategoryController->viewAction()
#17 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#18 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#19 /home/coloresh/public_html/ColoreSG.com/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#20 /home/coloresh/public_html/ColoreSG.com/app/Mage.php(683): Mage_Core_Model_App-    >run(Array)
#21 /home/coloresh/public_html/ColoreSG.com/index.php(87): Mage::run('', 'store')
#22 {main}

7 个答案:

答案 0 :(得分:27)

这是因为catalog / layer_view模块被调用了两次。 您可以通过xml文件搜索'type =“catalog / layer_view”'。删除不需要的块。或者将类型更改为另一个类

答案 1 :(得分:4)

我有<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/> 两次。 删除了一行并修复了它。

答案 2 :(得分:1)

在我的情况下,我必须乘坐whas type =&#34; catalog / layer_view&#34;从local.xml和catalog.xml中放入我修改过的type =&#34; catalog / layer_view&#34;块。确保只有一个块包含type =&#34; catalog / layer_view&#34;。

答案 3 :(得分:0)

对我来说,Dubbo的答案是正确的,但更具体地说,我发现Magento Enterprise触及enterprise_search.xml文件中的catalog_category_layered xml节点

答案 4 :(得分:0)

这会导致同样的问题。 - 在构建集合时将相同的属性添加到排序两次:

...
    ->addAttributeToSort('color', 'asc')
    ->addAttributeToSort('color', 'asc');

注意:调用setCollection($ this-&gt; getMyCollection);在模板上导致我的错误, 因为“颜色”已作为默认排序顺序添加到排序顺序中。

解决方案:解决此问题的一种快速方法是在获取值后从请求中删除默认排序顺序:

$this->getRequest()->setParam('order','');

否则扩展Block并覆盖setCollection()方法以满足您的特定需求。

答案 5 :(得分:0)

对于正在寻找在Magento Enterprise Edition中解决此问题的方法的任何人,请检查您的catalog.xml或local.xml模板是否具有目录搜索分层导航。如果确实有,请从企业主题覆盖当前主题中的search.xml,并清空其中的所有块引用。

答案 6 :(得分:0)

在企业版本上有类似的问题,所以发布给其他需要它的人 - 结果我必须使用以下内容才能让它工作:

<remove name="enterprisecatalog.leftnav" />