<?php global $db; require_once '../confy.php'; require_once '../functions.php'; require_once '../functions-2.php'; tep_db_connect(); use_class('jng_sp_catalog'); $class_jc = new jng_sp_catalog(); $jng_sp_id = '1'; $filter_query = " jc.active_status='1'"; $nm_cat = $class_jc->retrieveCatalog($jng_sp_id, $filter_query); $new_sp_id = '2'; $update_counter = 0; foreach ($nm_cat as $c) { $check_query = tep_db_query("SELECT jng_sp_catalog_id, status_price, price, price_old FROM jng_sp_catalog WHERE jng_sp_id={$new_sp_id} AND products_id={$c['products_id']}"); if (tep_db_num_rows($check_query) > 0) { $check_result = tep_db_fetch_array($check_query); $catalog_id = $check_result['jng_sp_catalog_id']; if ($check_result['status_price'] == '0' || $check_result['price'] != $c['price'] || $check_result['price_old'] != $c['price_old']) { $sda = array(); $sda['status_price'] = '1'; $sda['price'] = $c['price']; $sda['price_old'] = $c['price_old']; $class_jc->updateField($catalog_id, $sda); $update_counter++; } } } echo "{$update_counter} Products Price is updated."; tep_db_close();
function setParams($products_id, $param_code) { use_class('products_minierp'); $class_pm = new products_minierp(); if ($param_code == 'M') { $param_id_arrays = $class_pm->loadProductMaterials($products_id); $field_name = 'material'; } elseif ($param_code == 'C') { $param_id_arrays = $class_pm->loadColorPattern($products_id); $field_name = 'color'; } else { $param_id_arrays = array(); $field_name = ''; } if ($field_name != '') { if (count($param_id_arrays) == 0) { $sda = array($field_name => ''); tep_db_perform('jng_sp_catalog', $sda, 'update', "products_id = {$products_id}"); } else { use_class('jng_sp_catalog'); $class_jc = new jng_sp_catalog(); $q = tep_db_query("SELECT jng_sp_catalog_id, jng_sp_id FROM jng_sp_catalog WHERE products_id = {$products_id}"); $sp_list = array(); while ($row = tep_db_fetch_array($q)) { $sp_list[$row['jng_sp_catalog_id']] = $row['jng_sp_id']; } foreach ($sp_list as $catalog_id => $jng_sp_id) { $sp_params_raw = $this->load($jng_sp_id, $param_code); $sp_params = array(); foreach ($sp_params_raw as $spr) { if (in_array($spr['param_id'], $param_id_arrays)) { $sp_params[] = $spr['param_value']; } } $sda = array($field_name => implode(', ', $sp_params)); $class_jc->updateField($catalog_id, $sda); } } } }
} //SUBMIT ACTION if (isset($_POST['me_action'])) { if ($_POST['me_action'] == 'SEARCHPRODUCTS') { $keywords = tep_db_prepare_input($_POST['keywords']); if ($keywords == '') { unset($_SESSION[$session_page]['keywords']); } else { $_SESSION[$session_page]['keywords'] = $keywords; } } elseif ($_POST['me_action'] == 'UPDATECATALOG') { $catalog_id = tep_db_prepare_input($_POST['id']); $fieldName = tep_db_prepare_input($_POST['field_name']); $fieldValue = tep_db_prepare_input($_POST['field_value']); $dataArray = array($fieldName => $fieldValue); $class_jc->updateField($catalog_id, $dataArray); if ($fieldName == 'price') { $spArray = array('status_price' => '1'); $class_jc->updateField($catalog_id, $spArray); } $result = array(); $result['id'] = $catalog_id; $result['field_name'] = $fieldName; $result['field_value'] = $fieldValue; ajaxReturn($result); } } //SORT OPTIONS if (isset($_POST['sort_table'])) { $posted = array(); $posted['sort_table'] = tep_db_prepare_input($_POST['sort_table']);
exit; } elseif ($_POST['me_action'] == 'FINALIZETRADEBYTE') { //Update table 'products' $sda = array(); $sda['products_gender'] = tep_db_prepare_input($_POST['products_gender']); $sda['products_agegroup'] = tep_db_prepare_input($_POST['products_agegroup']); tep_db_perform('products', $sda, 'update', "products_id={$pid}"); //Update table 'jng_sp_catalog' $update_tb_status = false; //ZADE UPDATE $catalog = $class_jc->retrieveDetail(null, '8', $pid); if ($catalog !== false) { $sda = array(); $sda['navigation3'] = tep_db_prepare_input($_POST['zade_season']); //$sda['status_price'] = tep_db_prepare_input($_POST['zade_price']); $class_jc->updateField($catalog['jng_sp_catalog_id'], $sda); if (isset($_POST['zade_active']) && $_POST['zade_active'] == '1') { if ($catalog['active_status'] != '1') { $class_jc->activateProduct($catalog['jng_sp_catalog_id']); if ($catalog['last_active_status'] == '0') { $update_tb_status = true; } } } else { if ($catalog['active_status'] != '0') { $class_jc->deactivateProduct($catalog['jng_sp_catalog_id']); if ($catalog['last_active_status'] == '1') { $update_tb_status = true; } } }
} else { $updated_nav2 .= $cur_nav2_arr[$key]; } } elseif ($type == 'addreplace') { if ($val != '0' && $val != $cur_nav2_arr[$key]) { $updated_nav2 .= $val; } else { $updated_nav2 .= $cur_nav2_arr[$key]; } //no changes } } if ($updated_nav2 != $cur_nav2) { $cat_data = array(); $cat_data['navigation2'] = $updated_nav2; $class_jc->updateField($catalog_id, $cat_data); $total_updated++; } } $result = array(); $result['total_updated'] = $total_updated; ajaxReturn($result); } } /*NOT USING THIS BECAUSE WHEN getting > 1000 products_ids GET params is overlimit >> REPLACE USING js top.window $pids = tep_db_prepare_input($_GET['pids']); $products_ids = explode(",", $pids); $n_products = count($products_ids); * */ //MESSAGE BOX WIDGET AREA
<?php global $db; require_once '../confy.php'; require_once '../functions.php'; require_once '../functions-2.php'; tep_db_connect(); use_class('jng_sp_catalog'); $class_jc = new jng_sp_catalog(); $products_ids = explode(',', tep_db_prepare_input($_GET['pids'])); foreach ($products_ids as $pid) { $check = tep_db_query("SELECT * FROM products_removed WHERE products_id = '{$pid}'"); if (tep_db_num_rows($check) == 0) { $r_data = array(); $r_data['products_id'] = $pid; $r_data['removed_date'] = date('Y-m-d H:i:s'); tep_db_perform('products_removed', $r_data); $catalog_ids = $class_jc->retrieveProductCatalogIDs($pid); foreach ($catalog_ids as $catalog_id) { $class_jc->updateField($catalog_id, array('active_status' => '0')); } tep_db_perform('products', array('products_status' => '0'), 'update', "products_id = '{$pid}'"); //HIDE FROM JnG SHOWROOM echo "Products {$pid} is KILLED succesfully !<br/>"; } }
$info_updated = tep_db_prepare_input($_POST['iu']); $info_deactivated = tep_db_prepare_input($_POST['id']); $data = array(); $data['navigation'] = $navigation; if ($_POST['me_action'] == 'ADD') { $insert_id = $class_jc->addProduct($amvd_id, $pid); $jcid = $insert_id[0]; $info_added++; } else { $jcid = tep_db_prepare_input($_POST['jcid']); $data['price_uploaded'] = '0'; $data['active_status'] = '1'; $info_updated++; } //Update AM.VD specific data $class_jc->updateField($jcid, $data); $result = array(); $result['pid'] = $pid; $result['info-added'] = $info_added; $result['info-updated'] = $info_updated; $result['info-deactivated'] = $info_deactivated; ajaxReturn($result); } } //$amvd_catalogs_added = $class_jc->retrieveCatalog(5, "active_status = 1 AND last_active_status = 0"); //$amvd_catalogs_updated = $class_jc->retrieveCatalog(5, "active_status = 1 AND image_uploaded = 0"); //$content = '<div style="float:right;" class="red bold">Price will be updated to all SP and J&G</div>'; $content .= '<div id="info-area" class="bold">New Products Added ( <span class="add">0</span> )'; $content .= ' ⋅ Updated Products ( <span class="update">0</span> )'; $content .= ' ⋅ Deactivated Products ( <span class="deactivate">0</span> )</div>'; $content .= '<div id="display-area">';
} } elseif ($att_topics == null) { removeProducts($pid, $att_colls, $att_symbols); } } } foreach ($products_to_update as $pid) { $class_pm->updateDetail($pid, $gender, $agegroup); if ($addtoamvd == '1') { if ($amvdcatid == '0') { $catalog_id = $class_jc->addProduct('5', $pid); $amvdcatid = $catalog_id[0]; } if ($amvdprice_new > 0) { $sda = array('price_new' => $amvdprice_new); $class_jc->updateField($amvdcatid, $sda); } } $class_pm->saveDescription($pid, $languages_id, $pname, $pdesc, $pkeys, $pshortname, null, null, $topicname, $colname, null, null); $pda['name'] = $pname; $pda['description'] = $pdesc; $pda['keywords'] = $pkeys; $pda['status_price'] = '1'; //$pda['products_selling_points'] = $pspoint; $pda['short_name'] = $pshortname; tep_db_perform('jng_sp_catalog', $pda, 'update', "products_id={$pid}"); } $class_pm->updateFlagContentImproved($products_id, $improved_content); $class_pm->updateFlagImageImproved($products_id, $improved_image); $product = new Product($products_id); $price_uvp = $product->getPriceUVP();