Sorry I know this is marked as end of life however I continue to use this module with OpenMage successfully and hoping this may be an easy fix or at least someone might be able to point me in the right direction.
This bug specifically happens when you update an attribute in the configurable product and the simple product attributes underneath are not updated. (which I think is normal as they are not referred to).
The attribute values of the simple products should be ignored if their "Visibility = Not Visible Individually" as the configurable product's information takes precedence but in this case they are not and end up polluting the layered navigation over time as changes are made to the parent configurable products.
A filter removing items "Visibility = Not Visible Individually" applied to the simple products returned/counted for the rendering of the side layered navigations collection would fix this.
This bug only affects the rendering of the side layered navigation, the product grid and list are ok so I think the file needing editing is this one:
\app\code\community\Catalin\SEO\Model\Catalog\Resource\Layer\Filter\Attribute.php
in this section of code?
/**
* Retrieve array with products counts per attribute option
*
* @param Mage_Catalog_Model_Layer_Filter_Attribute $filter
* @return array
*/
public function getCount($filter)
{
if (!Mage::helper('catalin_seo')->isEnabled()) {
return parent::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()),
);
// start removing all filters for current attribute - we need correct count
$parts = $select->getPart(Zend_Db_Select::FROM);
$from = array();
foreach ($parts as $key => $part) {
if (stripos($key, $tableAlias) === false) {
$from[$key] = $part;
}
}
$select->setPart(Zend_Db_Select::FROM, $from);
// end of removing
$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);
}
Sorry I know this is marked as end of life however I continue to use this module with OpenMage successfully and hoping this may be an easy fix or at least someone might be able to point me in the right direction.
This bug specifically happens when you update an attribute in the configurable product and the simple product attributes underneath are not updated. (which I think is normal as they are not referred to).
The attribute values of the simple products should be ignored if their "Visibility = Not Visible Individually" as the configurable product's information takes precedence but in this case they are not and end up polluting the layered navigation over time as changes are made to the parent configurable products.
A filter removing items "Visibility = Not Visible Individually" applied to the simple products returned/counted for the rendering of the side layered navigations collection would fix this.
This bug only affects the rendering of the side layered navigation, the product grid and list are ok so I think the file needing editing is this one: \app\code\community\Catalin\SEO\Model\Catalog\Resource\Layer\Filter\Attribute.php
in this section of code?