Skip to content

Commit

Permalink
magento#12717 - Catalog Products List widget is not displayed on Stor…
Browse files Browse the repository at this point in the history
…efront
  • Loading branch information
RostislavS committed Dec 15, 2017
1 parent 169b3eb commit d30696e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ public function afterSave()
return parent::afterSave();
}

/**
* Is attribute enabled for flat indexing
*
* @return bool
*/
public function isEnabledInFlat()
{
return $this->_isEnabledInFlat();
}


/**
* Is attribute enabled for flat indexing
*
Expand Down
13 changes: 11 additions & 2 deletions app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,17 @@ public function addToCollection($collection)
$attribute = $this->getAttributeObject();

if ($collection->isEnabledFlat()) {
$alias = array_keys($collection->getSelect()->getPart('from'))[0];
$this->joinedAttributes[$attribute->getAttributeCode()] = $alias . '.' . $attribute->getAttributeCode();
if ($attribute->isEnabledInFlat()) {
$alias = array_keys($collection->getSelect()->getPart('from'))[0];
$this->joinedAttributes[$attribute->getAttributeCode()] = $alias . '.' . $attribute->getAttributeCode();
} else {
$alias = 'at_' . $attribute->getAttributeCode();
if (!in_array($alias, array_keys($collection->getSelect()->getPart('from')))) {
$collection->joinAttribute($attribute->getAttributeCode(), 'catalog_product/'.$attribute->getAttributeCode(), 'entity_id');
}

$this->joinedAttributes[$attribute->getAttributeCode()] = $alias . '.value';
}
return $this;
}

Expand Down

0 comments on commit d30696e

Please sign in to comment.