Reputation: 6344
I'm using Magento's layered navigation with my custom attributes and price. If I filter by price it works; but when filtering by my custom attributes it shows:
You cannot define a correlation name 'mycustomattribute' more than once
trace:
#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}
Upvotes: 14
Views: 28046
Reputation: 684
It is because catalog/layer_view module
was called twice.
You can search type="catalog/layer_view"
through your xml files. Remove the block you don't need. Or change the type to another class.
Upvotes: 27
Reputation: 1545
In my case I have to get rid of the block that was type="catalog/layer_view"
from local.xml and catalog.xml and put my modified type="catalog/layer_view"
block.
Be sure there is only one block that contains type="catalog/layer_view"
.
Upvotes: 1
Reputation: 3846
Had a similar issue on an Enterprise build, so posting for anyone else that needs it - turned out I had to use the following in order to get it to work:
<remove name="enterprisecatalog.leftnav" />
Upvotes: 0
Reputation: 138
For any of you who are looking for a way to solve this issue in Magento Enterprise Edition, check if your catalog.xml or local.xml template has catalog search layered navigation. If you do have it, override the search.xml in your current theme from the enterprise theme and empty all the block reference in it.
Upvotes: 0
Reputation: 1830
This causes the same problem. -adding the same attribute to the sort twice when building a collection:
...
->addAttributeToSort('color', 'asc')
->addAttributeToSort('color', 'asc');
NOTE: calling setCollection($this->getMyCollection); on the template caused my error, because 'color' was already added to the sort order as the default sort order.
SOLUTION:a quick way to fix this is to remove the default sort order from the request after obtain the value:
$this->getRequest()->setParam('order','');
otherwise extend the Block and override the setCollection() method for your particular needs.
Upvotes: 0
Reputation: 2635
For me Dubbo's answer was right, but more specifically I found out that Magento Enterprise touches the catalog_category_layered xml node in the enterprise_search.xml file
Upvotes: 0
Reputation: 6344
I had <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
twice.
Deleted one line and fixed it.
Upvotes: 4