Skip to content

Commit 27ad6c4

Browse files
committed
MC-5717: Sub-category doesnt display after moving categories
1 parent f77f96b commit 27ad6c4

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function execute()
4444
'id' => $categoryId,
4545
'path' => $category->getPath(),
4646
'parentId' => $category->getParentId(),
47+
'level' => $category->getLevel()
4748
]);
4849
}
4950
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/RefreshPathTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ private function setObjectProperty($object, string $propertyName, $value) : void
6666
*/
6767
public function testExecute() : void
6868
{
69-
$value = ['id' => 3, 'path' => '1/2/3', 'parentId' => 2];
70-
$result = '{"id":3,"path":"1/2/3","parentId":"2"}';
69+
$value = ['id' => 3, 'path' => '1/2/3', 'parentId' => 2, 'level' => 2];
70+
$result = '{"id":3,"path":"1/2/3","parentId":"2","level":"2"}';
7171

7272
$requestMock = $this->getMockForAbstractClass(\Magento\Framework\App\RequestInterface::class);
7373

app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@
7777
<dataType>text</dataType>
7878
</settings>
7979
</field>
80+
<field name="level" formElement="hidden">
81+
<argument name="data" xsi:type="array">
82+
<item name="config" xsi:type="array">
83+
<item name="source" xsi:type="string">category</item>
84+
</item>
85+
</argument>
86+
</field>
8087
<field name="store_id" formElement="hidden">
8188
<argument name="data" xsi:type="array">
8289
<item name="config" xsi:type="array">

app/code/Magento/Catalog/view/adminhtml/web/catalog/category/form.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ define([
1515
categoryIdSelector: 'input[name="id"]',
1616
categoryPathSelector: 'input[name="path"]',
1717
categoryParentSelector: 'input[name="parent"]',
18+
categoryLevelSelector: 'input[name="level"]',
1819
refreshUrl: config.refreshUrl
1920
},
2021

@@ -47,6 +48,7 @@ define([
4748
$(this.options.categoryIdSelector).val(data.id).change();
4849
$(this.options.categoryPathSelector).val(data.path).change();
4950
$(this.options.categoryParentSelector).val(data.parentId).change();
51+
$(this.options.categoryLevelSelector).val(data.level).change();
5052
}
5153
}
5254
};

0 commit comments

Comments
 (0)