SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    564
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question Web Cart System...

    Hello,

    I am creating a basic shopping cart. I have the following method of creating the cart in my mind. I would like to know if this is how the standards work or if there's some other better option available:

    My way of how cart works:

    Create 2 tables in database named "orders" and "orders_content".
    When user presses Add to Cart button then the product is added into the "orders_content" table with user's current session id so we recognize its this user's items.

    After adding item(s) into the cart using the way above then when user presses the checkout button we ask their details like shipping / billing details and add those details are entered into the "orders" table and the "orders" table has a autonumber field and the generated number is taken and we overwrite the session id (we stored for items in orders_content table) with this auto generated number.

    Now as we have a order number which is unique and generated by system we take the user to the payment page and process payments accordingly.

    The only flaw this system has that once the user has crossed the checkout part and we have replaced session id with order id then if user presses their browser's back button they cannot see their products they added to cart becuase our system is trying to find the particular user's product using session id ...but as we have replaced it with order id so the system cannot find it and user cannot see them.

    Please let me know your thoughts on this one. If you have something better then please let me know your concept or the way standard shopping cart sytems work.

    Please note that we don't want user to register...its come, choose, enter details and pay.

    Thanks.

  2. #2
    SitePoint Addict
    Join Date
    Jul 2006
    Location
    Kansas City, MO
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd suggest storing their cart contents in the session until they finalize the purchase at which point you populate the database.

  3. #3
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    564
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi

    This is what currently i am doing. Should i keep the session id permanently ? Won't it later affect other people with same session id ?

    Thanks.

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you saying you want the user to be able to use thier back button and see thier shopping cart contents after the order is completed?

    i would destroy thier shopping cart once the order is completed. if they want to see what they ordered, provide some kind of an order lookup page where they enter thier orderid and thier email address to verify its them.

  5. #5
    SitePoint Addict
    Join Date
    Jul 2006
    Location
    Kansas City, MO
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm saying store their shopping cart items in the session data until the point which they submit the order, THEN access the database.

    Don't access it beforehand. Storing the session ID is unnecessary.

  6. #6
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    564
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Okay so you say that the session order system is okay as per standards and security ?

    Thanks.

  7. #7
    SitePoint Evangelist Tapan's Avatar
    Join Date
    May 2005
    Location
    India
    Posts
    564
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Red face

    Quote Originally Posted by ZareMedia
    I'm saying store their shopping cart items in the session data until the point which they submit the order, THEN access the database.

    Don't access it beforehand. Storing the session ID is unnecessary.
    Hi,

    I don't think its wise to store a lot of data into the session. Maybe i am wrong but i don't think we should put it in session and then to db.

    Thanks.

  8. #8
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I store my cart data in a session untill such time the order is finalised, at which point I then write the contents to db for my invoice system. Seems to work fine.

    Also within the admin area I added a function to alter the status from "waiting for payment" to "shipping" then "completed", allowing clients to follow their order status online, also makes it easy to remove uncompleted orders keeping the database clean with only successfull purchases.


Bookmarks

Posting Permissions

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