//initial version of product converter to amazon product. //it should be adopted to the particular customer needs as many Amazon properties (like category) are unique and can't be mapped automatically. public static Product ToAmazonModel(this moduleModel.CatalogProduct product, IBlobUrlResolver assetUrlResolver, moduleModel.Property[] properties = null) { var amazonProduct = new Product(); amazonProduct.InjectFrom(product); amazonProduct.DescriptionData = new ProductDescriptionData { Brand = "Brand", Description = "Product description", }; amazonProduct.Condition = new ConditionInfo { ConditionType = ConditionType.New }; if (product.Images != null && product.Images.Any()) amazonProduct.ExternalProductUrl = assetUrlResolver.GetAbsoluteUrl(product.Images.First().Url.TrimStart('/')); amazonProduct.SKU = product.Code; amazonProduct.StandardProductID = new StandardProductID { Value = amazonProduct.SKU, Type = StandardProductIDType.ASIN }; //var mainCat = new Home(); //var subCat = new Kitchen(); //mainCat.ProductType = new HomeProductType { Item = subCat }; //amazonProduct.ProductData = new ProductProductData { Item = mainCat }; return amazonProduct; }
//{ // var amazonProduct = new Product(); // amazonProduct.DescriptionData = new ProductDescriptionData // { // Brand = "Brand", // Description = "Product description" // }; // amazonProduct.Condition = new ConditionInfo { ConditionType = ConditionType.New }; // amazonProduct.ExternalProductUrl = "http://demo.virtocommerce.com"; // amazonProduct.SKU = "SKU987654321"; // amazonProduct.StandardProductID = new StandardProductID { Value = amazonProduct.SKU, Type = StandardProductIDType.ASIN }; // amazonProduct.ProductData = new ProductProductData { Item = new Home() }; // var response = SubmitFeedSender.SendAmazonFeeds(new List<Product> { amazonProduct, amazonProduct }, AmazonEnvelopeMessageType.Product, AmazonFeedType._POST_PRODUCT_DATA_, merchantId, marketplaceId, serviceUrl, accessKeyId, secretAccessKey); // (response as List<string>).ForEach(line => Console.WriteLine(line)); // Console.ReadLine(); //} private static Product GenerateProduct() { var amazonProduct = new Product(); amazonProduct.DescriptionData = new ProductDescriptionData { Brand = "Brand", Description = "Product description", }; amazonProduct.Condition = new ConditionInfo { ConditionType = ConditionType.New }; amazonProduct.ExternalProductUrl = "http://demo.virtocommerce.com"; amazonProduct.SKU = "SKU987654321"; amazonProduct.StandardProductID = new StandardProductID { Value = amazonProduct.SKU, Type = StandardProductIDType.ASIN }; var mainCat = new Home(); var subCat = new Kitchen(); mainCat.ProductType = new HomeProductType { Item = subCat }; amazonProduct.ProductData = new ProductProductData { Item = mainCat }; return amazonProduct; }