PDA

View Full Version : How to count the number of PRODUCTS bought in a cart.


mancroft
07-27-2003, 08:11 PM
A shopping cart has a table called "cart" where the customer's selections are stored.

The customer buys 1 item of Product C, 2 items of Product H and 3 items of Product T.

I need to be able to count the number of PRODUCTS bought NOT the number of items. i.e. the answer here is 3.

What is the EASIEST way to do this?

Thanks.

ConfusedOfLife
07-27-2003, 08:38 PM
Well, did you write the db yourself? If you did, you should know it yourself, coz the easiest way always depends on the app that you're working on! Anyways, I think the easiest way is through sessions (whatever server side language you're using, it must have something like this, PHP and ASP have it for sure) and in your sessions array, you can count it. You can also have a temporary table for each customer holding his stuff before he leaves the site. But as I said it really depends on your app.