Help with cookies for shopping cart?

Results 1 to 3 of 3

Thread: Help with cookies for shopping cart?

  1. #1
    Raheen Guest

    Default Help with cookies for shopping cart?

    Before someone says it, I got Sams 21-days, but can&#039;t find the answer I need. Here&#039;s my prob:<BR><BR> I&#039;m building a shopping cart, and i HAVE to use cookies to do it, as per the assignment. I&#039;m displaying a list of books from a recordset (pg. 1), when I click on a book, i get a details on the book, price, author, etc. (pg2), there&#039;s also the button to add the book to the shopping cart(which is on pg3), however, each time I add a book to the cart, the previous book gets deleted. I need to know how to have multiple books in a cookie at the same time, *without* doing one of those long if/then statements...way too many books for that. I HAVE to add the books 1-by-1 on page checkboxes next to each title on pg1 unfortunately.<BR>I&#039;m aware of keys...I&#039;ve been told to use something like:<BR>Response.cookies("books")("book1")<BR>Res ponse.cookies("books")("book2"),<BR>but how do i get the book titles or id&#039;s (kept in the recordset as well) to fall into the right key? <BR>I suppose once that&#039;s done, I&#039;d use a For/Each loop, but I gotta get &#039;em in there first! HELP! :-)<BR><BR>Thanks for any help/faq&#039;s/URL&#039;s, etc!!!!!!

  2. #2
    Join Date
    Dec 1969

    Default RE: Help with cookies for shopping cart?

    Suggestion:<BR>Append the new info onto the existing info. E.G.<BR><BR>Response.Cookies("cart") = Response.Cookies("cart") & sNewInfo<BR><BR>sNewInfo is string containing info on the newly added book. It could be in the form of "&idBook_Qty". When u go to the checkout, the checkout will need to do some parsing of the cookie to find out which books and how many of each.<BR><BR>Cheers, Alfred Low.

  3. #3
    Raheen Guest

    Default RE: Help with cookies for shopping cart?

    Thanks, but I keep getting the error:<BR>"Object doesn&#039;t support this property or method " <BR><BR>BUT, what I just tried (came to me while i was SLEEPING of all things) is something like:<BR><BR>&#060;%num=num+1%&#062;<BR>&#060;%Res ponse.cookies("book")("CartBookId" & num)=request.form("hidID")%&#062;<BR><BR>and i just checked in the c:/windows/cookie file, and the TWO books i picked were in there! :-) Now I guess I need maybe a For/Each loop to get &#039;em out into a table? Wish me luck...any more/other suggestions/tips greatly appreciated!!!<BR><BR>Please<BR>my hompage:

Posting Permissions

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