Developer forum

Forum » Development » NavigationProvider is not working after DW 9.6.6

NavigationProvider is not working after DW 9.6.6

Kim Søjborg Pedersen
Reply

Hi

I have a custom NaviagtionProvider adding some extra nodes to some of my Ecommerce groups. After 9.6.6 its no longer working. When I select my custom provider in the navigation provider dropdown, my ecommerce navigation becomes empty. When I try savexml=true the xml no longer containing any ecommerce node, only content pages.

This is a simplyfied version og my code, just adding a single node to the childnodes

public class MenuProviderDW97 : NavigationProvider
    {
        public override void ProcessTree(RootNavigationItem rootNode, XmlNavigation.NavigationType navigationType)
        {
            foreach (NavigationItem node in rootNode.ChildNodes)
            {
                //The page holding the ecommerce navigation
                if (node.MenuText == "Shop")
                {
                    foreach (NavigationItem n1 in node.ChildNodes)
                    {
                        n1.AddChild(addChildNode(true, "Featured products", "/Shop?featured=true"));
                    }
                }
            }

        }
        private MyMenuItem addChildNode(bool allowClick, string menuText, string url)
        {
            MyMenuItem menuItem = new MyMenuItem
            {
                FriendlyHref = url
            };

            menuItem.MenuText = menuText;
            menuItem.AllowClick = allowClick;
            menuItem.NavigationItemType = NavigationItem.ItemType.group;

            return menuItem;
        }

    }

    public class MyMenuItem : NavigationItem
    {

    }

 

Screenshot_2019-07-12_at_19.21.46.png

Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Kim,

This is a bug that was introduced with a refactoring of a part of the navigation. I have registered the bug in our backlog with ID #67144.

Until the fix ready, you can work around the issue by changing your provider slightly:

public class MenuProvider : Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider
{
    public override void ProcessTree(RootNavigationItem rootNode, XmlNavigation.NavigationType navigationType)
    {
        base.ProcessTree(rootNode, navigationType);

        // Your code goes here
    }
}

You will have to revert this once you apply the fix, but these changes will allow your provider to continue as before.

- Jeppe

 
Kim Søjborg Pedersen
Reply

Hi Jeppe

Confirmed, the work around apply the ecommerce nodes and the extra nodes added in the code.

/Kim

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Kim

The problem regarding #67144 "XmlNavigation doesn't allow NavigationProviders to append to Ecommerce navigation" has now been resolved in Dynamicweb version 9.6.13

To upgrade please choose this version from download:

http://doc.dynamicweb.com/releases-and-downloads/releases

Let me know if you need any more help regarding this

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Mikkel Belchuke
Mikkel Belchuke
Reply

Hey Kim.

Looks like, only the Dynamicweb.dll is depended for the fix to work - but after upgrading this, it still doesn't work. 

Do I have to upgrade something else also? 

 
Kim Søjborg Pedersen
Reply

Hi Mikkel

I haven't tried yet, so I guess you have to ask Kristian Kirkholt or Jeppe Eriksson Agger

/Kim

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Mikkel

Is the Dynamicweb.dll updated to version 9.6.35

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Mikkel Belchuke
Mikkel Belchuke
Reply

Hey Kristian.

Yes, it is upgrade to latest version from myget: 9.6.35

Still does not seem to be called though. 

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Mikkel

Could you plase post the URL to the site in a mail to support@dynamicweb.dk so we can have a look at the site setup

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Mikkel,

Can you tell me exactly what you're experiencing? I'm not sure what you mean by "still does not seem to be called". Do you mean that after reverting your changes, the navigation provider isn't being called? I assume that the code for the navigation provider was reverted as specified in a previous post.

What version is displayed for the Dynamicweb.dll when you look in the backend under Settings -> System -> Solution information in the section Version?

If you add "debug=true" to the querystring on a page in the frontend and you search for "after provider", what do you find?

- Jeppe

 
Mikkel Belchuke
Mikkel Belchuke
Reply

Hi Jeppe.

Settings -> System -> Solution information

Dynamicweb.dll 9.6.35

Dynamicweb, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null
Build date Thu, 01 Aug 2019 10:29

 

After Provider:

After provider (Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider)

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

You have the correct version of Dynamicweb.dll. So far so good.

I assume, since you only posted one entry, that there is only one "after provider" entry in the debug log? If so, could you just check the navigation settings on the page and make sure that your provider is selected. Sometimes when you change versions of either DW or your custom assemblies, the relation is lost. You may have to unselect it, save and select it again.

- Jeppe

Votes for this answer: 1
 
Mikkel Belchuke
Mikkel Belchuke
Reply

Hey Jeppe.

Yes. There is only one after provider. 

This is not an issue with a single page, but rather an overall issue. 

We got the Ecom Menu all over the page, and use a Navigation provider to add specific paragraph content each main menu point.

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

From previous posts, it was my understanding that you have a page on which you've enabled Ecommerce navigation and you've selected a custom provider. This provider was executed exclusively and not after the default Ecommerce navigation after an upgrade. That page is where you need to go and verify that the navigation settings still specify your provider, as mentioned in my previous post.

If my understanding of the issue is incorrect or the issue has changed, please let me know.

- Jeppe

 
Mikkel Belchuke
Mikkel Belchuke
Reply

Hey Jeppe.

I'm sorry about the confusion. 

Your solution did work and the upgrade of Dynamicweb.dll to 9.6.35 did fix the issue. 

 

Fix: 

When upgrading to a new Dynamicweb version, the Navigation provider, under Ecommerce Navigation, need to be set again, to the custom navigation provider. 

 

 

 

You must be logged in to post in the forum