Skip to content

Commit 788e0f0

Browse files
MAGETWO-87358: #12717 - Catalog Products List widget is not displayed on Storefront #12765
2 parents 44a0ec1 + ec24990 commit 788e0f0

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ public function afterSave()
230230
return parent::afterSave();
231231
}
232232

233+
/**
234+
* Is attribute enabled for flat indexing
235+
*
236+
* @return bool
237+
*/
238+
public function isEnabledInFlat()
239+
{
240+
return $this->_isEnabledInFlat();
241+
}
242+
233243
/**
234244
* Is attribute enabled for flat indexing
235245
*

app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,21 @@ public function addToCollection($collection)
119119
$attribute = $this->getAttributeObject();
120120

121121
if ($collection->isEnabledFlat()) {
122-
$alias = array_keys($collection->getSelect()->getPart('from'))[0];
123-
$this->joinedAttributes[$attribute->getAttributeCode()] = $alias . '.' . $attribute->getAttributeCode();
122+
if ($attribute->isEnabledInFlat()) {
123+
$alias = array_keys($collection->getSelect()->getPart('from'))[0];
124+
$this->joinedAttributes[$attribute->getAttributeCode()] = $alias . '.' . $attribute->getAttributeCode();
125+
} else {
126+
$alias = 'at_' . $attribute->getAttributeCode();
127+
if (!in_array($alias, array_keys($collection->getSelect()->getPart('from')))) {
128+
$collection->joinAttribute(
129+
$attribute->getAttributeCode(),
130+
'catalog_product/'.$attribute->getAttributeCode(),
131+
'entity_id'
132+
);
133+
}
134+
135+
$this->joinedAttributes[$attribute->getAttributeCode()] = $alias . '.value';
136+
}
124137
return $this;
125138
}
126139

0 commit comments

Comments
 (0)