Installation and deployment
Version 7.x > Installation and deployment > Inventory Synchronization View modes: 
User avatar
Member
Member
bryanallott - 5/6/2013 2:57:00 AM
   
Inventory Synchronization
When synching document content, and particularly product data- how are individual fields handled, particularly the "stock on hand" field.. i.e. items available.

eg.
On staging, let's say we start with 20 items avail and synch to production. later, 5 are sold live. When we make a change to the product data (say, the product description) and synch the document again... the inventory items available remains untouched, correct?


User avatar
Kentico Support
Kentico Support
kentico_filipl - 5/6/2013 6:50:58 AM
   
RE:Inventory Synchronization
Hello Bryan,

Staging works as expected for products, too, i.e. if number of available items changes on a production server, then you change product description on a staging server but the number of available items stays the same as the original one and you execute the staging task, available items field will be changed on the production server, too.

To avoid this behaviour, you will have to handle the tasks manually through API. I would recommend you to save the value in this field before the staging task is performed and then restore it afterwards.

Useful API examples for staging can be found in Site Manager -> Support -> API Examples -> Tools -> Staging.

Best regards,
Filip Ligac

User avatar
Member
Member
bryanallott - 6/25/2013 4:14:42 PM
   
RE:Inventory Synchronization
Thanks, Filip, I've had a look at all the samples, but don't see any real way of solving this easily.

The inventory (SKUAvailableItems) value on the production server SKU object can't be changed by a synch. Even with bi-directional synching, there's a window between editing on staging and synching where customers are purchasing and the inventory management messes up.
So having a solution controlled from the staging environment doesn't really work.

The events I've looked (DocumentEvent -BeforeUpdate) for example runs for *all* updates, so when an order is placed as an example, that code will run- and legitimately update the inventory. UNLESS: is there a way to determine the source of the Document Update (like, is this update a result of a staging task). Barring that, controlling the inventory from production server can't work either (when there's a staging server involved).

There must be a standard way for managing stock levels across the server environments though? One where if you did a physical stock take in the warehouse, it would match up with inventory available on the production server; even as the product object/document changes over time (new pricing).

It seems to be a fundamental function for an ecommerce system it feels like I've overlooked something maybe?

I can see a potential solution where a handler for Document.Update on production server immediately does a bi-directional synch to staging, updating the inventory level.

Unfortunately, if there were any edits to the staging document (eg. new price) waiting to synch, they would be lost.

How does everybody else control inventory levels reliably? Using a third party reference?

User avatar
Member
Member
bryanallott - 6/25/2013 5:58:48 PM
   
RE:Inventory Synchronization
Ah. Found one potential solution in StagingEvents... hopefully this works :)

User avatar
Kentico Support
Kentico Support
kentico_filipl - 6/28/2013 2:30:43 AM
   
RE:Inventory Synchronization
Hello Bryan,

Have you solved your problem using StagingEvents?

This is probably much more effective but also more difficult way (as for implementation) of handling staging changes than using bi-directional staging and setting an interval of Content synchronization scheduled task to some short period of time.

Best regards,
Filip Ligac

User avatar
Member
Member
bryanallott - 6/28/2013 4:12:41 AM
   
RE:Inventory Synchronization
The bi-directional staging unfortunately doesn't really work, even with very short periods of time. That gap between synch and someone buying a product is subject to error (or worse client case; having a shopper place and pay for an expedited order for an out-of-stock item)

We also potentially end up burning cycles on Azure and increasing network chatter in the hope of closing that gap, but even then, that gap still remains a problem.

I have found StagingEvents to be the ultimate solution though. This way there really is only one version of the truth wrt stock levels- and that is what is on the shelf :) The testing so far has proved to be quite successful.

The only thing I have noticed in this development effort is that this is not particularly documented, that is, using the StagingEvents delegates. At the moment, it is public and thus consumable so my hope is that this remains so in future versions =D

User avatar
Kentico Support
Kentico Support
kentico_filipl - 6/28/2013 5:01:57 AM
   
RE:Inventory Synchronization
Hello Bryan,

All global events (including Staging events) should remain public to let administrators handle them to achieve their required functionality so you really do not have to worry about it.

Even if there were any API changes, they would be documented and workarounds would be provided as well. However, that is highly unlikely.

Best regards,
Filip Ligac