Results 1 to 2 of 2

Thread: php session handling

  1. #1
    Join Date
    Nov 2005
    Posts
    8

    php session handling

    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?

  2. #2
    Join Date
    Mar 2004
    Location
    China
    Posts
    3,315
    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.

Similar Threads

  1. PHP and MySQL Error handling problems
    By LithMaster in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 23 Oct 2005, 05:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •