Magento: You cannot define a correlation name ‘attribute_idx’ more than once [SOLVED]

Problem: I am having the following error when I browse Layered Navigation on Magento.

You cannot define a correlation name ‘attribute_idx’ more than once

Cause: This is because a block has been duplicated. You have to check your layout xml files to check if you have included same block at same place twice.

Solution: To solve this error, you have to find where the duplicate of block occurs and remove it.

For example:-

Suppose you have a custom module and it’s layout xml file is named mymodule.xml

Now, if you add the following in mymodule.xml


<catalog_category_layered>         
	<reference name="left">
		<block type="mymodule/catalog_layer_view" name="mymodule.navleft" after="currency" template="catalog/layer/view.phtml"/> 
	</reference>	
</catalog_category_layered>

And, you also edit catalog.xml file with the above code. Then, both xml files have same blocks, i.e. duplication of block occurs here and you will get the error mentioned above in this post.

Another scenario is that you included the same block two times in your custom module layout xml file. For example, you can see how the same block is added twice in the following layout file:-


<?xml version="1.0"?>
<layout>
    <default>
		<catalog_category_layered>         
			<reference name="left">
			   <block type="mymodule/catalog_layer_view" name="mymodule.navleft" after="currency" template="catalog/layer/view.phtml"/> 
			</reference>	
		</catalog_category_layered>
	</default>
	
	....
	...
	..
	
	<catalog_category_layered>         
		<reference name="left">
		   <block type="mymodule/catalog_layer_view" name="mymodule.navleft" after="currency" template="catalog/layer/view.phtml"/> 
		</reference>	
	</catalog_category_layered>
	
</layout>

To solve the error, you have to remove such duplicate inclusion of blocks.

Hope it helps.