Skip to content

Commit 4356876

Browse files
committed
Merge branch 'ACP2E-2494' of https://github.com/magento-l3/magento2ce into L3-PR-2024-02-16
2 parents 3e57a5a + 6c73a6c commit 4356876

File tree

2 files changed

+7
-8
lines changed
  • app/code/Magento/SalesRule/Model/ResourceModel
  • dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel

2 files changed

+7
-8
lines changed

app/code/Magento/SalesRule/Model/ResourceModel/Rule.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,19 @@ public function getStoreLabel($ruleId, $storeId)
305305
public function getActiveAttributes()
306306
{
307307
$connection = $this->getConnection();
308+
$subSelect = $connection->select();
309+
$subSelect->reset();
310+
$subSelect->from($this->getTable('salesrule_product_attribute'))
311+
->group('attribute_id');
308312
$select = $connection->select()->from(
309-
['a' => $this->getTable('salesrule_product_attribute')],
310-
new \Zend_Db_Expr('DISTINCT ea.attribute_code')
313+
['a' => $subSelect],
314+
new \Zend_Db_Expr('ea.attribute_code')
311315
)->joinInner(
312316
['ea' => $this->getTable('eav_attribute')],
313317
'ea.attribute_id = a.attribute_id',
314318
[]
315-
)->joinInner(
316-
['sr' => $this->getTable('salesrule')],
317-
'a.' . $this->getLinkField() . ' = sr.' . $this->getLinkField() . ' AND sr.is_active = 1',
318-
[]
319319
);
320+
320321
return $connection->fetchAll($select);
321322
}
322323

dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/RuleTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ public function testAfterSave()
7272
public function testGetActiveAttributes()
7373
{
7474
$rule = $this->fixtures->get('rule1');
75-
$items = $this->resource->getActiveAttributes();
76-
$this->assertEquals([], $items);
7775
$rule->setIsActive(1);
7876
$rule->save();
7977
$items = $this->resource->getActiveAttributes();

0 commit comments

Comments
 (0)