Skip to content

Commit ac8d63d

Browse files
committed
MC-13613: Product mass update
1 parent 63cffa2 commit ac8d63d

File tree

4 files changed

+12
-44
lines changed

4 files changed

+12
-44
lines changed

app/code/Magento/CatalogInventory/Plugin/MassUpdateProductAttribute.php

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,9 @@ class MassUpdateProductAttribute
4040
private $stockConfiguration;
4141

4242
/**
43-
* @var \Magento\Framework\App\RequestInterface
43+
* @var \Magento\Catalog\Helper\Product\Edit\Action\Attribute
4444
*/
45-
private $request;
46-
47-
/**
48-
* @var \Magento\Backend\Model\Session
49-
*/
50-
private $session;
51-
52-
/**
53-
* @var \Magento\Store\Model\StoreManagerInterface
54-
*/
55-
private $storeManager;
45+
private $attributeHelper;
5646

5747
/**
5848
* @var \Magento\Backend\Model\View\Result\Redirect
@@ -69,9 +59,7 @@ class MassUpdateProductAttribute
6959
* @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
7060
* @param \Magento\CatalogInventory\Api\StockItemRepositoryInterface $stockItemRepository
7161
* @param \Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration
72-
* @param \Magento\Framework\App\RequestInterface $request
73-
* @param \Magento\Backend\Model\Session $session
74-
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
62+
* @param \Magento\Catalog\Helper\Product\Edit\Action\Attribute $attributeHelper
7563
* @param \Magento\Backend\Model\View\Result\RedirectFactory $redirectFactory
7664
* @param \Magento\Framework\Message\ManagerInterface $messageManager
7765
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -82,9 +70,7 @@ public function __construct(
8270
\Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
8371
\Magento\CatalogInventory\Api\StockItemRepositoryInterface $stockItemRepository,
8472
\Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration,
85-
\Magento\Framework\App\RequestInterface $request,
86-
\Magento\Backend\Model\Session $session,
87-
\Magento\Store\Model\StoreManagerInterface $storeManager,
73+
\Magento\Catalog\Helper\Product\Edit\Action\Attribute $attributeHelper,
8874
\Magento\Backend\Model\View\Result\RedirectFactory $redirectFactory,
8975
\Magento\Framework\Message\ManagerInterface $messageManager
9076
) {
@@ -93,9 +79,7 @@ public function __construct(
9379
$this->stockRegistry = $stockRegistry;
9480
$this->stockItemRepository = $stockItemRepository;
9581
$this->stockConfiguration = $stockConfiguration;
96-
$this->request = $request;
97-
$this->session = $session;
98-
$this->storeManager = $storeManager;
82+
$this->attributeHelper = $attributeHelper;
9983
$this->redirectFactory = $redirectFactory;
10084
$this->messageManager = $messageManager;
10185
}
@@ -107,18 +91,19 @@ public function __construct(
10791
* @param callable $proceed
10892
*
10993
* @return \Magento\Framework\Controller\ResultInterface
110-
*
111-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
11294
*/
11395
public function aroundExecute(Save $subject, callable $proceed)
11496
{
11597
try {
116-
$inventoryData = $this->request->getParam('inventory', []);
117-
$storeId = $this->request->getParam('store', \Magento\Store\Model\Store::DEFAULT_STORE_ID);
118-
$websiteId = $this->storeManager->getStore($storeId)->getWebsiteId();
119-
$productIds = $this->session->getData('product_ids');
98+
/** @var \Magento\Framework\App\RequestInterface $request */
99+
$request = $subject->getRequest();
100+
$inventoryData = $request->getParam('inventory', []);
120101
$inventoryData = $this->addConfigSettings($inventoryData);
121102

103+
$storeId = $this->attributeHelper->getSelectedStoreId();
104+
$websiteId = $this->attributeHelper->getStoreWebsiteId($storeId);
105+
$productIds = $this->attributeHelper->getProductIds();
106+
122107
if (!empty($inventoryData)) {
123108
$this->updateInventoryInProducts($productIds, $websiteId, $inventoryData);
124109
}

app/code/Magento/CatalogInventory/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"require": {
88
"php": "~7.1.3||~7.2.0",
99
"magento/framework": "*",
10-
"magento/module-backend": "*",
1110
"magento/module-catalog": "*",
1211
"magento/module-search": "*",
1312
"magento/module-config": "*",

app/code/Magento/MessageQueue/Api/Data/PoisonPillInterface.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,4 @@ interface PoisonPillInterface
2020
* @return integer
2121
*/
2222
public function getVersion(): ?int;
23-
24-
/**
25-
* Set version of poison pill.
26-
*
27-
* @param int $version
28-
* @return void
29-
*/
30-
public function setVersion(int $version);
3123
}

app/code/Magento/MessageQueue/Model/PoisonPill.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,4 @@ public function getVersion(): ?int
2121
{
2222
return $this->_getData('version');
2323
}
24-
25-
/**
26-
* @inheritdoc
27-
*/
28-
public function setVersion(int $version)
29-
{
30-
$this->setData('version', $version);
31-
}
3224
}

0 commit comments

Comments
 (0)