@@ -82,18 +82,18 @@ public function execute()
82
82
{
83
83
$ collection = $ this ->filter ->getCollection ($ this ->collectionFactory ->create ());
84
84
$ productIds = $ collection ->getAllIds ();
85
- $ storeId = (int ) $ this ->getRequest ()->getParam ('store ' , 0 );
85
+ $ requestStoreId = $ storeId = $ this ->getRequest ()->getParam ('store ' , null );
86
+ $ filterRequest = $ this ->getRequest ()->getParam ('filters ' , null );
86
87
$ status = (int ) $ this ->getRequest ()->getParam ('status ' );
87
- $ filters = (array )$ this ->getRequest ()->getParam ('filters ' , []);
88
88
89
- if (isset ( $ filters [ ' store_id ' ]) ) {
90
- $ storeId = (int )$ filters ['store_id ' ];
89
+ if (null !== $ storeId && null !== $ filterRequest ) {
90
+ $ storeId = (isset ( $ filterRequest [ ' store_id ' ])) ? ( int ) $ filterRequest ['store_id ' ] : 0 ;
91
91
}
92
92
93
93
try {
94
94
$ this ->_validateMassStatus ($ productIds , $ status );
95
95
$ this ->_objectManager ->get (\Magento \Catalog \Model \Product \Action::class)
96
- ->updateAttributes ($ productIds , ['status ' => $ status ], $ storeId );
96
+ ->updateAttributes ($ productIds , ['status ' => $ status ], ( int ) $ storeId );
97
97
$ this ->messageManager ->addSuccess (__ ('A total of %1 record(s) have been updated. ' , count ($ productIds )));
98
98
$ this ->_productPriceIndexerProcessor ->reindexList ($ productIds );
99
99
} catch (\Magento \Framework \Exception \LocalizedException $ e ) {
@@ -104,6 +104,6 @@ public function execute()
104
104
105
105
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
106
106
$ resultRedirect = $ this ->resultFactory ->create (ResultFactory::TYPE_REDIRECT );
107
- return $ resultRedirect ->setPath ('catalog/*/ ' , ['store ' => $ storeId ]);
107
+ return $ resultRedirect ->setPath ('catalog/*/ ' , ['store ' => $ requestStoreId ]);
108
108
}
109
109
}
0 commit comments