Skip to content

Commit f979b85

Browse files
committed
ACP2E-3131: [Cloud] Anchor/Non-Anchor Categories Reversed in Content Widget
- Fix for default category
1 parent b2ecc62 commit f979b85

File tree

1 file changed

+16
-10
lines changed
  • app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget

1 file changed

+16
-10
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@ require(['jquery', 'jquery/jstree/jquery.jstree'], function($) {
115115
}
116116
}
117117
118+
function getAnchorNodeIds(tree, node) {
119+
if (useMassAction) {
120+
isAnchorArr[parseInt(node.id)] = node.original.is_anchor;
121+
if (checkedNodes.includes(node.id)) {
122+
tree.jstree(true).select_node(node.id);
123+
}
124+
getCheckedNodeIds(tree, node);
125+
actionBasedOnIsAnchorOnly();
126+
}
127+
}
128+
118129
function handleSuccessResponse(response, childNode, data) {
119130
if (response.length > 0) {
120131
response.forEach(newNode => {
@@ -160,16 +171,11 @@ require(['jquery', 'jquery/jstree/jquery.jstree'], function($) {
160171
}
161172
});
162173
}
163-
else if (childNode.children.length === 0
164-
&& childNode.original && childNode.original.lastNode) {
165-
if (useMassAction) {
166-
isAnchorArr[parseInt(childNode.id)] = childNode.original.is_anchor;
167-
if (checkedNodes.includes(childNode.id)) {
168-
tree.jstree(true).select_node(childNode.id);
169-
}
170-
getCheckedNodeIds(tree, childNode);
171-
actionBasedOnIsAnchorOnly();
172-
}
174+
else if ((childNode.children.length === 0
175+
&& childNode.original && childNode.original.lastNode)
176+
|| childNode.children.length === 1) {
177+
178+
getAnchorNodeIds(tree, childNode);
173179
}
174180
})
175181
}

0 commit comments

Comments
 (0)