Open Sharpsturdy opened 9 years ago
Hello, Do you need more information from me? or any other way i can help you find out what is the problem? Or may be you can advice how to update products programatically without CMS back-office?
@Sharpsturdy I guess that Umbraco does not trigger all events when using that code.
You could use code in our after publish event: https://github.com/uWebshop/uWebshop-Releases/blob/develop/Umbraco/uWebshop.Umbraco/ApplicationEventHandler.cs#L737
(the ResetAll probably)
Thanks, I will check your solution in neareast future.
Hello,
I use Umbraco 7.2.6 (also 7.2.5) and uWebShop 2.6.1 I have a problem during updating Product via Umbraco Web API.
After updating product with Umbraco Management API, content is visible in Umbraco back-office, updated and published. But this product is not available via uWebShop API (for example method Catalog.GetAllProducts()) and also this product is not available via url http://{host}/{category}/{product}, but I can rich it via normal Umbraco url http://{host}/catalog/categories/{category}/{product}. if after updating product via ContentService API, I click "Save and Publish" in back office for this product, it become available via url and uWbShop API.
Please look at litle bit simplified code for updating content in UmbracoWebApiControiller:
private void UpdateProduct(ProductModel model) { IContent product = service.GetById(model.ID); //IContnetService service;
service.UnPublish(product); product.ParentId = model.ProductCaregories[0]; product.Name = model.Name; product.Language = "en"; product.SetValue("title" , model.Title); product.SetValue("url" , model.Url); product.SetValue("sku" , model.SKU); product.SetValue("metaDescription" , model.MetaDescription); product.SetValue("description" , model.Description); product.SetValue("features" , model.Features); product.SetValue("shortDescription" , model.ShortDescription); product.SetValue("price" , model.GetConvertedPrice()); product.SetValue("featuredProduct" , model.IsFeatured); product.SetValue("topRatedProduct" , model.IsTopRated); product.SetValue("bestSellerProduct", model.IsBestSeller); product.SetValue("saleProduct" , model.IsSale); service.SaveAndPublishWithStatus(product); }
I would be happy to get any advice how to fix it.
Thanks in advance, Andriy