I'm doing a webshop, and every product can have several variants.
All variants are actually their own product. The SKU is different per product, but the productnumber is the same for all variants of "one product".
The variant combinations is held in a seperate table called variantvalues. In there is the product SKU, fieldname and fieldvalue.
Let's say I have 3 products. SKUs: 0505002699/SB/M, 0505002699/SC/L, and 0505002699/SC/M.
All products have the same productnumber; 0505002699.
The products have the following fields: Color, Size.
These are the values for each product:
0505002699/SB/M
Color: Black
Size: Small
0505002699/SC/L
Color: Blue
Size: Medium
0505002699/SC/M
Color: Red
Size: Small
Anyone with a clue on how I can loop that front end? Final result should be something like: https://i.sstatic.net/rAxeG.png
The problem (for me) is to figure out how to list the possible "configurations".
Anyone?
Just a quick thought of implementation:
If the "configurations" are variable for each product:
Extra tables:
size
- code
- descr
fe:
S - Small
M - Medium
And then a table between product and size:
product_size
- product_id
- size_code
fe:
1 - S
1 - M
2 - S
...
For the color:
product_color
- product_id
- color
fe:
1 - #FFFFFF
1 - #000000
2 - #000000
...
Then you can select all options for each product by product_id.
fe:
SELECT color FROM colors WHERE product_id = $product_id;
SELECT size_code FROM product_size WHERE product_id = $product_id;
EDIT: wow i misread a part of your question, sorry