I'm currently working on an open source ecommerce system for a CMS I use. I am currently working on product variations. I'm having trouble with calculating each possible option for the variations.
The array currently is like this:
Array
(
[Size] => Array
(
[0] => Small
[1] => Medium
[2] => Large
)
[Colour] => Array
(
[0] => Blue
[1] => Red
[2] => Green
)
)
I want it to return something like this:
Array
(
[0] => Size=Small, Colour=Blue
[1] => Size=Small, Colour=Red
[2] => Size=Small, Colour=Green
[3] => Size=Medium, Colour=Blue
[4] => Size=Medium, Colour=Red
[5] => Size=Medium, Colour=Green
[6] => Size=Large, Colour=Blue
[6] => Size=Large, Colour=Red
[8] => Size=Large, Colour=Green
)
I have tried a few approaches but it's starting to rack my brains. This should also be scaleable for example Size=Large, Colour=Red, Material=Fabric
.
Any help will be greatly appreciated.