21
21
class General extends AbstractModifier
22
22
{
23
23
/**
24
- * @var LocatorInterface
24
+ * @var LocatorInterface
25
25
* @since 101.0.0
26
26
*/
27
27
protected $ locator ;
28
28
29
29
/**
30
- * @var ArrayManager
30
+ * @var ArrayManager
31
31
* @since 101.0.0
32
32
*/
33
33
protected $ arrayManager ;
@@ -43,8 +43,8 @@ class General extends AbstractModifier
43
43
private $ attributeRepository ;
44
44
45
45
/**
46
- * @param LocatorInterface $locator
47
- * @param ArrayManager $arrayManager
46
+ * @param LocatorInterface $locator
47
+ * @param ArrayManager $arrayManager
48
48
* @param AttributeRepositoryInterface|null $attributeRepository
49
49
*/
50
50
public function __construct (
@@ -61,18 +61,21 @@ public function __construct(
61
61
/**
62
62
* Customize number fields for advanced price and weight fields.
63
63
*
64
- * @param array $data
64
+ * @param array $data
65
65
* @return array
66
66
* @throws \Magento\Framework\Exception\NoSuchEntityException
67
- * @since 101.0.0
67
+ * @since 101.0.0
68
68
*/
69
69
public function modifyData (array $ data )
70
70
{
71
71
$ data = $ this ->customizeWeightFormat ($ data );
72
72
$ data = $ this ->customizeAdvancedPriceFormat ($ data );
73
73
$ modelId = $ this ->locator ->getProduct ()->getId ();
74
74
75
- if (!isset ($ data [$ modelId ][static ::DATA_SOURCE_DEFAULT ][ProductAttributeInterface::CODE_STATUS ])) {
75
+ $ productStatus = $ this ->locator ->getProduct ()->getStatus ();
76
+ if ((isset ($ productStatus ) && !empty ($ productStatus )) && (isset ($ modelId )) && !empty ($ modelId )) {
77
+ $ data [$ modelId ][static ::DATA_SOURCE_DEFAULT ][ProductAttributeInterface::CODE_STATUS ] = $ productStatus ;
78
+ } elseif (!isset ($ data [$ modelId ][static ::DATA_SOURCE_DEFAULT ][ProductAttributeInterface::CODE_STATUS ])) {
76
79
$ attributeStatus = $ this ->attributeRepository ->get (
77
80
ProductAttributeInterface::ENTITY_TYPE_CODE ,
78
81
ProductAttributeInterface::CODE_STATUS
@@ -87,9 +90,9 @@ public function modifyData(array $data)
87
90
/**
88
91
* Customizing weight fields
89
92
*
90
- * @param array $data
93
+ * @param array $data
91
94
* @return array
92
- * @since 101.0.0
95
+ * @since 101.0.0
93
96
*/
94
97
protected function customizeWeightFormat (array $ data )
95
98
{
@@ -112,9 +115,9 @@ protected function customizeWeightFormat(array $data)
112
115
/**
113
116
* Customizing number fields for advanced price
114
117
*
115
- * @param array $data
118
+ * @param array $data
116
119
* @return array
117
- * @since 101.0.0
120
+ * @since 101.0.0
118
121
*/
119
122
protected function customizeAdvancedPriceFormat (array $ data )
120
123
{
@@ -136,9 +139,9 @@ protected function customizeAdvancedPriceFormat(array $data)
136
139
/**
137
140
* Customize product form fields.
138
141
*
139
- * @param array $meta
142
+ * @param array $meta
140
143
* @return array
141
- * @since 101.0.0
144
+ * @since 101.0.0
142
145
*/
143
146
public function modifyMeta (array $ meta )
144
147
{
@@ -154,9 +157,9 @@ public function modifyMeta(array $meta)
154
157
/**
155
158
* Disable collapsible and set empty label
156
159
*
157
- * @param array $meta
160
+ * @param array $meta
158
161
* @return array
159
- * @since 101.0.0
162
+ * @since 101.0.0
160
163
*/
161
164
protected function prepareFirstPanel (array $ meta )
162
165
{
@@ -177,9 +180,9 @@ protected function prepareFirstPanel(array $meta)
177
180
/**
178
181
* Customize Status field
179
182
*
180
- * @param array $meta
183
+ * @param array $meta
181
184
* @return array
182
- * @since 101.0.0
185
+ * @since 101.0.0
183
186
*/
184
187
protected function customizeStatusField (array $ meta )
185
188
{
@@ -203,9 +206,9 @@ protected function customizeStatusField(array $meta)
203
206
/**
204
207
* Customize Weight filed
205
208
*
206
- * @param array $meta
209
+ * @param array $meta
207
210
* @return array
208
- * @since 101.0.0
211
+ * @since 101.0.0
209
212
*/
210
213
protected function customizeWeightField (array $ meta )
211
214
{
@@ -277,9 +280,9 @@ protected function customizeWeightField(array $meta)
277
280
/**
278
281
* Customize "Set Product as New" date fields
279
282
*
280
- * @param array $meta
283
+ * @param array $meta
281
284
* @return array
282
- * @since 101.0.0
285
+ * @since 101.0.0
283
286
*/
284
287
protected function customizeNewDateRangeField (array $ meta )
285
288
{
@@ -335,9 +338,9 @@ protected function customizeNewDateRangeField(array $meta)
335
338
/**
336
339
* Add links for fields depends of product name
337
340
*
338
- * @param array $meta
341
+ * @param array $meta
339
342
* @return array
340
- * @since 101.0.0
343
+ * @since 101.0.0
341
344
*/
342
345
protected function customizeNameListeners (array $ meta )
343
346
{
@@ -409,9 +412,9 @@ private function getLocaleCurrency()
409
412
/**
410
413
* Format price according to the locale of the currency
411
414
*
412
- * @param mixed $value
415
+ * @param mixed $value
413
416
* @return string
414
- * @since 101.0.0
417
+ * @since 101.0.0
415
418
*/
416
419
protected function formatPrice ($ value )
417
420
{
@@ -429,9 +432,9 @@ protected function formatPrice($value)
429
432
/**
430
433
* Format number according to the locale of the currency and precision of input
431
434
*
432
- * @param mixed $value
435
+ * @param mixed $value
433
436
* @return string
434
- * @since 101.0.0
437
+ * @since 101.0.0
435
438
*/
436
439
protected function formatNumber ($ value )
437
440
{
0 commit comments