} //NAME CHECK if ($pdata['pd'][$lid]['products_name'] == '') { $product_errors[] = 'Product Name is empty'; } //KEYWORDS CHECK if ($pdata['pd'][$lid]['products_head_keywords_tag'] == '') { $product_errors[] = 'Product Keywords is empty'; } //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) {
$csvcolumns = explode('|||', 'item_sku|||item_name|||manufacturer|||model|||feed_product_type|||brand_name|||external_product_id|||external_product_id_type|||product_description|||update_delete|||standard_price|||quantity|||currency|||product_site_launch_date|||product_tax_code|||sale_price|||sale_from_date|||sale_end_date|||merchant_release_date|||fulfillment_latency|||restock_date|||max_aggregate_ship_quantity|||offering_can_be_gift_messaged|||offering_can_be_giftwrapped|||is_discontinued_by_manufacturer|||missing_keyset_reason|||website_shipping_weight|||website_shipping_weight_unit_of_measure|||display_dimensions_unit_of_measure|||item_display_diameter|||item_display_height|||item_display_width|||item_display_length|||target_audience_keywords|||recommended_browse_nodes|||catalog_number|||bullet_point1|||bullet_point2|||bullet_point3|||bullet_point4|||bullet_point5|||generic_keywords1|||generic_keywords2|||generic_keywords3|||generic_keywords4|||generic_keywords5|||platinum_keywords1|||platinum_keywords2|||platinum_keywords3|||platinum_keywords4|||platinum_keywords5|||main_image_url|||swatch_image_url|||other_image_url1|||other_image_url2|||other_image_url3|||other_image_url4|||other_image_url5|||other_image_url6|||other_image_url7|||other_image_url8|||fulfillment_center_id|||package_length|||package_width|||package_height|||package_length_unit_of_measure|||package_weight|||package_weight_unit_of_measure|||parent_child|||parent_sku|||relationship_type|||variation_theme|||legal_disclaimer_description|||fedas_id|||seasons|||model_year|||designer|||total_metal_weight|||total_metal_weight_unit_of_measure|||total_diamond_weight|||total_gem_weight|||material_type1|||material_type2|||material_type3|||material_type4|||metal_type|||metal_stamp|||setting_type|||number_of_stones|||clasp_type|||chain_type|||ring_size|||is_resizable|||ring_sizing_lower_range|||ring_sizing_upper_range|||certificate_type1|||certificate_type2|||certificate_type3|||certificate_type4|||certificate_type5|||certificate_type6|||certificate_type7|||certificate_type8|||certificate_type9|||certificate_number1|||certificate_number2|||certificate_number3|||certificate_number4|||certificate_number5|||certificate_number6|||certificate_number7|||certificate_number8|||certificate_number9|||gem_type1|||gem_type2|||gem_type3|||stone_cut1|||stone_cut2|||stone_cut3|||stone_color1|||stone_color2|||stone_color3|||stone_clarity1|||stone_clarity2|||stone_clarity3|||stone_shape1|||stone_shape2|||stone_shape3|||stone_weight1|||stone_weight2|||stone_weight3|||is_lab_created1|||is_lab_created2|||is_lab_created3|||inscription1|||inscription2|||inscription3|||stone_depth_percentage1|||stone_depth_percentage2|||stone_depth_percentage3|||stone_table_percentage1|||stone_table_percentage2|||stone_table_percentage3|||stone_symmetry1|||stone_symmetry2|||stone_symmetry3|||stone_polish1|||stone_polish2|||stone_polish3|||stone_girdle1|||stone_girdle2|||stone_girdle3|||stone_culet1|||stone_culet2|||stone_culet3|||stone_fluorescence1|||stone_fluorescence2|||stone_fluorescence3|||pearl_type|||pearl_minimum_color|||pearl_lustre|||pearl_shape|||pearl_uniformity|||pearl_surface_blemishes|||pearl_stringing_method|||size_per_pearl|||number_of_pearls|||style_name|||previous_sale_price|||previous_sale_from_date|||previous_sale_end_date|||estate_period|||back_finding'); $csvdata[] = $csvheader; $csvdata[] = $csvcolumns; echo tep_create_csv($csvdata, $csv_separator, ''); $csvdata = array(); //CSV PER PRODUCT foreach ($products as $p) { //GRAB IMAGE LINKS $imageurl_1 = webImageSource($p['products_clear_image'] != '' ? $p['products_clear_image'] : $p['products_image']); $extra_images = $class_jc->retrieveCatalogExtraImagesForUpload($p['products_id']); $imageurl_2 = isset($extra_images[0]) ? webImageSource($extra_images[0]) : ''; $imageurl_3 = isset($extra_images[1]) ? webImageSource($extra_images[1]) : ''; $imageurl_4 = isset($extra_images[2]) ? webImageSource($extra_images[2]) : ''; $imageurl_5 = isset($extra_images[3]) ? webImageSource($extra_images[3]) : ''; $pdata = Product::getOldProductFunction()->retrieveDetail($p['products_id'], 'pd,pd2'); $styles = $class_s->getProductStyles($p['products_id']); $subcatids = array_keys($styles['S']); $subcatid = $subcatids[0]; //LIMIT ARTICLE OPTION //$limit_nonarticle = 50; //if (!isset($nonarticle)) $nonarticle = 0; $stock = Product::getOldProductFunction()->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $p['products_id'], '0', true); $articles = $product_articles[$p['products_id']]; $p['delivery_days'] = 2; if (count($articles) > 0) { $csvdata[] = drawRowCSV($csvcolumns, 'P', $sp_detail, $p['products_id'], $p['article_number'], $p['date_added'], $p['products_ean'], $p['active_status'], $p['last_active_status'], $p['categories_id'], $subcatid, $p['short_name'], $p['promo_name'], $p['name'], $p['description'], $pdata['pd2'], $p['keywords'], $pdata['pd']['2']['products_selling_points'], $pdata['pd']['2']['topic_name'], $p['navigation'], $p['navigation2'], $p['sp_brand_id'], $p['length'], $p['price'], '', $p['delivery_days'], $imageurl_1, $imageurl_2, $imageurl_3, $imageurl_4, $imageurl_5); $csvdata[] = drawRowCSV($csvcolumns, 'C', $sp_detail, $p['products_id'], $p['article_number'], $p['date_added'], $p['products_ean'], $p['active_status'], $p['last_active_status'], $p['categories_id'], $subcatid, $p['short_name'], $p['promo_name'], $p['name'], $p['description'], $pdata['pd2'], $p['keywords'], $pdata['pd']['2']['products_selling_points'], $pdata['pd']['2']['topic_name'], $p['navigation'], $p['navigation2'], $p['sp_brand_id'], $p['length'], $p['price'], $stock, $p['delivery_days'], $imageurl_1, $imageurl_2, $imageurl_3, $imageurl_4, $imageurl_5); foreach ($articles as $a) { if ($a['active_status'] != '0') { $stock = Product::getOldProductFunction()->stockRetrieve(WAREHOUSE_ID_PRODUCTS_HAMBURG, $p['products_id'], $a['products_articles_id'], true); $csvdata[] = drawRowCSV($csvcolumns, 'C', $sp_detail, $p['products_id'], $p['article_number'], $p['date_added'], $a['products_ean'], $p['active_status'], $p['last_active_status'], $p['categories_id'], $subcatid, $p['short_name'], $p['promo_name'], $p['name'], $p['description'], $pdata['pd2'], $p['keywords'], $pdata['pd']['2']['products_selling_points'], $pdata['pd']['2']['topic_name'], $p['navigation'], $p['navigation2'], $p['sp_brand_id'], $a['length'], $p['price'], $stock, $p['delivery_days'], $imageurl_1, $imageurl_2, $imageurl_3, $imageurl_4, $imageurl_5);