File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
app/code/Magento/SalesRule/Model/ResourceModel
dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -305,18 +305,19 @@ public function getStoreLabel($ruleId, $storeId)
305
305
public function getActiveAttributes ()
306
306
{
307
307
$ connection = $ this ->getConnection ();
308
+ $ subSelect = $ connection ->select ();
309
+ $ subSelect ->reset ();
310
+ $ subSelect ->from ($ this ->getTable ('salesrule_product_attribute ' ))
311
+ ->group ('attribute_id ' );
308
312
$ 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 ' )
311
315
)->joinInner (
312
316
['ea ' => $ this ->getTable ('eav_attribute ' )],
313
317
'ea.attribute_id = a.attribute_id ' ,
314
318
[]
315
- )->joinInner (
316
- ['sr ' => $ this ->getTable ('salesrule ' )],
317
- 'a. ' . $ this ->getLinkField () . ' = sr. ' . $ this ->getLinkField () . ' AND sr.is_active = 1 ' ,
318
- []
319
319
);
320
+
320
321
return $ connection ->fetchAll ($ select );
321
322
}
322
323
Original file line number Diff line number Diff line change @@ -72,8 +72,6 @@ public function testAfterSave()
72
72
public function testGetActiveAttributes ()
73
73
{
74
74
$ rule = $ this ->fixtures ->get ('rule1 ' );
75
- $ items = $ this ->resource ->getActiveAttributes ();
76
- $ this ->assertEquals ([], $ items );
77
75
$ rule ->setIsActive (1 );
78
76
$ rule ->save ();
79
77
$ items = $ this ->resource ->getActiveAttributes ();
You can’t perform that action at this time.
0 commit comments