Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed regression introduced in #2993 where attributes are not correctly pre-filtered for the layered navigation #4063

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading