Skip to content

Commit

Permalink
Fixed regression introduced in #2993 where attributes are not correct…
Browse files Browse the repository at this point in the history
…ly pre-filtered for the layered navigation (#4063)
  • Loading branch information
davidhiendl authored Jul 2, 2024
1 parent 9e48335 commit 3da8c6e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/code/core/Mage/Catalog/Model/Layer.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ public function getFilterableAttributes()
foreach ($setAttributeIds as $attributeId) {
if (!isset($attributes[$attributeId])) {
$attribute = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeId);
if (!$this->_filterFilterableAttributes($attribute)) {
continue;
}
if ($attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute && $attribute->getIsFilterable()) {
$attributes[$attributeId] = $attribute;
}
Expand Down Expand Up @@ -249,6 +252,15 @@ protected function _prepareAttributeCollection($collection)
return $collection;
}

/**
* Filter which attributes are included in getFilterableAttributes
*
*/
protected function _filterFilterableAttributes(Mage_Catalog_Model_Resource_Eav_Attribute $attribute): bool
{
return $attribute->getIsFilterable() > 0;
}

/**
* Retrieve layer state object
*
Expand Down
9 changes: 9 additions & 0 deletions app/code/core/Mage/CatalogSearch/Model/Layer.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ protected function _prepareAttributeCollection($collection)
return $collection;
}

/**
* Filter which attributes are included in getFilterableAttributes
*
*/
protected function _filterFilterableAttributes(Mage_Catalog_Model_Resource_Eav_Attribute $attribute): bool
{
return $attribute->getIsVisible() && $attribute->getIsFilterableInSearch() > 0;
}

/**
* Prepare attribute for use in layered navigation
*
Expand Down

0 comments on commit 3da8c6e

Please sign in to comment.