SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    shopping cart question

    Im coding an e-commerce site....its almost done...have used my first class based code and some smarty templating so am very happy with the organisation of it all....next on to some mvc type stuff.....anyways i ve got the shopping cart to do....one thing that im not sure about is whether to store the products a user has added to thier cart should be stored in a session or in the database? What would/so you do and why?

    Thanks

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Either way is perfectly acceptable. Personally I store them in a temp database and when they are confirmed, run a quick query to select from the temp table, insert into the new table and delete from the temp.

    That way you are only passing an id variable around from page to page
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi spike....sounds good....could you explain what you mean by a temporary database?

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Literally just a table called temp_basket which is a duplicate of the confirmed_basket.
    When the person is shopping and buys something it goes into the temp_basket with a basket_id. When they checkout and confirm their purchases a simple query gets everything from the temp_basket and inserts it into the confirmed_basket based on the basket_id.

    It keeps the confirmed_basket tidy and free from half purchases where they have shopped but not bought.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right right got you...thats a good way of doing it...thanks


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
  •