Code:
<?xml version="1.0" standalone="yes" ?>
<package version="2.1" displayname="Entity Grid with Prices" debug="false" includeentityhelper="true">
<!-- ###################################################################################################### -->
<!-- Copyright AspDotNetStorefront.com, 1995-2007. 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 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 = @pgsize,
@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="@pgsize" paramtype="request" requestparamname="pagesize" sqlDataType="int" defvalue="20" 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>
<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="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="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: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>
<!--EditHere-->
<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>
<!--End EditHere-->
<xsl:template match="/">
<!--EditHere-->
<xsl:param name="QueryStringChar">
<xsl:choose>
<xsl:when test="contains($BaseURL,'?')">&</xsl:when>
<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="BaseURLNoSpace">
<xsl:value-of select="aspdnsf:StrReplace($BaseURL,' ','')"/>
</xsl:param>
<xsl:param name="BaseURLNoBreak">
<xsl:value-of select="aspdnsf:StrReplace($BaseURLNoSpace,'
','')"/>
</xsl:param>
<xsl:param name="PagingControl">
<xsl:choose>
<xsl:when test="/root/QueryString/pagesize">
<xsl:value-of select="aspdnsf:PagingControl(concat($BaseURLNoBreak, $QueryStringChar,'pagesize=',$PageSize), $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="aspdnsf:PagingControl($BaseURLNoBreak, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" />
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<!--End EditHere-->
<div>
<xsl:value-of select="aspdnsf:EntityPageHeaderDescription($EntityName, $EntityID)" disable-output-escaping="yes" />
</div>
<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>
<div style="text-align:right;">
<!--EditHere-->
<xsl:value-of select="$PagingControl" disable-output-escaping="yes"/>
<xsl:if test="number(/root/Products2/Product/pages) > 1">
 <a href="{concat($BaseURLNoBreak,$QueryStringChar,'pagesize=999999999')}">View All</a>
</xsl:if>
<!--<xsl:value-of select="aspdnsf:PagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" />-->
<!--End EditHere-->
</div>
<table border="0" cellpadding="0" cellspacing="4" width="100%" class="spespacer">
<xsl:apply-templates select="/root/Products/Product" />
</table>
<div style="text-align:right;">
<!--EditHere-->
<xsl:value-of select="$PagingControl" disable-output-escaping="yes"/>
<xsl:if test="number(/root/Products2/Product/pages) > 1">
 <a href="{concat($BaseURLNoBreak,$QueryStringChar,'pagesize=999999999')}">View All</a>
</xsl:if>
<!--<xsl:value-of select="aspdnsf:PagingControl($BaseURL, $CurrentPage, /root/Products2/Product/pages)" disable-output-escaping="yes" />-->
<!--End EditHere-->
</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]/Entity) mod number($SubcatGridCols)) = 0">0</xsl:when>
<xsl:otherwise>
<xsl:value-of select="number($SubcatGridCols)-(count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/Entity) mod number($SubcatGridCols))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="rows" select="ceiling(count(/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/Entity) 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'">
<table border="0" cellpadding="0" cellspacing="4" width="100%">
<xsl:if test="position() mod $SubcatGridCols = 1 or ($SubcatGridCols = 1)">
<tr>
<xsl:for-each select=". | following-sibling::*[position() < $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:if test="ceiling($entityposition div number($SubcatGridCols)) = $rows and $delta > 0">
<xsl:call-template name="FillerCells">
<xsl:with-param name="cellCount" select="$delta" />
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</tr>
<tr>
<td height="10" colspan="{$SubcatGridCols}"> </td>
</tr>
</xsl:if>
</table>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="scName" select="aspdnsf:GetMLValue(Name)"></xsl:variable>
<p align="left">
 <img border="0" src="{concat('skins/skin_', aspdnsf:SkinID(), '/images/redarrow.gif')}"></img> 
<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="URL">
<xsl:value-of select="aspdnsf:EntityLink(EntityID, SEName, $EntityName, 0, '')" />
</xsl:param>
<td align="center">
<a href="{$URL}">
<xsl:value-of select="aspdnsf:LookupEntityImage(EntityID, $EntityName, 'icon', 0)" disable-output-escaping="yes" />
</a>
<br/>
<a href="{$URL}">
<xsl:value-of select="$scName" disable-output-escaping="yes"/>
</a>
</td>
</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 > 1">
<tr>
<xsl:for-each select=". | following-sibling::*[position() < $SubcatGridCols]">
<xsl:call-template name="ProductCell"></xsl:call-template>
</xsl:for-each>
<xsl:if test="ceiling(position() div number($SubcatGridCols)) = $rows and $delta > 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="pSalesPromptName" select="aspdnsf:GetMLValue(SalesPromptName)"></xsl:param>
<td align="center" valign="top">
<a href="{aspdnsf:ProductandEntityLink(ProductID, SEName, $EntityID, $EntityName, 0)}">
<xsl:value-of select="aspdnsf:LookupImage(ProductID, 'product', 'icon', 1)" disable-output-escaping="yes"/>
</a>
<br/>
<a href="{aspdnsf:ProductandEntityLink(ProductID, SEName, $EntityID, $EntityName, 0)}">
<xsl:value-of select="$pName" disable-output-escaping="yes"/>
</a>
<br/>
<xsl:value-of select="aspdnsf:GetVariantPrice(VariantID, number(HidePriceUntilCart), Price, SalePrice, ExtendedPrice, Points, $pSalesPromptName, TaxClassID)" disable-output-escaping="yes" />
</td>
</xsl:template>
<xsl:template name="FillerCells">
<xsl:param name="cellCount"/>
<xsl:param name="CellWidth" select="100 div $SubcatGridCols" />
<td width="{$CellWidth}%"> </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>