Inventory updates are optionally managed for each item based on sales of items. This is very basic stock management that may or may not serve your purposes. It is primarily meant to allow you to stop taking orders for items that you're out of, more so than providing accurate stock management. The process is controlled through interaction of the invoice, lineitems and items business objects. The following rules apply:

Inventory is managed only for items marked as Physical
The wws_items table has a Physical field which determines whether inventory is updated for an item when an invoice is saved.

Inventory is updated only when an invoice is saved
While orders are being entered inventory is not updated in any way until you call the Save method of the Invoice object. This triggers a sequence of events that first removes all lineitems from the invoice and puts items back into inventory, then takes them all out again and adds it back to the invoice resulting in accurate inventory counts. Note that this can lead to potential stock shortages especially on the Web when items are near 0 stock counts and multiple people are putting the same item into their shopping baskets.

Inventory stock checks are not necessarily automatic
If you use cLineItems::AddLineItem() an inventory check will be performed automatically. But if you create lineitems on the fly and add them to the invoice lineitem array no implicit checks are performed. You can use the cItem::CheckStock and cItem::UpdateInventoryCount().

Inventory Strategies


There are different ways to approach inventory in your applications. Most likely you'll be interfacing the store application to an existing accounting or POS application. In these scenarios it's most common to transfer inventory data between the Web app and the target application performing import/export operations to and from the store's files.

Another approach might be to directly interface with your existing inventory management when orders are placed. So you could override the routines that handle the inventory checking and updates (cLineItems and cItem classes).

Finally for non-physical product businesses or companies that sell only a handful of products that will never be out of stock simply turn off the physical flag on all items and allow orders to be placed without any regard to inventory levels.


How it works


Inventory stock is updated through the cInvoice::Save and cLineItems::Delete methods.


Last Updated: 5/31/2003 | Send topic feedback