diff --git a/app/code/core/Mage/Catalog/Model/Layer.php b/app/code/core/Mage/Catalog/Model/Layer.php index f8c28662773..3d9ba78d9bb 100644 --- a/app/code/core/Mage/Catalog/Model/Layer.php +++ b/app/code/core/Mage/Catalog/Model/Layer.php @@ -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; } @@ -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 * diff --git a/app/code/core/Mage/CatalogSearch/Model/Layer.php b/app/code/core/Mage/CatalogSearch/Model/Layer.php index 4e1621b3eaa..4295ba7b663 100644 --- a/app/code/core/Mage/CatalogSearch/Model/Layer.php +++ b/app/code/core/Mage/CatalogSearch/Model/Layer.php @@ -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 *