$product_ids[] = 32316; $product_ids[] = 32317; $product_ids[] = 32314; $product_ids[] = 32315; //var_dump($product_ids);die(); $added_to_catalog = 0; $activated = 0; $deactivated = 0; foreach ($product_ids as $product_id) { $check_query = tep_db_query("SELECT jng_sp_catalog_id, active_status FROM jng_sp_catalog WHERE jng_sp_id=2 AND products_id={$product_id}"); if (tep_db_num_rows($check_query) == 0) { $insert_id = $class_jc->addProduct('2', $product_id); if ($insert_id > 0) { $added_to_catalog++; } } else { $cat = tep_db_fetch_array($check_query); if ($cat['active_status'] == '0') { $class_jc->activateProduct($cat['jng_sp_catalog_id']); $activated++; } else { $class_jc->deactivateProduct($cat['jng_sp_catalog_id']); $deactivated++; } } } echo "Success add {$added_to_catalog} to OTTO product_catalog"; echo '<br />'; echo "Success activating {$activated} OTTO product_catalog"; echo '<br />'; echo "Success deactivating {$deactivated} OTTO product_catalog";
$sda = array('products_status' => $status); if ($status == '1') { $active_date = date('Y-m-d H:i:s'); $sda['products_last_modified'] = $active_date; } tep_db_perform('products', $sda, 'update', "products_id={$products_id}"); } else { //SP ACTIVATION use_class('jng_sp_catalog'); $class_jc = new jng_sp_catalog(); $cat = $class_jc->retrieveDetail(null, $jng_sp_id, $products_id); $catalog_id = $cat['jng_sp_catalog_id']; if ($status == '1') { $class_jc->activateProduct($catalog_id); } else { $class_jc->deactivateProduct($catalog_id); } } $result = array(); $result['jng_sp_id'] = $jng_sp_id; $result['products_id'] = $products_id; $result['status'] = $status; ajaxReturn($result); } } //FILTER OPTIONS $products_id_limit = 49360; //LAST PRODUCT ID CREATED WITH CONFIGURATOR $filter_query = " WHERE p.active_status='1'"; $keywords = ''; if (isset($_POST['me_action'])) {
} else { $_SESSION['sp-products-finalize']['keywords'] = $keywords; } } elseif ($_POST['me_action'] == 'UPDATEACTIVESTATUS') { //first deactivate all products in the current page $all_cids = explode(',', tep_db_prepare_input($_POST['cids'])); $cids_to_activate = isset($_POST['cb_product']) && is_array($_POST['cb_product']) ? $_POST['cb_product'] : array(); foreach ($all_cids as $cid) { $catalog = $class_jc->retrieveDetail($cid); if (in_array($cid, $cids_to_activate)) { if ($catalog['active_status'] != '1') { $class_jc->activateProduct($cid); } } else { if ($catalog['active_status'] != '0') { $class_jc->deactivateProduct($cid); } } } } } if (isset($_GET['delete']) && $_GET['delete'] != '') { $jng_sp_catalog_id = tep_db_prepare_input($_GET['delete']); $delete_check = tep_db_query("SELECT jng_sp_catalog_id FROM jng_sp_catalog WHERE jng_sp_catalog_id={$jng_sp_catalog_id}"); if (tep_db_num_rows($delete_check) == 0) { $messagebox->add('1 Product is successfully removed from database.'); } } if (isset($_SESSION['sp-products-finalize']['keywords'])) { $keywords = $_SESSION['sp-products-finalize']['keywords']; $filter_query .= " AND (";
/** * Use this function to check if an EAN should be auto cancel for AMVD * @param String $ean EAN code * @param Array $ean_detail_info the result of function getAMVD_AutoCancelSupportingData() * @param Array $sp_specsets result of "load_config('sp-specific-settings');" dont send anything for auto load * @return Boolean true = EAN should be cancelled */ function checkAMVD_AutoCancelRule($ean, $ean_detail_info, $sp_specsets = null, $deactivate_products = true) { if (is_null($sp_specsets)) { $sp_specsets = load_config('sp-specific-settings'); } $auto_cancel_rule = false; if (!is_null($ean_detail_info) && isset($ean_detail_info[$ean])) { $auto_cancel_rule = $ean_detail_info[$ean]['active_status'] == '0'; if (!$auto_cancel_rule) { $auto_cancel_rule = !in_array($ean_detail_info[$ean]['products_id'], explode(',', $sp_specsets['amvd-autocancel-excludepids'])) && $ean_detail_info[$ean]['active_age'] >= $sp_specsets['amvd-autocancel-productsage'] && $ean_detail_info[$ean]['total_sold'] <= $sp_specsets['amvd-autocancel-articlesold'] && $ean_detail_info[$ean]['total_sold_products'] <= $sp_specsets['amvd-autocancel-productsold']; } } if ($auto_cancel_rule && $ean_detail_info[$ean]['active_status'] != '0' && $deactivate_products) { global $class_jc; if (!is_object($class_jc)) { use_class('jng_sp_catalog'); $class_jc = new jng_sp_catalog(); } $class_jc->deactivateProduct($ean_detail_info[$ean]['jng_sp_catalog_id']); } return $auto_cancel_rule; }