Skip to content

Commit f3d9ed2

Browse files
committed
fix regression introduced in OpenMage#2993 where attributes are not correctly pre-filtered for the layered navigation
1 parent 1d4fe88 commit f3d9ed2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

app/code/core/Mage/Catalog/Model/Layer.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ public function getFilterableAttributes()
212212
foreach ($setAttributeIds as $attributeId) {
213213
if (!isset($attributes[$attributeId])) {
214214
$attribute = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeId);
215+
if (!$this->_filterFilterableAttributes($attribute)) continue;
215216
if ($attribute instanceof Mage_Catalog_Model_Resource_Eav_Attribute && $attribute->getIsFilterable()) {
216217
$attributes[$attributeId] = $attribute;
217218
}
@@ -249,6 +250,17 @@ protected function _prepareAttributeCollection($collection)
249250
return $collection;
250251
}
251252

253+
/**
254+
* Filter which attributes are included in getFilterableAttributes
255+
*
256+
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
257+
* @return bool
258+
*/
259+
protected function _filterFilterableAttributes($attribute)
260+
{
261+
return $attribute->getIsFilterable() > 0;
262+
}
263+
252264
/**
253265
* Retrieve layer state object
254266
*

app/code/core/Mage/CatalogSearch/Model/Layer.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ protected function _prepareAttributeCollection($collection)
9999
return $collection;
100100
}
101101

102+
/**
103+
* Filter which attributes are included in getFilterableAttributes
104+
*
105+
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
106+
* @return bool
107+
*/
108+
protected function _filterFilterableAttributes($attribute)
109+
{
110+
return $attribute->getIsVisible() && $attribute->getIsFilterableInSearch() > 0;
111+
}
112+
102113
/**
103114
* Prepare attribute for use in layered navigation
104115
*

0 commit comments

Comments
 (0)