Skip to content

Commit ae7179f

Browse files
committed
#21747 Fix catalog_product_flat_data attribute value for store during
indexer
1 parent 810780b commit ae7179f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,11 @@ protected function _fillTemporaryTable(
306306
foreach ($columnsList as $columnName => $attribute) {
307307
$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 AND %1$s.attribute_id = %2$d AND (%1$s.store_id = %4$d OR %1$s.store_id = 0)',
310310
$countTableName,
311311
$attribute->getId(),
312-
$metadata->getLinkField()
312+
$metadata->getLinkField(),
313+
$storeId
313314
);
314315

315316
$select->joinLeft(
@@ -323,9 +324,10 @@ protected function _fillTemporaryTable(
323324
$columnValueName = $attributeCode . $valueFieldSuffix;
324325
if (isset($flatColumns[$columnValueName])) {
325326
$valueJoinCondition = sprintf(
326-
'e.%1$s = %2$s.option_id AND %2$s.store_id = 0',
327+
'e.%1$s = %2$s.option_id AND (%2$s.store_id = %3$d OR %2$s.store_id = 0)',
327328
$attributeCode,
328-
$countTableName
329+
$countTableName,
330+
$storeId
329331
);
330332
$selectValue->joinLeft(
331333
[

0 commit comments

Comments
 (0)