Skip to content

Commit 56a03ac

Browse files
author
Oleksii Korshenko
committed
MAGETWO-70796: MAGETWO-59282: Corrected previous fix to this ticket. #6990
- Merge Pull Request #6990 from wardcapp/magento2:wardcapp-patch-MAGETWO-59282 - Merged commits: 1. c226707 2. 6b11350 3. 9522319
2 parents 0a8e77a + 9522319 commit 56a03ac

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
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
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/MassStatusTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function setUp()
123123

124124
public function testMassStatusAction()
125125
{
126-
$storeId = 1;
126+
$storeId = 2;
127127
$status = \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED;
128128
$filters = [
129129
'store_id' => 2,
@@ -138,7 +138,7 @@ public function testMassStatusAction()
138138
$this->request->expects($this->exactly(3))
139139
->method('getParam')
140140
->willReturnMap([
141-
['store', 0, $storeId],
141+
['store', null, $storeId],
142142
['status', null, $status],
143143
['filters', [], $filters]
144144
]);

0 commit comments

Comments
 (0)