I'm trying to save the new stock values in my C# class library; We have a synchronization with back-end stock management software.
Saving the property using the default Umbraco way (getProperty etc.) does not persist the value.
Is there an API call to raise stock levels? The only call I can find is 'GetStock' but obviously that is only for getting the value, not setting the value
Thanks for your reply, but I'm getting the following error:
System.NullReferenceException: Object reference not set to an instance of an object. at TeaCommerce.Umbraco.Configuration.Persistence.DatabaseFactory.Get() at TeaCommerce.Api.Persistence.Repositories.ProductRepository.SetStock(Int64 storeId, String sku, Nullable`1 value) at TeaCommerce.Api.Services.ProductService.SetStock(Int64 storeId, String sku, Nullable`1 value) at TennisToday.CustomCode.pages.UpdateStock.RunUpdateStock()
The SKU is valid, and I've added the productSKU property to the TeaCommerce settings. Any ideas?
Ahh are you running this completely outside of Umbraco? Because Umbraco sets up the database connection and some autofac code. So that is why it properly doesn't work. So if you can add it into your Umbraco project and run it in that context that would be good. Else I need to find a way in TC to say - TC.Umbraco.Setup and then things happens :)
Tea Commerce use the ApplicationBase class of Umbraco to hook stuff up when Umbraco starts. BUT I think that with Umbraco 6 API they changed things so you can get the Umbraco context without the Umbraco application starting. Else try and check your log file in App_Data and see if Tea Commerce has logged anything.
Using Tea Commerce: Stock Management in C#
Hi all,
I'm trying to save the new stock values in my C# class library; We have a synchronization with back-end stock management software.
Saving the property using the default Umbraco way (getProperty etc.) does not persist the value.
Is there an API call to raise stock levels?
The only call I can find is 'GetStock' but obviously that is only for getting the value, not setting the value
Kind regards,
Peter Rombouts
You should use the ProductService.SetStock in the .NET API
Kind regards
Anders
Hi Anders,
Thanks for your reply, but I'm getting the following error:
The SKU is valid, and I've added the productSKU property to the TeaCommerce settings.
Any ideas?
Kind regards,
Peter Rombouts
Ahh are you running this completely outside of Umbraco? Because Umbraco sets up the database connection and some autofac code. So that is why it properly doesn't work. So if you can add it into your Umbraco project and run it in that context that would be good. Else I need to find a way in TC to say - TC.Umbraco.Setup and then things happens :)
Hi Anders,
I'm running an ASPX page which we call in a Umbraco ScheduleTask (put in an assembly, basic routine)
I've got the context of Umbraco:
I can lookup and save/edit nodes, so my context works and Umbraco is up and running.
Any ideas?
Kind regards,
Peter Rombouts
Tea Commerce use the ApplicationBase class of Umbraco to hook stuff up when Umbraco starts. BUT I think that with Umbraco 6 API they changed things so you can get the Umbraco context without the Umbraco application starting. Else try and check your log file in App_Data and see if Tea Commerce has logged anything.
Kind regards
Anders
Hi Anders,
I've found the problem. My code was running in the background, and that loses the TC context
Running the method in foreground fixes the issue.
Thanks for looking at my problem, and I hope someone has use for this info!
Kind regards.
Peter Rombouts
is working on a reply...