|
Shopping Cart
Hi all. I'm coding an online shop for a project. I'm using AJAX extensively on the website and serving it with java servlets. On the back-end is an sql database.
I'm wondering what is the best way (if I should at all..) to represent the shopping cart in the database. The entities I currently have are..
Product [product id, artist, title, description, cost]
User [userid, username, userpassword]
A many-to-many relationship exists between the Product and ShoppingCart and I'm unsure how to construct an intermediate table between the two. I was thinking to use a CartItem entity that can hold a productID, quantity and a userID. That way I can have my ShoppingCart entity have two attributes (cartID and userID).
Sorry if I havn't explained that very well but hopefully someone can tell me if the above solution is workable.
|