Skip to content

Commit c226707

Browse files
committed
MAGETWO-59282: Corrected previous fix, do not set store id on the response when it was not set in the first place.
1 parent bc9df94 commit c226707

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ public function execute()
8282
{
8383
$collection = $this->filter->getCollection($this->collectionFactory->create());
8484
$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);
8687
$status = (int) $this->getRequest()->getParam('status');
87-
$filters = (array)$this->getRequest()->getParam('filters', []);
8888

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;
9191
}
9292

9393
try {
9494
$this->_validateMassStatus($productIds, $status);
9595
$this->_objectManager->get(\Magento\Catalog\Model\Product\Action::class)
96-
->updateAttributes($productIds, ['status' => $status], $storeId);
96+
->updateAttributes($productIds, ['status' => $status], (int) $storeId);
9797
$this->messageManager->addSuccess(__('A total of %1 record(s) have been updated.', count($productIds)));
9898
$this->_productPriceIndexerProcessor->reindexList($productIds);
9999
} catch (\Magento\Framework\Exception\LocalizedException $e) {
@@ -104,6 +104,6 @@ public function execute()
104104

105105
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
106106
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
107-
return $resultRedirect->setPath('catalog/*/', ['store' => $storeId]);
107+
return $resultRedirect->setPath('catalog/*/', ['store' => $requestStoreId]);
108108
}
109109
}

0 commit comments

Comments
 (0)