Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 10 of 10

Thread: Version 9 Top Menu - Categories0

  1. #1
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default Version 9 Top Menu - Categories0

    Hey there,

    We are looking to list our categories along the top menu as we did in ver 8.

    I have edited the page.menu.xml.config however (!menu.Categories0!) does not work. How do I achieve this in ver 9?

    Thanks in advance.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  2. #2
    sha87 is offline Member
    Join Date
    Oct 2010
    Posts
    31

    Default

    I ended up having to manually build links in the page.menu.xml file. It's a bit of a pain, but the ver 8 fix didn't work for me either in v9.

    I.e.
    Code:
    <siteMapNode title="Category 1" url="~/c-1-Category.aspx" >
          <siteMapNode title="Sub Category 1" url="~/c-2-Sub-Category-1" />
          <siteMapNode title="Sub Category 2" url="~/c-3-Sub-Category-2" />
    </siteMapNode>

  3. #3
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    Hi

    What we usually do is replace all the menu generation with our own XML Packages. This gives us complete control over the HTML, functionality, CSS etc.

    In V9, insert a line like this into your template master file(s):

    Code:
    <asp:Literal runat="server" Text="<%$ Tokens: XmlPackage, topmenu.xml.config%>" />
    Then, in your App_Templates/Skin_1/XmlPackages directory, create a new XML Package called topmenu.xml.config containing code such as this using the EntityHelpers system:

    Code:
    <?xml version="1.0" standalone="yes" ?>
    <package version="2.1" displayname="Categories" debug="false" includeentityhelper="true">
      <PackageTransform>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
          <xsl:output method="html" omit-xml-declaration="yes"/>
    	  
          <xsl:param name="CategoryID">
            <xsl:choose>
              <xsl:when test="/root/QueryString/categoryid">
                <xsl:value-of select="/root/QueryString/categoryid"/>
              </xsl:when>
              <xsl:otherwise>0</xsl:otherwise>
            </xsl:choose>
          </xsl:param>
    
          <xsl:template match="/">
    			<ul>
              <xsl:for-each select="/root/EntityHelpers/Category/Entity">
                <!-- Root Level Categories-->
                <xsl:variable name="EntityID" select="EntityID"/>
                <xsl:variable name="Name" select="aspdnsf:GetMLValue(Name)"/>
               
    			<li>
    			<xsl:element name="a">
    				<xsl:attribute name="href">
                        <xsl:value-of select="concat('c-',$EntityID,'-',SEName,'.aspx')"/>
                    </xsl:attribute>
                       <xsl:value-of select="aspdnsf:GetMLValue(Name)"/>
                </xsl:element>
                </li>
                
              </xsl:for-each>
    		  </ul>
        </xsl:template>
    
    
      </xsl:stylesheet>
    </PackageTransform>
    </package>

    If you are using Multistore, the EntityHelper system isn't currently smart enough to include or filter by StoreID, so you'll need to replace it with a SQL Query that filters for the current Store being used.

    Adam

  4. #4
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    Thanks for the tip Webopius,

    We wanted to keep using the asp:menu so we made this change to page.menu.xml.config

    C#/VB.NET Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <package displayname="Menu" version="2.1" debug="false" includeentityhelper="true">
        <PackageTransform>
            <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
                <xsl:output method="xml" omit-xml-declaration="no" encoding="utf-8" indent="no" />
                
          <xsl:param name="CategoryID">
            <xsl:choose>
              <xsl:when test="/root/QueryString/categoryid">
                <xsl:value-of select="/root/QueryString/categoryid"/>
              </xsl:when>
              <xsl:otherwise>0</xsl:otherwise>
            </xsl:choose>
          </xsl:param>

                <xsl:template match="/">
                    <siteMap>
                        <siteMapNode title="(!menu.Home!)"  url="~/default.aspx">
                <xsl:for-each select="/root/EntityHelpers/Category/Entity">
                  <xsl:variable name="EntityID" select="EntityID"/>
                  <xsl:variable name="Name" select="aspdnsf:GetMLValue(Name)"/>
                  <siteMapNode title="{$Name}" url="~/{concat('c-',$EntityID,'-',SEName,'.aspx')}" />
                </xsl:for-each>
                            <siteMapNode title="(!menu.Manufacturers!)" url="~/manufacturers.aspx" type="manufacturer" />
                        </siteMapNode>                    
                    </siteMap>
          </xsl:template>
            </xsl:stylesheet>
        </PackageTransform>
    </package>
    Basically used the same idea as Webopius to use the EntityHelpers, just inside the menu XML.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  5. #5
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    Only problem I have now is subcategories.

    We may have 10 top level categories and then maybe 10 under each and even 5 more on some of the submenus.

    Guess the page.menu.xml.config needs to get a lot more complex.

    How can I make them subcategories show up as the dynamic menus, they show up as static?
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  6. #6
    findingking is offline Junior Member
    Join Date
    Oct 2008
    Posts
    8

    Default Subcategories

    Thanks to all of those who posted above. It really helped me out a lot. I was able to figure out how to get the subcategories to display using the implementation to the page.menu.xml.config file posted above. Here is what I did to get the first level of subcategories to display:

    Code:
    <package displayname="Menu" version="2.1" debug="false" includeentityhelper="true">
    	<PackageTransform>
    		<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf"   xmlns:g="http://base.google.com/ns/1.0" exclude-result-prefixes="aspdnsf">
    			<xsl:output method="xml" omit-xml-declaration="no" encoding="utf-8" indent="no" />
          <xsl:param name="CategoryID">
            <xsl:choose>
              <xsl:when test="/root/QueryString/categoryid">
                <xsl:value-of select="/root/QueryString/categoryid"/>
              </xsl:when>
              <xsl:otherwise>0</xsl:otherwise>
            </xsl:choose>
          </xsl:param>
    			<xsl:template match="/">
            
    				<siteMap>
    					<siteMapNode title="(!menu.Home!)"  url="~/default.aspx">
                      <xsl:for-each select="/root/EntityHelpers/Category/Entity[EntityID!=123]">
                  <xsl:variable name="EntityID" select="EntityID"/>
                  <xsl:variable name="Name" select="aspdnsf:GetMLValue(Name)"/>
                  <siteMapNode title="{$Name}" url="~/{concat('c-',$EntityID,'-',SEName,'.aspx')}" >
                    <xsl:for-each select="/root/EntityHelpers/Category//Entity[ParentEntityID = $EntityID]">
                      <xsl:variable name="ChildID" select="EntityID"/>
                      <xsl:variable name="ChildName" select="aspdnsf:GetMLValue(Name)"/>
                      <siteMapNode title="{$ChildName}" url="~/{concat('c-',$ChildID,'-',SEName,'.aspx')}" />
                    </xsl:for-each>
                  </siteMapNode>
                </xsl:for-each>
    					</siteMapNode>					
    				</siteMap>
    			</xsl:template>
    			
    		</xsl:stylesheet>
    
    	</PackageTransform>
    </package>

  7. #7
    ryanvmcgee is offline Junior Member
    Join Date
    Apr 2010
    Posts
    3

    Cool

    Thanks for this post, this was a tremendous help!! When I first installed ML9 the !menu.categories1! was working, but apparently that's weird. I upgraded to 9.2 and couldn't get it to work. Your post helped a lot! Works perfect.

    Thanks again for the post!

  8. #8
    daniel.knapp is offline Junior Member
    Join Date
    Dec 2011
    Posts
    1

    Default Thanks

    Thanks! You solution worked perfectly

  9. #9
    Armin Bender is offline Junior Member
    Join Date
    Feb 2012
    Posts
    1

    Default display more levels of subcategories

    Dear findingking,

    I am searching for an extension of your solution that can display all existing sub category levels, not only the first level. Could you tell me how to modifiy your code to accomplish this?

    Thank you very much!

  10. #10
    ipokrov is offline Junior Member
    Join Date
    Aug 2012
    Posts
    1

    Default This is awesome idea

    Worked for me in version 9.3!

    thanks webopius!!!!