Advertisement
TheBiagio1996

fcr

Dec 23rd, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.81 KB | None | 0 0
  1. if ($this->psversion() == 5 || $this->psversion() == 6)
  2.         {
  3.             foreach ($fpget as $attr)
  4.             {
  5.                 $combinations[$attr['id_product_attribute']]['combination'] = $attr;
  6.                 if (!isset($combinations[$attr['id_product_attribute']]['combination_name']))
  7.                 {
  8.                     $combinations[$attr['id_product_attribute']]['combination_name'] = '';
  9.                 }
  10.                 $gr = new AttributeGroupCore($attr['id_attribute_group']);
  11.                 $temp1 = $gr->position;
  12.                 $temp2 = $gr->public_name[$this->context->language->id] . ": " . $attr['attribute_name'] . "<br />";
  13.                 $tempArray = array('position' => $temp1, 'text'=> $temp2, 'reference' => $combinations[$attr['id_product_attribute']]['reference'], 'idatt' => $gr_atr->id_attribute_group);
  14.                 array_push($listaTemp, $tempArray);
  15.                 usort($listaTemp, function($a, $b) use ($listaTemp){
  16.                     return strnatcmp($a['position'], $b['position']);
  17.                 });
  18.                 //$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 />";
  19.                 if (isset($combination_images[$attr['id_product_attribute']]['0']))
  20.                 {
  21.                     $combinations[$attr['id_product_attribute']]['image'] = $combination_images[$attr['id_product_attribute']]['0'];
  22.                 }
  23.                 else
  24.                 {
  25.                     $combinations[$attr['id_product_attribute']]['image'] = 0;
  26.                 }
  27.                 $gr_atr = new Attribute($attr['id_attribute']);                
  28.                 $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['id'] = $gr_atr->id_attribute_group;
  29.                 $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['name'] = $attr['attribute_name'];
  30.                 $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['public_name'] = $gr->public_name[$this->context->language->id];
  31.                 $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['type'] = $gr->group_type;
  32.                 $combinations[$attr['id_product_attribute']]['attributes'][$gr->position]['color'] = $gr_atr->color;
  33.                
  34.                 if ($combinations[$attr['id_product_attribute']]['reference'] != end(array_keys($listaTemp))){
  35.                     $exclusion = array (31, 32, 33);
  36.                     foreach ($listaTemp as $item => $valore){
  37.                         if (!in_array($valore['idatt'], $exclusion)){
  38.                             $combinations[$attr['id_product_attribute']]['combination_name'] .= $valore['text'];
  39.                         }
  40.                     }
  41.                     unset($listaTemp);
  42.                     $listaTemp = array();
  43.                 }
  44.  
  45.                 //$matrix_attributes[$gr->position][$attr['group_name']] = 1;
  46.                 //$matrix_attributes[$gr->position][$gr->public_name[$this->context->language->id]] = $gr_atr->id_attribute_group;
  47.                 $matrix_attributes[$gr->position]['name'] = $gr->public_name[$this->context->language->id];
  48.                 $matrix_attributes[$gr->position]['id'] = $gr_atr->id_attribute_group;                
  49.                 $matrix_attributes[$gr->position]['id_value'] = $gr_atr->id;
  50.                 //ksort($combinations[$attr['id_product_attribute']]['attributes']);
  51.                 //ksort($matrix_attributes);
  52.                 echo("<script>console.log('PHP: ".json_encode($combinations[$attr['id_product_attribute']])."');</script>");
  53.                 //echo("<script>console.log('PHP: ".$gr->position."');</script>");
  54.             }
  55.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement