Hi all,
I am trying to create a product variants facility for an ecommerce site
(php/mysql).
Each of my products have options & option values stored in the db like
this:
-------------------- -------------------------
| product_options | | product_option_ values |
-------------------- -------------------------
| option_id | | option_value_id |
| name | | option_id |
| product_id | | value |
-------------------- -------------------------
I have created product variant tables as follows:
-------------------- -------------------------
| product_variant s | | product_variant _items |
-------------------- -------------------------
| variant_id | | variant_item_id |
| price | | variant_id |
| weight | | option_id |
| stock_available | | option_value_id |
| product_id | | |
-------------------- -------------------------
This allows the stock, price etc to be set for combinations of options.
For example:
Blue/Medium/Long Sleeved
Blue/Large/Long Sleeved
The problem comes when i try to generate these variants from the
product options. I need to get all the combinations as shown in the
example but i have no
idea how to do it. For the moment i have created a form where each
combination can be added manually but idealy this would be generated
automatically.
Of its more than possible that this is just not the way to do it ;0)
I'd appreciate any thoughts anyone might have,
Cheers,
Steve
I am trying to create a product variants facility for an ecommerce site
(php/mysql).
Each of my products have options & option values stored in the db like
this:
-------------------- -------------------------
| product_options | | product_option_ values |
-------------------- -------------------------
| option_id | | option_value_id |
| name | | option_id |
| product_id | | value |
-------------------- -------------------------
I have created product variant tables as follows:
-------------------- -------------------------
| product_variant s | | product_variant _items |
-------------------- -------------------------
| variant_id | | variant_item_id |
| price | | variant_id |
| weight | | option_id |
| stock_available | | option_value_id |
| product_id | | |
-------------------- -------------------------
This allows the stock, price etc to be set for combinations of options.
For example:
Blue/Medium/Long Sleeved
Blue/Large/Long Sleeved
The problem comes when i try to generate these variants from the
product options. I need to get all the combinations as shown in the
example but i have no
idea how to do it. For the moment i have created a form where each
combination can be added manually but idealy this would be generated
automatically.
Of its more than possible that this is just not the way to do it ;0)
I'd appreciate any thoughts anyone might have,
Cheers,
Steve