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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.