Developer forum

Forum » Development » NavigationProvider: Can you add nodes as childnodes to an ecom node?

NavigationProvider: Can you add nodes as childnodes to an ecom node?

Marie Louise Veigert
Reply

Hi DW,

I'm using DW 9.2.16

I'm using the Navigation Provider to add nodes based on items.

I would like to display those in a megamenu under a given parent node. Ex 'Men'.

I can easily add it at the buttom of the XML, but I need it in the wrap of the parent node like the subpages.

ex:

<Page MenuText="Men">
   <Page MenuText="CustomNode"/> 
</Page>

Can I either:

1) Add a child node to a node based on some of the nodes attributes?

2) Add attributes to an existing ecom Node in the XML?

I would be pretty cool, if it was possible :)

BR 

Marie Louise


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer

Take a look at these two articles:

http://devierkoeden.com/articles/extending-the-sitemap-with-dynamicweb-content.aspx
http://devierkoeden.com/articles/extending-the-google-sitemap-feature-with-custom-content.aspx

The first one shows something like this:

    var node = rootNode.ChildNodes.Where(no => no.ID == 12).FirstOrDefault();
    if (node != null)
    {
      node.AddChild(new PageNavigationItem() 
      { 
        FriendlyHref = "SomeUrl.aspx", 
        Title = "Your title", 
        MenuText = "Menu Text", 
        AllowClick = true 
      });
    }

which I think is what you need.

Imar

Votes for this answer: 1
 
Marie Louise Veigert
Reply

Thanks for the help! This is pretty cool and work perfect the first two levels - but I can't acces the level I want, which are level 3 in the sitemap.

 

So I can get the childnodes of the root. 

The node 'Shop', which are child of the rootnode, have some childnodes in the sitemap called 'Men', 'Women' etc., but in the navigationProvider the node 'Shop' children are counted to '0'.

Do you know how this can be done?

 

Marie Louise

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Could it be that your navigation settings (in your template) restrict the end level to two?

 
Marie Louise Veigert
Reply

I takes all levels. And I made a test - It works fine, when it's normal pages.

But this is eCom groups. I don't know if it's diffrent?

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Marie Louise,

The ecom groups are probably not added to the navigation tree at that point.

You can try to set the AddInOrder attribute on your custom navigation provider. This will ensure that your provider is executed AFTER the standard ecom navigation providers.

[AddInOrder(100)]
public class MyNavigationProvider : NavigationProvider
{
...
}

Votes for this answer: 1
 
Marie Louise Veigert
Reply

It worked! Thanks :)

 

You must be logged in to post in the forum