Posted on 01/04/2011 01:40:50
Hi Per, I have modified your code. It should work properly now.
Product p = new Product(""); //use empty string as productID. This way Ecom tries to load the product and populate default values. Instead of empty constructor.
// manual setting of product ID is not good solution, because it's a part of product key field (ProductID, VariantID, LanguageID). Please use Number field for not unique values, or create a product field.
p.Name = "AAA";
p.Active = true;
p.Number = "ArticleNo";
p.DefaultShopID = Shop.getShops("SHOP1").get_Item(0).ID; //set shop ID
p.Language = Dynamicweb.eCommerce.Common.Application.DefaultLanguage; //set language ID
p.Groups.Add(new Group("GROUP1")); // add product to a group.
p.Save();
Kind regards.