PDA

View Full Version : shopping cart table


lane87
03-18-2009, 10:04 PM
evening all,

just wondered if anyone could help me

i have a cart table : cartID - autonumber, customerID - number

i can insert the customerid no problem but when i add more than one item to the cart it will create a new cartid i.e.

1st item = cartID 1, customerID 1
2nd item = cartID 2, customerID 1
3rd item = cartID 3, customerID 1

so its creating a new cart for each product added to the cart.

Could anyone suggest anything that i could do

thanks

Old Pedant
03-19-2009, 01:09 AM
I wish you would just post your questions in ONE forum.

You should *NOT* create a new cart record for each item!!!

You create the cart ONE TIME.

Then you add the items, using the cartID of that cart.

In your CART table, besides CUSTID and CARTID, you might add fields such as ORDERDATETIME, PAYMENTMETHOD, etc., etc. That is where you put all the stuff that you need for ONE cart. Then the items are added to the CARTITEMS table and they do NOT need to repeat all that stuff (nor should they!).

If anybody else cares, Lane's long thread on this is here:
http://www.aspmessageboard.com/showthread.php?t=231111

By the way, conventionally, once a user says "buy the stuff in my cart", the tables that you add to are the ORDERS table (instead of CART in your system) and the ORDERITEMS table (instead of CARTITEMS). You don't have to use thos table names, of course, but if you see other posts talking about "order entry systems" this is exactly what they are talking about.