Dynamicweb 8 Documentation
UpdateVariantCount Method
Example 

The product.
The variant counter.
Updates the variant counter.
Syntax
'Declaration
 
Public Shared Function UpdateVariantCount( _ 
   ByVal product As Product, _ 
   ByVal variantCount As Integer _ 
) As Integer
public static int UpdateVariantCount( 
   Product product,
   int variantCount 
)

Parameters

product
The product.
variantCount
The variant counter.
Example
class MyPage : System.Web.UI.Page
{
   public void VariantOptions(Product prod)
   {
       string overwriteDefaultVarCombo = string.Empty;
       if (Request["saveVariant"] == "1")
       {
           Dynamicweb.eCommerce.Variants.VariantCombinationCollection vars = Dynamicweb.eCommerce.Variants.VariantCombination.getProductCombinations(prod);
           Product.UpdateVariantCount(prod, vars.Count);
       }
       if (Request["saveDefaultVariant"] == "1")
       {
           if (!string.IsNullOrEmpty(Base.ChkString(Base.Request("DefaultVariantComboID"))))
           {
               overwriteDefaultVarCombo = Base.ChkString(Base.Request("DefaultVariantComboID"));
           }
           Product.UpdateDefaultVariantID(prod, overwriteDefaultVarCombo);
       }
   }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Product Class
Product Members

Send Feedback