Skip to content

Commit 1675f7b

Browse files
MC-5906: The order of product SKU is not respected
- Get table with field
1 parent 4c0f020 commit 1675f7b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/code/Magento/Rule/Model/Condition/Sql/Builder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,23 +252,23 @@ public function attachConditionToCollection(
252252
if (!empty($whereExpression)) {
253253
if (!empty($combine->getConditions())) {
254254
$conditions = '';
255-
$attribute = '';
255+
$attributeField = '';
256256
foreach ($combine->getConditions() as $condition) {
257257
if ($condition->getData('attribute') === \Magento\Catalog\Api\Data\ProductInterface::SKU) {
258258
$conditions = $condition->getData('value');
259-
$attribute = $condition->getData('attribute');
259+
$attributeField = $condition->getMappedSqlField();
260260
}
261261
}
262262

263263
$collection->getSelect()->where($whereExpression);
264264

265-
if (!empty($conditions) && !empty($attribute)) {
265+
if (!empty($conditions) && !empty($attributeField)) {
266266
$conditions = explode(',', $conditions);
267267
foreach ($conditions as &$condition) {
268268
$condition = "'" . trim($condition) . "'";
269269
}
270270
$conditions = implode(', ', $conditions);
271-
$collection->getSelect()->order("FIELD($attribute, $conditions)");
271+
$collection->getSelect()->order("FIELD($attributeField, $conditions)");
272272
}
273273
} else {
274274
// Select ::where method adds braces even on empty expression

0 commit comments

Comments
 (0)