use_class('ProductAttribute');
use_class('Category');
use_class('products_minierp');
use_class('products_articles');
use_class('products_materials');
use_class('products_family');
use_class('jng_sp_catalog');
use_class('styles');
$class_pm = new products_minierp();
$class_pa = new products_articles();
$class_pmat = new products_materials();
$class_jc = new jng_sp_catalog();
$class_s = new styles();
$lid = '2';
$materials_name = array();
$materials_list = $class_pmat->retrieveList();
foreach ($materials_list as $mat) {
    //take only materials in german language
    $tmp_mat_name = explode(',', $mat['material_name']);
    $mat_name = trim($tmp_mat_name[0]);
    $materials_name[$mat['products_materials_id']] = $mat_name;
}
/**
 * Function to send message to responsible PIC
 * @global type $TB_CATUPLOAD_ADD_SUPERVISORS
 * @param type $messages
 */
function sendMessageToAdmin($messages)
{
    global $TB_CATUPLOAD_ADD_SUPERVISORS;
    $send_message = '';
 }
 if ($product['pd2']['height'] == '0.00') {
     $product_height = '';
 } else {
     $product_height = $product['pd2']['height'] / 10;
 }
 if ($product['pd2']['weight'] == '0.00') {
     $product_weight = '';
 } else {
     $product_weight = $product['pd2']['weight'] / 1000;
 }
 $product_ean = $product['p']['products_ean'];
 $product_keywords = $product['pd'][3]['products_head_keywords_tag'];
 $product_description = $product['pd'][3]['products_description'];
 $product_selling_points = explode(';', $product['pd'][3]['products_selling_points']);
 $materials = $class_pmat->retrieveList('', 'material_name');
 $product_materials = $class_pm->loadProductMaterials($pid);
 $separator = '';
 foreach ($materials as $mat) {
     if (in_array($mat['products_materials_id'], $product_materials)) {
         $materials_name = explode(',', $mat['material_name']);
         $product_materials_name .= $separator;
         $product_materials_name .= $materials_name[2];
         if (!$separator) {
             $separator = ',';
         }
     }
 }
 $query_color = "SELECT ptcp.products_id, ptcp.color_pattern_id, cpd.name FROM products_to_color_pattern ptcp";
 $query_color .= " LEFT JOIN color_pattern_description cpd ON cpd.color_pattern_id = ptcp.color_pattern_id";
 $query_color .= " WHERE ptcp.products_id = {$pid} AND languages_id = 1";
        $content .= '<td>&nbsp;</td>';
    }
    $content .= '</tr>';
}
$content .= '</table></div>';
$content .= '<div>';
$content .= ' <img id="col-load" src="images/ajax-load-2.gif" style="display:none;" />';
$content .= ' <input type="button" id="submit-col" class="button blue" value="Save" title="Save Changes" />';
$content .= ' <span id="col-stat"></span>';
$content .= '</div>';
$content .= '<div style="clear:left;">&nbsp;</div>';
$content .= '</div>';
$content .= '</div>';
//Acc Panel 3
$mat_columns = 2;
$materials = $class_pmat->retrieveList('products_materials_id NOT IN(15,9,75,53,72)', 'material_name');
//$materials = $class_pmat->retrieveList('', 'material_name');
$products_materials = $class_pm->loadProductMaterials($products_id);
$content .= '<div>';
$content .= '<h3><a href="#">Products Materials</a></h3>';
$content .= '<div>';
$content .= '<div>';
$content .= '<div style="float:left;"><table class="form" border="0" cellpadding="0" cellspacing="0">';
$col = 0;
foreach ($materials as $mat) {
    $col++;
    $cbid = 'mat_' . $mat['products_materials_id'];
    $checked = in_array($mat['products_materials_id'], $products_materials) ? 'checked="checked"' : '';
    if ($col == 0) {
        $content .= '<tr>';
    }