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)
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
Original file line number Diff line number Diff 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 ();
You can’t perform that action at this time.
0 commit comments