I would like to add a TreeNode to the Merchello tree resulting in a structure somewhat like this:
Merchello
Products
Sales
...
My Custom MenuItem
I have tried fiddling around with the backoffice section in merchello.config, but the resulting menu item is missing locales. I have also tried adding a TreeNode manually in the TreeNodesRendering event, doing something like this:
private void TreeControllerBase_TreeNodesRendering(TreeControllerBase sender, TreeNodesRenderingEventArgs e)
{
if (sender.TreeAlias == "merchello")
{
var node = sender.CreateTreeNode(...);
e.Nodes.Add(node);
}
}
In the latter case I lack some control over the node, for example being able to specify the sort order.
Is there a better/right way to do this, and if so what would an example of this look like?
I'm not sure if you can override plugin areas in your own App_Plugins like you can with the core sections, but you could try it =) Would be interested in knowing if that works.
I tried overriding the plugin areas, however I was unsuccessful - can be that I messed up something, but I found an unsolved Umbraco issue describing the same problem: http://issues.umbraco.org/issue/U4-6617
I hope that solving this issue will allow me to add my own plugin area for handling custom Merchello views, but in the meantime I will have to place my views in the Merchello folder.
I'd say the easiest way to do it would be to add a localization key in the Merchello local files ...
/App_Plugins/Merchello/Lang/
... but you would have to keep replacing the key after you upgrade.
If you go the config route, there should be no issue with routing in the back office as long as your pathing is correct. You'll notice the the Merchello.Providers App_Plugins folder, and we've done it quite a few times in other projects.
Adding a custom section to the Merchello tree
Hello,
I would like to add a TreeNode to the Merchello tree resulting in a structure somewhat like this:
Merchello
I have tried fiddling around with the backoffice section in merchello.config, but the resulting menu item is missing locales. I have also tried adding a TreeNode manually in the TreeNodesRendering event, doing something like this:
In the latter case I lack some control over the node, for example being able to specify the sort order.
Is there a better/right way to do this, and if so what would an example of this look like?
BR Peter
Hi Peter,
The Merchello.config method is the quickest way - basically it just setups up an angular route ...
The localization is based off the "id" ... e.g. add the "id" to the merchelloTree area.
Language file.
I'm not sure if you can override plugin areas in your own App_Plugins like you can with the core sections, but you could try it =) Would be interested in knowing if that works.
Hey Rusty,
Thank you for the reply,
I tried overriding the plugin areas, however I was unsuccessful - can be that I messed up something, but I found an unsolved Umbraco issue describing the same problem: http://issues.umbraco.org/issue/U4-6617
I hope that solving this issue will allow me to add my own plugin area for handling custom Merchello views, but in the meantime I will have to place my views in the Merchello folder.
BR Peter
I'd say the easiest way to do it would be to add a localization key in the Merchello local files ...
/App_Plugins/Merchello/Lang/
... but you would have to keep replacing the key after you upgrade.
If you go the config route, there should be no issue with routing in the back office as long as your pathing is correct. You'll notice the the Merchello.Providers App_Plugins folder, and we've done it quite a few times in other projects.
Hi Rusty,
thanks for your tip with the config file. That way it's a matter of 5 minutes to make a new subtree appear in the merchello tree.
But how about subnodes of the new subtree?
It seems that I need to intercept the GetNodes call for the tree somehow to provide my own subnodes. How can I do that?
-Mirko
EDIT: Got the solution.
Add a tree in merchello.config:
Write an event handler to add the nodes. Note the setting of the HasChildren property.
Nice - had not seen that one before =)
is working on a reply...