5
5
*/
6
6
namespace Magento \Catalog \Block \Adminhtml \Product \Edit \Action \Attribute \Tab ;
7
7
8
+ use Magento \Customer \Api \Data \GroupInterface ;
9
+
8
10
/**
9
11
* Products mass update inventory tab
10
12
*
@@ -29,6 +31,11 @@ class Inventory extends \Magento\Backend\Block\Widget implements \Magento\Backen
29
31
*/
30
32
protected $ disabledFields = [];
31
33
34
+ /**
35
+ * @var \Magento\Framework\Serialize\SerializerInterface
36
+ */
37
+ private $ serializer ;
38
+
32
39
/**
33
40
* @param \Magento\Backend\Block\Template\Context $context
34
41
* @param \Magento\CatalogInventory\Model\Source\Backorders $backorders
@@ -39,10 +46,13 @@ public function __construct(
39
46
\Magento \Backend \Block \Template \Context $ context ,
40
47
\Magento \CatalogInventory \Model \Source \Backorders $ backorders ,
41
48
\Magento \CatalogInventory \Api \StockConfigurationInterface $ stockConfiguration ,
42
- array $ data = []
49
+ array $ data = [],
50
+ \Magento \Framework \Serialize \SerializerInterface $ serializer = null
43
51
) {
44
52
$ this ->_backorders = $ backorders ;
45
53
$ this ->stockConfiguration = $ stockConfiguration ;
54
+ $ this ->serializer = $ serializer ?? \Magento \Framework \App \ObjectManager::getInstance ()
55
+ ->get (\Magento \Framework \Serialize \SerializerInterface::class);
46
56
parent ::__construct ($ context , $ data );
47
57
}
48
58
@@ -74,7 +84,7 @@ public function getFieldSuffix()
74
84
public function getStoreId ()
75
85
{
76
86
$ storeId = $ this ->getRequest ()->getParam ('store ' );
77
- return (int )$ storeId ;
87
+ return (int ) $ storeId ;
78
88
}
79
89
80
90
/**
@@ -88,6 +98,21 @@ public function getDefaultConfigValue($field)
88
98
return $ this ->stockConfiguration ->getDefaultConfigValue ($ field );
89
99
}
90
100
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
+
91
116
/**
92
117
* Tab settings
93
118
*
0 commit comments