Skip to content

Commit cc0ced0

Browse files
authored
ENGCOM-4749: #21747 Fix catalog_product_flat_data attribute value for store during indexer #22318
2 parents fdf9a74 + 818e1c0 commit cc0ced0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,16 @@ protected function _fillTemporaryTable(
304304

305305
/** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
306306
foreach ($columnsList as $columnName => $attribute) {
307-
$countTableName = 't' . $iterationNum++;
307+
$countTableName = 't' . ($iterationNum++);
308308
$joinCondition = sprintf(
309-
'e.%3$s = %1$s.%3$s AND %1$s.attribute_id = %2$d AND %1$s.store_id = 0',
309+
'e.%3$s = %1$s.%3$s' .
310+
' AND %1$s.attribute_id = %2$d' .
311+
' AND (%1$s.store_id = %4$d' .
312+
' OR %1$s.store_id = 0)',
310313
$countTableName,
311314
$attribute->getId(),
312-
$metadata->getLinkField()
315+
$metadata->getLinkField(),
316+
$storeId
313317
);
314318

315319
$select->joinLeft(
@@ -323,9 +327,10 @@ protected function _fillTemporaryTable(
323327
$columnValueName = $attributeCode . $valueFieldSuffix;
324328
if (isset($flatColumns[$columnValueName])) {
325329
$valueJoinCondition = sprintf(
326-
'e.%1$s = %2$s.option_id AND %2$s.store_id = 0',
330+
'e.%1$s = %2$s.option_id AND (%2$s.store_id = %3$d OR %2$s.store_id = 0)',
327331
$attributeCode,
328-
$countTableName
332+
$countTableName,
333+
$storeId
329334
);
330335
$selectValue->joinLeft(
331336
[

0 commit comments

Comments
 (0)