[ic] Prevent from ordering more than is in stock

Jonathan Clark interchange-users@icdevgroup.org
Tue Oct 15 18:18:00 2002


> MH>>As part of my continuing series plugging IC 4.9, there is now
> a feature
> MH>>that does this:
> MH>>
> MH>>    MaxQuantityField  inventory:quantity
> MH>>
> MH>>You can set a field which will intrinsically limit the order
> quantity to
> MH>>the amount in inventory. If the user orders 9 while 9 are in
> stock, then
> MH>>there is an intervening order for 5, the number on order will
> automatically
> MH>>be adjusted to 4 on the next cart refresh.
> MH>>
> MH>>(The observant will notice that there are of some possible
> problems with
> MH>>contention there, as it would be possible to have an order adjusted
> MH>>between time of loading the checkout page and time of actual order
> MH>>placement. There is some exception handling possible with this, but it
> MH>>isn't documented yet. This type of thing is a very advanced
> function though,
> MH>>and probably anyone using it should be capable of perusing
> the source.)
> MH>>
>
> When is it counting the inventory, and when is it being deducted?
>
> Customer A orders 10 gadgets and puts them in his cart. (There are only 15
> in stock). Does it deduct them then, or does it deduct them when he
> submits his order? Or, after the CC# approval and the receipt sent to him?

When the order is placed, accepted and confirmed to the customer - downdate
inventory happens in etc/log_transaction - a part of the order route.

> Customer B orders 10 gadgets and puts them in his cart at the same time as
> Customer A. They both hit 'submit' within seconds of each other. The first
> one submitted has a declined card, so at that precise moment
> there are 15 in
> stock for customer B. Does customer B only get 5?

Nope. As the customer A is back at the checkout page with a decline error,
the inventory is not downdated here. (Assuming online cc processing)

Jonathan
Webmaint.