Skip to content

Commit 1f3c5dc

Browse files
committed
MAGETWO-96908: [2.3] Wrong attribute value in flat table
1 parent a5457dd commit 1f3c5dc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ protected function _updateTemporaryTableByStoreValues(
349349
//Update not simple attributes (eg. dropdown)
350350
$columnName = $attributeCode . $valueFieldSuffix;
351351
if (isset($flatColumns[$columnName])) {
352+
$columnValue = $this->_connection->getIfNullSql('ts.value', 't0.value');
352353
$select = $this->_connection->select();
353354
$select->joinLeft(
354355
['t0' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')],
@@ -359,8 +360,8 @@ protected function _updateTemporaryTableByStoreValues(
359360
'ts.option_id = et.' . $attributeCode . ' AND ts.store_id = ' . $storeId,
360361
[]
361362
)->columns(
362-
[$columnName => $this->_connection->getIfNullSql('ts.value', 't0.value')]
363-
)->where($columnName . ' IS NOT NULL');
363+
[$columnName => $columnValue]
364+
)->where($columnValue . ' IS NOT NULL');
364365
if (!empty($changedIds)) {
365366
$select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds));
366367
}

0 commit comments

Comments
 (0)