Only display product attributes that are in stock?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Hi All,

When you are managing stock by attribute combinations - is there a way to only display attribute combinations that are in stock or allow out of stock orders? Or will I need to write some custom code?

Thanks

Jacques.
13 years ago
Any ideas anyone?
13 years ago
Jacques,

You're right, it'll require you to customize the source code
13 years ago
Thanks Andrei I'll get digging then, once I've done the mod - I'll post it here.
13 years ago
Ok I've coded this in now. If you have one product attribute for a product variant and stock is managed by attribute combinations then the attribute will now display whether it is in or out of stock in the item of the DropDown / CheckBox etc.

For anyone else that is interested, please see below:

Code Modified: CreateAttributeControls() function in NopCommerceStore\Modules\ProductAttributes.ascx.cs

[code]
public void CreateAttributeControls()
        {
            var productVariant = ProductManager.GetProductVariantById(this.ProductVariantId);
            if (productVariant != null)
            {
                this.phAttributes.Controls.Clear();
                var productVariantAttributes = productVariant.ProductVariantAttributes;
                
                
                if (productVariantAttributes.Count > 0)
                {
                    StringBuilder adjustmentTableScripts = new StringBuilder();
                    StringBuilder attributeScripts = new StringBuilder();

                    this.Visible = true;
                    foreach (var attribute in productVariantAttributes)
                    {
                        
                        var divAttribute = new Panel();
                        var attributeTitle = new Label();                        
                        List<ProductVariantAttributeCombination> pVAttributeCombonations = null;
                        if (attribute.IsRequired)
                            attributeTitle.Text = "<span>*</span> ";
                        if (productVariant.ManageInventory == 2)
                        {
                            pVAttributeCombonations = ProductAttributeManager.GetAllProductVariantAttributeCombinations(productVariant.ProductVariantId);
                        }
                        //text prompt / title
                        string textPrompt = string.Empty;
                        if (!string.IsNullOrEmpty(attribute.TextPrompt))
                            textPrompt = attribute.TextPrompt;
                        else
                            textPrompt = attribute.ProductAttribute.LocalizedName;

                        attributeTitle.Text += Server.HtmlEncode(textPrompt);
                        attributeTitle.Style.Add("font-weight", "bold");

                        //description
                        if (!string.IsNullOrEmpty(attribute.ProductAttribute.LocalizedDescription))
                            attributeTitle.Text += string.Format("<br /><span>{0}</span>", Server.HtmlEncode(attribute.ProductAttribute.LocalizedDescription));

                        bool addBreak = true;
                        switch (attribute.AttributeControlType)
                        {
                            case AttributeControlTypeEnum.TextBox:
                                {
                                    addBreak = false;
                                }
                                break;
                            default:
                                break;
                        }
                        if (addBreak)
                        {
                            attributeTitle.Text += "<br />";
                        }
                        else
                        {
                            attributeTitle.Text += "&nbsp;&nbsp;&nbsp;";
                        }
                        divAttribute.Controls.Add(attributeTitle);
                        phAttributes.Controls.Add(divAttribute);

                        string controlId = string.Format("{0}_{1}", attribute.ProductAttribute.ProductAttributeId, attribute.ProductVariantAttributeId);
                        switch (attribute.AttributeControlType)
                        {
                            case AttributeControlTypeEnum.DropdownList:
                                {
                                    var ddlAttributes = new DropDownList();
                                    ddlAttributes.ID = controlId;
                                    divAttribute.Controls.Add(ddlAttributes);
                                    ddlAttributes.Items.Clear();

                                    if (!attribute.IsRequired)
                                    {
                                        ddlAttributes.Items.Add(new ListItem("---", "0"));
                                    }
                                    var pvaValues = attribute.ProductVariantAttributeValues;

                                    adjustmentTableScripts.AppendFormat("{0}['{1}'] = new Array(", AdjustmentTableName, ddlAttributes.ClientID);
                                    attributeScripts.AppendFormat("$('#{0}').change(function(){{{1}();}});\n", ddlAttributes.ClientID, AdjustmentFuncName);

                                    bool preSelectedSet = false;
                                    foreach (var pvaValue in pvaValues)
                                    {
                                        string pvaValueName = pvaValue.LocalizedName;
                                        if (!this.HidePrices &&
                                            (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                            (NopContext.Current.User != null &&
                                            !NopContext.Current.User.IsGuest)))
                                        {
                                            decimal taxRate = decimal.Zero;
                                            decimal priceAdjustmentBase = TaxManager.GetPrice(productVariant, pvaValue.PriceAdjustment, out taxRate);
                                            decimal priceAdjustment = CurrencyManager.ConvertCurrency(priceAdjustmentBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                            if(priceAdjustmentBase > decimal.Zero)
                                            {
                                                pvaValueName += string.Format(" [+{0}]", PriceHelper.FormatPrice(priceAdjustment, false, false));
                                            }
                                            adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0},", (float)priceAdjustment);
                                        }
                                        if (productVariantAttributes.Count == 1 && productVariant.ManageInventory == 2)
                                        {
                                            //Only one attibute and we're tracking by attribute combinations, so display the stock qty's
                                            foreach (var pvaCombo in pVAttributeCombonations)
                                            {
                                                if (ProductAttributeHelper.AreProductAttributesEqual(pvaCombo.AttributesXml, ProductAttributeHelper.AddProductAttribute("", attribute, pvaValue.ProductVariantAttributeValueId.ToString())))
                                                {

                                                    if (pvaCombo.StockQuantity == 0)
                                                    {
                                                        pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.OutOfStock") + "]";
                                                    }
                                                    else
                                                    {
                                                        if (productVariant.DisplayStockQuantity)
                                                        {
                                                            //display "in stock" with stock quantity
                                                            pvaValueName += string.Format(" [" + string.Format(LocalizationManager.GetLocaleResourceString("Products.InStockWithQuantity"), pvaCombo.StockQuantity) + "]", pvaCombo.StockQuantity);
                                                        }
                                                        else
                                                        {
                                                            //display "in stock" without stock quantity

                                                            pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.InStock") + "]";
                                                        }
                                                        
                                                    }

                                                }
                                            }
                                        }
                                        var pvaValueItem = new ListItem(pvaValueName, pvaValue.ProductVariantAttributeValueId.ToString());
                                        if (!preSelectedSet && pvaValue.IsPreSelected)
                                        {
                                            pvaValueItem.Selected = pvaValue.IsPreSelected;
                                            preSelectedSet = true;
                                        }
                                        

                                        ddlAttributes.Items.Add(pvaValueItem);
                                    }
                                    adjustmentTableScripts.Length -= 1;
                                    adjustmentTableScripts.Append(");\n");
                                }
                                break;
                            case AttributeControlTypeEnum.RadioList:
                                {
                                    var rblAttributes = new RadioButtonList();
                                    rblAttributes.ID = controlId;
                                    divAttribute.Controls.Add(rblAttributes);
                                    rblAttributes.Items.Clear();

                                    var pvaValues = attribute.ProductVariantAttributeValues;
                                    bool preSelectedSet = false;
                                    foreach (var pvaValue in pvaValues)
                                    {
                                        string pvaValueName = pvaValue.LocalizedName;
                                        if (!this.HidePrices &&
                                            (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                            (NopContext.Current.User != null &&
                                            !NopContext.Current.User.IsGuest)))
                                        {
                                            decimal taxRate = decimal.Zero;
                                            decimal priceAdjustmentBase = TaxManager.GetPrice(productVariant, pvaValue.PriceAdjustment, out taxRate);
                                            decimal priceAdjustment = CurrencyManager.ConvertCurrency(priceAdjustmentBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                            if(priceAdjustmentBase > decimal.Zero)
                                            {
                                                pvaValueName += string.Format(" [+{0}]", PriceHelper.FormatPrice(priceAdjustment, false, false));
                                            }
                                            adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0}['{1}_{2}'] = {3};\n", AdjustmentTableName, rblAttributes.ClientID, rblAttributes.Items.Count, (float)priceAdjustment);
                                            attributeScripts.AppendFormat("$('#{0}_{1}').click(function(){{{2}();}});\n", rblAttributes.ClientID, rblAttributes.Items.Count, AdjustmentFuncName);
                                        }
                                        if (productVariantAttributes.Count == 1 && productVariant.ManageInventory == 2)
                                        {
                                            //Only one attibute and we're tracking by attribute combinations, so display the stock qty's
                                            foreach (var pvaCombo in pVAttributeCombonations)
                                            {
                                                if (ProductAttributeHelper.AreProductAttributesEqual(pvaCombo.AttributesXml, ProductAttributeHelper.AddProductAttribute("", attribute, pvaValue.ProductVariantAttributeValueId.ToString())))
                                                {

                                                    if (pvaCombo.StockQuantity == 0)
                                                    {
                                                        pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.OutOfStock") + "]";
                                                    }
                                                    else
                                                    {
                                                        if (productVariant.DisplayStockQuantity)
                                                        {
                                                            //display "in stock" with stock quantity
                                                            pvaValueName += string.Format(" [" + string.Format(LocalizationManager.GetLocaleResourceString("Products.InStockWithQuantity"), pvaCombo.StockQuantity) + "]", pvaCombo.StockQuantity);
                                                        }
                                                        else
                                                        {
                                                            //display "in stock" without stock quantity

                                                            pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.InStock") + "]";
                                                        }

                                                    }

                                                }
                                            }
                                        }
                                        var pvaValueItem = new ListItem(Server.HtmlEncode(pvaValueName), pvaValue.ProductVariantAttributeValueId.ToString());
                                        if (!preSelectedSet && pvaValue.IsPreSelected)
                                        {
                                            pvaValueItem.Selected = pvaValue.IsPreSelected;
                                            preSelectedSet = tr
12 years ago
Amazing. Great work. worked perfect. Your solution was much cleaner than mine. Thank you, Brennan
12 years ago
Some people have been getting in touch as the code here is cut off - here it is again


public void CreateAttributeControls()
        {
            var productVariant = ProductManager.GetProductVariantById(this.ProductVariantId);
            if (productVariant != null)
            {
                this.phAttributes.Controls.Clear();
                var productVariantAttributes = productVariant.ProductVariantAttributes;
                
                
                if (productVariantAttributes.Count > 0)
                {
                    StringBuilder adjustmentTableScripts = new StringBuilder();
                    StringBuilder attributeScripts = new StringBuilder();

                    this.Visible = true;
                    foreach (var attribute in productVariantAttributes)
                    {
                        
                        var divAttribute = new Panel();
                        var attributeTitle = new Label();                        
                        List<ProductVariantAttributeCombination> pVAttributeCombonations = null;
                        if (attribute.IsRequired)
                            attributeTitle.Text = "<span>*</span> ";
                        if (productVariant.ManageInventory == 2)
                        {
                            pVAttributeCombonations = ProductAttributeManager.GetAllProductVariantAttributeCombinations(productVariant.ProductVariantId);
                        }
                        //text prompt / title
                        string textPrompt = string.Empty;
                        if (!string.IsNullOrEmpty(attribute.TextPrompt))
                            textPrompt = attribute.TextPrompt;
                        else
                            textPrompt = attribute.ProductAttribute.LocalizedName;

                        attributeTitle.Text += Server.HtmlEncode(textPrompt);
                        attributeTitle.Style.Add("font-weight", "bold");

                        //description
                        if (!string.IsNullOrEmpty(attribute.ProductAttribute.LocalizedDescription))
                            attributeTitle.Text += string.Format("<br /><span>{0}</span>", Server.HtmlEncode(attribute.ProductAttribute.LocalizedDescription));

                        bool addBreak = true;
                        switch (attribute.AttributeControlType)
                        {
                            case AttributeControlTypeEnum.TextBox:
                                {
                                    addBreak = false;
                                }
                                break;
                            default:
                                break;
                        }
                        if (addBreak)
                        {
                            attributeTitle.Text += "<br />";
                        }
                        else
                        {
                            attributeTitle.Text += "&nbsp;&nbsp;&nbsp;";
                        }
                        divAttribute.Controls.Add(attributeTitle);
                        phAttributes.Controls.Add(divAttribute);

                        string controlId = string.Format("{0}_{1}", attribute.ProductAttribute.ProductAttributeId, attribute.ProductVariantAttributeId);
                        switch (attribute.AttributeControlType)
                        {
                            case AttributeControlTypeEnum.DropdownList:
                                {
                                    var ddlAttributes = new DropDownList();
                                    ddlAttributes.ID = controlId;
                                    divAttribute.Controls.Add(ddlAttributes);
                                    ddlAttributes.Items.Clear();

                                    if (!attribute.IsRequired)
                                    {
                                        ddlAttributes.Items.Add(new ListItem("---", "0"));
                                    }
                                    var pvaValues = attribute.ProductVariantAttributeValues;

                                    adjustmentTableScripts.AppendFormat("{0}['{1}'] = new Array(", AdjustmentTableName, ddlAttributes.ClientID);
                                    attributeScripts.AppendFormat("$('#{0}').change(function(){{{1}();}});\n", ddlAttributes.ClientID, AdjustmentFuncName);

                                    bool preSelectedSet = false;
                                    foreach (var pvaValue in pvaValues)
                                    {
                                        string pvaValueName = pvaValue.LocalizedName;
                                        if (!this.HidePrices &&
                                            (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                            (NopContext.Current.User != null &&
                                            !NopContext.Current.User.IsGuest)))
                                        {
                                            decimal taxRate = decimal.Zero;
                                            decimal priceAdjustmentBase = TaxManager.GetPrice(productVariant, pvaValue.PriceAdjustment, out taxRate);
                                            decimal priceAdjustment = CurrencyManager.ConvertCurrency(priceAdjustmentBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                            if(priceAdjustmentBase > decimal.Zero)
                                            {
                                                pvaValueName += string.Format(" [+{0}]", PriceHelper.FormatPrice(priceAdjustment, false, false));
                                            }
                                            adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0},", (float)priceAdjustment);
                                        }
                                        if (productVariantAttributes.Count == 1 && productVariant.ManageInventory == 2)
                                        {
                                            //Only one attibute and we're tracking by attribute combinations, so display the stock qty's
                                            foreach (var pvaCombo in pVAttributeCombonations)
                                            {
                                                if (ProductAttributeHelper.AreProductAttributesEqual(pvaCombo.AttributesXml, ProductAttributeHelper.AddProductAttribute("", attribute, pvaValue.ProductVariantAttributeValueId.ToString())))
                                                {

                                                    if (pvaCombo.StockQuantity == 0)
                                                    {
                                                        pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.OutOfStock") + "]";
                                                    }
                                                    else
                                                    {
                                                        if (productVariant.DisplayStockQuantity)
                                                        {
                                                            //display "in stock" with stock quantity
                                                            pvaValueName += string.Format(" [" + string.Format(LocalizationManager.GetLocaleResourceString("Products.InStockWithQuantity"), pvaCombo.StockQuantity) + "]", pvaCombo.StockQuantity);
                                                        }
                                                        else
                                                        {
                                                            //display "in stock" without stock quantity

                                                            pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.InStock") + "]";
                                                        }
                                                        
                                                    }

                                                }
                                            }
                                        }
                                        var pvaValueItem = new ListItem(pvaValueName, pvaValue.ProductVariantAttributeValueId.ToString());
                                        if (!preSelectedSet && pvaValue.IsPreSelected)
                                        {
                                            pvaValueItem.Selected = pvaValue.IsPreSelected;
                                            preSelectedSet = true;
                                        }
                                        

                                        ddlAttributes.Items.Add(pvaValueItem);
                                    }
                                    adjustmentTableScripts.Length -= 1;
                                    adjustmentTableScripts.Append(");\n");
                                }
                                break;
                            case AttributeControlTypeEnum.RadioList:
                                {
                                    var rblAttributes = new RadioButtonList();
                                    rblAttributes.ID = controlId;
                                    divAttribute.Controls.Add(rblAttributes);
                                    rblAttributes.Items.Clear();

                                    var pvaValues = attribute.ProductVariantAttributeValues;
                                    bool preSelectedSet = false;
                                    foreach (var pvaValue in pvaValues)
                                    {
                                        string pvaValueName = pvaValue.LocalizedName;
                                        if (!this.HidePrices &&
                                            (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                            (NopContext.Current.User != null &&
                                            !NopContext.Current.User.IsGuest)))
                                        {
                                            decimal taxRate = decimal.Zero;
                                            decimal priceAdjustmentBase = TaxManager.GetPrice(productVariant, pvaValue.PriceAdjustment, out taxRate);
                                            decimal priceAdjustment = CurrencyManager.ConvertCurrency(priceAdjustmentBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                            if(priceAdjustmentBase > decimal.Zero)
                                            {
                                                pvaValueName += string.Format(" [+{0}]", PriceHelper.FormatPrice(priceAdjustment, false, false));
                                            }
                                            adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0}['{1}_{2}'] = {3};\n", AdjustmentTableName, rblAttributes.ClientID, rblAttributes.Items.Count, (float)priceAdjustment);
                                            attributeScripts.AppendFormat("$('#{0}_{1}').click(function(){{{2}();}});\n", rblAttributes.ClientID, rblAttributes.Items.Count, AdjustmentFuncName);
                                        }
                                        if (productVariantAttributes.Count == 1 && productVariant.ManageInventory == 2)
                                        {
                                            //Only one attibute and we're tracking by attribute combinations, so display the stock qty's
                                            foreach (var pvaCombo in pVAttributeCombonations)
                                            {
                                                if (ProductAttributeHelper.AreProductAttributesEqual(pvaCombo.AttributesXml, ProductAttributeHelper.AddProductAttribute("", attribute, pvaValue.ProductVariantAttributeValueId.ToString())))
                                                {

                                                    if (pvaCombo.StockQuantity == 0)
                                                    {
                                                        pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.OutOfStock") + "]";
                                                    }
                                                    else
                                                    {
                                                        if (productVariant.DisplayStockQuantity)
                                                        {
                                                            //display "in stock" with stock quantity
                                                            pvaValueName += string.Format(" [" + string.Format(LocalizationManager.GetLocaleResourceString("Products.InStockWithQuantity"), pvaCombo.StockQuantity) + "]", pvaCombo.StockQuantity);
                                                        }
                                                        else
                                                        {
                                                            //display "in stock" without stock quantity

                                                            pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.InStock") + "]";
                                                        }

                                                    }

                                                }
                                            }
                                        }
                                        var pvaValueItem = new ListItem(Server.HtmlEncode(pvaValueName), pvaValue.ProductVariantAttributeValueId.ToString());
                                        if (!preSelectedSet && pvaValue.IsPreSelected)
                                        {
                                            pvaValueItem.Selected = pvaValue.IsPreSelected;
                                            preSelectedSet = true;
                                        }
                                        rblAttributes.Items.Add(pvaValueItem);
                                    }
                                }
                                break;
                            case AttributeControlTypeEnum.Checkboxes:
                                {
                                    var cblAttributes = new CheckBoxList();
                                    cblAttributes.ID = controlId;
                                    divAttribute.Controls.Add(cblAttributes);
                                    cblAttributes.Items.Clear();

                                    var pvaValues = attribute.ProductVariantAttributeValues;
                                    foreach (var pvaValue in pvaValues)
                                    {
                                        string pvaValueName = pvaValue.LocalizedName;
                                        if (!this.HidePrices &&
                                            (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                            (NopContext.Current.User != null &&
                                            !NopContext.Current.User.IsGuest)))
                                        {
                                            decimal taxRate = decimal.Zero;
                                            decimal priceAdjustmentBase = TaxManager.GetPrice(productVariant, pvaValue.PriceAdjustment, out taxRate);
                                            decimal priceAdjustment = CurrencyManager.ConvertCurrency(priceAdjustmentBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                            if (priceAdjustmentBase > decimal.Zero)
                                                pvaValueName += string.Format(" [+{0}]", PriceHelper.FormatPrice(priceAdjustment, false, false));
                                            adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0}['{1}_{2}'] = {3};\n", AdjustmentTableName, cblAttributes.ClientID, cblAttributes.Items.Count, (float)priceAdjustment);
                                            attributeScripts.AppendFormat("$('#{0}_{1}').click(function(){{{2}();}});\n", cblAttributes.ClientID, cblAttributes.Items.Count, AdjustmentFuncName);
                                        }
                                        if (productVariantAttributes.Count == 1 && productVariant.ManageInventory == 2)
                                        {
                                            //Only one attibute and we're tracking by attribute combinations, so display the stock qty's
                                            foreach (var pvaCombo in pVAttributeCombonations)
                                            {
                                                if (ProductAttributeHelper.AreProductAttributesEqual(pvaCombo.AttributesXml, ProductAttributeHelper.AddProductAttribute("", attribute, pvaValue.ProductVariantAttributeValueId.ToString())))
                                                {

                                                    if (pvaCombo.StockQuantity == 0)
                                                    {
                                                        pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.OutOfStock") + "]";
                                                    }
                                                    else
                                                    {
                                                        if (productVariant.DisplayStockQuantity)
                                                        {
                                                            //display "in stock" with stock quantity
                                                            pvaValueName += string.Format(" [" + string.Format(LocalizationManager.GetLocaleResourceString("Products.InStockWithQuantity"), pvaCombo.StockQuantity) + "]", pvaCombo.StockQuantity);
                                                        }
                                                        else
                                                        {
                                                            //display "in stock" without stock quantity

                                                            pvaValueName += " [" + LocalizationManager.GetLocaleResourceString("Products.InStock") + "]";
                                                        }

                                                    }

                                                }
                                            }
                                        }
                                        var pvaValueItem = new ListItem(Server.HtmlEncode(pvaValueName), pvaValue.ProductVariantAttributeValueId.ToString());
                                        pvaValueItem.Selected = pvaValue.IsPreSelected;
                                        cblAttributes.Items.Add(pvaValueItem);
                                    }
                                }
                                break;
                            case AttributeControlTypeEnum.TextBox:
                                {
                                    var txtAttribute = new TextBox();
                                    txtAttribute.Width = SettingManager.GetSettingValueInteger("ProductAttribute.Textbox.Width", 300);
                                    txtAttribute.ID = controlId;
                                    divAttribute.Controls.Add(txtAttribute);
                                }
                                break;
                            case AttributeControlTypeEnum.MultilineTextbox:
                                {
                                    var txtAttribute = new TextBox();
                                    txtAttribute.ID = controlId;
                                    txtAttribute.TextMode = TextBoxMode.MultiLine;
                                    txtAttribute.Width = SettingManager.GetSettingValueInteger("ProductAttribute.MultiTextbox.Width", 300);
                                    txtAttribute.Height = SettingManager.GetSettingValueInteger("ProductAttribute.MultiTextbox.Height", 150);
                                    divAttribute.Controls.Add(txtAttribute);
                                }
                                break;
                            case AttributeControlTypeEnum.Datepicker:
                                {
                                    var datePicker = new NopDatePicker();
                                    //changes these properties in order to change year range
                                    datePicker.FirstYear = DateTime.Now.Year;
                                    datePicker.LastYear = DateTime.Now.Year + 1;
                                    datePicker.ID = controlId;
                                    divAttribute.Controls.Add(datePicker);
                                }
                                break;
                            default:
                                break;
                        }
                        
                    }
                
                    lblAdjustmentTableScripts.Text = adjustmentTableScripts.ToString();
                    lblAttributeScripts.Text = attributeScripts.ToString();
                }
                else
                {
                    this.Visible = false;
                }
            }
            else
            {
                this.Visible = false;
            }
        }
12 years ago
hi Jack,
Thanks for your post. I am trying to upgrade to 1.90 but it´s not working as I suposed. We have 2 attributes (color and size) for each product and I imagined when one of them was selected (one color in a dropdown list, for istance), the page was refreshed and the another dropdown list attrbute (size)  was updated only with values in stock. Is it that right?  If yes, there are something wrong here.. rs... If not, please explain the behavior of your implementation. When I finish this upgrade I will publish it here, ok?
Thanks again.
12 years ago
Hi,

When I wrote this I was only dealing with products which have one product attribute (size). You're going to need to modify this to make it work for the way you want. As you say your size's available depend on your colours so it's going to be different.

Good luck!
12 years ago
Ok, thanks .
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.