$content .= '<tr><td>Stone Type</td><td><select id="desc2_gt" class="input" disabled="disabled">' . loadComboListFromArray($gem_type, null, $p['pd2']['gem_type']) . '</select> <span class="red">Auto Update</span></td></tr>';
    $amde_stone_type = changeToAmazonDeStoneType($p['pd2']['gem_type'], 'ID');
} else {
    $content .= '<tr><td>Stone Type</td><td><select id="desc2_gt" class="input" disabled="disabled">' . loadComboListFromArray($gem_type, $p['pd2']['gem_type'], null) . '</select> <span class="red">Auto Update</span></td></tr>';
    $amde_stone_type = changeToAmazonDeStoneType($p['pd2']['gem_type'], 'NAME');
}
if ($amde_stone_type == '') {
    $amde_stone_type = 'no value';
}
$content .= '<tr><td>AM.DE Stone Type</td><td><input id="desc2_amdegt" class="input" disabled="disabled" value="' . $amde_stone_type . '" /> <span class="red">Auto Update</span></td></tr>';
//get element attributes data
$el_attr_shapes_data = $class_ea->retrieveListData('sha');
$el_attr_cuts_data = $class_ea->retrieveListData('cut');
$el_attr_size_data = $class_ea->retrieveListData('siz');
$empty_value = array('' => '');
$el_attr_shapes = $empty_value + $class_ea->useGermanNames('element_shape_id', $el_attr_shapes_data);
$el_attr_cuts = $empty_value + $class_ea->useGermanNames('element_cut_id', $el_attr_cuts_data);
$el_attr_sizes = $empty_value;
foreach ($el_attr_size_data as $easzd) {
    if (strtolower(trim($easzd['name'])) == 'other') {
        continue;
    }
    $el_attr_sizes[$easzd['element_size_id']] = $easzd['name'];
}
$content .= '<tr><td>Stone Cut</td><td><select id="desc2_sc" class="input">' . loadComboListFromArray($el_attr_cuts, null, $p['pd2']['element_cut_id']) . '</select></td></tr>';
$amde_stone_cut = changeToAmazonDeCut($p['pd2']['element_cut_id']);
if ($amde_stone_cut == '') {
    $amde_stone_cut = 'no value';
}
$content .= '<tr><td>AM.DE Stone Cut</td><td><input id="desc2_amdesc" class="input" disabled="disabled" value="' . $amde_stone_cut . '" /> <span class="red">Auto Update</span></td></tr>';
$content .= '<tr><td>Stone Shape</td><td><select id="desc2_ss" class="input">' . loadComboListFromArray($el_attr_shapes, null, $p['pd2']['element_shape_id']) . '</select></td></tr>';
Exemplo n.º 2
0
 /**
  * Return description 2 value with german text label as array key and unit as suffix for measurement related
  * @param Array $des2_data Products Description 2 data resut from function $this->retrieveDetail 'pd2'
  * @return Array
  */
 function description2_label($des2_data, $category_id = null)
 {
     //always display the selected label for each category id, unless the value is null (unset)
     $always_display_in_category = array();
     //list for necklace
     $always_display_in_category['2'] = array('length_expandable');
     //list for bracelet
     $always_display_in_category['3'] = array('length_expandable');
     use_class('elements_attributes');
     $class_ea = new elements_attributes();
     $result = array();
     if (is_array($des2_data)) {
         $pd2_alias = array();
         $pd2suffix = array();
         $pd2zerovalue = array();
         if (isset($des2_data['stone_cut'])) {
             $des2_data['stone_cut'] = $class_ea->useGermanNames('', '', $des2_data['stone_cut']);
         }
         if (isset($des2_data['stone_shape'])) {
             $des2_data['stone_shape'] = $class_ea->useGermanNames('', '', $des2_data['stone_shape']);
         }
         //ALIAS
         $pd2_alias['clasp_type'] = 'Verschluss';
         $pd2_alias['setting_type'] = 'Steinfassung';
         $pd2_alias['chain_type'] = 'Art der Kette';
         $pd2_alias['gem_type'] = 'Steinart';
         $pd2_alias['stone_total'] = 'Gesamtanzahl Steine';
         $pd2_alias['stone_cut'] = 'Steinschliff';
         $pd2_alias['stone_shape'] = 'Steinform';
         $pd2_alias['stone_size'] = 'Steingröße';
         $pd2_alias['ring_resizeable'] = 'Verstellbarer Ring';
         $pd2_alias['pearls_total'] = 'Gesamtanzahl Perlen';
         $pd2_alias['pearls_type'] = 'Perlenart';
         $pd2_alias['pearls_color'] = 'Perlenfarbe';
         $pd2_alias['pearls_size'] = 'Perlengröße';
         $pd2_alias['pearls_shine'] = 'Perlenglanz';
         $pd2_alias['pearls_shape'] = 'Perlenform';
         $pd2_alias['pearls_surface'] = 'Perlenoberfläche';
         $pd2_alias['diamond_total_weight'] = 'Gesamtgewicht der Diamanten';
         $pd2_alias['diamond_color'] = 'Farbe des Diamanten';
         $pd2_alias['diamond_clarity'] = 'Reinheit des Diamanten';
         $pd2_alias['diamond_stone_cut'] = 'Schliffart des Steins';
         $pd2_alias['diamond_girdle'] = 'Rondiste des Diamanten';
         $pd2_alias['diamond_polish'] = 'Glanz des Diamanten';
         $pd2_alias['diamond_certificate_type'] = 'Art des Zertifikats';
         $pd2_alias['length_expandable'] = 'Länge erweiterbar';
         $pd2_alias['optical_property'] = 'Optik';
         //$pd2_alias['packaging'] = 'Verpackung';
         $pd2_alias['height'] = 'Höhe';
         $pd2_alias['width'] = 'Breite';
         $pd2_alias['weight'] = 'Gewicht';
         $pd2_alias['diameter'] = 'Durchmesser';
         //VALUE SUFFIX
         $pd2suffix['diamond_total_weight'] = ' carat';
         $pd2suffix['length_expandable'] = 'cm';
         $pd2suffix['height'] = 'mm';
         $pd2suffix['width'] = 'mm';
         $pd2suffix['weight'] = 'g';
         $pd2suffix['diameter'] = 'mm';
         //VALUE TO SHOW IF EMPTY/ZERO
         //IMPORTANT: Only if column name is also
         //added in $always_display_in_category
         $pd2zerovalue['length_expandable'] = 'Nein - nicht erweiterbar';
         foreach ($des2_data as $pd2k => $pd2v) {
             $always_display = !is_null($category_id) && isset($always_display_in_category[$category_id]) && in_array($pd2k, $always_display_in_category[$category_id]);
             if (isset($pd2_alias[$pd2k]) && ($always_display && !is_null($pd2v) || $pd2v != '' && $pd2v != '0')) {
                 if ($pd2v == '' || $pd2v == '0') {
                     //only ALWAYS DISPLAY can go in here
                     if (isset($pd2zerovalue[$pd2k])) {
                         $pd2v = $pd2zerovalue[$pd2k];
                     } else {
                         $pd2v = '-';
                     }
                 } else {
                     if (isset($pd2suffix[$pd2k])) {
                         switch ($pd2suffix[$pd2k]) {
                             case 'mm':
                                 $pd2v = intval($pd2v);
                                 break;
                             case 'g':
                                 $pd2v = number_format($pd2v, 1, ',', '.');
                                 break;
                         }
                         $pd2v .= $pd2suffix[$pd2k];
                     }
                 }
                 $result[$pd2_alias[$pd2k]] = $pd2v;
             }
         }
     }
     return $result;
 }