Results 1 to 15 of 15

Thread: [RESOLVED] Update cart quantity for same items

Threaded View

  1. #9

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    49

    Re: Update cart quantity for same items

    Hi kows,

    Removed the @, got a $result error, tried it in PHP Admin using a number instead of the order session variable and it was fine.

    Echo'ed out the order session variable and there was nothing stored.... checked the other page and it was a case problem, orderid vs OrderID .... doh.

    Just to confirm, I can use $OrderID and Session['OrderID'] seperately as they are two different var's yes?

    Also regarding querying the database as little as possible, do I need to have:
    PHP Code:
    extract(mysql_fetch_assoc(mysql_query("SELECT ProductPrice FROM product WHERE ProductID='{$_REQUEST['productid']}' LIMIT 1")));
    if(
    $ProductPrice 0){ 
    If instead I can use the $price that was posted along with the quantity and productid? Could I use this variable instead of $ProductPrice and get rid of the extract query?



    So my cart and quantity are now looking pretty good. Which means I can now go back to my other cart issue from earlier o_0

    Currently:
    A guest comes to the site - add's items to the cart - then logs in.
    The order is updated with the customer's id.
    If the customer logs out, and comes back later and logs in and goes to the show cart the previously added items are there (which is fine. The query is to display all 'unsaved' orders for that customers id).
    But if they add another item the order id is not set anymore since they logged out. So a new order is created for any items added when they log back in.

    So I figure I can either:
    1) Add a statement on the show cart page, to detect if there is 1 or more orders present for the same customer with a status of unsaved. If so, somehow combine them and delete the customers other 'unsaved' order records. Make sure combined order is the session orderid.
    OR
    2) Add another check on the product pages, to add it to their previous unsaved order if there is one, and use that order id as the session order id.

    I think number 2 is more manageable. Only problem is, if they log out and return as a guest, then I can't do a check for existing orders as I won't have their customer id.

    Which leads me to think I would have to do it on the show cart page... does this sound correct?
    Last edited by buffy; Mar 28th, 2009 at 11:46 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
  •  



Click Here to Expand Forum to Full Width