Developer forum

Forum » Development » Get Variant Names and Values

Get Variant Names and Values


Reply

Hi guys,




I+m creating a Stock Viewer application and I have everything but the product variants, how can I retrieve this?




I have 4 variant groups and products have at least 2 of them with values, how can I get all this in just one product?




my code:




Dynamicweb.eCommerce.Products.ProductCollection products =


                    Dynamicweb.eCommerce.Products.Product.getProductsFromGroup(group);



                foreach (Dynamicweb.eCommerce.Products.Product product in products)


                {


                    ProductStockInfo prd = new ProductStockInfo();


                    prd.GroupID = group.ID;


                    prd.GroupName = group.Name;


                    prd.ProductID = product.ID;


                    prd.ProductCode = product.Number;


                    prd.ProductName = product.Name;


                    prd.ProductStock = product.UnitStock;


                    prd.ProductActive = product.IsActive;



                    foreach (Dynamicweb.eCommerce.Variants.VariantGroupCollection variantGroups in product.VariantGroups)


                    {


                        prd.ProductVariant += variantGroup.Name + ": "; // <-- "Size : Colors : "


                        //Dynamicweb.eCommerce.Variants.VariantNumber.VariantName(product.VariantID, "LANG1").ToString();


                    }



                    //prd.ProductVariant = product.VariantID;



                    prdSIC.Add(prd);


                }




I can get the variant group names, but how about the values?




anyone?




Replies

 

You must be logged in to post in the forum