View Full Version : php session handling
phouse
07 Nov 2005, 05:07 PM
I've developed a shopping cart with PHP and MySql which works fine. Once an item is added to the cart it is withdrawn from the database instead of leaving the withdrawing till the checkout stage. This avoids shoppers all choosing an item that may be the last in stock. The only problem is if the shopper that has the item in their cart decides not to buy and leaves the site without removing the item from the cart or the session times out, the item hasn't been purchased but also hasn't been put back in the database. What can i do to get round this?
Rincewind
07 Nov 2005, 10:33 PM
Most shops won't take an item off the shop floor without at least a deposit. You should probably practice a similar thing on your site. It's up to the person to pay before the item is removed form stock.
You can get round the out of stock problem by rechecking the availability at the transfer form cart to payment page and also after payment completes. You then error handle what should happen should the item just have sold out - e.g. tell the user that it's just sold out that minute, offer them a chance to pre-order or reserve new stock, tell them when the stock is due back in.
Taking items out of stock that haven't been sold is just asking for problems.
Powered by vBulletin® Version 4.2.0 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.