Help me, please, with the algorithm for attribute groups - how best to implement this (the code is not needed, only the algorithm):
A product has attribute groups, and a group has attributes. The user first selects a value of group in the product , and then selects a value of an attribute from the attributes belonging to the group. Price premium depends on the group, and does not depend on the attribute itself. In the product there are several groups and several attributes without groups. Accordingly, there can be a lot of combinations.
For example, a product is a carpet, two attributes without groups — width (50, 60, 70, ..., 240, 250) and length (50, 60, 70, ..., 240, 250), two group attributes:
group1 - material:
wool + $ 20 (attributes - mohair, cashmere, merino, alpaca, ..., angora),
artificial thread + $ 0 (attributes - acrylic, polyamide, polyester, ..., polypropyl),
vegetable + 0 $ (attributes - viscose, bamboo, flax, cotton, jute, hemp, ..., sisal)
silk + $ 1000 (attributes - 1000, 1400, ..., 2000)
group2 - palette:
autumn + $ 0 (attributes - red, warm, ..., wine)
winter + $ 10 (attributes - cold, blue, ..., frosty)
summer + $ 0 (attributes - hot, ..., colorful)
How best to accomplish this task? (version 1.6)