Skip to content

Commit 8298661

Browse files
dhorytskyiBeagon
authored andcommitted
MAGETWO-96908: [2.3] Wrong attribute value in flat table
1 parent 2c5bf7d commit 8298661

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
@@ -355,6 +355,7 @@ protected function _updateTemporaryTableByStoreValues(
355355
//Update not simple attributes (eg. dropdown)
356356
$columnName = $attributeCode . $valueFieldSuffix;
357357
if (isset($flatColumns[$columnName])) {
358+
$columnValue = $this->_connection->getIfNullSql('ts.value', 't0.value');
358359
$select = $this->_connection->select();
359360
$select->joinLeft(
360361
['t0' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')],
@@ -365,8 +366,8 @@ protected function _updateTemporaryTableByStoreValues(
365366
'ts.option_id = et.' . $attributeCode . ' AND ts.store_id = ' . $storeId,
366367
[]
367368
)->columns(
368-
[$columnName => $this->_connection->getIfNullSql('ts.value', 't0.value')]
369-
)->where($columnName . ' IS NOT NULL');
369+
[$columnName => $columnValue]
370+
)->where($columnValue . ' IS NOT NULL');
370371
if (!empty($changedIds)) {
371372
$select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds));
372373
}

0 commit comments

Comments
 (0)