Skip to content

Commit db66078

Browse files
committed
Fixed different ways use config on category save
Signed-off-by: Denis Kopylov <[email protected]>
1 parent d7918c6 commit db66078

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function execute()
168168
if (isset($categoryPostData['use_config']) && !empty($categoryPostData['use_config'])) {
169169
foreach ($categoryPostData['use_config'] as $attributeCode => $attributeValue) {
170170
if ($attributeValue) {
171-
$useConfig[] = $attributeValue;
171+
$useConfig[] = $attributeCode;
172172
$category->setData($attributeCode, null);
173173
}
174174
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/NewCategoryDataProvider.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Ui\DataProvider\Product\Form;
79

10+
use Magento\Framework\Phrase;
811
use Magento\Ui\DataProvider\AbstractDataProvider;
912
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
1013
use Magento\Framework\UrlInterface;
@@ -47,10 +50,12 @@ public function __construct(
4750
}
4851

4952
/**
50-
* {@inheritdoc}
53+
* Get data
54+
*
55+
* @return array
5156
* @since 101.0.0
5257
*/
53-
public function getData()
58+
public function getData(): array
5459
{
5560
$this->data = array_replace_recursive(
5661
$this->data,
@@ -60,7 +65,10 @@ public function getData()
6065
'is_active' => 1,
6166
'include_in_menu' => 1,
6267
'return_session_messages_only' => 1,
63-
'use_config' => ['available_sort_by', 'default_sort_by']
68+
'use_config' => [
69+
'available_sort_by' => true,
70+
'default_sort_by' => true
71+
]
6472
]
6573
]
6674
]
@@ -70,10 +78,12 @@ public function getData()
7078
}
7179

7280
/**
73-
* {@inheritdoc}
81+
* Get meta
82+
*
83+
* @return array
7484
* @since 101.0.0
7585
*/
76-
public function getMeta()
86+
public function getMeta(): array
7787
{
7888
$this->meta = [
7989
'data' => [
@@ -91,7 +101,7 @@ public function getMeta()
91101
/**
92102
* Get notice message
93103
*
94-
* @return \Magento\Framework\Phrase
104+
* @return Phrase
95105
* @since 101.0.0
96106
*/
97107
protected function getNotice()

0 commit comments

Comments
 (0)