Skip to content

Commit

Permalink
MAGETWO-82469: Can't save "Minimum Qty Allowed" configuration option …
Browse files Browse the repository at this point in the history
…in Catalog->Inventory->Product Stock Options
  • Loading branch information
viktym committed Oct 24, 2017
1 parent a08cf22 commit 6c9a8b2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
13 changes: 13 additions & 0 deletions app/code/Magento/Config/Block/System/Config/Form.php
Expand Up @@ -8,6 +8,7 @@
use Magento\Config\App\Config\Type\System;
use Magento\Config\Model\Config\Reader\Source\Deployed\SettingChecker;
use Magento\Config\Model\Config\Structure\ElementVisibilityInterface;
use Magento\Framework\App\Config\Data\ProcessorInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\ObjectManager;
Expand Down Expand Up @@ -429,6 +430,18 @@ private function getFieldData(\Magento\Config\Model\Config\Structure\Element\Fie
if ($data === null) {
$path = $field->getConfigPath() !== null ? $field->getConfigPath() : $path;
$data = $this->getConfigValue($path);
if ($field->hasBackendModel()) {
$backendModel = $field->getBackendModel();
// Backend models which implement ProcessorInterface are processed by ScopeConfigInterface
if (!$backendModel instanceof ProcessorInterface) {
$backendModel->setPath($path)
->setValue($data)
->setWebsite($this->getWebsiteCode())
->setStore($this->getStoreCode())
->afterLoad();
$data = $backendModel->getValue();
}
}
}

return $data;
Expand Down
11 changes: 1 addition & 10 deletions app/code/Magento/Config/Model/Config/Backend/Serialized.php
Expand Up @@ -5,15 +5,14 @@
*/
namespace Magento\Config\Model\Config\Backend;

use Magento\Framework\App\Config\Data\ProcessorInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Serialize\Serializer\Json;

/**
* @api
* @since 100.0.2
*/
class Serialized extends \Magento\Framework\App\Config\Value implements ProcessorInterface
class Serialized extends \Magento\Framework\App\Config\Value
{
/**
* @var Json
Expand Down Expand Up @@ -68,12 +67,4 @@ public function beforeSave()
parent::beforeSave();
return $this;
}

/**
* @inheritdoc
*/
public function processValue($value)
{
return empty($value) ? '' : $this->serializer->unserialize($value);
}
}
Expand Up @@ -548,7 +548,7 @@ public function initFieldsDataProvider()
false,
'some_value',
null,
0,
1,
false,
false,
false
Expand All @@ -560,7 +560,7 @@ public function initFieldsDataProvider()
true,
'Config Value',
null,
0,
1,
true,
false,
true
Expand Down
Expand Up @@ -10,7 +10,7 @@
<test_section>
<test_group>
<test_field_encrypted backend_model="Magento\Config\Model\Config\Backend\Encrypted">{ENCRYPTED_VALUE}</test_field_encrypted>
<test_field_serialized backend_model="Magento\Config\Model\Config\Backend\Serialized">["value1","value2"]</test_field_serialized>
<test_field_serialized>["value1","value2"]</test_field_serialized>
<test_field>test config value</test_field>
</test_group>
</test_section>
Expand Down

0 comments on commit 6c9a8b2

Please sign in to comment.