Hello,
I think that you can be interested in SKU.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I want to connect products with different options_values and to be able to query these values with grouping by option.
For example:
//Tables
products:
id
name
options:
id
name
option_values:
id
option_id
value
//Data
options:
1 - Colors
2 - Sizes
option_values:
1 - 1 - Red
2 - 1 - Green
3 - 1 - Blue
4 - 1 - Yellow
5 - 2 - Big
6 - 2 - Small
product_option_values:
product_id: 1
option_value_id: 2
product_id: 1
option_value_id: 3
product_id: 1
option_id_value: 5
Is there a way to display the product's values grouped by the option_id?
e.g.:
Color:
Green, Blue
Size:
Big
What relationship should I use in the models?
Or should I created different tables structure? something like:
product_options:
id, product_id, option_id
product_option_values:
product_option_id, value
A bit confused.
Thank you
Please or to participate in this conversation.