Skip to content

Commit

Permalink
ENGCOM-4749: #21747 Fix catalog_product_flat_data attribute value for…
Browse files Browse the repository at this point in the history
… store during indexer #22318
  • Loading branch information
sidolov authored Apr 18, 2019
2 parents fdf9a74 + 818e1c0 commit cc0ced0
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,16 @@ protected function _fillTemporaryTable(

/** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
foreach ($columnsList as $columnName => $attribute) {
$countTableName = 't' . $iterationNum++;
$countTableName = 't' . ($iterationNum++);
$joinCondition = sprintf(
'e.%3$s = %1$s.%3$s AND %1$s.attribute_id = %2$d AND %1$s.store_id = 0',
'e.%3$s = %1$s.%3$s' .
' AND %1$s.attribute_id = %2$d' .
' AND (%1$s.store_id = %4$d' .
' OR %1$s.store_id = 0)',
$countTableName,
$attribute->getId(),
$metadata->getLinkField()
$metadata->getLinkField(),
$storeId
);

$select->joinLeft(
Expand All @@ -323,9 +327,10 @@ protected function _fillTemporaryTable(
$columnValueName = $attributeCode . $valueFieldSuffix;
if (isset($flatColumns[$columnValueName])) {
$valueJoinCondition = sprintf(
'e.%1$s = %2$s.option_id AND %2$s.store_id = 0',
'e.%1$s = %2$s.option_id AND (%2$s.store_id = %3$d OR %2$s.store_id = 0)',
$attributeCode,
$countTableName
$countTableName,
$storeId
);
$selectValue->joinLeft(
[
Expand Down

0 comments on commit cc0ced0

Please sign in to comment.