} if (isset($_POST['usr_name_chk']) && $_POST['usr_name_chk'] != '') { $reference = $_POST['reference_login']; $user_name = $_POST['usr_name_chk']; $user_pass = $_POST['usr_pass_chk']; $user_login = UserLogin($user_name, $user_pass); $chk_cus_status = CheckCusStatus($user_login[0]['cus_compname']); if (count($user_login[0]) > 0) { $_SESSION['sohorepro_userid'] = $user_login[0]['cus_id']; $_SESSION['sohorepro_companyid'] = $user_login[0]['cus_compname']; $_SESSION['sohorepro_username'] = $user_login[0]['cus_contact_name']; $ip = md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']); $items_guest = ItemsTemp($ip); foreach ($items_guest as $items) { $check_spl_price = GetSplPriceProduct($items['product_id'], $user_login[0]['cus_compname']); $unit_prc = count($check_spl_price) == '' ? ProdPriceForAdd($items['product_id']) : GetSplPriceProduct($items['product_id'], $user_login[0]['cus_compname']); $query = "INSERT INTO sohorepro_checkout SET product_id = '" . $items['product_id'] . "', quantity = '" . $items['quantity'] . "', unit_price = '" . $unit_prc . "', user_id = '" . $user_login[0]['cus_id'] . "', staff_id = '0', company_id = '" . $user_login[0]['cus_compname'] . "', reference = '" . $reference . "', shipping_add_id = '0' "; $res = mysql_query($query); } $query = "DELETE FROM sohorepro_checkout_guest WHERE ip = '" . $ip . "' "; mysql_query($query); if ($res) { echo '1'; } } else { } } if (isset($_POST['order_notification']) && !empty($_POST['order_notification'])) { $order_notification_id = $_POST['order_notification_id']; $query = "select * from sohorepro_email where id = '{$order_notification_id}'"; $val_order = mysql_query($query);
//echo '<pre>'; //print_r($_SESSION); //echo '</pre>'; //exit; if($_GET['usr_id'] != ''){ $_SESSION['usr_id_guest'] = $_GET['usr_id']; } $user_id = ($_GET['usr_id'] != '')? $_GET['usr_id']: $_SESSION['sohorepro_userid']; $company_id = ($_GET['comp_id'] != '')? $_GET['comp_id'] : $_SESSION['sohorepro_companyid']; $ip = md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']); if($_REQUEST['order_val'] == '1'){ $items_guest = ItemsTemp($ip); foreach ($items_guest as $items){ $unit_prc = ProdPriceForAdd($items['product_id']); $exist_product = ExistProdInChe($items['product_id'], $user_id); $added_qty = $exist_product[0]['quantity'] + $items['quantity']; if (count($exist_product) > 0) { $query = "UPDATE sohorepro_checkout SET quantity = '".$added_qty."' WHERE product_id = '".$items['product_id']."' AND user_id = '".$user_id."' "; } else { $query = "INSERT INTO sohorepro_checkout SET product_id = '" . $items['product_id'] . "', quantity = '" . $items['quantity'] . "', unit_price = '" . $items['unit_price'] . "', user_id = '" . $user_id . "', staff_id = '0', company_id = '" . $company_id . "', reference = '" . $job_reference . "', shipping_add_id = '0' "; } mysql_query($query); } $query_guest = "DELETE FROM sohorepro_checkout_guest WHERE ip = '".$ip."' "; mysql_query($query_guest); } $shipping_address = ($company_id != '') ? ShippingAddressAll($company_id): ShipAddNewSup($user_id) ; $shipping_size = count($shipping_address);
// if ($sql_result) { // $result = "success_addprod"; // } else { // $result = "failure_addprod"; // } // } $additional_products = AdditionalProduct($order_id); foreach ($additional_products as $additional) { $product_id = $additional['product_id']; $product_qty = $additional['product_quantity']; $order_id = $additional['order_id']; $product_name = mysql_real_escape_string(ProdNameForAdd($product_id)); $product_price = ProdPriceForAdd($product_id); $shipp_add_id = GetShippforAddProd($order_id); $sql = "INSERT INTO sohorepro_product_master SET product_id = '$product_id', product_price = '$product_price', product_quantity = '" . $product_qty . "', product_name = '$product_name', order_id = '$order_id', shipping_add_id = '$shipp_add_id'"; mysql_query($sql); } $query = "DELETE FROM sohorepro_products_order_temp WHERE order_id = '".$order_id."' "; $sql_result = mysql_query($query); if ($sql_result) { $result = "success_addprod"; } else { $result = "failure_addprod"; } }