Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require a parent category to add a new sub category #2716

Merged
merged 3 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -381,20 +381,27 @@ Ext.onReady(function()
reRenderTree();
});

function addNew(url, isRoot)
function addNew(url, isRoot, node)
{
if (isRoot) {
if (tree.currentNodeId && (node = tree.getNodeById(tree.currentNodeId))) {
node.unselect();
}
tree.currentNodeId = tree.root.id;
}
else if (!tree.currentNodeId || (tree.currentNodeId == tree.root.id)) {
alert("<?php echo Mage::helper('core')->jsQuoteEscape($this->__('Please select a parent category before adding a new one.')) ?>");
return;
}

if (/store\/\d+/.test(url)) {
url = url.replace(/store\/\d+/, "store/" + tree.storeId);
}
else {
url+= "store/" + tree.storeId + "/";
else {
url += "store/" + tree.storeId + "/";
}

url+= 'parent/'+tree.currentNodeId;
url += 'parent/' + tree.currentNodeId + '/';
updateContent(url);
}

Expand Down
1 change: 1 addition & 0 deletions app/locale/en_US/Mage_Adminhtml.csv
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@
"Phone:","Phone:"
"Please Select","Please Select"
"Please confirm site switching. All data that hasn't been saved will be lost.","Please confirm site switching. All data that hasn't been saved will be lost."
"Please select a parent category before adding a new one.","Please select a parent category before adding a new one."
"Please enter 6 or more characters.","Please enter 6 or more characters."
"Please enter a number greater than 0 in this field.","Please enter a number greater than 0 in this field."
"Please enter a valid $ amount. For example $100.00.","Please enter a valid $ amount. For example $100.00."
Expand Down