SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict dr_dumb99's Avatar
    Join Date
    Sep 2004
    Location
    Pakistan
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Cookie Based Or Session Based Shopping Cart

    Hi!
    I want to make shopping cart which should be based on PHP cookies or Sessions.

    Some points :

    A- Only data will be fetched from database [like product name, product picture , product price etc].

    B- No data insertion in database tables [untill user clicks on checkout process]

    C- All shopping cart calculations would be handled through PHP cookies or session values.

    Can someone guide in this regards [some code example] and which approach is better :

    1- Cookie based
    2- Session Based

    Thanks in advance

  2. #2
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wel, really, I'd make it session based, but perhaps have an option for user login so that their data, information, and preferences can be stored longer.

  3. #3
    SitePoint Addict dr_dumb99's Avatar
    Join Date
    Sep 2004
    Location
    Pakistan
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, data would be stored in database , but after login. As I don't want to store junk shopping cart data in database and then executing queries to cleanup database. I think it would be better to store data in sessions/cookies so only serious customer's [signed up customers] data would be stored in database .

    Can anyone provide sample code about session/cookie based shopping cart.

    Thanks in advance

  4. #4
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I really disagree. If they are logged in, and they add something to their shopping cart, you probably want it to still be there if they come back later on? That makes the most sense to me.

  5. #5
    SitePoint Addict dr_dumb99's Avatar
    Join Date
    Sep 2004
    Location
    Pakistan
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you are right, but I am all talking about shopping cart handling before login.

  6. #6
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This might help you.

    shopping cart
    Barbara

  7. #7
    SitePoint Addict dr_dumb99's Avatar
    Join Date
    Sep 2004
    Location
    Pakistan
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Barbara1712.....


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
  •