Skip to content

#12717 - Catalog Products List widget is not displayed on Storefront #12765

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

Merged
merged 2 commits into from
Feb 7, 2018
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
10 changes: 10 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,16 @@ 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
17 changes: 15 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,21 @@ 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