Connecting Tech Pros Worldwide Help | Site Map

Adding two different records.

Newbie
 
Join Date: Feb 2007
Posts: 4
#1: Feb 20 '07
I am developing a shopping cart and I have the following question.

People can add products to their shopping cart whether they are logged in or not, however their items go to what I call a user_cart or a session_cart respectively.

My question: when the user logs in, all the items from the session_cart are entered into the user_cart. the problem is this allows for duplicates,

is there a way to add the quantity of potentially several items together?

checkout www.SomeGuysStuff.com to see my cart.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Feb 21 '07

re: Adding two different records.


You can use a combination of arrays and structures to achieve what you want.

The struct can contain the product key and each key value will be an array which contains the shopping cart information, e.g. product name, cost, quantity (which you can update).
Reply