Location: PHPKode > projects > Warp.cms - php/mysql content management > warp_121/cart_ord_op.php
<?php

// [e-commerce cart order operations module v.1.2.1]
// xantis.warp.cms - version 1.2
// (c) 2002 xantis - all rights reserved
// this code is registered and protected by international copyrights laws


//####### Register Globals !

extract($HTTP_ENV_VARS);
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);

//#########################

$ys = rawurldecode($ys);
$ys = base64_decode ($ys);

if ($ys == 'xshopcartoky_acc') {
	$xnt_control_var = 'xnt2002warp.cms';
} //end if

if (empty($yfilename)) {
	$yfilename = 'cart_ord_op.php';
} //end if

require("lib_adv.php");

//#######################################



function xecomm_cart_ord_opx () {

//usr
global	$wxu, $wxp;

//special
global 	$SERVER_PORT, $REQUEST_METHOD, $QUERY_STRING, $REMOTE_ADDR ;

//comm
global	$wchkcrt, $wchkusr, $wpsid ;

//main
global	$arr_var_result, $warp_numform_decimal_sep, $warp_numform_thousand_sep,
	$warp_deny_acc_sect, $y_warp_direct_file_acc_msg_reff, $y_warp_err_data_failure, $y_warp_xdate,
	$y_warp_xtime, $ywebsite_addr_secure, $ywebsite_addr_secure_port, $ywebsite_name ;

//ecomm
global	$yecomm_active, $yecomm_crt_excepting_vat, $yecomm_crt_includding_dev_p, $yecomm_crt_includding_vat,
	$yecomm_crt_subtotal_price, $yecomm_crt_total_deliv_p_list, $yecomm_crt_total_deliv_price, 
	$yecomm_crt_total_deliv_weight, $yecomm_crt_total_topay, $yecomm_crt_totals, $yecomm_deliv_availab_note,
	$yecomm_deliv_time_note, $yecomm_deliv_vat_znote, $yecomm_for_prepos_txt, $yecomm_order_info, 
	$yecomm_order_invoice_prof, $yecomm_order_ip_addr, $yecomm_order_msg_err_01, $yecomm_order_msg_err_02, 
	$yecomm_order_msg_err_03, $yecomm_order_msg_err_04, $yecomm_order_msg_oky, $yecomm_order_ord_no,
	$yecomm_order_server_time, $yecomm_total_deliv_chrg, $yecomm_total_rows, $yecomm_total_weight,
	$yecomm_vat_for_delivery, $yecomm_vat_tax, $yecomm_vendor_company, $yecomm_vendor_company_txt,
	$yecomm_vendor_country, $yecomm_vendor_email, $yecomm_vendor_email_txt, $yecomm_vendor_fulladdr,
	$yecomm_vendor_fulladdr_txt, $yecomm_vendor_phone, $yecomm_vendor_phone_txt, $yecomm_vendor_regcode,
	$yecomm_vendor_regcode_txt, $yecomm_vendor_ty_cust_txt, $yecomm_vendor_ty_txt, $yecomm_yhh_country_destin,
	$yecomm_yhh_country_origin ;
global	$y_warp_office_email, $yecomm_order_vbck_mailsubj, $ywebsite_addr ;

//prods
global	$yprods_item_code, $yprods_item_crr, $yprods_item_crr_code, $yprods_item_crr_expl, $yprods_item_crr_name,
	$yprods_item_delivery_method_d, $yprods_item_delivery_method_p, $yprods_item_delivery_method_s,
	$yprods_item_package, $yprods_item_pname, $yprods_item_price, $yprods_item_qty, $yprods_item_weight_um ;

//usr
global	$ywusr_thecompany_isneeded, $ywusr_user_forcompany, $ywusr_xentire_addr, $ywusr_xentire_company,
	$ywusr_xentire_email, $ywusr_xentire_name, $ywusr_xentire_phone ;


//######################################################### general security checkings

//--------------------------------------
$wordid = ''; //order id
$yx_process_ord_msg_oky = $yecomm_order_msg_oky;
$yx_process_ord_msg_err = $y_warp_err_data_failure;
$yx_process_ord_err = 'ok';
//--------------------------------------



//check request method
if ( ($REQUEST_METHOD <> 'POST') OR (!empty($QUERY_STRING)) ) {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $y_warp_direct_file_acc_msg_reff; 
	} //end if
	$yx_process_ord_err = 'notok';
} //end if


//check if e-commerce active
if ($yecomm_active <> 'y') {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $warp_deny_acc_sect; 
	} //end if
	$yx_process_ord_err = 'notok';
} //end if


//check secure connection
if ($SERVER_PORT <> "$ywebsite_addr_secure_port") {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $yecomm_order_msg_err_01; 
	} //end if
	$yx_process_ord_err = 'notok';
} //end if


//check session
if (strlen($wpsid) < '32') {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $y_warp_err_data_failure;
	} //end if
	$yx_process_ord_err = 'notok';
} //end if


//------------------------ get user auth
//read from users
$ylocal_ord_arr_usr_data = array();
xmysql_read_data_fl ("SELECT id, usr_fname, usr_sname, usr_company, usr_addr, usr_city, usr_reg_st, usr_zip, usr_country, usr_countr_id, usr_phone, usr_email FROM users WHERE ( (MD5(usr_name)='$wxu') AND (MD5(usr_pass)='$wxp') )");
$ylocal_ord_arr_usr_data = $arr_var_result;
//------------------------


$wcheck_local_usr_sum = '';
$wcheck_local_usr_sum = $ylocal_ord_arr_usr_data[1].$ylocal_ord_arr_usr_data[2].$ylocal_ord_arr_usr_data[3].$ylocal_ord_arr_usr_data[4].$ylocal_ord_arr_usr_data[5].
			$ylocal_ord_arr_usr_data[6].$ylocal_ord_arr_usr_data[7].$ylocal_ord_arr_usr_data[10].$ylocal_ord_arr_usr_data[11].$ylocal_ord_arr_usr_data[8].
			$ylocal_ord_arr_usr_data[9].$ylocal_ord_arr_usr_data[0] ;

$wcheck_local_usr_sum_md5 = md5($wcheck_local_usr_sum);
$wcheck_local_usr_sum = '';


	$ox_usr_id = "$ylocal_ord_arr_usr_data[0]" ;
	$ox_usr_allname = "$ylocal_ord_arr_usr_data[1]".'  '."$ylocal_ord_arr_usr_data[2]" ;
	$ox_usr_company = "$ylocal_ord_arr_usr_data[3]" ;

	$ox_usr_alladdr = "$ylocal_ord_arr_usr_data[7]".' '."$ylocal_ord_arr_usr_data[5]".', '.
			  "$ylocal_ord_arr_usr_data[4]".', '."$ylocal_ord_arr_usr_data[6]".', '.
			  "$ylocal_ord_arr_usr_data[8]" ;

	$ox_usr_country = "$ylocal_ord_arr_usr_data[8]" ;
	$ox_usr_countrid = "$ylocal_ord_arr_usr_data[9]" ;
	$ox_usr_phone = "$ylocal_ord_arr_usr_data[10]" ;
	$ox_usr_email = "$ylocal_ord_arr_usr_data[11]" ;


//user id verify
if (empty($ylocal_ord_arr_usr_data[0])) {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $y_warp_err_data_failure; 
	} //end if
	$yx_process_ord_err = 'notok';
} //end if

//user info checksum
if ($wcheck_local_usr_sum_md5 != $wchkusr) {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $yecomm_order_msg_err_03; 
	} //end if
	$yx_process_ord_err = 'notok';
} //end if


// check if country exists
$ylocal_ord_arr_country_data = array();
xmysql_read_data_fl ("SELECT id, vat_tax, pst_tax_zone FROM country_list WHERE ( (c_id='$ylocal_ord_arr_usr_data[9]') AND (c_name='$ylocal_ord_arr_usr_data[8]') ) ");
$ylocal_ord_arr_country_data = $arr_var_result ;

//get post coef
$ylocal_deliv_arr_coef = array();
xmysql_read_data_fl ("SELECT id, coef FROM delivery_zones WHERE (id='$ylocal_ord_arr_country_data[2]') " );
$ylocal_deliv_arr_coef = $arr_var_result ;

//assign pst coef
if (empty($ylocal_deliv_arr_coef[0])) {
	$ox_pst_coef = '0';
} //end if
else {
	$ox_pst_coef = $ylocal_deliv_arr_coef[1] ;
} //end else

//assign vat tax per country
if (empty($ylocal_ord_arr_country_data[1])) {
	$ox_country_vat = 'n';
} //end if
else {
	$ox_country_vat = $ylocal_ord_arr_country_data[1];
} //end else

//check empty vars for user
if ( (empty($ylocal_ord_arr_usr_data[1])) OR (empty($ylocal_ord_arr_usr_data[2])) OR (empty($ylocal_ord_arr_usr_data[4])) OR 
     (empty($ylocal_ord_arr_usr_data[5])) OR (empty($ylocal_ord_arr_usr_data[6])) OR (empty($ylocal_ord_arr_usr_data[7])) OR 
     (empty($ylocal_ord_arr_usr_data[10])) OR (empty($ylocal_ord_arr_usr_data[11])) OR (empty($ylocal_ord_arr_country_data[0])) ) {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $yecomm_order_msg_err_02;
	} //end if
	$yx_process_ord_err = 'notok';
} //end if

//check empty company if required
if ($ywusr_thecompany_isneeded == 'y') {
	if (empty($ylocal_ord_arr_usr_data[3])) {
		if ($yx_process_ord_err == 'ok') {
			$yx_process_ord_msg_err = $yecomm_order_msg_err_02;
		} //end if
		$yx_process_ord_err = 'notok';
	} //end if
} //end if

//check email
if (!stristr($ylocal_ord_arr_usr_data[11], '@')) {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $yecomm_order_msg_err_02;
	} //end if
	$yx_process_ord_err = 'notok';
} //end if
if (!stristr($ylocal_ord_arr_usr_data[11], '.')) {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $yecomm_order_msg_err_02;
	} //end if
	$yx_process_ord_err = 'notok';
} //end if



//######################################################### generate the order details if ok


//-----------------------------------------------

//generate orders details

if ($yx_process_ord_err == 'ok') {

	$ord_arr_crt_all_res = array();
	xmysql_read_data_fl ("SELECT id, p_id, p_qty FROM prod_cart WHERE ( (w_sess='$wpsid') AND (u_id='$ylocal_ord_arr_usr_data[0]') ) ORDER BY id ASC " );
	$ord_arr_crt_all_res = $arr_var_result;


	$ox_order_detail_html = '';


	//missing table start (added later)

		//row start
		$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;

			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"100%\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;

				//table start
				$ox_order_detail_html = $ox_order_detail_html."<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n";

					//row start
					$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;

						//vendor
						//column start
						$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"40%\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;

							$ox_lll_txt = '';
							$ox_lll_txt = $ox_lll_txt.'<b><u>'."$yecomm_vendor_ty_txt".'</u> :</b><br>' ;
							$ox_lll_txt = $ox_lll_txt."$yecomm_vendor_company_txt".' : <b>'."$yecomm_vendor_company".'</b><br>' ;
							$ox_lll_txt = $ox_lll_txt."$yecomm_vendor_regcode_txt".' : <b>'."$yecomm_vendor_regcode".'</b><br>' ;
							$ox_lll_txt = $ox_lll_txt."$yecomm_vendor_fulladdr_txt".' : <b>'."$yecomm_vendor_fulladdr".'</b><br>' ;
							$ox_lll_txt = $ox_lll_txt."$yecomm_vendor_phone_txt".' : <b>'."$yecomm_vendor_phone".'</b><br>' ;
							$ox_lll_txt = $ox_lll_txt."$yecomm_vendor_email_txt".' : <b>'."$yecomm_vendor_email".'</b><br><br>' ;
							$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;

						//column end
						$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


						//empty
						//column start
						$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"20%\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;

							//text idx
							$ox_lll_txt = '&nbsp;';
							$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;

						//column end
						$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


						//customer
						//column start
						$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"40%\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;

							$ox_lll_txt = '';
							$ox_lll_txt = $ox_lll_txt.'<b><u>'."$yecomm_vendor_ty_cust_txt".'</u> :</b><br>' ;

							//text idx
							if ($ywusr_thecompany_isneeded == 'y') {
								$ox_lll_txt = $ox_lll_txt."$ywusr_xentire_company".' : <b>'."$ox_usr_company".'</b><br>' ;
							} //end if
							else {
								$ox_lll_txt = $ox_lll_txt."$ywusr_xentire_name".' : <b>'."$ox_usr_allname".'</b><br>' ;
							} //end else

							$ox_lll_txt = $ox_lll_txt."$ywusr_xentire_addr".' : <b>'."$ox_usr_alladdr".'</b><br>' ;
							$ox_lll_txt = $ox_lll_txt."$ywusr_xentire_phone".' : <b>'."$ox_usr_phone".'</b><br>' ;
							$ox_lll_txt = $ox_lll_txt."$ywusr_xentire_email".' : <b>'."$ox_usr_email".'</b><br>' ;

							if ($ywusr_thecompany_isneeded == 'y') {
								$ox_lll_txt = $ox_lll_txt."$ywusr_user_forcompany".' : <b>'."$ox_usr_allname".'</b><br>' ;
							} //end if

							$ox_lll_txt = $ox_lll_txt.'<br>';

							$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;

						//column end
						$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;

					//row end
					$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;

				//table end
				$ox_order_detail_html = $ox_order_detail_html."</table>\n" ;


			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;

		//row end
		$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;


		//TABLE
		//row start
		$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;

			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"100%\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;


	//------------------------

	//table start
	$ox_order_detail_html = $ox_order_detail_html."<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n";

		//row start
		$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;

			//---idx
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '<b>&nbsp;#</b>';
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_name
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '<b>&nbsp;'."$yprods_item_pname".'</b>';
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_qty
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '<b>'."$yprods_item_qty".'</b>'.'<br>'.'<b>'."($yprods_item_package)".'</b>' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_price
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '<b>'.'*'."$yprods_item_price".'<br>'."($yprods_item_package)".'</b><br>'."$yprods_item_crr_name" ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---total price no vat
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '<b>'."$yecomm_crt_subtotal_price".'<br>'."$yecomm_crt_excepting_vat".'</b><br>'."$yprods_item_crr_name" ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---vat sub totals
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '<b>'."$yecomm_vat_tax".'<br>'."$yecomm_for_prepos_txt".' '."$ylocal_ord_arr_usr_data[8]".'</b><br>'."$yprods_item_crr_name" ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;

		//row end
		$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;

		//------------------------

		$yxall_local_calc_tot_price = '0';
		$yxall_local_calc_tot_vat = '0';

		$yxall_local_calc_tot_weight = '0';
		$yxall_local_calc_tot_delivery_p = '0';

		$yxall_local_calc_tot_delivery_p_vat = '0';
		$yxall_local_calc_tot_delivery_list = '';
		$yxall_local_calc_tot_delivery_list_num = '0';

		$yxall_local_download_delivery_list = '';
		$yxall_local_theall_all_list = '';

		$yxall_local_calc_tot_topay = '0';

		$zindx_iterator_zz = '0';

		$wcheck_local_cart_sum = '';

		$arr_count = count($ord_arr_crt_all_res);
		for ($i=0; $i < $arr_count; $i++) {
			$i_id = $i;
			$i_pid = $i + 1;
			$i_pqty = $i + 2;
			$i = $i + 2;


		xmysql_read_data_fl ("SELECT title, p_code, e_deliver, price, weight_g, u_m, vat_tax, delivery_p, id FROM prod_items WHERE (id='$ord_arr_crt_all_res[$i_pid]') " );

//---------------- cart error handling cart

		//check if all products exist
		if (empty($arr_var_result[8])) {
			xmysql_write_data_fl ("DELETE FROM prod_cart WHERE (id='$ord_arr_crt_all_res[$i_id]') " );
		} //end if
		else {

//---------------- cart error handling cart

		$zindx_iterator_zz = $zindx_iterator_zz + 1;

		//checksum
		$wcheck_local_cart_sum = $wcheck_local_cart_sum.$ord_arr_crt_all_res[$i_id].$ord_arr_crt_all_res[$i_pid].$ord_arr_crt_all_res[$i_pqty] ;

		//------------------------

		//row start
		$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;

			//---idx
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//text idx
				$ox_lll_txt = "$zindx_iterator_zz".'.' ;
				$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_name
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;

				//table start
				$ox_order_detail_html = $ox_order_detail_html."<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";

					//row start
					$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;

						//column start
						$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;

							//text idx
							$ox_lll_txt = '<u>'."$arr_var_result[0]".'</u>'.'<br>'."$yprods_item_code".' : '."$arr_var_result[1]".'<br>'."$yprods_item_package".' : '.'<b>'."$arr_var_result[5]".'</b>'.'<br>';

							$yxall_local_theall_all_list = $yxall_local_theall_all_list.$arr_var_result[8].',';;

							if ($arr_var_result[2] == 'd') {
								$ox_lll_txt = $ox_lll_txt.'<i>'."$yprods_item_delivery_method_d".'</i>' ;

								$yxall_local_download_delivery_list = $yxall_local_download_delivery_list.$arr_var_result[8].',';
							} //end if
							if ($arr_var_result[2] == 'p') {
								$ox_lll_txt = $ox_lll_txt.'<i>'."$yprods_item_delivery_method_p".'</i><br>' ;

								$yxall_local_calc_tot_delivery_list = $yxall_local_calc_tot_delivery_list.$zindx_iterator_zz.'; ';
								$yxall_local_calc_tot_delivery_list_num = $yxall_local_calc_tot_delivery_list_num + 1;

								$y_local_qty_we_nf = number_format($ord_arr_crt_all_res[$i_pqty], 0, $warp_numform_decimal_sep, $warp_numform_thousand_sep);

								//delivery charge
								$yx_local_calc_deliv_p = '0';
								$yx_local_calc_deliv_x = '0';
								$yx_local_calc_deliv_x = $arr_var_result[7] * $ox_pst_coef;
								$yx_local_calc_deliv_x = number_format($yx_local_calc_deliv_x, 2, '.', '');
								$yx_local_calc_deliv_p = $yx_local_calc_deliv_x * $ord_arr_crt_all_res[$i_pqty];
								$yxall_local_calc_tot_delivery_p = $yxall_local_calc_tot_delivery_p + $yx_local_calc_deliv_p ;
								$yx_local_calc_deliv_p_nf = number_format($yx_local_calc_deliv_p, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
								$yx_local_calc_deliv_p_um_nf = number_format($yx_local_calc_deliv_x, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);

								$ox_lll_txt = $ox_lll_txt.
									'<i>'."$yecomm_total_deliv_chrg".' : '.
									'('."$yx_local_calc_deliv_p_um_nf".' x '."$y_local_qty_we_nf".') = '.
									'<b>'."$yx_local_calc_deliv_p_nf $yprods_item_crr_name".'</b></i><br>' ;

								//weight
								$yx_local_calc_weight = '0';
								$yx_local_calc_weight = $arr_var_result[4] * $ord_arr_crt_all_res[$i_pqty];
								$yxall_local_calc_tot_weight = $yxall_local_calc_tot_weight + $yx_local_calc_weight ;
								$yx_local_calc_weight_nf = number_format($yx_local_calc_weight, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
								$yx_local_calc_weight_um_nf = number_format($arr_var_result[4], 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);

								$ox_lll_txt = $ox_lll_txt.
									'<i>'."$yecomm_total_weight".' : '.
									'('."$yx_local_calc_weight_um_nf".' x '."$y_local_qty_we_nf".') = '.
									'<b>'."$yx_local_calc_weight_nf $yprods_item_weight_um".'</b></i>' ;


							} //end if
							if ($arr_var_result[2] == 's') {
								$ox_lll_txt = $ox_lll_txt.'<i>'."$yprods_item_delivery_method_s".'</i>' ;
							} //end if
							$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;

						//column end
						$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;

					//row end
					$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;

				//table end
				$ox_order_detail_html = $ox_order_detail_html."</table>\n" ;


			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_qty
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$y_local_qty_nf = number_format($ord_arr_crt_all_res[$i_pqty], 0, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
					$ox_lll_txt = "$y_local_qty_nf" ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_price
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center right start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"right\">" ;
					//text idx
					$yx_local_calc_itm_price = number_format($arr_var_result[3], 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
					$ox_lll_txt = "$yx_local_calc_itm_price" ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---total price no vat
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center right start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"right\">" ;
					//text idx
					$yx_local_calc_itm_subtot_price = '0';
					$yx_local_calc_itm_subtot_price = $arr_var_result[3] * $ord_arr_crt_all_res[$i_pqty] ;
					$yxall_local_calc_tot_price = $yxall_local_calc_tot_price + $yx_local_calc_itm_subtot_price ;
					$yx_local_calc_itm_subtot_price_nf = number_format($yx_local_calc_itm_subtot_price, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
					$ox_lll_txt = '<b>'."$yx_local_calc_itm_subtot_price_nf".'</b>' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---vat sub totals
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center right start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"right\">" ;
					//text idx
				$yx_local_calc_vattax = '0';
				if ($ox_country_vat == 'y') {
					$yx_local_calc_vattax = ($arr_var_result[6] * $yx_local_calc_itm_subtot_price) / 100 ;
					$yxall_local_calc_tot_vat = $yxall_local_calc_tot_vat + $yx_local_calc_vattax ;
				} //end id
				else {
					$yx_local_calc_vattax = '0';
					$yxall_local_calc_tot_vat  = '0';
				} //end else
				$yx_local_calc_vattax_nf = number_format($yx_local_calc_vattax, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
					$ox_lll_txt = '<b>'."$yx_local_calc_vattax_nf".'</b>'.'<br>' ;
					if ($ox_country_vat == 'y') {
						$ox_lll_txt = $ox_lll_txt.'('."$arr_var_result[6]".'%)' ;
					} //end if
					else {
						$ox_lll_txt = $ox_lll_txt.'(0%)' ;
					} //end else

					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;

		//row end
		$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;

		} //end else

		//------------------------

		} //end for

		$yxall_local_calc_tot_delivery_p_vat = $yxall_local_calc_tot_delivery_p * $yecomm_vat_for_delivery / 100 ;

		//total price and total vat
		$yxall_local_calc_tot_price = $yxall_local_calc_tot_price + $yxall_local_calc_tot_delivery_p ;
		$yxall_local_calc_tot_vat = $yxall_local_calc_tot_vat + $yxall_local_calc_tot_delivery_p_vat ;
		$yxall_local_calc_tot_price = number_format ($yxall_local_calc_tot_price, 2, '.', '');
		$yxall_local_calc_tot_vat = number_format ($yxall_local_calc_tot_vat, 2, '.', '');

		$yxall_local_calc_tot_price_fxt = number_format($yxall_local_calc_tot_price, 2, '.', '');
		$yxall_local_calc_tot_vat_fxt = number_format($yxall_local_calc_tot_vat, 2, '.', '');

		//total to pay
		$yxall_local_calc_tot_topay = $yxall_local_calc_tot_price_fxt + $yxall_local_calc_tot_vat_fxt ;
		$yxall_local_calc_tot_topay = number_format ($yxall_local_calc_tot_topay, 2, '.', '');


		$wcheck_local_cart_sum_md5 = '';
		$wcheck_local_cart_sum = $wcheck_local_cart_sum.$yxall_local_calc_tot_topay.$wpsid ;
		$wcheck_local_cart_sum_md5 = md5($wcheck_local_cart_sum) ;
		$wcheck_local_cart_sum = '';


		$hlocal_deliv_show_to_total = '';

		//DELIVERY
		if ($yxall_local_calc_tot_delivery_p > '0') {

		$hlocal_deliv_show_to_total = ' - '.$yecomm_crt_includding_dev_p;
		$yxall_local_calc_tot_weight_nf = number_format($yxall_local_calc_tot_weight, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);

		//row start
		$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;


			//---idx and deliv
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"2\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;

				//table start
				$ox_order_detail_html = $ox_order_detail_html."<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";

					//row start
					$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;

						//column start
						$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;

							//text idx
							$ox_lll_txt = '<b>'."$yecomm_crt_total_deliv_price".' '."$yecomm_for_prepos_txt".' '."$ylocal_ord_arr_usr_data[8]".' - '."$yxall_local_calc_tot_delivery_list_num".' '."$yecomm_total_rows".'</b>'.'<br>' ;
							$ox_lll_txt = $ox_lll_txt.'<i>'."$yecomm_crt_total_deliv_weight".' - '."$yxall_local_calc_tot_delivery_list_num".' '."$yecomm_total_rows".' : <b>'."$yxall_local_calc_tot_weight_nf".' '."$yprods_item_weight_um".'</b></i>'.'<br>' ;
							$ox_lll_txt = $ox_lll_txt."$yecomm_crt_total_deliv_p_list".' :'.'<br>' ;
							$ox_lll_txt = $ox_lll_txt.'# : '."$yxall_local_calc_tot_delivery_list" ;
							$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;

						//column end
						$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;

					//row end
					$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;

				//table end
				$ox_order_detail_html = $ox_order_detail_html."</table>\n" ;


			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_qty
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '-' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_price
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '-' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---total deliv price no vat
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center right start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"right\">" ;
					//text idx
					$yxall_local_calc_tot_delivery_p_nf = number_format($yxall_local_calc_tot_delivery_p, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
					$ox_lll_txt = '<b>'."$yxall_local_calc_tot_delivery_p_nf".'</b>' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---vat for deliv
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center right start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"right\">" ;
					//text idx
					$yxall_local_calc_tot_delivery_p_vat_nf = number_format($yxall_local_calc_tot_delivery_p_vat, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
					$ox_lll_txt = '<b>'."$yxall_local_calc_tot_delivery_p_vat_nf".'</b>'.'<br>'.'('."$yecomm_vat_for_delivery".'%)' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;

		//row end
		$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;

	} //end if


		// TOTALS

		//row start
		$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;


			//---idx and totals
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"2\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//text idx
				$ox_lll_txt = '<b>'."$yecomm_crt_totals".' - '."$zindx_iterator_zz".' '."$yecomm_total_rows".' '."$hlocal_deliv_show_to_total".'</b>' ;
				$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_qty
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '-' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---p_price
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$ox_lll_txt = '-' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---totals price
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center right start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"right\">" ;
					//text idx
					$yxall_local_calc_tot_price_nf = number_format($yxall_local_calc_tot_price, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
					$ox_lll_txt = '<b>'."$yxall_local_calc_tot_price_nf".'</b>' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---totals vat
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"1\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;
				//center right start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"right\">" ;
					//text idx
					$yxall_local_calc_tot_vat_nf = number_format($yxall_local_calc_tot_vat, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
					$ox_lll_txt = '<b>'."$yxall_local_calc_tot_vat_nf".'</b>' ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;

		//row end
		$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;


		// TOTAL TO PAY

		//row start
		$ox_order_detail_html = $ox_order_detail_html."<tr>\n" ;


			//---text
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"4\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"center\">\n" ;
				//text idx
				$ox_lll_txt = '<br>'.'<b>'."$yecomm_crt_total_topay $hlocal_deliv_show_to_total - $yecomm_crt_includding_vat".'</b><br><br>' ;
				$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


			//---amount
			//column start
			$ox_order_detail_html = $ox_order_detail_html."<td colspan=\"2\" width=\"\" bgcolor=\"#FFFFFF\" valign=\"center\">\n" ;
				//center start
				$ox_order_detail_html = $ox_order_detail_html."<div align=\"center\">" ;
					//text idx
					$yxall_local_calc_tot_topay_nf = number_format($yxall_local_calc_tot_topay, 2, $warp_numform_decimal_sep, $warp_numform_thousand_sep);
					$ox_lll_txt = '<b>'."$yxall_local_calc_tot_topay_nf".'</b>'.'&nbsp;&nbsp;'."$yprods_item_crr_name" ;
					$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;
				//center end
				$ox_order_detail_html = $ox_order_detail_html."</div>\n" ;
			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


		//row end
		$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;


	//table end
	$ox_order_detail_html = $ox_order_detail_html."</table>\n" ;


	$ox_lll_txt = '<br>'.'&#149; '.'*'."$yprods_item_crr_expl".'<br>' ;
	$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;

	$ox_lll_txt = '&#149; <i>'."$yecomm_deliv_vat_znote".' ['."$yecomm_yhh_country_destin : $ylocal_ord_arr_usr_data[8]".']'.' - '.' ['."$yecomm_yhh_country_origin : $yecomm_vendor_country".']'.'</i><br>' ;
	$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;

	$ox_lll_txt = '&#149; '."$yecomm_deliv_availab_note".' '."$yecomm_deliv_time_note" ;
	$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;


	$ox_lll_txt = '<br><hr><i>'."$yecomm_order_info".' : '."<b>$ywebsite_name</b>".' - ['."$ywebsite_addr_secure".']' ;
	$ox_lll_txt = $ox_lll_txt.'<br>'."$yecomm_order_ip_addr".' [ # '.$ox_usr_id.' ] '.' : '."<b>$REMOTE_ADDR</b>".'</i><br><hr>' ;
	$ox_order_detail_html = $ox_order_detail_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"1\" color=\"#000000\">$ox_lll_txt</font>" ;



	//---------------------------------------


			//column end
			$ox_order_detail_html = $ox_order_detail_html."</td>\n" ;


		//row end
		$ox_order_detail_html = $ox_order_detail_html."</tr>\n" ;


	//table end
	$ox_order_detail_html = $ox_order_detail_html."</table>\n" ;


} //end if



//######################################################### cart checksum verify


//user info checksum
if ($wcheck_local_cart_sum_md5 != $wchkcrt) {
	if ($yx_process_ord_err == 'ok') {
		$yx_process_ord_msg_err = $yecomm_order_msg_err_04; 
	} //end if
	$yx_process_ord_err = 'notok';
} //end if



//######################################################### generate the order if ok

//-----------------------------------------------

//generate a new order and assure is unique

if ($yx_process_ord_err == 'ok') {

	//1st try
	$hlocal_ord_id_uniq = '';
	$hlocal_ord_id_uniq =  uniqid(time());
	$hlocal_ord_id_uniq = str_pad($hlocal_ord_id_uniq, 25, '0', STR_PAD_LEFT);
	xmysql_read_data_fl ("SELECT id FROM orders WHERE ( ord_id='$hlocal_ord_id_uniq' )");

	//try till ok
	while (!empty($arr_var_result[0])) {
		$hlocal_ord_id_uniq = '';
		$hlocal_ord_id_uniq =  uniqid(time());
		$hlocal_ord_id_uniq = str_pad($hlocal_ord_id_uniq, 25, '0', STR_PAD_LEFT);
		xmysql_read_data_fl ("SELECT id FROM orders WHERE ( ord_id='$hlocal_ord_id_uniq' )");
	} //end while

	$wordid = $hlocal_ord_id_uniq;

	xmysql_write_data_fl ("INSERT INTO orders (ord_id, w_date, w_time, w_sess, usr_id, usr_all_name, usr_company, usr_all_addr, usr_country, usr_countr_id, usr_email, usr_phone, w_crr, w_crr_id, w_crr_name, apply_vat, pst_zone, pst_coef, pst_vat, deliv_tot_wgt, deliv_tot_pr, deliv_tot_vat, gtot_pr, gtot_vat, tot_pay, usr_by_co, w_weight_um) VALUES 
				('$wordid', '$y_warp_xdate', '$y_warp_xtime', '$wpsid', '$ox_usr_id', '$ox_usr_allname', '$ox_usr_company', '$ox_usr_alladdr', '$ox_usr_country', '$ox_usr_countrid', '$ox_usr_email', '$ox_usr_phone', '$yprods_item_crr', '$yprods_item_crr_code', '$yprods_item_crr_name', '$ox_country_vat', '$ylocal_ord_arr_country_data[2]', '$ox_pst_coef', '$yecomm_vat_for_delivery', '$yxall_local_calc_tot_weight', '$yxall_local_calc_tot_delivery_p', '$yxall_local_calc_tot_delivery_p_vat', '$yxall_local_calc_tot_price', '$yxall_local_calc_tot_vat', '$yxall_local_calc_tot_topay', '$ywusr_thecompany_isneeded', '$yprods_item_weight_um') ");

	xmysql_read_data_fl ("SELECT id FROM orders WHERE ( ord_id='$wordid' )");

	//check if successful order creation
	if (empty($arr_var_result[0])) {
		if ($yx_process_ord_err == 'ok') {
			$yx_process_ord_msg_err = $y_warp_err_data_failure; 
		} //end if
		$yx_process_ord_err = 'notok';
	} //end if


	//---------preparing final html code

	$ox_order_detail_xf_html = '';

	//table start now
	$ox_order_detail_xf_html = $ox_order_detail_xf_html."<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n";

		//row start
		$ox_order_detail_xf_html = $ox_order_detail_xf_html."<tr>\n" ;

			//column start
			$ox_order_detail_xf_html = $ox_order_detail_xf_html."<td colspan=\"1\" width=\"100%\" bgcolor=\"#FFFFFF\" valign=\"top\">\n" ;


				//center start
				$ox_order_detail_xf_html = $ox_order_detail_xf_html."<div align=\"center\">" ;

					//text
					$ox_lll_txt = '';
					$ox_lll_txt = $ox_lll_txt.'<b>'."$yecomm_order_invoice_prof".' : '."$arr_var_result[0]".'</b><br>';
					$ox_lll_txt = $ox_lll_txt.'<b>'."$yecomm_order_ord_no".' : '."$wordid".'</b><br>';
					$ox_lll_txt = $ox_lll_txt."$yecomm_order_server_time".' : '."$y_warp_xdate".' [ '."$y_warp_xtime".' ] '.'<br><br>';

					$ox_order_detail_xf_html = $ox_order_detail_xf_html."<font face=\"Verdana, Tahoma, Arial, sans-serif\" size=\"2\" color=\"#000000\">$ox_lll_txt</font>" ;

				//center end
				$ox_order_detail_xf_html = $ox_order_detail_xf_html."</div>\n" ;

			//column end
			$ox_order_detail_xf_html = $ox_order_detail_xf_html."</td>\n" ;


		//row end
		$ox_order_detail_xf_html = $ox_order_detail_xf_html."</tr>\n" ;


	// adding the rest
	$ox_order_detail_xf_html = $ox_order_detail_xf_html.$ox_order_detail_html ;

	//clear old
	$ox_order_detail_html = '';

} //end if


//-----------------------------

	$ox_order_detail_xf_html = xdex_warp_crypt ($ox_order_detail_xf_html);

	xmysql_write_data_fl ("UPDATE orders SET details_htm='$ox_order_detail_xf_html', xxall_list='$yxall_local_theall_all_list', xdeliv_d_lst='$yxall_local_download_delivery_list', accepted='y', status=CONCAT(status, ' [step validation done] ') WHERE ( ord_id='$wordid' )");
	$ox_order_detail_xf_html = '';

	xmysql_read_data_fl ("SELECT details_htm FROM orders WHERE ( ord_id='$wordid' )");

	//check if successful order updating
	if (empty($arr_var_result[0])) {
		if ($yx_process_ord_err == 'ok') {
			$yx_process_ord_msg_err = $y_warp_err_data_failure; 
		} //end if
		$yx_process_ord_err = 'notok';
	} //end if
	else {
		$ybck_ord_htmx = xdex_warp_decrypt($arr_var_result[0]);
		$y_snt_mail_headers  = "MIME-Version: 1.0\r\n";
		$y_snt_mail_headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

		mail("$y_warp_office_email", 
			"$ywebsite_name : $yecomm_order_vbck_mailsubj", 
				'----------------------------------- [Order Backup]'."<br>".
				"$y_warp_xdate".'  -  '."$y_warp_xtime"."<br>".
				"$ywebsite_addr"."<br>".
				'-----------------------------------'."<br><br><br>".
				'----------------------------------- [Order START]'."<br><br>".
				"$ybck_ord_htmx"."<br><br>".
				'----------------------------------- [Order END]'."<br><br>",
			$y_snt_mail_headers);
	} //end if

//-----------------------------


//-----------------------------------------------

//output

echo( 
	"&xcheck_load_controlvar=".rawurlencode('ok').
	"&xcheck_data_controlvar=".rawurlencode("$yx_process_ord_err").
	"&flash_form_text_err=".rawurlencode("$yx_process_ord_msg_err").
	"&flash_form_text_oky=".rawurlencode("$yx_process_ord_msg_oky").
	"&wordid=".rawurlencode("$wordid").
	"&"
);


} //end function

//################################3


//----------------------------------------

if ($ys == 'xshopcartoky_acc') {
	xecomm_cart_ord_opx ();
} //end if

//----------------------------------------


//end of php code
?>
Return current item: Warp.cms - php/mysql content management