Developer forum

Forum » Feature requests » Menu Management - Show Ecom subcategories as menu

Menu Management - Show Ecom subcategories as menu

Lars Pham
Reply

Hi.. 

It would be great if you could set a specific Ecom category ID as the parent ID of a menu, so I can have the subcategories shown as a menu without showing all the toplevel categories. 

/ Lars


Replies

 
Mikkel Ricky
Reply

We may add this in a future revamp of the way Dynamicweb generates menus, but we don't have any specific plans as of now.

However, it's quite easy to do this already.

The first thing to do is to specify a custom setting, eComParentGroupId, say, in the navigation element:

<div class="dwnavigation" id="navigation" data-settings="eComParentGroupId:GROUP87"></div>

This new settings will be available in the navigation xslt:

<xsl:variable name="eComParentGroupId" select="NavigationTree/Settings/LayoutNavigationSettings/@eComParentGroupId"/>

Then final thing to do is to render only the nodes under the node with the specified group id:

<!-- Get eCom nodes under the specified eComParentGroupId -->
<xsl:variable name="eComGroupToken" select="concat('&amp;GroupID=', $eComParentGroupId, '&amp;')"/>
<xsl:variable name="eComNodes" select="//Page[contains(concat(@Href, '&amp;'), $eComGroupToken)]/Page"/>

<xsl:if test="$eComNodes">
  <ul>
    <xsl:apply-templates select="$eComNodes"/>
  </ul>
</xsl:if>

See attached file for the complete navigation xslt.

Best regards,
Mikkel

 
Mikkel Ricky
Reply

The future is near! Dynamicweb 8.5 we'll have a GroupID attribute that will make the xslt trick above much easier to implement (cf. http://developer.dynamicweb-cms.com/forum/templates/templates/ecom-dropdown-menu.aspx).

Best regards,
Mikkel