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 7 of 7

Thread: "This product has options!" link in category view for multi-variant products

  1. #1
    skpr is offline Member
    Join Date
    Feb 2010
    Posts
    31

    Default "This product has options!" link in category view for multi-variant products

    I'm adding variant support to my site slowly, I have the product xml all sorted out, but I'm a bit stumped on the entity xml.

    All I want to do is, for products that have more than the one default variant, add a link just above the add to cart buttons that says "This product has options! Click here for more info." and links to the product itself.

    I just cannot figure out how to do the proper comparison so that the link ONLY shows up on products with more than one variant.

    Help would be greatly appreciated, thanks so much!

    -Beth
    http://www.lynxmotion.com
    AspDotNetStorefront ML 8.01.2/8.0.1.2

  2. #2
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    In your entity xml package you will also need to return a count of variants for the product. A simple query for this would be:

    Code:
    SELECT VariantID, COUNT(*) FROM ProductVariant WHERE ProductID = @ProductID AND Deleted=0 AND Published=1 GROUP BY VariantID
    Now you'll need to combine the above into your query within your xml package.

    Once you have the count of variant records you'll then be able to do a comparison on that number and create your link.
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!

  3. #3
    skpr is offline Member
    Join Date
    Feb 2010
    Posts
    31

    Default

    Thanks for the reply!

    I'm not sure how to combine your code with the existing query for the entity, though:

    Code:
        <query name="Products" rowElementName="Product">
            <sql>
                <![CDATA[
                    exec dbo.aspdnsf_GetProducts 
                        @categoryID = @CatID,
                        @sectionID = @SecID,
                        @manufacturerID = @ManID,
                        @distributorID = @DistID,
                        @genreID = @GenreID,
                        @vectorID = @VectorID,
                        @localeName = @locale,
                        @CustomerLevelID = @CustLevelID,
                        @affiliateID = @AffID,
                        @ProductTypeID = @ProdTypeID, 
                        @ViewType = 1,
                        @pagenum = @pgnum,
                        @pagesize = null,
                        @StatsFirst = 0,
                        @publishedonly = 1,
                        @ExcludePacks = 0,
                        @ExcludeKits = 0,
                        @ExcludeSysProds = 0,
                        @InventoryFilter = @InvFilter,
                        @sortEntityName = @entityname
                ]]>
            </sql>
            <queryparam paramname="@CatID" paramtype="runtime" requestparamname="CatID" sqlDataType="int" defvalue="0"  validationpattern="" />
            <queryparam paramname="@SecID" paramtype="runtime" requestparamname="SecID" sqlDataType="int" defvalue="0"  validationpattern="" />
            <queryparam paramname="@ManID" paramtype="runtime" requestparamname="ManID" sqlDataType="int" defvalue="0"  validationpattern="" />
            <queryparam paramname="@DistID" paramtype="runtime" requestparamname="DistID" sqlDataType="int" defvalue="0"  validationpattern="" />
            <queryparam paramname="@GenreID" paramtype="runtime" requestparamname="GenreID" sqlDataType="int" defvalue="0"  validationpattern="" />
            <queryparam paramname="@VectorID" paramtype="runtime" requestparamname="VectorID" sqlDataType="int" defvalue="0"  validationpattern="" />
            <queryparam paramname="@locale" paramtype="runtime" requestparamname="LocaleSetting" sqlDataType="varchar" defvalue="en-US"  validationpattern="" />
            <queryparam paramname="@CustLevelID" paramtype="runtime" requestparamname="CustomerLevelID" sqlDataType="int" defvalue="0"  validationpattern="" />
            <queryparam paramname="@AffID" paramtype="runtime" requestparamname="AffiliateID" sqlDataType="int" defvalue="0"  validationpattern="" />
            <queryparam paramname="@ProdTypeID" paramtype="runtime" requestparamname="ProductTypeFilterID" sqlDataType="int" defvalue="1"  validationpattern="" />
            <queryparam paramname="@pgnum" paramtype="request" requestparamname="pagenum" sqlDataType="int" defvalue="1"  validationpattern="" />
            <queryparam paramname="@InvFilter" paramtype="appconfig" requestparamname="HideProductsWithLessThanThisInventoryLevel" sqlDataType="int" defvalue="0"  validationpattern="" />
            <queryparam paramname="@entityname" paramtype="runtime" requestparamname="EntityName" sqlDataType="varchar" defvalue=""  validationpattern="" />
        </query>
    For the link itself, I know it will be something like this, but I'm not entirely sure on the exact comparison to call the information I need:

    Code:
        <xsl:choose>                    
            <xsl:when test="??? > 1">
                <a href="{$URL}">This product has options!</a><br/>
            </xsl:when>
        </xsl:choose>
    Thanks again for the help!
    http://www.lynxmotion.com
    AspDotNetStorefront ML 8.01.2/8.0.1.2

  4. #4
    esedirect is offline Senior Member
    Join Date
    Feb 2010
    Location
    Norfolk, UK
    Posts
    343

    Default

    You need to either amend the stored proc aspdns_getProducts or create another query in the xml package. I'll do it the second way.

    I've revised the query I wrote before to this for the package:

    Code:
    	<query name="EntityProducts" rowElementName="Product">
    		<sql>
                <![CDATA[
    				SELECT pv.[ProductID] AS [EntityProductID], COUNT([pv].[VariantID]) AS [NumVariants]
    				FROM [Product{EntityName}] AS pe WITH (NOLOCK)
    				JOIN [ProductVariant] AS pv WITH (NOLOCK) ON [pe].[ProductID] = [pv].[ProductID] 
    				JOIN [Product] AS p WITH (NOLOCK) ON [p].[ProductID] = [pv].[ProductID]
    				JOIN [{EntityName}] AS e WITH (NOLOCK) ON [e].[{EntityName}ID] = [pe].[{EntityName}ID] 
    				WHERE pe.[{EntityName}ID] = @EntityID
    				AND [pv].[Deleted] = 0 AND [pv].[Published] = 1
    				AND [p].[Deleted] = 0 AND [p].[Published] = 1
    				AND [e].[Deleted] = 0 AND [e].[Published] = 1
    				GROUP BY [pv].[ProductID] 
    			]]>
    		</sql>
            <queryparam paramname="@EntityID" paramtype="runtime" requestparamname="EntityID" sqlDataType="int" defvalue="0" validationpattern="" />
    		<querystringreplace replaceTag="{EntityName}" replacetype="runtime" replaceparamname="EntityName" defvalue="" validationpattern="(category)|(section)" /> 
    	</query>
    This will count how many variants there are for each of the products in the current entity (category or section).

    Assuming you might be using entity.grid.xml.config (or a copy of it) down near the bottom of it you will find a template called <xsl:template name="ProductCell"> which defines the table layout of products in a grid.
    At the top of the ProductCell declartion you'll need to declare a parameter variable, which will be used later:
    Code:
    				<xsl:param name="saveProductID" select="ProductID"></xsl:param>
    You need to create a new row i your table grid with the following:

    Code:
    						<tr>
    							<td>
    								<xsl:for-each select="/root/EntityProducts/Product" >
    									<xsl:call-template name="EntityProduct">
    										<xsl:with-param name="saveProductID" select="$saveProductID" />
    										<xsl:with-param name="EntityID" select="$EntityID" />
    										<xsl:with-param name="EntityName" select="$EntityName" />
    									</xsl:call-template>
    								</xsl:for-each>
    							</td>
    						</tr>
    And then a new template name:

    Code:
    			<xsl:template name="EntityProduct">
    				<xsl:param name="saveProductID"></xsl:param>
    				<xsl:param name="EntityID"></xsl:param>
    				<xsl:param name="EntityName"></xsl:param>
    				<xsl:if test="EntityProductID=$saveProductID">
    					<a href="{aspdnsf:ProductandEntityLink($saveProductID, '', $EntityID, $EntityName, 0)}">
    					This product has <xsl:value-of select="NumVariants" disable-output-escaping="yes" /> options!</a>
    				</xsl:if>
    			</xsl:template>
    To make it easier and see how things fit together here is the whole xml package. Place this in your xmlpackages directory and point your category/section to use this package:

    Code:
    <?xml version="1.0" standalone="yes" ?>
    <package version="2.1" displayname="Entity Grid" debug="false" includeentityhelper="true">
    
    	<!-- ###################################################################################################### -->
    	<!-- Copyright AspDotNetStorefront.com, 1995-2009.  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.                                                                   -->
    	<!--                                                                                                        -->
    	<!-- ###################################################################################################### -->
    
        <query name="Products" rowElementName="Product">
            <sql>
                <![CDATA[
                    exec dbo.aspdnsf_GetProducts 
                        @categoryID = @CatID,
                        @sectionID = @SecID,
                        @manufacturerID = @ManID,
                        @distributorID = @DistID,
                        @genreID = @GenreID,
                        @vectorID = @VectorID,
                        @localeName = @locale,
                        @CustomerLevelID = @CustLevelID,
                        @affiliateID = @AffID,
                        @ProductTypeID = @ProdTypeID, 
                        @ViewType = 1,
                        @pagenum = @pgnum,
                        @pagesize = null,
                        @StatsFirst = 0,
                        @publishedonly = 1,
                        @ExcludePacks = 0,
                        @ExcludeKits = 0,
                        @ExcludeSysProds = 0,
                        @InventoryFilter = @InvFilter,
                        @sortEntityName = @entityname
                ]]>
            </sql>
            <queryparam paramname="@CatID"       paramtype="runtime"   requestparamname="CatID"                                         sqlDataType="int"     defvalue="0"      validationpattern="" />
            <queryparam paramname="@SecID"       paramtype="runtime"   requestparamname="SecID"                                         sqlDataType="int"     defvalue="0"      validationpattern="" />
            <queryparam paramname="@ManID"       paramtype="runtime"   requestparamname="ManID"                                         sqlDataType="int"     defvalue="0"      validationpattern="" />
            <queryparam paramname="@DistID"      paramtype="runtime"   requestparamname="DistID"                                        sqlDataType="int"     defvalue="0"      validationpattern="" />
            <queryparam paramname="@GenreID"     paramtype="runtime"   requestparamname="GenreID"                                       sqlDataType="int"     defvalue="0"      validationpattern="" />
            <queryparam paramname="@VectorID"    paramtype="runtime"   requestparamname="VectorID"                                      sqlDataType="int"     defvalue="0"      validationpattern="" />
            <queryparam paramname="@locale"      paramtype="runtime"   requestparamname="LocaleSetting"                                 sqlDataType="varchar" defvalue="en-US"  validationpattern="" />
            <queryparam paramname="@CustLevelID" paramtype="runtime"   requestparamname="CustomerLevelID"                               sqlDataType="int"     defvalue="0"      validationpattern="" />
            <queryparam paramname="@AffID"       paramtype="runtime"   requestparamname="AffiliateID"                                   sqlDataType="int"     defvalue="0"      validationpattern="" />
            <queryparam paramname="@ProdTypeID"  paramtype="runtime"   requestparamname="ProductTypeFilterID"                           sqlDataType="int"     defvalue="1"      validationpattern="" />
            <queryparam paramname="@pgnum"       paramtype="request"   requestparamname="pagenum"                                       sqlDataType="int"     defvalue="1"      validationpattern="" />
            <queryparam paramname="@InvFilter"   paramtype="appconfig" requestparamname="HideProductsWithLessThanThisInventoryLevel"    sqlDataType="int"     defvalue="0"      validationpattern="" />
            <queryparam paramname="@entityname"  paramtype="runtime"   requestparamname="EntityName"                                    sqlDataType="varchar" defvalue=""       validationpattern="" />
        </query>
    	
    	<query name="EntityProducts" rowElementName="Product">
    		<sql>
                <![CDATA[
    				SELECT pv.[ProductID] AS [EntityProductID], COUNT([pv].[VariantID]) AS [NumVariants]
    				FROM [Product{EntityName}] AS pe WITH (NOLOCK)
    				JOIN [ProductVariant] AS pv WITH (NOLOCK) ON [pe].[ProductID] = [pv].[ProductID] 
    				JOIN [Product] AS p WITH (NOLOCK) ON [p].[ProductID] = [pv].[ProductID]
    				JOIN [{EntityName}] AS e WITH (NOLOCK) ON [e].[{EntityName}ID] = [pe].[{EntityName}ID] 
    				WHERE pe.[{EntityName}ID] = @EntityID
    				AND [pv].[Deleted] = 0 AND [pv].[Published] = 1
    				AND [p].[Deleted] = 0 AND [p].[Published] = 1
    				AND [e].[Deleted] = 0 AND [e].[Published] = 1
    				GROUP BY [pv].[ProductID] 
    			]]>
    		</sql>
            <queryparam paramname="@EntityID" paramtype="runtime" requestparamname="EntityID" sqlDataType="int" defvalue="0" validationpattern="" />
    		<querystringreplace replaceTag="{EntityName}" replacetype="runtime" replaceparamname="EntityName" defvalue="" validationpattern="(category)|(section)" /> 
    	</query>
    	
    	<query name="ese" rowElementName="maxEntityDiscount">
    		<sql>
    			<![CDATA[
    				SELECT [{EntityName}ID] AS [EntityID], [ExtensionData]
    				FROM [{EntityName}] WITH (NOLOCK)
    				WHERE [Parent{EntityName}ID] = @EntityID
    				AND ExtensionData IS NOT NULL
    			]]>
    		</sql>
            <queryparam paramname="@EntityID" paramtype="runtime" requestparamname="EntityID" sqlDataType="int" defvalue="0" validationpattern="" />
    		<querystringreplace replaceTag="{EntityName}" replacetype="runtime" replaceparamname="EntityName" defvalue="" validationpattern="(category)|(section)" /> 
    	</query>
    	
        <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="yes" />
    
                <xsl:param name="LocaleSetting" select="/root/Runtime/LocaleSetting" />
                <xsl:param name="WebConfigLocaleSetting" select="/root/Runtime/WebConfigLocaleSetting" />
                <xsl:param name="ShowSubcatsInGrid"><xsl:value-of select="aspdnsf:AppConfig('ShowSubcatsInGrid')" /></xsl:param>
                <xsl:param name="SubcatGridCols"><xsl:value-of select="/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/ColWidth" /></xsl:param>
                <xsl:param name="EntityName"><xsl:value-of select="/root/Runtime/EntityName" /></xsl:param>
                <xsl:param name="EntityID"><xsl:value-of select="/root/Runtime/EntityID" /></xsl:param>
                <xsl:param name="WholesaleOnlySite"><xsl:value-of select="aspdnsf:AppConfigBool('WholesaleOnlySite')"/></xsl:param>
                <xsl:param name="Summary"><xsl:value-of select="/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/EntityID" /></xsl:param>
    
                <xsl:param name="BaseURL">
                    <xsl:choose>
                        <xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'category'">c-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx</xsl:when>
                        <xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'section'">s-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx</xsl:when>
                        <xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'manufacturer'">m-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx</xsl:when>
                        <xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'library'">l-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx</xsl:when>
                        <xsl:when test="aspdnsf:StrToLower(/root/Runtime/EntityName) = 'distributor'">d-<xsl:value-of select="/root/Runtime/EntityID" />-<xsl:value-of select="/root/QueryString/sename" />.aspx</xsl:when>
                    </xsl:choose>
                </xsl:param>
    
                <xsl:param name="CurrentPage">
                    <xsl:choose>
                    	<xsl:when test="/root/QueryString/pagenum"><xsl:value-of select="/root/QueryString/pagenum" /></xsl:when>
                    	<xsl:otherwise>1</xsl:otherwise>
                    </xsl:choose>
                </xsl:param>
    
    			<xsl:param name="ParentSectionID">
    				<xsl:value-of select="/root/EntityHelpers/Section/Entity/Entity[EntityID=$EntityID]/ParentEntityID"/>
    			</xsl:param>
    
    
                <xsl:template match="/">
    				<h1><xsl:value-of select="aspdnsf:GetMLValue(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/Name)" disable-output-escaping="yes" /></h1>
    				
                    <xsl:value-of select="aspdnsf:EntityPageFilterOptions($EntityName, $EntityID, /root/Runtime/SecID, /root/Runtime/CatID, /root/Runtime/ManID, /root/Runtime/ProductTypeFilterID)" disable-output-escaping="yes" />
    
                    <xsl:call-template name="SubEntity" />
                    <xsl:choose>
                        <xsl:when test="count(/root/Products/Product) = 0 and count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/Entity) = 0">
                            <xsl:value-of select="aspdnsf:Topic(concat('empty', /root/Runtime/EntityName, 'text'))" disable-output-escaping="yes" />
                        </xsl:when>
                        <xsl:otherwise>
    						<xsl:if test="count(/root/Products/Product) > 0">
    							<xsl:if test="/root/Products2/Product/pages > 1">
    								<div style="text-align:right; font-size:small;"><xsl:value-of select="aspdnsf:PagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" /></div>
    							</xsl:if>
    							<table border="0" cellpadding="0" cellspacing="4" width="100%">
    								<xsl:apply-templates select="/root/Products/Product" />
    							</table>
    							
    							<xsl:if test="aspdnsf:StrToLower($EntityName) = 'section' and count(/root/EntityHelpers/Section/Entity[EntityID=$ParentSectionID]/Entity/Name) &gt; 1">					  
    								<div class="eseRelatedSections">
    									Other sections in <strong><xsl:value-of select="/root/EntityHelpers/Section/Entity[EntityID=$ParentSectionID]/Name" disable-output-escaping="yes" /></strong>:
    									<ul>
    										<xsl:for-each select="/root/EntityHelpers/Section/Entity/Entity">
    											<xsl:if test="ParentEntityID = /root/EntityHelpers/Section/descendant::Entity[EntityID=$EntityID]/ParentEntityID and not(Name = /root/EntityHelpers/Section/descendant::Entity[EntityID=$EntityID]/Name)">
    												<li>
    													<a href="{concat('s-',EntityID,'-',SEName,'.aspx')}"><xsl:value-of select="Name" disable-output-escaping="yes" /></a>
    												</li>
    											</xsl:if>
    										</xsl:for-each>
    									</ul>
    								</div>
    							</xsl:if>
    							
    							<xsl:if test="/root/Products2/Product/pages > 1">
    								<div style="text-align:right; font-size:small;"><xsl:value-of select="aspdnsf:PagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" /></div>
    							</xsl:if>
    						</xsl:if>
    						
    						<div class="eseEntityDescription">
    							<xsl:value-of select="aspdnsf:EntityPageHeaderDescription($EntityName, $EntityID)" disable-output-escaping="yes" />
    						</div>
    						
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:template>
    
                <xsl:template name="SubEntity">
                    <xsl:variable name="delta">
                        <xsl:choose>
                            <xsl:when test="(count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[ParentEntityID=/root/Runtime/EntityID]) mod number($SubcatGridCols)) = 0">0</xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="number($SubcatGridCols)-(count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[ParentEntityID=/root/Runtime/EntityID]) mod number($SubcatGridCols))"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:variable>
                    <xsl:variable name="rows" select="ceiling(count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[ParentEntityID=/root/Runtime/EntityID]) div number($SubcatGridCols))" />
    
                    <xsl:for-each select="/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[ParentEntityID=/root/Runtime/EntityID]">
    
                        <xsl:variable name="entityposition" select="position()" />
    
    
                        <xsl:choose>
                            <xsl:when test="$ShowSubcatsInGrid = 'true'">
                                <xsl:if test="position() mod $SubcatGridCols = 1 or ($SubcatGridCols = 1)">
                                    <table border="0" cellpadding="0" cellspacing="4" width="100%">
                                        <tr>
                                            <xsl:for-each select=". | following-sibling::*[position() &lt; $SubcatGridCols]">
                                                <xsl:variable name="scName" select="aspdnsf:GetMLValue(Name)"></xsl:variable>
                                                 
                                                <xsl:call-template name="SubCatCell">
                                                    <xsl:with-param name="scName" select="$scName" />
                                                </xsl:call-template>
    
                                            </xsl:for-each>
                                            <xsl:if test="ceiling($entityposition div  number($SubcatGridCols)) = $rows and $delta &gt; 0">
                                                <xsl:call-template name="FillerCells">
                                                    <xsl:with-param name="cellCount" select="$delta" />
                                                </xsl:call-template>
                                            </xsl:if>
    
                                        </tr>
                                        <tr>
                                            <td height="10" colspan="{$SubcatGridCols}">&#0160;</td>
                                        </tr>
                                    </table>
                                </xsl:if>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:variable name="scName" select="aspdnsf:GetMLValue(Name)"></xsl:variable>
    
                                <p align="left">
                                    &#0160;&#0160;&#0160;<img border="0" src="{concat('skins/skin_', aspdnsf:SkinID(), '/images/redarrow.gif')}"></img>&#0160;
                                    <a href="{aspdnsf:EntityLink(EntityID, SEName, $EntityName, 0, '')}">
                                        <xsl:value-of select="$scName" disable-output-escaping="yes"/>
                                    </a>
                                </p>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:for-each>
                </xsl:template>
    			
    
                <xsl:template name="SubCatCell">
                    <xsl:param name="scName"></xsl:param>
                    <xsl:param name="pSEAltText" select="aspdnsf:GetMLValue(SEAltText)"></xsl:param>
                    <xsl:param name="AltText">
                        <xsl:choose>
                            <xsl:when test="$pSEAltText=''"><xsl:value-of select="$scName" /></xsl:when>
                            <xsl:otherwise><xsl:value-of select="$pSEAltText" /></xsl:otherwise>
                        </xsl:choose>
                    </xsl:param>
    				<xsl:param name="saveEntityID" select="EntityID"></xsl:param>
    
    
                    <xsl:param name="URL"><xsl:value-of select="aspdnsf:EntityLink(EntityID, SEName, $EntityName, 0, '')" /></xsl:param>
    
                    <td align="center" width="{concat(round(100 div number($SubcatGridCols)),'%')}" style="border: 1px solid #ddd;width:200px">
    					<div class="eseFeaturedImageSections">
    						<a href="{$URL}">
    							<xsl:value-of select="aspdnsf:LookupEntityImage(EntityID, $EntityName, 'icon', 0, $AltText)" disable-output-escaping="yes" />
    							<xsl:for-each select="/root/ese/maxEntityDiscount">
    								<xsl:call-template name="EntityPage">
    									<xsl:with-param name="saveEntityID" select="$saveEntityID" />
    								</xsl:call-template>
    							</xsl:for-each>
    						</a>
    					</div>
                        <br/>
    					<h2 class="eseH2">
    						<a href="{$URL}">
    							<xsl:value-of select="$scName" disable-output-escaping="yes"/>
    						</a>
    					</h2>
                    </td>
                </xsl:template>
    			
    			<xsl:template name="EntityPage">
    				<xsl:param name="saveEntityID"></xsl:param>
    				<xsl:if test="$saveEntityID=EntityID and ExtensionData != ''">
    					<xsl:if test="contains(ExtensionData, 'maxDiscount')">
    						<div style="position: absolute; top: 100px; left: 100px;">
    							<img src="{concat('skins/Skin_1/images/discount-small-',aspdnsf:XmlStringAsXml(ExtensionData, 'maxDiscount'),'.png')}" width="52" height="52"></img>
    						</div>
    					</xsl:if>
    				</xsl:if>
    			</xsl:template>
                
    			<xsl:template match="Product">
    				<xsl:variable name="delta">
    					<xsl:choose>
    						<xsl:when test="(count(/root/Products/Product) mod number($SubcatGridCols)) = 0">0</xsl:when>
    						<xsl:otherwise>
    							<xsl:value-of select="number($SubcatGridCols)-(count(/root/Products/Product) mod number($SubcatGridCols))"/>
    						</xsl:otherwise>
    					</xsl:choose>
    				</xsl:variable>
    				
    				<xsl:variable name="rows" select="ceiling(count(/root/Products/Product) div number($SubcatGridCols))" />
    
    				<xsl:if test="$SubcatGridCols = 1">
    					<tr>
    						<xsl:call-template name="ProductCell"></xsl:call-template>
    					</tr>
    				</xsl:if>
    
    				<xsl:if test="position() mod $SubcatGridCols = 1 and $SubcatGridCols &gt; 1">
    					<tr>
    						 <xsl:for-each select=". | following-sibling::*[position() &lt; $SubcatGridCols]">
    							<xsl:call-template name="ProductCell"></xsl:call-template>
    						 </xsl:for-each>
    						<xsl:if test="ceiling(position() div  number($SubcatGridCols)) = $rows and $delta &gt; 0">
    							<xsl:call-template name="FillerCells">
    								<xsl:with-param name="cellCount" select="$delta" />
    							</xsl:call-template>
    						</xsl:if>
    					</tr>
    				</xsl:if>
    			</xsl:template>
    
                <xsl:template name="ProductCell">
                    <xsl:param name="pName" select="aspdnsf:GetMLValue(Name)"></xsl:param>
                    <xsl:param name="pSEAltText" select="aspdnsf:GetMLValue(SEAltText)"></xsl:param>
                    <xsl:param name="AltText">
                        <xsl:choose>
                            <xsl:when test="$pSEAltText=''"><xsl:value-of select="$pName" /></xsl:when>
                            <xsl:otherwise><xsl:value-of select="$pSEAltText" /></xsl:otherwise>
                        </xsl:choose>
                    </xsl:param>
    				<xsl:param name="saveProductID" select="ProductID"></xsl:param>
    
                    <td align="center" valign="top" width="{concat(round(100 div number($SubcatGridCols)),'%')}">
                        <table>
                            <tr>
                                <td height="30" align="center" valign="middle" style="border: 1px solid #ddd;width:200px">
    								<div class="eseFeaturedImageSections">
    									<a href="{aspdnsf:ProductandEntityLink(ProductID, SEName, $EntityID, $EntityName, 0)}" title="{$AltText}" id="s{ProductID}">
    										<img src="{concat('/images/product/icon/',ProductID,'.jpg')}" width="150" height="150" alt="{$AltText}" title="{$AltText}" />
    									</a>
    									<xsl:if test="DiscountSticker != '' and DiscountSticker != '0'">
    										<div style="position: absolute; top: 90px; left: 80px;">
    											<a href="{aspdnsf:ProductandEntityLink(ProductID, SEName, $EntityID, $EntityName, 0)}">
    												<img src="{concat('skins/Skin_1/images/discount-small-',DiscountSticker,'.png')}"></img>
    											</a>
    										</div>
    									</xsl:if>
    								</div>
                                </td>
                            </tr>
                            <tr>
                                <td height="10" align="center" valign="top">
                                    <a href="{aspdnsf:ProductandEntityLink(ProductID, SEName, $EntityID, $EntityName, 0)}" title="{$AltText}">
                                        <xsl:value-of select="$pName" disable-output-escaping="yes" />
                                    </a>
    								<br />
    								Prices from: <xsl:value-of select="DiscountedPrice" disable-output-escaping="yes" /> (ex. VAT)
                                </td>
                            </tr>
    						<tr>
    							<td height="45" align="center" valign="top">
    								<xsl:if test="aspdnsf:AppConfigBool('DisplayOutOfStockProducts') = 'true'">
    									<xsl:value-of select="aspdnsf:DisplayProductStockHint(ProductID, VariantID,'Entity')" disable-output-escaping="yes" />
    								</xsl:if>
    							</td>
    						</tr>
    						<tr>
    							<td>
    								<xsl:for-each select="/root/EntityProducts/Product" >
    									<xsl:call-template name="EntityProduct">
    										<xsl:with-param name="saveProductID" select="$saveProductID" />
    										<xsl:with-param name="EntityID" select="$EntityID" />
    										<xsl:with-param name="EntityName" select="$EntityName" />
    									</xsl:call-template>
    								</xsl:for-each>
    							</td>
    						</tr>
                        </table>
                    </td>
                </xsl:template>
    			
    			<xsl:template name="EntityProduct">
    				<xsl:param name="saveProductID"></xsl:param>
    				<xsl:param name="EntityID"></xsl:param>
    				<xsl:param name="EntityName"></xsl:param>
    				<xsl:if test="EntityProductID=$saveProductID">
    					<a href="{aspdnsf:ProductandEntityLink($saveProductID, '', $EntityID, $EntityName, 0)}">
    					This product has <xsl:value-of select="NumVariants" disable-output-escaping="yes" /> options!</a>
    				</xsl:if>
    			</xsl:template>
    			
                <xsl:template name="FillerCells">
                    <xsl:param name="cellCount"/>
                    <xsl:param name="CellWidth" select="100 div $SubcatGridCols" />
                    <td width="{$CellWidth}%">&#160;</td>
                    <xsl:if test="$cellCount > 1">
                        <xsl:call-template name="FillerCells">
                            <xsl:with-param name="cellCount" select="$cellCount - 1"/>
                        </xsl:call-template>
                    </xsl:if>
                </xsl:template>
                
            </xsl:stylesheet>
        </PackageTransform>
    </package>
    http://www.esedirect.co.uk
    --------------------------------------------------------------------------
    Using MS 9.2.0.0 with the following customisations:

    Lightbox/Fancybox enlarged images;
    Auto-suggest searchbox;
    Extra product information shown only to our IP Address (such as supplier info, costs, etc.);
    Failed transactions emailed via trigger;
    Custom app to show basket contents when customer online;
    Orders pushed through to accounting systems.

    All the above without source!

  5. #5
    skpr is offline Member
    Join Date
    Feb 2010
    Posts
    31

    Default

    You, sir, are an amazing person, and are my hero right now.

    Added in the comparison so the link shows up only for products with multiple variants, and it works beautifully.

    Thank you so much for taking the time to help me out.
    http://www.lynxmotion.com
    AspDotNetStorefront ML 8.01.2/8.0.1.2

  6. #6
    vacshack is offline Junior Member
    Join Date
    Jul 2011
    Posts
    13

    Default Almost worked for me

    Quote Originally Posted by skpr View Post
    Added in the comparison so the link shows up only for products with multiple variants, and it works beautifully.
    So I have added a new xml file to my site, added my addtocart command. It displays correctly except it, displays this link on all products in the grid, not just the ones with multiple variants.

    Did I miss something here?

    I don't understand the comparison that you are speaking of.

    One more thing, Once the addtocart command is present, the grid no longer fits in the area according to IE. ON Chrome and Firefox it all displays correctly, however when I look on IE it dumps the whole body of the page down underneath the left nav.
    Last edited by vacshack; 10-16-2012 at 09:09 AM.

  7. #7
    Fondy is offline Junior Member
    Join Date
    Nov 2011
    Posts
    2

    Default

    I would like to do this exact same thing with: page.casearch.xml.config package any help would be appreciated

    Code:
    <?xml version="1.0" standalone="yes" ?>
    <package version="2.1" displayname="Search" debug="false" includeentityhelper="true" CacheMode="Url">
        <webquery name="WebQuery" RetType="xml">
    		<url>http://localhost:880/FilteredProductData.ashx?CategoryIDs={CategoryID}-{CategoryIDs}&amp;SectionIDs={SectionID}-{SectionIDs}&amp;ManufacturerIDs={ManufacturerID}-{ManufacturerIDs}&amp;DistributorIDs={DistributorID}-{DistributorIDs}&amp;searchterm={SearchTerm}{Query}&amp;MinPrice={MinPrice}&amp;MaxPrice={MaxPrice}&amp;Page={Page}&amp;PageSize={PageSize}&amp;SortBy={SortBy}&amp;DisplayOutOfStock={DisplayOutOfStock}</url>
    		<querystringreplace replaceTag="{CategoryID}" replacetype="request" replaceparamname="CategoryID" defvalue=""  validationpattern="" />
    		<querystringreplace replaceTag="{SectionID}" replacetype="request" replaceparamname="SectionID" defvalue=""  validationpattern="" />
    		<querystringreplace replaceTag="{ManufacturerID}" replacetype="request" replaceparamname="ManufacturerID" defvalue=""  validationpattern="" />
    		<querystringreplace replaceTag="{DistributorID}" replacetype="request" replaceparamname="DistributorID" defvalue=""  validationpattern="" />
    		<querystringreplace replaceTag="{CategoryIDs}" replacetype="request" replaceparamname="Category" defvalue=""  validationpattern="" />
    		<querystringreplace replaceTag="{SectionIDs}" replacetype="request" replaceparamname="Section" defvalue=""  validationpattern="" />
    		<querystringreplace replaceTag="{ManufacturerIDs}" replacetype="request" replaceparamname="Manufacturer" defvalue=""  validationpattern="" />
    		<querystringreplace replaceTag="{DistributorIDs}" replacetype="request" replaceparamname="Distributor" defvalue=""  validationpattern="" />   
    		<querystringreplace replaceTag="{SearchTerm}" replacetype="request" replaceparamname="SearchTerm" defvalue=""  validationpattern="" />  
    		<querystringreplace replaceTag="{Query}" replacetype="request" replaceparamname="Query" defvalue=""  validationpattern="" />  
    		<querystringreplace replaceTag="{MinPrice}" replacetype="request" replaceparamname="MinPrice" defvalue=""  validationpattern="" />  
    		<querystringreplace replaceTag="{MaxPrice}" replacetype="request" replaceparamname="MaxPrice" defvalue=""  validationpattern="" />   
    		<querystringreplace replaceTag="{Page}" replacetype="request" replaceparamname="PageNum" defvalue="1"  validationpattern="" />   
    		<querystringreplace replaceTag="{PageSize}" replacetype="request" replaceparamname="PageSize" defvalue="20"  validationpattern="" />
    		<querystringreplace replaceTag="{SortBy}" replacetype="request" replaceparamname="SortBy" defvalue="popularity"  validationpattern="" />
    		<querystringreplace replaceTag="{DisplayOutOfStock}" replacetype="appconfig" replaceparamname="DisplayOutOfStockProducts" defvalue="0"  validationpattern="" />
    	</webquery>
    	
    	
    	
    	<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="SearchTerm">
    				<xsl:choose>
    					<xsl:when test="/root/QueryString/searchterm != ''">
    						<xsl:value-of select="/root/QueryString/searchterm" />
    					</xsl:when>
    					<xsl:otherwise>
    						<xsl:value-of select="/root/QueryString/query" />
    					</xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="SectionIDs">
    				<xsl:choose>
    					<xsl:when test="/root/QueryString/sectionid != ''">
    						<xsl:value-of select="/root/QueryString/section" />-<xsl:value-of select="/root/QueryString/sectionid" />
    					</xsl:when>
    					<xsl:otherwise><xsl:value-of select="/root/QueryString/section" /></xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="CurrentPage">
    				<xsl:choose>
    					  <xsl:when test="/root/QueryString/pagenum != ''"><xsl:value-of select="/root/QueryString/pagenum" /></xsl:when>
    					  <xsl:otherwise>1</xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="TotalPages">
    				<xsl:choose>
    					<xsl:when test="/root/WebQuery/Result/Paging/PageCount &gt; 5000">5000</xsl:when><!-- Setting a max page count, no need for 3,874 pages -->
    					<xsl:when test="/root/WebQuery/Result/Paging/PageCount &gt; 0"><xsl:value-of select="/root/WebQuery/Result/Paging/PageCount" /></xsl:when>
    					<xsl:otherwise>0</xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="NextPage">
    				<xsl:choose>
    					<xsl:when test="$CurrentPage &lt; $TotalPages">
    					<xsl:value-of select="$CurrentPage + 1" />
    						</xsl:when>
    					<xsl:otherwise><xsl:value-of select="$TotalPages" /></xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="PreviousPage">
    				<xsl:choose>
    					<xsl:when test="$CurrentPage &gt; 1">
    						<xsl:value-of select="$CurrentPage - 1" />
    					</xsl:when>
    				  <xsl:otherwise>1</xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="PageSize">
    				<xsl:choose>
    					<xsl:when test="/root/QueryString/pagesize != ''">
    						<xsl:value-of select="/root/QueryString/pagesize" />
    					</xsl:when>
    					<xsl:otherwise>20</xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="SortBy">
    				<xsl:choose>
    					<xsl:when test="/root/QueryString/sortby != ''">
    						<xsl:value-of select="/root/QueryString/sortby" />
    					</xsl:when>
    					<xsl:otherwise>popularity</xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="TotalProducts"><xsl:value-of select="/root/WebQuery/Result/Paging/ProductCount" /></xsl:param>
    			<xsl:param name="CurrentTotalProducts"><xsl:value-of select="count(/root/WebQuery/Result/Products/Product)" /></xsl:param>
    			<xsl:param name="UseCalculatedVariantPrice">
    				<xsl:choose>
    					<xsl:when test="aspdnsf:AppConfig('VAT.DefaultSetting') = '1'"><xsl:value-of select="aspdnsf:AppConfig('VAT.Enabled')" /></xsl:when>
    					<xsl:when test="aspdnsf:AppConfig('CASearch.OnlyFilterOnDefaultVariantPrice') = 'true'">true</xsl:when>
    					<xsl:otherwise>false</xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    		<xsl:param name="CurrentEntityType">
    				<xsl:choose>
    					<xsl:when test="/root/QueryString/categoryid != ''">Category</xsl:when>
    					<xsl:when test="/root/QueryString/manufacturerid != ''">Manufacturer</xsl:when>
    					<xsl:when test="/root/QueryString/sectionid != ''">Section</xsl:when>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="CurrentEntityID">
    				<xsl:choose>
    					<xsl:when test="/root/QueryString/categoryid != ''"><xsl:value-of select="/root/QueryString/categoryid" /></xsl:when>
    					<xsl:when test="/root/QueryString/manufacturerid != ''"><xsl:value-of select="/root/QueryString/manufacturerid" /></xsl:when>
    					<xsl:when test="/root/QueryString/sectionid != ''"><xsl:value-of select="/root/QueryString/sectionid" /></xsl:when>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="CurrentEntityNode" select="/root/EntityHelpers/*[name()=$CurrentEntityType]//Entity[EntityID = $CurrentEntityID]" />
    			<xsl:param name="CurrentPageName">
    				<xsl:choose>
    					<xsl:when test="/root/System/PageName = 'showcategory.aspx'"><xsl:value-of select="concat('c-', $CurrentEntityID, '-', /root/QueryString/sename, '.aspx')" /></xsl:when>
    					<xsl:when test="/root/System/PageName = 'showmanufacturer.aspx'"><xsl:value-of select="concat('m-', $CurrentEntityID, '-', /root/QueryString/sename, '.aspx')" /></xsl:when>
    					<xsl:when test="/root/System/PageName = 'showsection.aspx'"><xsl:value-of select="concat('s-', $CurrentEntityID, '-', /root/QueryString/sename, '.aspx')" /></xsl:when>
    					<xsl:otherwise><xsl:value-of select="/root/System/PageName" disable-output-escaping="yes" /></xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:param name="FilteredNavEnabled">
    				<xsl:choose>
    					<xsl:when test="aspdnsf:AppConfig('ReductiveNav.Enabled') = 'true'">true</xsl:when>
    					<xsl:otherwise>false</xsl:otherwise>
    				</xsl:choose>
    			</xsl:param>
    			<xsl:template match="/">
    				<xsl:comment>
    					---------------------- WebQuery ----------------------
    					<xsl:value-of select="/root/WebQuery/Result/Url" disable-output-escaping="yes" />
    					---------------------- Params ----------------------
    					SearchTerm: <xsl:value-of select="$SearchTerm" disable-output-escaping="yes" />
    					PageSize: <xsl:value-of select="$PageSize" disable-output-escaping="yes" />
    					CurrentPage: <xsl:value-of select="$CurrentPage" disable-output-escaping="yes" />
    					NextPage: <xsl:value-of select="$NextPage" disable-output-escaping="yes" />
    					PreviousPage: <xsl:value-of select="$PreviousPage" disable-output-escaping="yes" />
    					TotalPages: <xsl:value-of select="$TotalPages" disable-output-escaping="yes" />
    					SortBy: <xsl:value-of select="$SortBy" disable-output-escaping="yes" />
    					TotalProducts: <xsl:value-of select="$TotalProducts" disable-output-escaping="yes" />
    					CurrentTotalProducts: <xsl:value-of select="$CurrentTotalProducts" disable-output-escaping="yes" />
    					UseCalculatedVariantPrice: <xsl:value-of select="$UseCalculatedVariantPrice" disable-output-escaping="yes" />
    					CurrentPageName: <xsl:value-of select="$CurrentPageName" disable-output-escaping="yes" />
    					SectionIDs: <xsl:value-of select="$SectionIDs" disable-output-escaping="yes" />
    					FilteredNavEnabled: <xsl:value-of select="$FilteredNavEnabled" disable-output-escaping="yes" />
    					CurrentEntityID: <xsl:value-of select="$CurrentEntityID" disable-output-escaping="yes" />
    					CurrentEntityName: <xsl:value-of select="$CurrentEntityNode/Name" disable-output-escaping="yes" />
    					CurrentEntityType: <xsl:value-of select="$CurrentEntityType" disable-output-escaping="yes" />
    				</xsl:comment>
    				
    				<link rel="stylesheet" href="images/casearch/casearchv2.css" type="text/css" />
    				<script src="jscripts/casearch.js"></script>
    				
    				<div class="caSearchContentContainer">
    					<xsl:choose>
    						<xsl:when test="$CurrentEntityNode">
    							<div><xsl:value-of select="aspdnsf:EntityPageHeaderDescription($CurrentEntityType, $CurrentEntityID)" disable-output-escaping="yes" /></div>
    						</xsl:when>
    						<xsl:otherwise>
    							<div><xsl:value-of select="aspdnsf:Topic('SearchPageHeader')" disable-output-escaping="yes" /></div>
    						</xsl:otherwise>
    					</xsl:choose>
    					<form method="get" action="{$CurrentPageName}" id="caSearchForm">
    						<input type="hidden" id="pagenum" name="pagenum" />
    						<input type="hidden" id="section" name="section" value="{$SectionIDs}" />
    						<input type="hidden" id="sortselector" />
    						
    						<!-- Result string -->
    						<div class="resultsString">
    						<h1>
    							<xsl:value-of select="$TotalProducts" disable-output-escaping="yes" /> Products
    							<xsl:if test="$SearchTerm != ''"> for "<xsl:value-of select="$SearchTerm" disable-output-escaping="yes" />"</xsl:if>
    							<xsl:if test="$CurrentEntityNode"> in <xsl:value-of select="aspdnsf:GetMLValue($CurrentEntityNode/Name)" disable-output-escaping="yes" /></xsl:if>
    						</h1>
    						</div>
    						
    						<!-- Show search box if filtered navigation is off and is not an entity page, eg c-123-category-page.aspx -->
    						<xsl:choose>
    							<xsl:when test="$FilteredNavEnabled = 'true' or $CurrentEntityNode">
    								<input type="hidden" name="SearchTerm" value="{$SearchTerm}" />
    							</xsl:when>
    							<xsl:otherwise>
    								<div id="caSearchContainer" class="caSearchContainer">
    									<div class="searchHeader">
    										<div class="showHideFilters">
    											<!-- Content for right side of search bar -->
    										</div>
    										<div class="caSearchBox clearfix">
    											<!-- Content for left side of search bar -->
    											<input type="text" class="caSearchTextBox" name="SearchTerm" value="{$SearchTerm}" />
    											<div class="searchButton">
    												<input type="submit" value="Search" />
    											</div>
    										</div>
    										<div class="clearFloats"></div>
    									</div>
    								</div>
    							</xsl:otherwise>
    						</xsl:choose>
    						
    						<!-- Pagination bar -->
    						<xsl:if test="$CurrentTotalProducts > 0">
    							<div class="caSortContainer">
    								<div class="sortBy">
    									<label>Sort By:</label>
    									<select onchange="return caSearch.submitForm();" name="sortBy">
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$SortBy" />
    											<xsl:with-param name="value" select="'popularity'" />
    											<xsl:with-param name="label" select="'Popularity'" />
    										</xsl:apply-templates>
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$SortBy" />
    											<xsl:with-param name="value" select="'relevance'" />
    											<xsl:with-param name="label" select="'Relevance'" />
    										</xsl:apply-templates>
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$SortBy" />
    											<xsl:with-param name="value" select="'priceascending'" />
    											<xsl:with-param name="label" select="'Price (Low to High)'" />
    										</xsl:apply-templates>
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$SortBy" />
    											<xsl:with-param name="value" select="'pricedescending'" />
    											<xsl:with-param name="label" select="'Price (High to Low)'" />
    										</xsl:apply-templates>
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$SortBy" />
    											<xsl:with-param name="value" select="'nameascending'" />
    											<xsl:with-param name="label" select="'Name (A to Z)'" />
    										</xsl:apply-templates>
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$SortBy" />
    											<xsl:with-param name="value" select="'namedescending'" />
    											<xsl:with-param name="label" select="'Name (Z to A)'" />
    										</xsl:apply-templates>
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$SortBy" />
    											<xsl:with-param name="value" select="'newarrivals'" />
    											<xsl:with-param name="label" select="'New Arrivals'" />
    										</xsl:apply-templates>
    									</select>
    								</div>
    								<div class="itemsPerPage">
    									<select onchange="return caSearch.changePageSize();" name="pageSize" >
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$PageSize" />
    											<xsl:with-param name="value" select="'20'" />
    											<xsl:with-param name="label" select="'20 items per page'" />
    										</xsl:apply-templates>
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$PageSize" />
    											<xsl:with-param name="value" select="'40'" />
    											<xsl:with-param name="label" select="'40 items per page'" />
    										</xsl:apply-templates>
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$PageSize" />
    											<xsl:with-param name="value" select="'60'" />
    											<xsl:with-param name="label" select="'60 items per page'" />
    										</xsl:apply-templates>
    										<xsl:apply-templates select="/" mode="Options" >
    											<xsl:with-param name="select" select="$PageSize" />
    											<xsl:with-param name="value" select="'100'" />
    											<xsl:with-param name="label" select="'100 items per page'" />
    										</xsl:apply-templates>										
    									</select>
    								</div>
    								<div class="paging">
    									<ul>
    										<xsl:if test="$TotalPages > 1">
    											<xsl:if test="$CurrentPage > 1">
    												<li class="first"><a href="javascript:caSearch.gotoPage(1);">&lt;&lt;</a></li>
    												<li class="previous"><a href="javascript:caSearch.gotoPage({$PreviousPage});">&lt;</a></li>
    											</xsl:if>
    											<li>
    												<label>Page </label>
    												<select onchange="return caSearch.gotoPage(this.value);" >
    													<xsl:call-template name="PageNumberOptions">
    														<xsl:with-param name="i" select="'1'" />
    														<xsl:with-param name="count" select="$TotalPages" />
    														<xsl:with-param name="select" select="$CurrentPage" />
    													</xsl:call-template>
    												</select>
    												<label> of <xsl:value-of select="$TotalPages" disable-output-escaping="yes" /></label>
    											</li>
    											<xsl:if test="$CurrentPage != $TotalPages">
    												<li class="next"><a href="javascript:caSearch.gotoPage({$NextPage});">&gt;</a></li>
    												<li class="last"><a href="javascript:caSearch.gotoPage({$TotalPages});">&gt;&gt;</a></li>
    											</xsl:if>
    										</xsl:if>
    									</ul>
    									<div class="clearFloats"></div>
    								</div>
    								<div class="clearFloats"></div>
    							</div>
    						</xsl:if>
    					</form>					
    							<!-- Search Results -->
    						<xsl:if test="$CurrentTotalProducts > 0">
    							<div id="caResultsContainer" class="caResultsContainer gridResults">
    								<xsl:apply-templates select="/root/WebQuery/Result/Products/Product" />
    								<div class="clearFloats"></div>
    							</div>
    							<!-- Footer Paging -->							
    							<br />
    							<xsl:if test="$TotalPages > 1">
    								<div class="caSortContainer">
    									<div class="paging">
    										<ul>
    											<xsl:if test="$TotalPages > 1">
    												<xsl:if test="$CurrentPage > 1">
    													<li class="first"><a href="javascript:caSearch.gotoPage(1);">&lt;&lt;</a></li>
    													<li class="previous"><a href="javascript:caSearch.gotoPage({$PreviousPage});">&lt;</a></li>
    												</xsl:if>
    												<li>
    													<label>Page </label>
    													<select onchange="return caSearch.gotoPage(this.value);" >
    														<xsl:call-template name="PageNumberOptions">
    															<xsl:with-param name="i" select="'1'" />
    															<xsl:with-param name="count" select="$TotalPages" />
    															<xsl:with-param name="select" select="$CurrentPage" />
    														</xsl:call-template>
    													</select>
    													<label> of <xsl:value-of select="$TotalPages" disable-output-escaping="yes" /></label>
    												</li>
    												<xsl:if test="$CurrentPage != $TotalPages">
    													<li class="next"><a href="javascript:caSearch.gotoPage({$NextPage});">&gt;</a></li>
    													<li class="last"><a href="javascript:caSearch.gotoPage({$TotalPages});">&gt;&gt;</a></li>
    												</xsl:if>
    											</xsl:if>
    										</ul>
    										<div class="clearFloats"></div>
    									</div>
    									<div class="clearFloats"></div>
    								</div>
    							</xsl:if>	
    							<!-- End Footer Paging -->
    						</xsl:if>
    					
    					
    					<!-- Show search footer if not using filtered nav -->
    					<xsl:if test="$FilteredNavEnabled = 'false'">
    						<xsl:value-of select="aspdnsf:Topic('SearchPageFooter')" disable-output-escaping="yes" />
    					</xsl:if>
    					
    				</div>
                </xsl:template>
    
    			
    			
                <xsl:template match="Product">
    				<xsl:param name="PID" select="ProductID" />
    				<xsl:param name="URL" select="aspdnsf:ProductLink(ProductID, SEName, 0, '')" />
    				
    				<div class="searchResult">
    					<div class="productInfo">
    						<div class="productImage">
    							<a href="{$URL}" >
    								<xsl:value-of select="aspdnsf:LookupProductImage(ProductID, ImageFileNameOverride, SKU, 'icon', 0, Name)" disable-output-escaping="yes" />
    							</a>
    						</div>
    						<div class="productTitle">
    							<a href="{$URL}"><xsl:value-of select="Name"  disable-output-escaping="yes" /></a>
    						</div>
    						<div class="productPrice">
    						<table id="productPriceContainer">
    						<tr><td>
    							<!-- 
    								PRICE DISPLAY OPTIONS:
    								  A:  Storefront calculated price for default variant; use if store is configured for VAT Inclusive or there is no need for option B
    								  B:  Display prices as they are in the index; if variant prices vary, a range is shown, e.g. $55.00 - $75.00; if saleprice is present, "Sale:" is shown
    							-->
    							<xsl:choose>
    							
    								<!-- PRICE FORMAT A -->
    								<xsl:when test="$UseCalculatedVariantPrice = 'true'">
    									<xsl:value-of select="aspdnsf:GetVariantPrice(VariantID, 0, Price, SalePrice, Price, 0, '')"  disable-output-escaping="yes" />
    								</xsl:when>		
    													
    								<!-- PRICE FORMAT B -->
    								<xsl:otherwise>
    								
    									<xsl:choose>
    										<xsl:when test="VariantLowPrice!=VariantHighPrice">
    											<span class="StandardPriceText"><xsl:value-of select="aspdnsf:FormatCurrency(VariantLowPrice)"  disable-output-escaping="yes" /> - <xsl:value-of select="aspdnsf:FormatCurrency(VariantHighPrice)"  disable-output-escaping="yes" /></span>
    										</xsl:when>	
    										
    										
    										
    										<xsl:otherwise>
    										
    										
    										<!-- START SHOW THIS FORMATING FOR PRODUCTS THAT ARE ON SALE -->
    										
    																				
    										    <xsl:choose><!-- 1 -->
    											
    											   <xsl:when test="(Price - SalePrice) &lt; Price"><!-- 1 -->
    											   
    												  <xsl:choose><!-- 2 -->
    											
    											         <xsl:when test="MSRP &gt; SalePrice"><!-- 2 -->
    													 
    							<span class="list_price">List Price:    <xsl:value-of select="aspdnsf:FormatCurrency(MSRP)"  disable-output-escaping="yes" /></span>
    						<!--<span class="list_price">Regular Price: <xsl:value-of select="aspdnsf:FormatCurrency(Price)"  disable-output-escaping="yes" /></span> -->
    							<span class="SalePriceText">On Sale:    <xsl:value-of select="aspdnsf:FormatCurrency(SalePrice)"  disable-output-escaping="yes" /></span>
    							
    
    																   
                                <div style="color:red;" id="save">
                                   <b>You Save: </b><xsl:value-of select="aspdnsf:FormatCurrency(MSRP - SalePrice)"/> 
    								   <xsl:variable name="save" select="(MSRP - SalePrice) div MSRP"/> (<xsl:value-of select="format-number($save, '##%')" />)
    						    </div>																   
    											         </xsl:when><!-- 2 -->
    													 
    											         <xsl:when test="MSRP &lt; SalePrice or MSRP = SalePrice"><!-- 3 -->
    													 
    						<!--<span class="list_price">List Price:    <xsl:value-of select="aspdnsf:FormatCurrency(MSRP)"  disable-output-escaping="yes" /></span> -->
    						<!--<span class="list_price">Regular Price: <xsl:value-of select="aspdnsf:FormatCurrency(Price)"  disable-output-escaping="yes" /></span> -->
    							<span class="SalePriceText">On Sale:    <xsl:value-of select="aspdnsf:FormatCurrency(SalePrice)"  disable-output-escaping="yes" /></span>
    																   
    											         </xsl:when><!-- 3 -->													 
    										
    										          </xsl:choose><!-- 2 -->
    
    											   
    											   </xsl:when><!-- 1 -->
    											   
    											
    										
    										    </xsl:choose><!-- 1 -->
    										<!-- END SHOW THIS FORMATING FOR PRODUCTS THAT ARE ON SALE -->
    
    											
    											
    											
    										<!-- START SHOW THIS FORMATING FOR PRODUCTS THAT ARE NOT ON SALE -->
    										
    										
    										
    												  <xsl:choose><!-- 4 -->
    											
    											         <xsl:when test="MSRP &gt; Price and SalePrice = 0"><!-- 4 -->
    													 
    							<span class="list_price">List Price:    <xsl:value-of select="aspdnsf:FormatCurrency(MSRP)"  disable-output-escaping="yes" /></span>
    						    <span class="SalePriceText">Price:      <xsl:value-of select="aspdnsf:FormatCurrency(Price)"  disable-output-escaping="yes" /></span>
    																   
                                <div style="color:red;" id="save">
                                   <b>You Save: </b><xsl:value-of select="aspdnsf:FormatCurrency(MSRP - Price)"/> 
    								   <xsl:variable name="save" select="(MSRP - Price) div MSRP"/> (<xsl:value-of select="format-number($save, '##%')" />)
    						    </div>																   
    											         </xsl:when><!-- 4 -->
    													 
    											         <xsl:when test="MSRP &lt;= Price and SalePrice = 0"><!-- 5 -->
    													 
    						<!--<span class="list_price">List Price:    <xsl:value-of select="aspdnsf:FormatCurrency(MSRP)"  disable-output-escaping="yes" /></span> -->
    						<span class="SalePriceText">Price:  <xsl:value-of select="aspdnsf:FormatCurrency(Price)"  disable-output-escaping="yes" /></span> 
    																   
    											         </xsl:when><!-- 5 -->		
    													 
    													 											 
    										
    										          </xsl:choose><!-- 4 -->	
    												  
    												  										   
    										<!-- END SHOW THIS FORMATING FOR PRODUCTS THAT ARE NOT ON SALE -->											   										
    									
    										</xsl:otherwise>
    										
    										
    										
    										
    									</xsl:choose>
    								</xsl:otherwise>
    								<!-- END PRICE FORMATS -->
    							</xsl:choose>
    							
    						</td></tr></table>
    						
    						
    						
    						<!--Display the Add to Cart Button -->                
    						
    						<xsl:choose>
    							<xsl:when test="aspdnsf:AppConfig('CASearch.ShowAddtoCart') = 'True'">
    							<div class="boxaddtocart">
    								<xsl:value-of select="aspdnsf:AddtoCartForm(ProductID, VariantID, 1)" disable-output-escaping="yes"/>
    							</div>
    							</xsl:when>
    						</xsl:choose>
    					</div>
    					
    					</div><div class="clearFloats"></div>
    				</div>
                </xsl:template>
    			
    			<xsl:template match="/" mode="Options">
    				<xsl:param name="select" />
    				<xsl:param name="value" />
    				<xsl:param name="label" />
    				<xsl:element name="option">
    					<xsl:attribute name="value"><xsl:value-of select="$value" /></xsl:attribute>
    					<xsl:if test="$value = $select"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
    					<xsl:value-of select="$label" />
    				</xsl:element>		
    			</xsl:template>
    			
    			<xsl:template name="PageNumberOptions">
    				<xsl:param name="i"      />
    				<xsl:param name="count"  />
    				<xsl:param name="select"  />
    
    				<xsl:if test="$i &lt;= $count">
    				  <xsl:element name="option">
    					<xsl:attribute name="value"><xsl:value-of select="$i"/></xsl:attribute>
    					<xsl:if test="$i = $select"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
    					<xsl:value-of select="$i"/>
    				</xsl:element>	
    				</xsl:if>
    
    				<xsl:if test="$i &lt;= $count">
    				  <xsl:call-template name="PageNumberOptions">
    					  <xsl:with-param name="i">
    						  <xsl:value-of select="$i + 1"/>
    					  </xsl:with-param>
    					  <xsl:with-param name="count">
    						  <xsl:value-of select="$count"/>
    					  </xsl:with-param>
    					  <xsl:with-param name="select">
    						  <xsl:value-of select="$select"/>
    					  </xsl:with-param>
    				  </xsl:call-template>
    				</xsl:if>
    			</xsl:template>
            </xsl:stylesheet>
    
        </PackageTransform>
    </package>