Originally Posted by
mmcgeachy
Just to be clear you are talking about product.VariantsInDropDown.xml.config or something else. If so the code you have and what I show don't exactly match up. In particular the for-each and what the select shows as /root/ProductVariants/Variant instead of /root/Products/Product. Therefore Try changing it to the select to /root/ProductVariants/Variant and see if that fixes the issue?
Thanks... actually it was for:
product.configurable-tabbedvariantradiobuttons.xml.config
Apparently I needed to change the "/root/Products/Product" to "/root/ProductVariants/Variant" as you mentioned, then add the query below:
Code:
<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, p.HidePriceUntilCart, 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
and ((@InvFilter = 0) or (case p.TrackInventoryBySizeAndColor when 1 then isnull(i.quan, 0) else pv.inventory end >= @InvFilter))
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>
and lastly add the form code
theForm.Quantity_<xsl:value-of select="/root/Products/Product/ProductID" />_<xsl:value-of select="$defaultVariant" />.value = VarMinQty[selValue];
to the SetCartVariant function below:
Code:
function SetCartVariant(selValue)
{
//alert("AddToCartForm_"+prodid+"_"+varid);
var theForm;
//v9 compatibility check
if(document.forms["aspnetForm"])
{
theForm = document.forms["aspnetForm"];
}
else{ //v8
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');
return false;
}
else
{
//v9 compatibility check
if(theForm.VariantID_<xsl:value-of select="/root/Products/Product/ProductID" />_<xsl:value-of select="$defaultVariant" />)
{
theForm.VariantID_<xsl:value-of select="/root/Products/Product/ProductID" />_<xsl:value-of select="$defaultVariant" />.value=selValue;
}
else{
theForm.VariantID.value=selValue;
}
VariantMinimumQty_<xsl:value-of select="/root/Products/Product/ProductID" />_<xsl:value-of select="$defaultVariant" /> = VarMinQty[selValue];
SelectedVariantInventory_<xsl:value-of select="/root/Products/Product/ProductID" />_<xsl:value-of select="$defaultVariant" /> = VarInventory[selValue];
theForm.Quantity_<xsl:value-of select="/root/Products/Product/ProductID" />_<xsl:value-of select="$defaultVariant" />.value = VarMinQty[selValue];
}
}
Now it seems to update the Quantity box appropriatly when I click on the radio buttons.
Thanks for pointing me in the right direction!
A