Forum Moderators: buckworks
And anything it should be, as well as as many as needed, and whether or not that attribute changes the price or adds to the price, or whether it's required or an add-on, which adds to the price. Don't "hard code" a product attribute in your cart, devise a method to allow you to add any option to any product as needed.
I have a couple posts here on this, the most recent one is described in detail in the database forum [webmasterworld.com].
But that's just "how I would do it." :-)
At the moment i have the folowing tables products, category, product_attribute, product_option, product_option_valuesand product_option_value_to_prodcut_option. My issue is wher to start with the php code.. Any hel will appreciated.
select * from products;
This starts going through your product list in a while loop. One of those will be product id, which you use as a join on the options. While inside this while loop do a select to get the appropriate options for this product:
select * from option_types where product_id='$pid';
Let's say this returns two options color and size as "product option types" for this product. While still inside this while loop, do a third select and another while loop inside the first to get all the values for those associated with this product:
select * from options where option_id='$optionid' and product_id='$pid';
This lists all the options for color, then size; then you end the inner while loop and go on to the next product.
The multiple selects and nested while loops can be eliminated by a single complex select statement that joins all the tables, but start this way to get an understanding of how this would all work.