Permutations of product options – advice for approaching this problem
I've been struggling to get my head around a coding problem and wondered if someone could point my in the right direction.
Essentially, I'm trying to create a list of all the possible customisation options available to each of our products.
E.g. ProductA can come in black or red or blue. Then it can come with or without a shelf. So already we have 6 possibilities. Black with and without a shelf. Red with or without and blue with or without a shelf.
Now imagine if we had a potentially unlimited number of customisations. My head just explodes trying to conceptualise how I might begin to create a loop that goes through an unlimited number of products and options.
So first up… is that ever doable? I feel like it's something that clearly someone has done somewhere along the line has done I just can't begin to know how to approach it and I'd just like a little direction.
Secondly. As if that bit weren't grim enough sometimes a customisation might only be able to be done dependent on a previous condition. So for expanding out the example above only those products who have opted for a shelf can have a rail as well but products with a shelf and without can have a hook.
Submitted July 12, 2017 at 11:31PM by scottwestron
via reddit http://ift.tt/2tOKuM1