Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I would like to add a TreeNode to the Merchello tree resulting in a structure somewhat like this:
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(...);
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?
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.
<tree id="test" title="Test" icon="icon-settings" routePath="merchello/merchello/gatewayproviderlist/manage" visible="true" sortOrder="7" />
<key alias="gateways">Gateway Providers</key>
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.
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.
I'd say the easiest way to do it would be to add a localization key in the Merchello local files ...
... 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.
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?
EDIT: Got the solution.
Add a tree in merchello.config:
<tree id="suppliers" title="Suppliers" icon="icon-truck" routePath="merchello/merchello/suppliers/manage" visible="true" sortOrder="4" />
Write an event handler to add the nodes. Note the setting of the HasChildren property.
public class TreeEvents : ApplicationEventHandler
protected override void ApplicationStarted( UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext )
TreeControllerBase.TreeNodesRendering += TreeControllerBase_TreeNodesRendering;
private void TreeControllerBase_TreeNodesRendering( TreeControllerBase sender, TreeNodesRenderingEventArgs e )
if (sender.TreeAlias == "merchello")
var node = e.Nodes.FirstOrDefault(n=>n.Name == "Suppliers");
if (node != null)
node.HasChildren = true;
if (e.QueryStrings["id"] == "suppliers")
e.Nodes.Add( sender.CreateTreeNode( "ff01", "suppliers", e.QueryStrings, "Formfakten", "icon-truck", false ) );
e.Nodes.Add( sender.CreateTreeNode( "ff02", "suppliers", e.QueryStrings, "Japanese", "icon-truck", false ) );
e.Nodes.Add( sender.CreateTreeNode( "ff03", "suppliers", e.QueryStrings, "English", "icon-truck", false ) );
Nice - had not seen that one before =)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted