Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

There has been an error processing your request
 
mujshaikh
Jr. Member
 
Total Posts:  4
Joined:  2012-10-14
 

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

Please help me to resolve this error. New to magento

Trace:
#0 /home1/sevabhav/public_html/adamore/lib/Varien/Db/Select.php(281): Zend_Db_Select->_join(’inner join’, Array, ‘gender_ring_idx...’, Array, NULL)
#1 /home1/sevabhav/public_html/adamore/lib/Zend/Db/Select.php(336): Varien_Db_Select->_join(’inner join’, Array, ‘gender_ring_idx...’, Array, NULL)
#2 /home1/sevabhav/public_html/adamore/lib/Zend/Db/Select.php(315): Zend_Db_Select->joinInner(Array, ‘gender_ring_idx...’, Array, NULL)
#3 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Attribute.php(70): Zend_Db_Select->join(Array, ‘gender_ring_idx...’, Array)
#4 /home1/sevabhav/public_html/adamore/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), ‘10’)
#5 /home1/sevabhav/public_html/adamore/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 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Catalog/Block/Layer/Filter/Abstract.php(73): Mage_Catalog_Block_Layer_Filter_Abstract->_initFilter()
#7 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Catalog/Block/Layer/View.php(136): Mage_Catalog_Block_Layer_Filter_Abstract->init()
#8 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Block/Abstract.php(238): Mage_Catalog_Block_Layer_View->_prepareLayout()
#9 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#10 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock(’catalog/layer_v...’, ‘catalog.rightna...’)
#11 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock(’catalog/layer_v...’, ‘catalog.rightna...’)
#12 /home1/sevabhav/public_html/adamore/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 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#14 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#15 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Catalog/controllers/CategoryController.php(146): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#16 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Catalog_CategoryController->viewAction()
#17 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch(’view’)
#18 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#19 /home1/sevabhav/public_html/adamore/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#20 /home1/sevabhav/public_html/adamore/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#21 /home1/sevabhav/public_html/adamore/index.php(87): Mage::run(’’, ‘store’)
#22 {main}

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brent W Peterson
Moderator
 
Avatar
Total Posts:  3217
Joined:  2009-02-26
Minneapolis MN
 

Please tell us:

Did you do anything prior to the error? for example: upload new products, re-index, clear cache, add extention
What triggers the error?
When did the error start?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mujshaikh
Jr. Member
 
Total Posts:  4
Joined:  2012-10-14
 
Brent W Peterson - 09 February 2013 08:40 AM

Please tell us:

Did you do anything prior to the error? for example: upload new products, re-index, clear cache, add extention
What triggers the error?
When did the error start?

I have just added the attributes and while clicking on the attributes on front end it’s shows me this error.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mujshaikh
Jr. Member
 
Total Posts:  4
Joined:  2012-10-14
 
Brent W Peterson - 09 February 2013 08:40 AM

Please tell us:

Did you do anything prior to the error? for example: upload new products, re-index, clear cache, add extention
What triggers the error?
When did the error start?

Finally Problem Solved

Replace below code

Open file app/Mage/Catalog/Model/Resource/Layer/Filter/Attribute.php and make sure entire file looks like following:
class Mage_Catalog_Model_Resource_Layer_Filter_Attribute extends Mage_Core_Model_Resource_Db_Abstract
{
/**
* Initialize connection and define main table name
*
*/
protected function _construct()
{
$this->_init(’catalog/product_index_eav’, ‘entity_id’);
}

/**
* Apply attribute filter to product collection
*
* @param Mage_Catalog_Model_Layer_Filter_Attribute $filter
* @param int $value
* @return Mage_Catalog_Model_Resource_Layer_Filter_Attribute
*/
public function applyFilterToCollection($filter, $value)
{

$filterSingleton = FilterSingleton::singleton();

if (!isset($filterSingleton->return)) {

$collection = $filter->getLayer()->getProductCollection();
$attribute = $filter->getAttributeModel();
$connection = $this->_getReadAdapter();
$tableAlias = $attribute->getAttributeCode() . ‘_idx’;
$conditions = array(
“{$tableAlias}.entity_id = e.entity_id”,
$connection->quoteInto("{$tableAlias}.attribute_id = ?”, $attribute->getAttributeId()),
$connection->quoteInto("{$tableAlias}.store_id = ?”, $collection->getStoreId()),
$connection->quoteInto("{$tableAlias}.value = ?”, $value)
);

$collection->getSelect()->join(
array($tableAlias => $this->getMainTable()),
join(’ AND ‘, $conditions),
array()
);

$filterSingleton->return = $this;

return $this;

} else {
return $filterSingleton->return;
}
}

/**
* Retrieve array with products counts per attribute option
*
* @param Mage_Catalog_Model_Layer_Filter_Attribute $filter
* @return array
*/
public function getCount($filter)
{
// clone select from collection with filters
$select = clone $filter->getLayer()->getProductCollection()->getSelect();
// reset columns, order and limitation conditions
$select->reset(Zend_Db_Select::COLUMNS);
$select->reset(Zend_Db_Select::ORDER);
$select->reset(Zend_Db_Select::LIMIT_COUNT);
$select->reset(Zend_Db_Select::LIMIT_OFFSET);

$connection = $this->_getReadAdapter();
$attribute = $filter->getAttributeModel();
$tableAlias = sprintf(’%s_idx’, $attribute->getAttributeCode());
$conditions = array(
“{$tableAlias}.entity_id = e.entity_id”,
$connection->quoteInto("{$tableAlias}.attribute_id = ?”, $attribute->getAttributeId()),
$connection->quoteInto("{$tableAlias}.store_id = ?”, $filter->getStoreId()),
);

$select
->join(
array($tableAlias => $this->getMainTable()),
join(’ AND ‘, $conditions),
array(’value’, ‘count’ => new Zend_Db_Expr("COUNT({$tableAlias}.entity_id)")))
->group("{$tableAlias}.value");

return $connection->fetchPairs($select);
}
}
class FilterSingleton {

static private $instance;

public $return = null;

private function __construct() {

}

static public function singleton() {
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c;
}

return self::$instance;
}
}

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top