jay_bo Posted March 28, 2010 Share Posted March 28, 2010 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 Quote Link to comment Share on other sites More sharing options...
otuatail Posted March 30, 2010 Share Posted March 30, 2010 This depends on how they order the goods. If you are selling shirts. Then all you need is a table of products and a seperat drop down of sizes small, medium and large. When you submit this page you will have all the information you need. Desmond. Quote Link to comment Share on other sites More sharing options...
ignace Posted March 30, 2010 Share Posted March 30, 2010 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.