Developer forum

Forum » Ecommerce - Standard features » Razor menus don't account for Ecom groups 'Show in Menu'

Razor menus don't account for Ecom groups 'Show in Menu'

Mafalda Correa
Mafalda Correa
Reply

Hi,

I'm in the process of converting the Mega Menu to Razor templates, but I stumbled upon what looks like a bug.

While by default, when I loop through the nodes, the navigation doesn't renders the page where 'Hide in Menu' is selected, it doesn't do the same for when 'Show in Menu' isn't select in a product group.

See the video below:

https://www.screencast.com/t/kAMGolP8ir

 

The code I was using for that is:

var navigationSettings = new NavigationSettings()
{
    StartLevel = 1,
    StopLevel = 5,
    ExpandMode = ExpandMode.All,
    Parameters =
    {
        {"id", "topnavigation"}
    }
};

 

@helper RenderNavigationMenu(NavigationSettings navigationSettings)
{
   
    <div class="grid__cell u-flex u-reset-position">
        @RenderNavigationNodes2(GetNavigation(navigationSettings).Nodes, navigationSettings)
    </div>
}
@helper RenderNavigationNodes(IEnumerable<NavigationTreeNodeViewModel> nodes, NavigationSettings navigationSettings = null)
{
    <ul>
        @foreach (NavigationTreeNodeViewModel node in nodes)
        {
            <li>@node.Name</li>
                @RenderNavigationNodes2(node.Nodes)
        }
    </ul>
}

Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Good find. Will have a fix for you with next release of the Dynamicweb.Ecommerce package 1.8.*

BR Nicolai

Votes for this answer: 1
 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

Would be also important to get the GroupId in the node.

 

We're finding that we need to use services to get the page and/or the Item, which is fine for now, but when it's a group, we have no way to use services to get things like GroupSmallImage.

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply

Yes, the groupid should be present - just added it. The rest - to make navigation slower, you have to do your self :-)

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Thank you Nicolai,

 

Yeah, I was not suggesting the rest. Just really the bare minimum to allow this to be scalable/customizable.

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply

>>scalable/customizable.

You mean: unscalable/customizable. wink

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Yep smiley

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Mafalda and Nuno

The problem TFS#79739 "Groups are part of the navigation viewmodel even if they are not published in menu" has now been fixed in Package "Dynamicweb.Ecommerce" version 1.8.56

You are able to find this update in the backend Package update section.

Also the correction are part of the 9.8.7 release 

You are able to find this build in the download section:

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

Please contact Dynamicweb Support if you need any additional help regarding this.

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Perfect, thanks Kristian

 

You must be logged in to post in the forum