Hi All,

I'm after some preformance opinions based on the below, any thoughts? On my laptop it's adding roughly 20% processing time when loading 20 ProductBoxes... With the feature turned off the page takes 1 second, with it on it takes 1.2 seconds.

I have just implemented displaying instock product attributes in ProductGrids which use /Modules/ProductBox1.ascx.

Added Control to /Modules/ProductBox.ascx


<asp:Panel ID="PnlSizes" runat="server" EnableViewState="false"></asp:Panel>


Added following code to /Modules/ProductBox.ascx.cs at line: 85


if (SettingManager.GetSettingValueBoolean("Display.ProductBox.SizesInStock") == true)
                        {
                            var pvas = productVariant.ProductVariantAttributes;
                            var pvaCs = productVariant.NpProductVariantAttributeCombinations;
                            //PnlSizes.Controls.Add(new LiteralControl(" pvas= "));
                            if (pvas.Count > 0 && pvaCs.Count > 0)
                            {
                                //Ok we have product attributes.
                                foreach (NopSolutions.NopCommerce.BusinessLogic.Products.Attributes.ProductVariantAttribute pva in pvas)
                                {                                    
                                    if (pva.NpProductAttribute.Name.ToLower() == "size")
                                    {
                                        
                                        foreach (ProductVariantAttributeValue pvaV in pva.NpProductVariantAttributeValues)
                                        {
                                            
                                            foreach (ProductVariantAttributeCombination pvaC in pvaCs)
                                            {
                                                if (pvaC.StockQuantity > 0 && ProductAttributeHelper.AreProductAttributesEqual(pvaC.AttributesXml, ProductAttributeHelper.AddProductAttribute("", pva, pvaV.ProductVariantAttributeValueId.ToString()))) {
                                                    if (PnlSizes.Controls.Count != 0) {
                                                        PnlSizes.Controls.Add(new LiteralControl(" | "));
                                                    }
                                                    PnlSizes.Controls.Add(new LiteralControl(pvaV.Name));
                                                }
                                            }    
                                        }
                                    }
                                }
                                if (PnlSizes.Controls.Count == 0) { PnlSizes.Visible = false; }

                            }
                            else { PnlSizes.Visible = false; }
                        }
                        else
                        {PnlSizes.Visible = false;
                        }