예제 #1
0
$row[] = 'Diamond Certificate Type';
$table[] = $row;
foreach ($preorder->items as $i) {
    $pid = $i['products_id'];
    $aid = $i['articles_id'];
    $pdata = $class_pm->retrieveDetail($pid, 'p,pd,pd2,pnc,cat');
    $obj_product = new Product($pid);
    $adata = $aid == 0 ? null : $class_pa->retrieveDetail($aid);
    if (is_null($adata)) {
        $ean = $pdata['p']['products_ean'];
        $length = $pdata['pnc']['products_length'];
    } else {
        $ean = $adata['products_ean'];
        $length = $adata['length'];
    }
    $colors = $class_pm->loadColorPatternNames($pid, '2');
    $colors_main = '';
    if (is_array($colors)) {
        foreach ($colors as $c) {
            $colors_main = $c;
            break;
        }
    } else {
        $colors = array();
    }
    $materials_ids = $class_pm->loadProductMaterials($pid);
    $materials = array();
    foreach ($materials_ids as $mid) {
        $materials[] = $materials_name[$mid];
    }
    $pues = $class_pm->retrieveElementsUsage($pid, 0);
 //CATEGORY CHECK
 if ($category_name == '' || $category_name == 'No Category Name') {
     $product_errors[] = 'Product Category is not yet set';
 }
 //SUBCATEGORY CHECK
 $subcat_group = $category->getCategoryTop()->getSubCategoryGroup();
 $attributes = $class_s->getProductStyles($pid);
 $subcategory = $attributes[$subcat_group];
 $subcattotal = count($subcategory);
 if ($subcattotal == 0) {
     $product_errors[] = 'Product has no Subcategory';
 } elseif ($subcattotal > 1) {
     $product_errors[] = 'Product can only have 1 Subcategory';
 }
 //COLORS CHECK
 $pdata['colors'] = $class_pm->loadColorPatternNames($pid, $lid);
 $pdata['colors_total'] = count($pdata['colors']);
 $include_neon = isset($pdata['colors']['22']);
 //ID 22 = neon
 $color_reject1 = !$include_neon && $pdata['colors_total'] > 1;
 $color_reject2 = $include_neon && $pdata['colors_total'] > 2;
 if ($color_reject1 || $color_reject2) {
     $product_errors[] = 'Product has more than 1 color' . '(and 1 of them is not neon)';
 } else {
     //now check if we have duplicate colors
     $color_ids = array_keys($pdata['colors']);
     sort($color_ids);
     $color_key = implode('-', $color_ids);
     if (in_array($color_key, $family_colors)) {
         $product_errors[] = 'Family has already a product ' . 'with the same color';
     } else {
         if ($sp_languages_id == $languages_id) {
             $sda = array();
             $sda['name'] = $name;
             $sda['description'] = $description;
             $sda['products_selling_points'] = $sellingpointsamde;
             $sda['short_name'] = $shortname;
             $sda['promo_name'] = $promoname;
             $sda['keywords'] = $keywords;
             $class_jc->updateField($catalog_id, $sda);
         }
     }
     //disabled this, now its already handled on class products_minierp on each functions that possible need image reupload
     //reupload changes to ot.de and am.vd
     //tep_db_query("UPDATE jng_sp_catalog SET image_uploaded='0' WHERE jng_sp_id IN (2,5) AND products_id=$products_id");
     $pdata = $class_pm->retrieveDetail($products_id, 'p,cat');
     $products_colors = $class_pm->loadColorPatternNames($products_id, $languages_id);
     use_class('products_brand');
     $class_pb = new products_brand();
     $products_brand = $class_pb->retrieveDetail($pdata['p']['products_brand_id']);
     $result = array();
     $result['languages_id'] = $languages_id;
     $result['keywords'] = $keywords;
     $result['autokw-amvd'] = addAutoKeywords($keywords, 188, $name, $products_colors);
     $result['autokw-otde'] = otdeAutoKeywords($name, strtoupper($products_brand['brand_name']), $class_pm->retrieveCategoryName($pdata['categories_id'], '2'));
     ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == "SAVECOLORS") {
     $color_pattern_id = $_POST['colors'] == '' ? array() : explode(',', $_POST['colors']);
     $class_pm->setColorPattern($products_id, $color_pattern_id);
     $q = tep_db_query("SELECT jng_sp_catalog_id, jng_sp_id FROM jng_sp_catalog WHERE products_id={$products_id}");
     $sp_list = array();