Click to See Complete Forum and Search --> : shopping cart problems


esthera
12-08-2004, 01:33 AM
I created a shopping cart. The shoppingcart table stores the sessionid, productid, and qty.

Now we are coming up with a few items that have properties. Such as a ring that has different sizes and colors.

Can anyone recommend the easiest way for me to add properties to my shopping cart without having to rewrite all the code???

It also only applies to a few items out of 200.

russell
12-08-2004, 02:39 AM
create a new table and link it to the items (or whatever the table with the ring is in) and custoner tables via foreign keys.

the table definition might look like

Create Table RingOrders (
customerId bigint not null,
ringId int not null,
size int not null,
color varchar(32) not null,
Constraint FK_RingOrderCustomer Foreign Key
(customerId)
References
(Customers.CustomerId),
Constraint FK_RingOrderItem Foreign Key
(ringId)
References
(items.productId)
)

You'll need to modify any forms and any middle tier code that reads/writes ring orders to the db.

esthera
12-08-2004, 02:44 AM
but currently my cart works easily -- I have a catalog diplaying items and I have add to cart which just adds the product id and allows for updating of quantity.

The catalog of displaying the items is dynamic from the database.
How would I do this change that it just effects this item and it displays properly in the catalog. I think I need to do something general in case another item (not ring) comes up that might have different colors. (Ring has both different colors and different sizes)

How would you go about doing this?

Thanks for your help.

russell
12-08-2004, 12:37 PM
maybe make a seperate entry in the items table for each possible size/color combination. would need to see your shopping cart db schema to give a better answer.