size and color options
I tried to figure out how to add options in the cart for several days but I couldn’t.
I will add two options (color and size) in the product detail pages where size is dependent on color. There might be several ways to design database but my design is as follows:
DIM_Product table has (product_code, product_id, product_desc, pack_price, picture, color_code, size_code, stock, and so on) fields.
DIM_Color table has (color_code, color_id, color_desc) fields.
DIM_Size table has (size_code, size_id, size_desc) fileds.
Please let me know if I miss something to create options in product detail pages (I am trying to understand one option for this help).
First, I created recordset, ‘rscolor’ using two tables (DIM_Product and DIM_Color).
SELECT *
FROM dim_product JOIN dim_color ON dim_product.color_code = dim_color.color_code
WHERE dim_product.stock = 1 AND dim_product.product_id = '12539S'
ORDER BY dim_color.color_desc
Second, I created List/Menu using rscolor recordset.
I selected values as Product_Code and labels as Color_Desc.
Third, I created another recordset, ‘rsproduct’ using the same tables (DIM_Product and DIM_Color).
SELECT *
FROM dim_product JOIN dim_color ON dim_product.color_code = dim_color.color_code
WHERE dim_product.product_code = color_choice
The variable name is color_choice, Type is integer, Default value is -1, and Runtime value is $_POST['Product_Code'] in the Edit Variable dialog box.
Finally, I added cart button using the recordset, ‘rsproduct’, redirected to cart page, and did binding.
When I clicked add to cart button in product detail page, it is not redirected to the cart page but stays in the product page. I tried using ‘rscolor’ for add to cart button as the recordset information is almost same, in this case I could see the cart page but always add the first record where it seems like that binding is not working.
Please help me how to add options to the cart.