Jump to content

how to change the combination generator code?


Recommended Posts

protected static function createCombinations($list)

{

if (count($list) <= 1)

return count($list) ? array_map(create_function('$v', 'return (array($v));'), $list[0]) : $list;

$res = array();

$first = array_pop($list);

foreach ($first as $attribute)

{

$tab = AdminAttributeGeneratorController::createCombinations($list);

foreach ($tab as $to_add)

$res[] = is_array($to_add) ? array_merge($to_add, array($attribute)) : array($to_add, $attribute);

}

return $res;

}

 

can we change the above code to obtain such combinations

Link to comment
Share on other sites

PrestaShop requires that you use 1 attribute value from each group when creating combinations, and each combination must have the same attribute groups.

 

That means you cannot change the structure of combinations, unless you also change PrestaShop's way of handling combinations (which is a tall order).

 

If you are looking for a system that would allow you to select only some attributes, try https://www.prestashop.com/forums/topic/47363-module-attribute-wizard-pro-create-unlimited-attributes-combinations-choose-frm-7-input-types

Link to comment
Share on other sites

PrestaShop requires that you use 1 attribute value from each group when creating combinations, and each combination must have the same attribute groups.

 

That means you cannot change the structure of combinations, unless you also change PrestaShop's way of handling combinations (which is a tall order).

 

If you are looking for a system that would allow you to select only some attributes, try https://www.prestashop.com/forums/topic/47363-module-attribute-wizard-pro-create-unlimited-attributes-combinations-choose-frm-7-input-types

 

Thank you for your suggestion.

Link to comment
Share on other sites

×
×
  • Create New...