Ecommerce Managing product inventory during payments

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Ecommerce Managing product inventory during payments

Post by kendall »

Hey guys I need some advice...

I am building a shopping cart system and when the payment process is done the product quantity needs to be updated. How can I prevent a scenario where by a customer A is in the mist of purchasing a quantity of products that were available probably 10 seconds before customer B came and JUST bought an amount that would probably deplete the products quantity to a minimum that cannot supply customer A's purchase?

thus
customer a and b see that there are 10 of the same item available
customer A chooses to buy 5
customer B ends up buying 6 right before customer A's transaction goes through

I was thinking to lock the product but i'm not sure how that is possible...

What is usually done?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Ecommerce Managing product inventory during payments

Post by Christopher »

I don't think there is a good way to deal with this, so simple and bulletproof is what I would recommend. The reality is that whichever customer gets there first -- the other customer did not get enough of what they wanted. The customer who got enough is not the problem. You are better off focusing on the customer with the problem, with a backorder system, cancellation process, cross-sell, up-sell, etc.
(#10850)
Post Reply