Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($this->psversion() == 5 || $this->psversion() == 6)
- {
- foreach ($fpget as $attr)
- {
- $combinations[$attr['id_product_attribute']]['combination'] = $attr;
- if (!isset($combinations[$attr['id_product_attribute']]['combination_name']))
- {
- $combinations[$attr['id_product_attribute']]['combination_name'] = '';
- }
- $gr = new AttributeGroupCore($attr['id_attribute_group']);
- $temp1 = $gr->position;
- $temp2 = $gr->public_name[$this->context->language->id] . ": " . $attr['attribute_name'] . "<br />";
- $tempArray = array('position' => $temp1, 'text'=> $temp2, 'reference' => $combinations[$attr['id_product_attribute']]['reference'], 'idatt' => $gr_atr->id_attribute_group);
- array_push($listaTemp, $tempArray);
- usort($listaTemp, function($a, $b) use ($listaTemp){
- return strnatcmp($a['position'], $b['position']);
- });
- //$combinations[$attr['id_product_attribute']]['combination_name'] = $combinations[$attr['id_product_attribute']]['combination_name'] . $gr->public_name[$this->context->language->id] . ": " . $attr['attribute_name'] . "<br />";
- if (isset($combination_images[$attr['id_product_attribute']]['0']))
- {
- $combinations[$attr['id_product_attribute']]['image'] = $combination_images[$attr['id_product_attribute']]['0'];
- }
- else
- {
- $combinations[$attr['id_product_attribute']]['image'] = 0;
- }
- $gr_atr = new Attribute($attr['id_attribute']);
- $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['id'] = $gr_atr->id_attribute_group;
- $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['name'] = $attr['attribute_name'];
- $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['public_name'] = $gr->public_name[$this->context->language->id];
- $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['type'] = $gr->group_type;
- $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['color'] = $gr_atr->color;
- if ($combinations[$attr['id_product_attribute']]['reference'] != end(array_keys($listaTemp))){
- $exclusion = array (31, 32, 33);
- foreach ($listaTemp as $item => $valore){
- if (!in_array($valore['idatt'], $exclusion)){
- $combinations[$attr['id_product_attribute']]['combination_name'] .= $valore['text'];
- }
- }
- unset($listaTemp);
- $listaTemp = array();
- }
- //$matrix_attributes[$gr->position][$attr['group_name']] = 1;
- //$matrix_attributes[$gr->position][$gr->public_name[$this->context->language->id]] = $gr_atr->id_attribute_group;
- $matrix_attributes[$gr->position]['name'] = $gr->public_name[$this->context->language->id];
- $matrix_attributes[$gr->position]['id'] = $gr_atr->id_attribute_group;
- $matrix_attributes[$gr->position]['id_value'] = $gr_atr->id;
- //ksort($combinations[$attr['id_product_attribute']]['attributes']);
- //ksort($matrix_attributes);
- echo("<script>console.log('PHP: ".json_encode($combinations[$attr['id_product_attribute']])."');</script>");
- //echo("<script>console.log('PHP: ".$gr->position."');</script>");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement