Developer forum

Forum » Templates » Display products in menus

Display products in menus

Alec Stubbs
Reply

I've got a requirement to display products within my left navigation. The Nav should ideally look something like this:
Product group 1
    Sub group 
        Product
        Product
    Sub group
        Product
Product group 2
   Sub group
        Product


I know how to display the product groups within the nav but is it possible to display products within the navigation using the designs and layouts principle?

Any help would be much appreciated.

Replies

 
Vladimir
Reply
Hi Alec!
I think that you should to implement a Dynamicweb.Frontend.NavigationProviders.NavigationProvider for that
An example: http://devierkoeden.com/articles/extending-the-sitemap-with-dynamicweb-content.aspx

Best regards,
Vladimir

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Is this still current? Or is there now a built-in way to display products within the main eCommerce navigation? I need to implement this for a customer and before I build a navigation provider, I wanted to check if that's still needed.

 

Imar

 

 
Nicolai Høeg Pedersen
Reply

It is not built-in. Do we dare, having 120.000 products?

 

Any suggestions for how to do it would be appreciated - then we can make it a feature.

 

BR Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Yes, I see the point about potential performance issues. What about an opt-in model? An "Include products" setting in the Navigation settings that would add the products as additional nodes in the Navigation XML?

 

Imar

 
Nicolai Høeg Pedersen
Reply

Of course - simple and effective!

 

Added in TFS as 13586 for a maybe task for 8.4

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

I started implementing this with a NavigationProvider as I need this in a web site today, but it seems I don't have access to the eCom groups as navigation items. Is that correct? I enabled eCom navigation but the NavigationPovider's rootNode doesn't contain any children with eCommerce groups.

 

Is there something else I need to configure for this to work? Or may there's a code example available that shows how to add the products?

 

Imar

 
Morten Bengtson
Reply
This post has been marked as an answer
I might have misunderstood what you are trying to do here, but I think that this is possible already. I am able to generate a menu like the one in Alecs initial post using nothing but standard functionality in DW 8.3.
 
  1. Go to the website administration and under "Robots.txt" make sure the "Include products inside sitemap.xml" is checked.
  2. Create a page with ecom catalog and configure the page to include ecom groups in the navigation.
  3. Create some ecom groups and make sure "Show in sitemap" is checked.
  4. Create some products in those groups and make sure that you set a primary group on each product.
  5. In the layout template insert the following dwnavigation. It needs to have the "sitemapmode" setting set to true.  
<div id="navproducts" class="dwnavigation" data-settings="sitemapmode:1"></div>

 

 

However, it only works if this is the first navigation in the in the layout template?!
 
The navigation xml looks like this...
 
<Page MenuText="Frontpage" MouseOver="" Image="" ImageActive="" ImageMouseOver="" Allowclick="True" ShowInSitemap="True" ShowInLegend="True" Href="Default.aspx?ID=1" FriendlyHref="/da-DK/Frontpage.aspx" Title="" RelativeLevel="1" Sort="1" LastInLevel="True" ChildCount="1" class="L1_Active" NavigationTag="" ID="1" AreaID="1" InPath="True" Active="True" AbsoluteLevel="1">
    <Page SmallImage="" LargeImage="" Icon="" MenuText="Gruppe1" MouseOver="" Image="" ImageActive="" ImageMouseOver="" Allowclick="True" ShowInSitemap="True" ShowInLegend="False" Href="Default.aspx?ID=1&GroupID=GROUP1" FriendlyHref="/da-DK/Frontpage/Gruppe1.aspx" Title="" RelativeLevel="2" Sort="1" LastInLevel="True" ChildCount="3" class="L2" NavigationTag="" ID="1" AreaID="1" InPath="False" Active="False" AbsoluteLevel="2">
        <Page MenuText="PRODUKT1" MouseOver="" Image="" ImageActive="" ImageMouseOver="" Allowclick="False" ShowInSitemap="True" ShowInLegend="False" Href="Default.aspx?ID=1&ProductID=PROD1" FriendlyHref="/da-DK/Frontpage/PRODUKT1.aspx" Title="" RelativeLevel="3" Sort="1" LastInLevel="True" ChildCount="0" class="L3" NavigationTag="" ID="1" AreaID="1" InPath="False" Active="False" AbsoluteLevel="3"/>
        <Page MenuText="PRODUKT2" MouseOver="" Image="" ImageActive="" ImageMouseOver="" Allowclick="False" ShowInSitemap="True" ShowInLegend="False" Href="Default.aspx?ID=1&ProductID=PROD2" FriendlyHref="/da-DK/Frontpage/PRODUKT2.aspx" Title="" RelativeLevel="3" Sort="1" LastInLevel="True" ChildCount="0" class="L3" NavigationTag="" ID="1" AreaID="1" InPath="False" Active="False" AbsoluteLevel="3"/>
        <Page MenuText="PRODUKT3" MouseOver="" Image="" ImageActive="" ImageMouseOver="" Allowclick="False" ShowInSitemap="True" ShowInLegend="False" Href="Default.aspx?ID=1&ProductID=PROD3" FriendlyHref="/da-DK/Frontpage/PRODUKT3.aspx" Title="" RelativeLevel="3" Sort="1" LastInLevel="True" ChildCount="0" class="L3" NavigationTag="" ID="1" AreaID="1" InPath="False" Active="False" AbsoluteLevel="3"/>
    </Page>
</Page>
 
Votes for this answer: 1

 

You must be logged in to post in the forum