I have a product
Dynamicweb.eCommerce.Products.Product product = new Dynamicweb.eCommerce.Products.Product(); product.Name = "Test product"; product.Save();
And a variantgroup
Dynamicweb.eCommerce.Variants.VariantGroup newGroup = Dynamicweb.eCommerce.Variants.VariantGroup.Create("variantGroupFor_" + product.ID); newGroup.LanguageID = "LANG1"; newGroup.Name = product.ID; newGroup.Label = product.ID; newGroup.Save();
I've added a variant to the group
Dynamicweb.eCommerce.Variants.VariantOption Opt = new Dynamicweb.eCommerce.Variants.VariantOption(); Opt.Name = "Variant option"; Opt.GroupID = newGroup.ID; Opt.LanguageID = "LANG1"; Opt.Save(); newGroup.VariantOptions.Add(Opt); newGroup.Save();
Now, all this works fine. The variantgroup is created in the Management Center, and the option is created in the variantgroup.
The problem is, when i try to add the variantgroup to the product
product.AddVariantGroup(newGroup); product.Save();
The group is not added, and therefor not visible in the "Variants" part of the product in the eCommerce backpanel?
Any idea, whats up?
Best regards
Jonas