我是aspdotnetstorefront的新手。我刚刚安装了一个vanila网站并与我的数据库连接。
如何自定义它或在哪里可以学习如何自定义它。
例如:
我希望如果有0个库存,请更改' InStock'到了OutOfStock'并隐藏AddToCart Button。
有谁可以举例说明怎么做? 我是一名c#程序员。
答案 0 :(得分:1)
如果这是一个香草网站,那就不那么难了。
在您的管理门户中,转到配置>广告资源控制
将缺货阈值更改为 0
的值 产品页面上的和“缺货”消息:到缺货
您可以使用隐藏低于此库存水平的产品隐藏数量为0的产品
答案 1 :(得分:1)
在admin中的Inventory Control页面上,尝试将LimitCartToQuantityOnHand设置为True(勾选方框)以查看是否有效。
如果没有,那么我有另一个解决方案。
该页面的工作方式如下。默认情况下,当页面加载时,将禁用“添加到购物车”和“添加到心愿单”按钮,下拉框选择的值将为“--SELECT ONE--”。将下拉菜单更改为“--SELECT ONE--”以外的值将启用按钮,如果您再更改回“--SELECT ONE--”,则按钮将再次禁用。
如果您将appconfig DisplayOutOfStockOnProductPages设置为“true”,那么库存小于HideProductsWithLessThanThisInventoryLevel appconfig参数的任何变体都将显示为灰色/禁用。
如果列表中的所有变体都显示为灰色/禁用,则他们将无法将项目添加到购物车。如果appconfig DisplayOutOfStockOnProductPages设置为“false”,则任何库存小于HideProductsWithLessThanThisInventoryLevel appconfig参数中指定的值的变体将不会包含在下拉列表中。
您唯一需要注意的是更改“添加到购物车”和“添加到愿望清单”按钮的文本。因为这些按钮没有ID,所以找到正确的按钮需要查看AddToCartForm的元素,直到找到带有“添加到购物车”和“添加到愿望清单”文本的按钮。如果您需要更改文本(或者您已经拥有),只需将XmlPackage中的文本替换为您现在用于按钮的文本。
<?xml version="1.0" standalone="yes" ?>
<!-- ###################################################################################################### -->
<!-- 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_ProductInfo @ProductID, @CustomerLevelID, 1, 0, @affiliateID
]]>
</sql>
<queryparam paramname="@ProductID" paramtype="request" requestparamname="ProductID" sqlDataType="int" defvalue="0" validationpattern="^\d{1,10}$" />
<queryparam paramname="@CustomerLevelID" paramtype="runtime" requestparamname="CustomerLevelID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@affiliateID" paramtype="system" requestparamname="AffiliateID" sqlDataType="int" defvalue="0" validationpattern="" />
</query>
<query name="ProductVariants" rowElementName="Variant">
<sql>
<![CDATA[
select pv.VariantID, pv.Name, pv.Price, pv.Description, pv.ProductID, pv.Deleted, pv.MinimumQuantity,
pv.Published, pv.Points, pv.IsDefault, pv.DisplayOrder, case p.TrackInventoryBySizeAndColor when 1 then isnull(i.quan, 0) else pv.inventory end Inventory,
case when pv.SalePrice is null then 0 else isnull(pv.SalePrice, 0) end SalePrice, case when pcl.productid is null then 0 else isnull(e.Price, 0) end ExtendedPrice
from dbo.productvariant pv with (nolock)
join dbo.product p with (nolock) on p.productid = pv.productid
left join dbo.ExtendedPrice e with (nolock) on pv.VariantID=e.VariantID and e.CustomerLevelID=@CustomerLevelID
left join dbo.ProductCustomerLevel pcl with (NOLOCK) on pcl.ProductID = p.ProductID and pcl.CustomerLevelID = @CustomerLevelID
left join dbo.Inventory i with (nolock) on i.VariantID = pv.VariantID
where pv.ProductID=@ProductID and pv.Deleted=0 and pv.Published = 1
order by pv.IsDefault DESC, pv.DisplayOrder ASC
]]>
</sql>
<queryparam paramname="@CustomerLevelID" paramtype="system" requestparamname="CustomerLevelID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@ProductID" paramtype="request" requestparamname="ProductID" sqlDataType="int" defvalue="0" validationpattern="" />
<queryparam paramname="@InvFilter" paramtype="appconfig" requestparamname="HideProductsWithLessThanThisInventoryLevel" sqlDataType="int" defvalue="0" 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="defaultVariant">
<xsl:choose>
<xsl:when test="count(/root/ProductVariants/Variant[IsDefault=1]) = 0"><xsl:value-of select="/root/ProductVariants/Variant[1]/VariantID" /></xsl:when>
<xsl:otherwise><xsl:value-of select="/root/ProductVariants/Variant[IsDefault=1]/VariantID" /></xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="LocaleSetting" select="/root/Runtime/LocaleSetting" />
<xsl:param name="WebConfigLocaleSetting" select="/root/Runtime/WebConfigLocaleSetting" />
<xsl:param name="XmlPackageName" select="/root/System/XmlPackageName" />
<xsl:param name="SecID">
<xsl:choose>
<xsl:when test="count(/root/QueryString/sectionid) > 0">
<xsl:value-of select="/root/QueryString/sectionid" />
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="CatID">
<xsl:choose>
<xsl:when test="count(/root/QueryString/categoryid) > 0">
<xsl:value-of select="/root/QueryString/categoryid" />
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:template match="/">
<xsl:apply-templates select="/root/Products/Product" />
<SCRIPT LANGUAGE="JavaScript">
var theForm = document.forms["AddToCartForm_<xsl:value-of select="/root/QueryString/productid" />_<xsl:value-of select="$defaultVariant" />"];
for(e = 0; e < theForm.elements.length; e+=1)
{
if(theForm.elements[e].value == 'Add to Cart')
{
theForm.elements[e].disabled = 'true';
}
if(theForm.elements[e].value == 'Add to Wish List')
{
theForm.elements[e].disabled = 'true';
}
}
var VarMinQty = new Array();
var VarInventory = new Array();
<xsl:for-each select="/root/ProductVariants/Variant">
<xsl:choose>
<xsl:when test="MinimumQuantity > 0">
VarMinQty[<xsl:value-of select="VariantID" />] = <xsl:value-of select="MinimumQuantity" />;
</xsl:when>
<xsl:otherwise>
VarMinQty[<xsl:value-of select="VariantID" />] = 1;
</xsl:otherwise>
</xsl:choose>
VarInventory[<xsl:value-of select="VariantID" />] = <xsl:value-of select="Inventory" />;
</xsl:for-each>
function SetCartVariant(selValue){
//alert("AddToCartForm_"+prodid+"_"+varid);
var theForm = document.forms["AddToCartForm_<xsl:value-of select="/root/QueryString/productid" />_<xsl:value-of select="$defaultVariant" />"];
if(selValue=='')
{
//alert('Please select a variant to add to the cart');
for(e = 0; e < theForm.elements.length; e+=1)
{
if(theForm.elements[e].value == 'Add to Cart')
{
theForm.elements[e].disabled = 'true';
}
if(theForm.elements[e].value == 'Add to Wish List')
{
theForm.elements[e].disabled = 'true';
}
}
}
else
{
for(e = 0; e < theForm.elements.length; e+=1)
{
if(theForm.elements[e].value == 'Add to Cart')
{
theForm.elements[e].disabled = '';
}
if(theForm.elements[e].value == 'Add to Wish List')
{
theForm.elements[e].disabled = '';
}
}
theForm.VariantID.value=selValue;
VariantMinimumQty_<xsl:value-of select="/root/QueryString/productid" />_<xsl:value-of select="$defaultVariant" /> = VarMinQty[selValue];
SelectedVariantInventory_<xsl:value-of select="/root/QueryString/productid" />_<xsl:value-of select="$defaultVariant" /> = VarInventory[selValue];
}
}
SelectedVariantInventory_<xsl:value-of select="/root/QueryString/productid" />_<xsl:value-of select="$defaultVariant" /> = VarInventory[<xsl:value-of select="$defaultVariant" />];
</SCRIPT>
<xsl:comment>Copyright 1995-2009 AspDotNetStorefront.com</xsl:comment>
</xsl:template>
<xsl:template match="Product">
<xsl:param name="pName" select="aspdnsf:GetMLValue(Name)"></xsl:param>
<xsl:param name="pDescription" select="aspdnsf:GetMLValue(Description)"></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:choose>
<xsl:when test="IsAKit=1">
<table border="0" width="100%" cellpadding="4" cellspacing="0">
<tr>
<td align="left" valign="top">
<xsl:value-of select="aspdnsf:LookupProductImage(ProductID, ImageFilenameOverride, SKU, 'medium', 1, $AltText)" disable-output-escaping="yes"/>
</td>
<td align="left" valign="top" width="100%">
<div>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="left" valign="middle">
<span class="ProductNameText">
<xsl:value-of select="$pName" disable-output-escaping="yes" />
</span>
</td>
<td align="right" valign="Middle">
<nobr>
<xsl:value-of select="aspdnsf:ProductNavLinks(ProductID, $CatID, $SecID)" disable-output-escaping="yes" />
</nobr>
</td>
</tr>
</table>
</div>
<div>
<br />
</div>
<div>
<b>
<font color="red">
Display of Kit Products is not supported by this XmlPackage.<br /><br />XmlPackage=<xsl:value-of select="$XmlPackageName" />
</font>
</b>
</div>
</td>
</tr>
</table>
</xsl:when>
<xsl:when test="IsAPack=1">
<table border="0" width="100%" cellpadding="4" cellspacing="0">
<tr>
<td align="left" valign="top">
<xsl:value-of select="aspdnsf:LookupProductImage(ProductID, ImageFilenameOverride, SKU, 'medium', 1, $AltText)" disable-output-escaping="yes"/>
</td>
<td align="left" valign="top" width="100%">
<div>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="left" valign="middle">
<span class="ProductNameText">
<xsl:value-of select="$pName" disable-output-escaping="yes" />
</span>
</td>
<td align="right" valign="Middle">
<nobr>
<xsl:value-of select="aspdnsf:ProductNavLinks(ProductID, $CatID, $SecID)" disable-output-escaping="yes" />
</nobr>
</td>
</tr>
</table>
</div>
<div>
<br />
</div>
<div>
<b>
<font color="red">
Display of Pack Products is not supported by this XmlPackage.<br /><br />XmlPackage=<xsl:value-of select="$XmlPackageName" />
</font>
</b>
</div>
</td>
</tr>
</table>
</xsl:when>
<xsl:otherwise>
<table border="0" width="100%" cellpadding="4" cellspacing="0">
<tr>
<td align="left" valign="top">
<xsl:value-of select="aspdnsf:LookupProductImage(ProductID, ImageFilenameOverride, SKU, 'medium', 1, $AltText)" disable-output-escaping="yes"/>
</td>
<td align="left" valign="top" width="100%">
<div>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="left" valign="middle">
<span class="ProductNameText">
<xsl:value-of select="$pName" disable-output-escaping="yes" />
</span>
<br/>
</td>
<td align="right" valign="Middle">
<nobr>
<xsl:value-of select="aspdnsf:ProductNavLinks(ProductID, /root/Runtime/EntityID, /root/Runtime/EntityName, /root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/SEName, 0, 1, 1)" disable-output-escaping="yes" />
<xsl:value-of select="aspdnsf:EmailProductToFriend(ProductID, $CatID)" disable-output-escaping="yes"/>
</nobr>
</td>
</tr>
</table>
</div>
<div>
</div>
<div>
<xsl:value-of select="$pDescription" disable-output-escaping="yes"/>
<br/>
<br/>
</div>
<div>
</div>
<div>
Options: <select name="variants" onchange="SetCartVariant(this.value)">
<option value="" selected="selected">--SELECT ONE--</option>
<xsl:apply-templates select="/root/ProductVariants/Variant" />
</select>
<xsl:if test="aspdnsf:AppConfigBool('DisplayOutOfStockProducts') = 'true'">
<xsl:value-of select="aspdnsf:DisplayProductStockHint(ProductID, VariantID, 'Product')" disable-output-escaping="yes" />
</xsl:if>
<div>
<br/>
</div>
<xsl:value-of select="aspdnsf:AddtoCartForm(ProductID, $defaultVariant, 1)" disable-output-escaping="yes"/>
</div>
</td>
</tr>
</table>
<xsl:value-of select="aspdnsf:RelatedProducts(ProductID)" disable-output-escaping="yes"/>
<xsl:value-of select="aspdnsf:RecentlyViewed(ProductID)" disable-output-escaping="yes"/>
<xsl:value-of select="aspdnsf:ShowUpsellProducts(ProductID)" disable-output-escaping="yes"/>
<xsl:value-of select="aspdnsf:AlsoBought(ProductID, VariantID)" disable-output-escaping="yes"/>
<xsl:value-of select="aspdnsf:ProductSpecs(ProductID, 1)" disable-output-escaping="yes"/>
<xsl:value-of select="aspdnsf:ProductRatings(ProductID, 0, 0, 0, 1)" disable-output-escaping="yes"/>
<xsl:value-of select="aspdnsf:Topic('imagepricetable')" disable-output-escaping="yes" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="Variant">
<xsl:param name="vName" select="aspdnsf:GetMLValue(Name)"></xsl:param>
<xsl:param name="pSalesPromptName" select="aspdnsf:GetMLValue(/root/Products/Product/SalesPromptName)"></xsl:param>
<xsl:param name="pTaxClassID" select="/root/Products/Product/TaxClassID" />
<xsl:choose>
<xsl:when test="aspdnsf:AppConfig('DisplayOutOfStockOnProductPages') = 'true'">
<option value="{VariantID}">
<xsl:if test="Inventory < aspdnsf:AppConfig('HideProductsWithLessThanThisInventoryLevel')">
<xsl:attribute name="disabled">disabled</xsl:attribute>
</xsl:if>
<xsl:value-of select="$vName" />*-*<xsl:value-of select="aspdnsf:GetVariantPrice(VariantID, number(HidePriceUntilCart), Price, SalePrice, ExtendedPrice, Points, $pSalesPromptName, $pTaxClassID)" disable-output-escaping="yes" />
</option>
</xsl:when>
<xsl:otherwise>
<xsl:if test="Inventory > (number(aspdnsf:AppConfig('HideProductsWithLessThanThisInventoryLevel')) - 1)">
<option value="{VariantID}">
<xsl:value-of select="$vName" />*-*<xsl:value-of select="aspdnsf:GetVariantPrice(VariantID, number(HidePriceUntilCart), Price, SalePrice, ExtendedPrice, Points, $pSalesPromptName, $pTaxClassID)" disable-output-escaping="yes" />
</option>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>