Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: shopping cart quantities.....


Message #1 by "Phil Perks" <philp@w...> on Tue, 20 Jun 2000 9:42:58
-----Original Message-----
From: Deron Pardue [mailto:dpardue@d...]
Sent: 19 June 2000 23:00
To: support@w...
Subject: Prpfessional PHP Programming 2963

I am using Case Study 1 as a model for a shopping cart I'm currently 
writing in PHP.  I'm having problems with the quantities.

After displaying the cart when I have added items, changing quantities 
works fine; but if want to add more items after displaying the cart, the 
quantities get mixed up with different items .  For example:
Initial Display Cart:
  Item A --- Quantity =  4
  Item B --- Quantity = 2
  Item C--- Quantity = 5
If I delete item C by changing the quantity to 0:
  Item A --- Quantity = 4
  Item B -- Quantity = 2
I add another item and it does something like this
 New Item -- Quantity = 4      (should be quan = 1)
 Item A --- Quantity = 2          (should be quan = 4)
Item B --- Quantity = 1           (should be quan = 2)

In other words, it doesn't keep the arrays for items and quantities in the 
same order.  HELP!  This seems happen only after deleting some items when 
displaying the cart.  I could only allow items to be deleted after all 
purchases are made, but customers won't like this at all.

Also if I logout and login as another user, the quantity of the first item 
will equal the quantity of an item from a previous session.

I assume there is a problem in how the quantity array is being stored in a 
cookie, but I can't seem to find a solution.

Thanks!!!

Deron Pardue
dpardue@d...

  Return to Index