Skip to content

Commit 6c9a8b2

Browse files
committed
MAGETWO-82469: Can't save "Minimum Qty Allowed" configuration option in Catalog->Inventory->Product Stock Options
1 parent a08cf22 commit 6c9a8b2

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

app/code/Magento/Config/Block/System/Config/Form.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Config\App\Config\Type\System;
99
use Magento\Config\Model\Config\Reader\Source\Deployed\SettingChecker;
1010
use Magento\Config\Model\Config\Structure\ElementVisibilityInterface;
11+
use Magento\Framework\App\Config\Data\ProcessorInterface;
1112
use Magento\Framework\App\Config\ScopeConfigInterface;
1213
use Magento\Framework\App\DeploymentConfig;
1314
use Magento\Framework\App\ObjectManager;
@@ -429,6 +430,18 @@ private function getFieldData(\Magento\Config\Model\Config\Structure\Element\Fie
429430
if ($data === null) {
430431
$path = $field->getConfigPath() !== null ? $field->getConfigPath() : $path;
431432
$data = $this->getConfigValue($path);
433+
if ($field->hasBackendModel()) {
434+
$backendModel = $field->getBackendModel();
435+
// Backend models which implement ProcessorInterface are processed by ScopeConfigInterface
436+
if (!$backendModel instanceof ProcessorInterface) {
437+
$backendModel->setPath($path)
438+
->setValue($data)
439+
->setWebsite($this->getWebsiteCode())
440+
->setStore($this->getStoreCode())
441+
->afterLoad();
442+
$data = $backendModel->getValue();
443+
}
444+
}
432445
}
433446

434447
return $data;

app/code/Magento/Config/Model/Config/Backend/Serialized.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
*/
66
namespace Magento\Config\Model\Config\Backend;
77

8-
use Magento\Framework\App\Config\Data\ProcessorInterface;
98
use Magento\Framework\App\ObjectManager;
109
use Magento\Framework\Serialize\Serializer\Json;
1110

1211
/**
1312
* @api
1413
* @since 100.0.2
1514
*/
16-
class Serialized extends \Magento\Framework\App\Config\Value implements ProcessorInterface
15+
class Serialized extends \Magento\Framework\App\Config\Value
1716
{
1817
/**
1918
* @var Json
@@ -68,12 +67,4 @@ public function beforeSave()
6867
parent::beforeSave();
6968
return $this;
7069
}
71-
72-
/**
73-
* @inheritdoc
74-
*/
75-
public function processValue($value)
76-
{
77-
return empty($value) ? '' : $this->serializer->unserialize($value);
78-
}
7970
}

app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ public function initFieldsDataProvider()
548548
false,
549549
'some_value',
550550
null,
551-
0,
551+
1,
552552
false,
553553
false,
554554
false
@@ -560,7 +560,7 @@ public function initFieldsDataProvider()
560560
true,
561561
'Config Value',
562562
null,
563-
0,
563+
1,
564564
true,
565565
false,
566566
true

dev/tests/integration/testsuite/Magento/Config/Block/System/Config/_files/test_config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<test_section>
1111
<test_group>
1212
<test_field_encrypted backend_model="Magento\Config\Model\Config\Backend\Encrypted">{ENCRYPTED_VALUE}</test_field_encrypted>
13-
<test_field_serialized backend_model="Magento\Config\Model\Config\Backend\Serialized">["value1","value2"]</test_field_serialized>
13+
<test_field_serialized>["value1","value2"]</test_field_serialized>
1414
<test_field>test config value</test_field>
1515
</test_group>
1616
</test_section>

0 commit comments

Comments
 (0)