Skip to content

Commit a3c9082

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.2-develop
Accepted Public Pull Requests: - #22581: [Backport] #21747 Fix catalog_product_flat_data attribute value for store during indexer (by @maheshWebkul721) Fixed GitHub Issues: - #21747: catalog_product_flat_data for store view populated with default view data when it should be store view data (reported by @bengower) has been fixed in #22581 by @maheshWebkul721 in 2.2-develop branch Related commits: 1. 020f970 2. aae1e59
2 parents 4885d16 + e26f379 commit a3c9082

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
@@ -289,12 +289,16 @@ protected function _fillTemporaryTable(
289289

290290
/** @var $attribute \Magento\Catalog\Model\ResourceModel\Eav\Attribute */
291291
foreach ($columnsList as $columnName => $attribute) {
292-
$countTableName = 't' . $iterationNum++;
292+
$countTableName = 't' . ($iterationNum++);
293293
$joinCondition = sprintf(
294-
'e.%3$s = %1$s.%3$s AND %1$s.attribute_id = %2$d AND %1$s.store_id = 0',
294+
'e.%3$s = %1$s.%3$s' .
295+
' AND %1$s.attribute_id = %2$d' .
296+
' AND (%1$s.store_id = %4$d' .
297+
' OR %1$s.store_id = 0)',
295298
$countTableName,
296299
$attribute->getId(),
297-
$metadata->getLinkField()
300+
$metadata->getLinkField(),
301+
$storeId
298302
);
299303

300304
$select->joinLeft(
@@ -308,9 +312,10 @@ protected function _fillTemporaryTable(
308312
$columnValueName = $attributeCode . $valueFieldSuffix;
309313
if (isset($flatColumns[$columnValueName])) {
310314
$valueJoinCondition = sprintf(
311-
'e.%1$s = %2$s.option_id AND %2$s.store_id = 0',
315+
'e.%1$s = %2$s.option_id AND (%2$s.store_id = %3$d OR %2$s.store_id = 0)',
312316
$attributeCode,
313-
$countTableName
317+
$countTableName,
318+
$storeId
314319
);
315320
$selectValue->joinLeft(
316321
[

0 commit comments

Comments
 (0)