Should I use ChangeStock or SetStock? ChangeStock doesn't seems to update the node. SetStock can do it, but does it run an umbraco UpdateDocumentCache?
The thing is that we will have around 200-300 people ordering in the same minute. So I think umbraco will die if the cache is updated 200 times in one minute.
Well. The stock management of Tea Commerce uses a separate custom table in the database. This is partly because of performance which would be very slow if the value was on the node. The other part is that we would have to publish the node, which could potentially publish something the user have previously saved.
Your doc type should use the custom Tea Commerce stock datatype, which will fetch the stock from the custom table. Then it should be displayed properly.
Also you should use the GetStock method to retrieve the value for a specific node.
As to your 2-300 people ordering on the same time, that won't be a problem. It's a simple update to the database each time.
ChangeStock vs SetStock ChangeStock will add or withdraw stock from the current stock of the node/product. SetStock will brutally overwrite the stock. Also ChangeStock uses SetStock after calculating the new stock.
Yes, I know about the stock is in the database, and I use the stock datatype on my node.
When I tried ChangeStock, I took the current stock (with GetStock) and took one from that. I can see know thats wrong, and that why I didn't work as I expected.
Update stock from codebehind
Hi,
Is it possible to update stock from c#? I tried some different stuff, and I get an error when I do it the-umbraco-way.
It's related to this post http://our.umbraco.org/projects/website-utilities/tea-commerce/tea-commerce-support/34364-Optimistic-stock-system
/Morten
Hi Morten,
You will need to use the NodeStock class which have a bunch of static methods. It's placed in the TeaCommerce.Data namespace.
/Rune
Hi Rune,
Thanks! I works perfect.
Should I use ChangeStock or SetStock? ChangeStock doesn't seems to update the node. SetStock can do it, but does it run an umbraco UpdateDocumentCache?
The thing is that we will have around 200-300 people ordering in the same minute. So I think umbraco will die if the cache is updated 200 times in one minute.
/Morten
Hi Morten,
Well. The stock management of Tea Commerce uses a separate custom table in the database. This is partly because of performance which would be very slow if the value was on the node. The other part is that we would have to publish the node, which could potentially publish something the user have previously saved.
Your doc type should use the custom Tea Commerce stock datatype, which will fetch the stock from the custom table. Then it should be displayed properly.
Also you should use the GetStock method to retrieve the value for a specific node.
As to your 2-300 people ordering on the same time, that won't be a problem. It's a simple update to the database each time.
ChangeStock vs SetStock
ChangeStock will add or withdraw stock from the current stock of the node/product. SetStock will brutally overwrite the stock.
Also ChangeStock uses SetStock after calculating the new stock.
/Rune
Hi Rune,
Yes, I know about the stock is in the database, and I use the stock datatype on my node.
When I tried ChangeStock, I took the current stock (with GetStock) and took one from that. I can see know thats wrong, and that why I didn't work as I expected.
But every things work perfectly now! Thanks :)
/Morten
No problem. I'm glad to help. :)
/Rune
is working on a reply...