Skip to content

Commit 9d858b3

Browse files
committed
fix-issue21073
1 parent d700436 commit 9d858b3

File tree

2 files changed

+28
-3
lines changed
  • app/code/Magento/Catalog

2 files changed

+28
-3
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab;
77

8+
use Magento\Customer\Api\Data\GroupInterface;
9+
810
/**
911
* Products mass update inventory tab
1012
*
@@ -29,6 +31,11 @@ class Inventory extends \Magento\Backend\Block\Widget implements \Magento\Backen
2931
*/
3032
protected $disabledFields = [];
3133

34+
/**
35+
* @var \Magento\Framework\Serialize\SerializerInterface
36+
*/
37+
private $serializer;
38+
3239
/**
3340
* @param \Magento\Backend\Block\Template\Context $context
3441
* @param \Magento\CatalogInventory\Model\Source\Backorders $backorders
@@ -39,10 +46,13 @@ public function __construct(
3946
\Magento\Backend\Block\Template\Context $context,
4047
\Magento\CatalogInventory\Model\Source\Backorders $backorders,
4148
\Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration,
42-
array $data = []
49+
array $data = [],
50+
\Magento\Framework\Serialize\SerializerInterface $serializer = null
4351
) {
4452
$this->_backorders = $backorders;
4553
$this->stockConfiguration = $stockConfiguration;
54+
$this->serializer = $serializer ?? \Magento\Framework\App\ObjectManager::getInstance()
55+
->get(\Magento\Framework\Serialize\SerializerInterface::class);
4656
parent::__construct($context, $data);
4757
}
4858

@@ -74,7 +84,7 @@ public function getFieldSuffix()
7484
public function getStoreId()
7585
{
7686
$storeId = $this->getRequest()->getParam('store');
77-
return (int)$storeId;
87+
return (int) $storeId;
7888
}
7989

8090
/**
@@ -88,6 +98,21 @@ public function getDefaultConfigValue($field)
8898
return $this->stockConfiguration->getDefaultConfigValue($field);
8999
}
90100

101+
/**
102+
* Returns min_sale_qty configuration for the ALL Customer Group
103+
* @return int
104+
*/
105+
public function getDefaultMinSaleQty()
106+
{
107+
$default = $this->stockConfiguration->getDefaultConfigValue('min_sale_qty');
108+
if (!is_numeric($default)) {
109+
$default = $this->serializer->unserialize($default);
110+
$default = isset($default[GroupInterface::CUST_GROUP_ALL]) ? $default[GroupInterface::CUST_GROUP_ALL] : 1;
111+
}
112+
113+
return (int) $default;
114+
}
115+
91116
/**
92117
* Tab settings
93118
*

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
<div class="field">
133133
<input type="text" class="input-text validate-number" id="inventory_min_sale_qty"
134134
name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[min_sale_qty]"
135-
value="<?= /* @escapeNotVerified */ $block->getDefaultConfigValue('min_sale_qty') * 1 ?>"
135+
value="<?= /* @escapeNotVerified */ $block->getDefaultMinSaleQty() * 1 ?>"
136136
disabled="disabled"/>
137137
</div>
138138
<div class="field choice">

0 commit comments

Comments
 (0)