Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

Learn more about...

AspDotNetStorefront
DotFeed

horizontal navigation with dropdown

I'm attempting to create a horizontal dynamic navigation bar on my site. Basically, I want to determine which categories are on my nav bar and it show the children in a dropdown. 

I'm trying to accomplish it with something like this on the template.master:

 <li class="dropdown">
	<a href="#" class="dropdown-toggle" data-toggle="dropdown"  rel="nofollow">
	        Equipment <span class="caret"></span>
	</a>
	<aspdnsf:XmlPackage runat="server" PackageName="entitymenudropdown" RuntimeParams="entitytype=category&categoryid=5" />
</li>
<li class="dropdown">
	<a href="#" class="dropdown-toggle" data-toggle="dropdown"  rel="nofollow">
		  Smallwares <span class="caret"></span>
	</a>
         <aspdnsf:XmlPackage runat="server" PackageName="entitymenudropdown" RuntimeParams="entitytype=category&categoryid=324" />
</li>

however it's not pulling anything. 

here's my entitymenudropdown.xml.config file: 

<?xml version="1.0" standalone="yes" ?>
<!-- ##################################################################################	-->
<!-- Copyright AspDotNetStorefront.com. All Rights Reserved.							-->
<!-- http://www.aspdotnetstorefront.com													-->
<!-- For details on this license please visit the product homepage at the URL above.	-->
<!-- THE ABOVE NOTICE MUST REMAIN INTACT.												-->
<!-- ##################################################################################	-->
<package version="2.1" displayname="Entity Menu" debug="false" includeentityhelper="true">
    <PackageTransform>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:msxsl="urn:schemas-microsoft-com:xslt"
              xmlns:aspdnsf="urn:aspdnsf"
              exclude-result-prefixes="aspdnsf">
            <xsl:output method="html" omit-xml-declaration="yes"/>
			
			<xsl:variable name="EntityType" select="aspdnsf:StrCapitalize(/root/Runtime/entitytype)" />
			<xsl:variable name="CurrentEntityType" select="aspdnsf:StrCapitalize(/root/Runtime/PageType)" />
			<xsl:variable name="CurrentEntityID" select="/root/Runtime/PageID" />
			<xsl:variable name="MaxMenuSize" select="aspdnsf:AppConfig('MaxMenuSize')" />
			<xsl:variable name="UseMaxMenuSize" select="$MaxMenuSize &gt; 0" />
			<xsl:variable name="MaxMenuDepth" select="aspdnsf:AppConfig('MaxMenuLevel')" />
			<xsl:variable name="UseMaxMenuDepth" select="$MaxMenuDepth &gt; 0" />
			<xsl:variable name="EntityID" select="/root/Runtime/entityid" />

			<xsl:template match="/">
                <ul class="dropdown-menu">
                    <xsl:apply-templates select="/root/EntityHelpers/*[name() = $EntityType]/Entity[EntityID = $EntityID]/Entity" />
                </ul>
				<xsl:if test="$UseMaxMenuSize">
					<script>
						adnsf$(document).ready(function(){
							adnsf$('.menu-item').hide();
							adnsf$('.menuItemMore').click(function(event){
								adnsf$(this).closest('.menuItemMore').hide();
								adnsf$(this).closest('ul').children('.menu-item').show();
								event.preventDefault();
							});
						});
					</script>
				</xsl:if>
            </xsl:template>

			<xsl:template match="Entity">
				<xsl:variable name="CurrentDepth" select="count(ancestor::Entity)+1" />
                <li>
					<xsl:if test="$UseMaxMenuSize and (position() &gt; $MaxMenuSize)">
						<xsl:attribute name="class">menu-item menu-item-hidden</xsl:attribute>
					</xsl:if>
                    <a href="{aspdnsf:EntityLink(EntityID, SEName, $EntityType, 0)}">
						<xsl:if test="($CurrentEntityType = $EntityType) and (EntityID = $CurrentEntityID or descendant::Entity/EntityID = $CurrentEntityID)">
                            <xsl:attribute name="class">selected</xsl:attribute>
                        </xsl:if>
						<xsl:value-of select="aspdnsf:GetMLValue(Name)"/>
					</a>
					<!-- 
					If we are on a category and this is a category menu, 
					and if the category id the user is looking at is the same as this one(or one of its childeren), 
					and we have childeren
					and we are at or below the maximum menu depth
					-->
                    <xsl:if test="($CurrentEntityType = $EntityType) and (EntityID = $CurrentEntityID or descendant::Entity/EntityID = $CurrentEntityID) and (count(child::Entity) &gt; 0) and ($UseMaxMenuDepth) and ($CurrentDepth &lt; $MaxMenuDepth)">
                        <ul class="dropdown-menu">
                            <xsl:apply-templates select="Entity" />
                        </ul>
                    </xsl:if>
                </li>
				<xsl:if test="$UseMaxMenuSize and (position() = $MaxMenuSize) and (position() != last())">
					<li class="menuItemMore">
						<a href="#" class="menuItemMoreLink">
							<xsl:value-of select="aspdnsf:StringResource('common.cs.62')" disable-output-escaping="yes" />
						</a>
					</li>
				</xsl:if>
            </xsl:template>

        </xsl:stylesheet>
    </PackageTransform>
</package>

Any help/guidance would be greatly, greatly appreciated!

 

Thanks! 

 

asked Sep 30, 2015 in MultiStore by KHampton (120 points)

1 Answer

0 votes

I did some testing localy and the bigest issue I see is that your RuntimeParams have issues. entitytype is case sensative and the xmlpackage uses the runtime param of entityid instead of categoryid. So basicly to fix this change the RuntimeParams attribute to

RuntimeParams="entitytype=Category&entityid=324"

 

answered Oct 1, 2015 by mmcgeachy (4,310 points)
That was it!

Thank you soo much for your help!
...