Jump to content

Shopping Cart


jay_bo

Recommended Posts

I have created a shopping cart myself and it works perfectly. However, i would like to add a drop down list for each product so that they can select small, medium and large..but i'm struggling to visualise how i would implement this as at the moment, when i click add to cart it adds the product id(Serial).

 

Would i need to add each product three times...1st one small...2nd medium...3rd Large?

 

In my product table i have:

serial cat_id name description price    quantity

Link to comment
https://forums.phpfreaks.com/topic/196763-shopping-cart/
Share on other sites

Move price & quantity out of your products table then add these tables:

 

products_sizes (id, size_name);
products_has_sizes (products_id, products_sizes_id, price, quantity);

 

SELECT p.name, p.description, ps.size_name, phs.price, phs.quantity
FROM products_has_sizes phs
JOIN products p ON phs.product_id = p.id
JOIN products_sizes ps ON phs.products_id = ps.id

 

This will return:

 

Vintage T-Shirt, .., S, 5.99, 15
Vintage T-Shirt, .., M, 8.99, 3
Vintage T-Shirt, .., L, 10.99, 7

Link to comment
https://forums.phpfreaks.com/topic/196763-shopping-cart/#findComment-1034106
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.