>"; $paypal[background_color]=""; //""=white 1=black $paypal[display_shipping_address]="1"; //""=yes 1=no $paypal[display_comment]="1"; //""=yes 1=no //Product Settings $paypal[item_name]="Emotionalwavelengths.com"; $paypal[item_number]="$_POST[item_number]"; $paypal[amount]="10"; $paypal[on0]="Order No"; $paypal[os0]=""; $paypal[on1]="$_POST[on1]"; $paypal[os1]="$_POST[os1]"; $paypal[quantity]="1"; //"$_POST[quantity]"; $paypal[edit_quantity]=""; //1=yes ""=no $paypal[invoice]=""; $paypal[tax]=""; //Shipping and Taxes $paypal[shipping_amount]=$sess_orderinfo[8]; $paypal[shipping_amount_per_item]=""; $paypal[handling_amount]=""; $paypal[custom_field]=""; //Customer Settings $paypal[firstname]= $vname; $paypal[lastname]=""; $paypal[address1]=$vaddress1; $paypal[address2]=""; $paypal[city]=$vcity; $paypal[state]=$vstate; $paypal[zip]=$vzip; $paypal[email]=$vemail; $paypal[phone_1]=$vphone; $paypal[phone_2]="$_POST[phone2]"; $paypal[phone_3]="$_POST[phone3]"; ?>$v) { $postdata.= $i . "=" . urlencode($v) . "&"; } $postdata.="cmd=_notify-validate"; //execute curl on the command line exec("$paypal[curl_location] -d \"$postdata\" $url", $info); $info=implode(",",$info); return $info; } //posts transaction data using libCurl function libCurlPost($url,$data) { //build post string foreach($data as $i=>$v) { $postdata.= $i . "=" . urlencode($v) . "&"; } $postdata.="cmd=_notify-validate"; $ch=curl_init(); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,1); curl_setopt($ch,CURLOPT_POSTFIELDS,$postdata); //Start ob to prevent curl_exec from displaying stuff. ob_start(); curl_exec($ch); //Get contents of output buffer $info=ob_get_contents(); curl_close($ch); //End ob and erase contents. ob_end_clean(); return $info; } //posts transaction data using fsockopen. function fsockPost($url,$data) { //Parse url $web=parse_url($url); //build post string foreach($data as $i=>$v) { $postdata.= $i . "=" . urlencode($v) . "&"; } $postdata.="cmd=_notify-validate"; //Set the port number if($web[scheme] == "https") { $web[port]="443"; $ssl="ssl://"; } else { $web[port]="80"; } //Create paypal connection $fp=@fsockopen($ssl . $web[host],$web[port],$errnum,$errstr,30); //Error checking if(!$fp) { echo "$errnum: $errstr"; } //Post Data else { fputs($fp, "POST $web[path] HTTP/1.1\r\n"); fputs($fp, "Host: $web[host]\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ".strlen($postdata)."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $postdata . "\r\n\r\n"); //loop through the response from the server while(!feof($fp)) { $info[]=@fgets($fp, 1024); } //close fp - we are done with it fclose($fp); //break up results into a string $info=implode(",",$info); } return $info; } //Display Paypal Hidden Variables function showVariables() { global $paypal; ?> "> "> "> ">
|
|
|
";
$product_th_image=ROOT_DIR."images/products/thumbimage/".$prodImage["vthumbimage"];
$size = getimagesize(Site_URL."images/products/thumbimage/".$prodImage["vthumbimage"]);
if($size[0]<=70 && $size[1]<=70){
$width=70;
$height=70;
}
else{
$width=$size[0];
$height=$size[1];
}
// echo "
";
else
$freeshipImg = "";
// $disc = getSpecialDiscountFor($product_id);
$disc = 10;
if($disc==0){
$product_new_price="";
}else{
/*if(!empty()){
}*/
$newSale = $products[$i]["fsaleprice"] - $disc;
$product_new_price = "New Price : $ ".$newSale;
//$product_sale_price = ""; print_r($localvars); echo ""; */ $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index_new.htm"; include_once("include/footer.inc.php"); ?> ob_start(); session_start(); /* include_once("functions/shoppingcart.inc"); include_once("functions/checkout.inc"); include_once("functions/orderreceipt.inc"); include_once("messagefiles/shoppingcart_message.inc"); */ include_once("functions/general.inc"); $oOrderAddress=new OrderAddress(); $oOrderAddr = new OrderAddress(); $iMemberid=$sessMemberID; //echo $iMemberid; $SiteTitle = $obj->SiteTitle; $horizontal_image = "shop-cart-01.gif"; $iMemberid = $HTTP_POST_VARS["x_cust_id"]; /* $response_code=$HTTP_POST_VARS["x_response_code"]; $response_subcode=$HTTP_POST_VARS["x_response_subcode"]; $response_reason_code=$HTTP_POST_VARS["x_response_reason_code"]; $response_reason_text=$HTTP_POST_VARS["x_response_reason_text"]; */ $response_code=$HTTP_POST_VARS["response_code"]; $response_subcode=$HTTP_POST_VARS["response_subcode"]; $response_reason_code=$HTTP_POST_VARS["response_reason_code"]; $response_reason_text=$HTTP_POST_VARS["response_reason_text"]; $auth_code=$HTTP_POST_VARS["x_auth_code"]; $Trans_ID=$HTTP_POST_VARS["x_Trans_ID"]; $refmsg = "response_code=".$response_code.">>response_subcode=".$response_subcode.">>response_reason_code=".$response_reason_code.">>response_reason_text=".$response_reason_text.">>auth_code=".$auth_code.">>Trans_ID=".$Trans_ID; session_register("iMemberid"); $ord_cvv = $HTTP_POST_VARS["x_CVV2_Resp_Code"]; $ord_x_avs_code = $HTTP_POST_VARS["x_avs_code"]; //$ord_inv_no = trim($HTTP_POST_VARS["x_invoice_num"]); $trans_id = $HTTP_POST_VARS["x_Trans_ID"]; $upordersql_avs = "UPDATE `ordermast` set AVSADDR ='$ord_x_avs_code', AVSZIP ='$ord_cvv',CVV2MATCH ='$trans_id' where iorderid='$ord_inv_no' "; $uporderres_avs = $db->DirectUpdate($upordersql_avs); /////$response_code=1;//changed by nishant for testing if($response_code!="1" or !isset($response_code) or empty($response_code)){ $upordersql2 = "UPDATE `ordermast` set estatus='Declined' where iorderid='$ord_inv_no' "; $uporderres2 = $db->DirectUpdate($upordersql2); $err_msg = "Order is Declined."; $vtoemail = generalsetting("adminemail",2); $vfromemail = Get_Info_Email(); $headers = "To: $vtoemail <$vtoemail>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"; $subject = "Your Order No. ".Get_Order_Number($iorderid)." ".$SITE_NAME.".com."; // $sendmessage = "
| Thisaaaaaaaaaaaaaaaaaaaaayyyyyy order No.: ".Get_Order_Number($iorderid)." is Declined |
| Sincerely, |
| ".$SITE_NAME."., Inc. |
| ||||||||||||||||||||||||||||||||||||||||||
| Sincerely, |
| Internet Sales Division |
| ".SITE_NAME.", Inc. |
|
||||||||||||||||||||||||||||||||||
| Dear ".$cname." Thank you for your order with www.".$SITE_NAME.".com Your order No. is : ".Get_Order_Number($iorderid)." |
| Unfortunately, your order cannot be processed for the following reasons: |
| 1. Your credit card has been declined by your credit card company. Please contact your credit card company to resolve the issue. |
| If you wish order again, please visit our web site www.".$SITE_NAME.".com and create a NEW order. |
| If there are any questions, please contact our customer service at ".$TOLL_FREE." or contact us via email at ".$salesemail." |
| Sincerely, |
| ".$SITE_NAME."., Inc. |
|
||||||||||||||||||||||||||||||||||
";
//print_r($shoppingCart);
for($tc=0;$tc<$totalcart;$tc++)
{
$oldflag = 0;
$shoppingItem = $shoppingCart->items[$tc];
for($old=0;$old<$tc;$old++)
{
$oldShoppingItem = $shoppingCart->items[$old];
if($oldShoppingItem->shippingAddressId==$shoppingItem->shippingAddressId)
{
$oldflag = 1;
break;
}
}
if($oldflag == 0)
{
if(isset($shoppingItem->shippingAddressId) and !empty($shoppingItem->shippingAddressId) and $shoppingItem->shippingAddressId!='-1')
{
/////////// Check If address is correct
$ship_id = "select iorderno from shippingmode where ishippingmodeid= '$shoppingItem->shippingmodeid'";
$row_shipid = $db->DirectSelect($ship_id);
$viewadd = $oAddressBook->clientShippingAddress($shoppingItem->shippingAddressId,$sessMemberID);
$vstate = $viewadd["vstate"];
$vcountry = $viewadd["vcountry"];
if ($row_shipid[0]["iorderno"] == 0)//Standard Shipping (US 50 States)
{
if($vcountry!="US")
{
$err_msg = rawurlencode($Shipping_Method_Not_Match);
header("location:".$Site_URL."index.php?file=s-checkout&err_msg=$err_msg");
exit;
}
/* $check=checkforstates($shoppingItem->shippingmodeid);
if(!$check)
{
$err_msg = rawurlencode($Shipping_Method_Not_Match);
header("location:".$Site_URL."index.php?file=s-checkout&err_msg=$err_msg");
exit;
}*/
}
if ($row_shipid[0]["iorderno"] == 1)//International Scheduled other then US Country
{
if($vcountry=="US"){
$err_msg = rawurlencode($Shipping_Method_Not_Match);
header("location:".$Site_URL."index.php?file=s-checkout&err_msg=$err_msg");
exit;
}
}
if($row_address[0]["vcountry"]=="US" || $row_address[0]["vcountry"]=="CA")
$credit_dispaly = 1;
////////////////////////////////
$temp_shippingaddresstotal=$sess_shippingarr_id[$shoppingItem->shippingmodeid];
$temp_itemtotal = $sess_shippingarr_totalid[$shoppingItem->shippingmodeid];
$oShipping=new Shipping();
$tmp_ship_charge = $oShipping->MultiAddress_ShippingCharge($shoppingItem->shippingAddressId,$shoppingItem->shippingmodeid);
$temp_ShippingCharge = $temp_ShippingCharge + $tmp_ship_charge;
//$temp_total_new = Count_Tax();
//original $shoppingCart->update_temp_ship_charge($tc, $tmp_ship_charge);
}
}
/////////////
}
//$shoppingCart->store();
// First time Buyer Promotion Code Start Here
$order_exist = "select * from ordermast where iclientid='".$sessMemberID."'";
// exit;
$result_order = $db->DirectSelect($order_exist);
if (count($result_order)<=0)//first time order checking
{
$tyear = date(Y);
$tmonth = date(m);
$tdate = date(d);
$todays_date = $tyear."-".$tmonth."-".$tdate;
$sql_special = "SELECT * FROM buyerpromotion WHERE '$todays_date' BETWEEN dstartdate AND denddate and estatus='Active' order by ibuyerpromotionid";
$special = $db->DirectSelect($sql_special);
if (count($special) > 0)
{
$sel_id = $special[0]["ipromotiontype"];
$sel_dis_amount = $special[0]["idiscount"];
$sel_dis_type = $special[0]["ediscounttype"];
if ($sel_id == '1')//Get amount/percent off on Order
{
if ($sel_dis_type == "Percent") {
$autodiscount = $autodiscount + (($SubTotal * $sel_dis_amount) / 100);
}else{
$autodiscount = $autodiscount + $sel_dis_amount;
}
}
else if($sel_id == '2')//Get Free shipping on Order
{
$temp_ShippingCharge = 0;
}
else if($sel_id == '3')//Get Free Tax on Order
{
$temp_Tax = 0;
}
}
}
//
//if($billaddres[0]["vstate"]=="NY"){
//$temp_Tax =number_format(8.625,2,'.',',');
//}
$temp_totaldiscount = $autodiscount + $coupondiscount;
$temp_ordertotal1 = ($SubTotal - $temp_totaldiscount) + $temp_ShippingCharge + $temp_HandlingCharge + $temp_Tax + $packingcharge;
$temp_ordertotal = max(0, $temp_ordertotal1 - $temp_giftcerttotal); // only substract what is needed, total order should be >=0
$temp_giftcerttotal = min($temp_giftcerttotal, $temp_ordertotal1); // how much did we deduct from the giftcertificate
$totaldiscount = $temp_totaldiscount;//Make_Price($temp_totaldiscount);
$ShippingCharge = number_format($temp_ShippingCharge,2,'.',',');//Make_Price($temp_ShippingCharge);
$HandlingCharge = number_format($temp_HandlingCharge,2,'.',',');//Make_Price($temp_HandlingCharge);
//if($billaddres[0]["vstate"]=="NY"){
//$Tax=number_format(8.625,2,'.',',');
//}else{
$Tax = number_format($temp_Tax,2,'.',',');//Make_Price($temp_Tax);
//}
//number_format($temp_Tax,2,'.',',');
$GiftCertificateValue =$temp_giftcerttotal;// Make_Price($temp_giftcerttotal);
$verisignamount = number_format($temp_ordertotal,2,'.','');
$ordertotal = $temp_ordertotal;//Make_Price($temp_ordertotal);
//number_format($temp_ordertotal,2,'.',',');
//if(!eregi("0.00", $totaldiscount))
if ($totaldiscount == "0.00" || $totaldiscount == "0" || $totaldiscount == "$0.00")
{
$dis_title = "";
$dis_value = 0;
}
else
{
$dis_title = "
Discount :";
$dis_value = 1;
}
//if(!eregi("0.00", $ShippingCharge))
if ($ShippingCharge == "0.00" || $ShippingCharge == "0" || $ShippingCharge == "$0.00")
{
$ship_title = "";
$ship_value = 0;
}
else
{
$ship_title = "
Shipping Charge :";
$ship_value = 1;
}
//if(!eregi("0.00", $HandlingCharge))
/*if ($HandlingCharge == "0.00" || $HandlingCharge == "0" || $HandlingCharge == "$0.00")
{
$hand_title = "";
$hand_value = 0;
}
else
{
$hand_title = "
Handling Charge :";
$hand_value = 1;
}
*/
if ($Tax == "0.00" || $Tax == "0" || $Tax == "$0.00")
{
$tax_title = "";
$tax_value = 0;
}
else
{
$tax_title = "
Sales Tax :";
$tax_value = 1;
}
if($temp_giftcerttotal > 0)
{
$gift_certificate_title = "
Gift Certificate:";
$gift_certificate_value = 1;
}
else
{
$gift_certificate_title = "";
$gift_certificate_value = 0;
}
$sess_orderinfo[5] = number_format($SubTotal,2,'.','');
$sess_orderinfo[6] = number_format($autodiscount,2,'.','');
$sess_orderinfo[7] = number_format($coupondiscount,2,'.','');
$sess_orderinfo[8] = number_format($temp_ShippingCharge,2,'.','');
$sess_orderinfo[9] = number_format($temp_HandlingCharge,2,'.','');
$sess_orderinfo[10] = number_format($temp_Tax,2,'.','');
$sess_orderinfo[11] = number_format($temp_ordertotal,2,'.','');
$sess_orderinfo['gift_certificate_value'] = number_format($temp_giftcerttotal,2,'.','');
$sess_orderinfo['igcid'] = $igcid;
if(!$sess_orderinfo['payment_method'])
$sess_orderinfo['payment_method'] = "verisign";
$paypal_checked = ($sess_orderinfo['payment_method'] == "paypal")?"checked":"";
$verisign_checked = ($sess_orderinfo['payment_method'] == "verisign")?"checked":"";
$cheque_checked = ($sess_orderinfo['payment_method'] == "cheque")?"checked":"";
$payment_needed = ($temp_ordertotal > 0);
$shoppingCart->store();
// Is Active Coupon Code
$dDate = date('Y-m-d');
$couponsql = "select icouponid from coupon where dstartdate<='$dDate' and dexpirydate>='$dDate' and estatus='Active' ";
$couponres = $db->DirectSelect($couponsql);
if(count($couponres)>0)
{
$coupon_code = 1;
}
else
{
$coupon_code = 0;
}
$oGiftCertificates=new GiftCertificates();
// Are there any issued gift certificates available?
$gift_certificate = (!$shoppingCart->containsGiftCertificates()) && ($oGiftCertificates->countValidGiftCertificates() > 0);
/// Payment Option
$payment_options = $db->DirectSelect("select * from payment_options where estatus = 'Active' order by ipos");
for($p=0;$p $payment_options[$p]["voption_name"],
'option_check' => $payment_options[$p]["option_check"],
'vdetail' => $payment_options[$p]["vdetail"],
'check' => $check,
'id' => $p
);
}
$credit_options = $db->DirectSelect("select * from creditcard_options where estatus = 'Active' order by vcard_name");
for($c=0;$c $credit_options[$c]["vcard_name"],
);
}
//////////////
/*functions*/
function Count_Auto_Discount_1()
{
Global $db, $SubTotal, $OrderSubTotal, $sess_orderinfo;
$dDate = date('Y-m-d');
$autosql = "select * from autodiscount where iorderamount<='$SubTotal' and dstartdate<='$dDate' and dexpirydate>='$dDate' and estatus='Active' Order by iorderamount DESC";
// echo $autosql;
// exit;
$autores = $db->DirectSelect($autosql);
if(count($autores)>0)
{
if($autores[0]["iorderamount"]<=$SubTotal)
{
if($autores[0]["etype"]=='1')
$temp_autodiscount = ($SubTotal * $autores[0]["iautodiscount"]) / 100;
else
$temp_autodiscount = $autores[0]["iautodiscount"];
}
else
{
$temp_autodiscount = "0";
}
}
else
$temp_autodiscount = "0";
return $temp_autodiscount;
}
function Count_Coupon_Discount_1()
{
Global $db, $SubTotal, $OrderSubTotal, $sess_orderinfo,$shoppingCart,$prodflag;
$couponsql = "select * from coupon where icouponid='$sess_orderinfo[3]' ";
// echo $couponsql;
// exit;
$couponres =$db->DirectSelect($couponsql);
//echo "
orderis".$couponres[0]["eorder"];
if(count($couponres)>0)
{
if($couponres[0]["eorder"]!="order")
{
$prodsku = $couponres[0]["vsku"];
$totsess = count($shoppingCart->items);
$saleprice = 0;
if($couponres[0]["etype"]=='1')
{
for($l=0;$l<$totsess;$l++)
{
$item = $shoppingCart->items[$l];
/*edit by nishant */
if($couponres[0]["eorder"]=="sku")
{
$prodres =$db->DirectSelect("select vSKU,fsaleprice from products where iproductid = '".$item->productid."'");
if($prodres[0]["vSKU"] == $prodsku){
$saleprice += ($item->quantity*$prodres[0]["fsaleprice"]);
}
}elseif($couponres[0]["eorder"]=="brand")
{
$brandres =$db->DirectSelect("select ibrandid,fsaleprice from products where iproductid = '".$item->productid."'");
if($brandres[0]["ibrandid"] == $prodsku)
$saleprice += ($item->quantity*$brandres[0]["fsaleprice"]);
}elseif($couponres[0]["eorder"]=="category")
{
/*$subcatres*/$maincatres =$db->DirectSelect("select icategoryid from productcat where iproductid = '".$item->productid."' and icategoryid='".$prodsku."'");
//$maincatres =$db->DirectSelect("select iparentid from category where icategoryid = '".$subcatres[0]["icategoryid"]."'");
if($maincatres[0]["icategoryid"] == $prodsku)
{/*edit by nishant */
$prodres =$db->DirectSelect("select fsaleprice from products where iproductid = '".$item->productid."'");
$saleprice += ($item->quantity*$prodres[0]["fsaleprice"]);
/*edit by nishant */}
}/*edit by nishant */
}//end for
$temp_coupondiscount = ($saleprice * $couponres[0]["fdiscount"]) / 100;
$prodflag=0;
}//end etype=1
else if($couponres[0]["etype"]=='0')
{
$temp_coupondiscount = $couponres[0]["fdiscount"];
$prodflag=0;
}
else if($couponres[0]["etype"]=='2')
{
$temp_coupondiscount=$couponres[0]["vfreesku"];
$prodflag=1;
}
}//end !="order"
else //discount on total order
{
if($couponres[0]["etype"]=='1')
{
$temp_coupondiscount = ($SubTotal * $couponres[0]["fdiscount"]) / 100;
$prodflag=0;
}
elseif($couponres[0]["etype"]=='0')
{
$temp_coupondiscount = $couponres[0]["fdiscount"];
$prodflag=0;
}
else
{
$temp_coupondiscount=$couponres[0]["vfreesku"];
$prodflag=1;
}
}
}
else
$temp_coupondiscount = "0";
return $temp_coupondiscount;
}
function Check_Coupon_Discount_1($tmp_total)
{
Global $db, $couponcode;
$cksql = "select icoupon_id from coupon where vcoupon_no='".$couponcode."' and estatus='1' ";
$ckres = $db->DirectSelect($cksql);
if(count($ckres)>0) {
// $tmp_total="$".$shoppingcart->total;
$curdate = date("Y-m-d");
$curtime = date("H:i:s");
$makedate = explode("-",$curdate);
$maketime = explode(":",$curtime);
$dDate = gmdate('Y-m-d',mktime($maketime[0] - 8,$maketime[1],$maketime[2],$makedate[1],$makedate[2],$makedate[0]));
$csql = "SELECT * FROM coupon WHERE vcouponno='".$couponcode."' AND estatus='Active' AND dstartdate<='$dDate' AND dexpirydate>='$dDate' AND forderamount <= ".$tmp_total." ORDER BY forderamount DESC ";
$cres = $db->DirectSelect($csql);
if(count($cres)>0){
return $cres;
}
else{
return false;
}
}
else
{
return 1111;
}
}
/*functions end*/
$localvars = array(
'cart_msg'=>$cart_msg,
'class_detail'=>$class_detail,
'err_msg'=>$err_msg,
'totalitems_in_cart'=>$totalitems_in_cart,
'totalcart'=>$totalcart,
'OrderSubTotal'=>"$ ".number_format($OrderSubTotal,2,'.',','),
'tc'=>$tc,
'shmodecombo'=>$shmodecombo,
'single_shipping_name'=>$single_shipping_name,
'single_shipping_address'=>$single_shipping_address,
'AddressTdTitle'=>$AddressTdTitle,
'totaldiscount'=>number_format($totaldiscount,2,'.',','),
'ShippingCharge'=>$ShippingCharge,
'HandlingCharge'=>$HandlingCharge,
'Tax'=>$Tax,
'ordertotal'=>"$ ".number_format($ordertotal,2,'.',','),
'dis_title'=>$dis_title,
'ship_title'=>$ship_title,
'hand_title'=>$hand_title,
'tax_title'=>$tax_title,
'verisignamount'=>$verisignamount,
'veristreet'=>$veristreet,
'verizip'=>$verizip,
'gift_certificate_title'=>$gift_certificate_title,
'GiftCertificateValue'=>$GiftCertificateValue,
'OrderSubTotal_org'=>$OrderSubTotal_org,
'err_msg_cpn'=>$err_msg_cpn,
'couponcode'=>$couponcode,
'gccode'=>$gccode,
'err_msg_gc'=>$err_msg_gc,
'check'=>$check,
'verisign_checked'=>$verisign_checked,
'icatid'=>$icatid,
'packingchargeval'=>$packingchargeval,
'packing_title'=>$packing_title,
'giftpack'=>$giftpack,
'shippingmode'=>$shippingmode,
'main_category'=>$main_category,
'special_prods'=>$special_prods,
'top_brands'=>$top_brands,
'catlist'=>$catlist,
'extralookuplist'=>$extralookuplist,
'recsearchlist'=>$recsearchlist,
'recprodlist'=>$recprodlist,
'reccatlist'=>$reccatlist,
'category_menu'=>$category_menu,
'category_menu_bottom'=>$category_menu_bottom,
'table_multishadd'=>$table_multishadd,
'temp_category_name'=>$temp_category_name,
'temp_arry'=>$temp_arry,
'left_main_cat'=>$left_main_cat,
'brand_logo'=>$brand_logo,
'sub_temp_arry'=>$sub_temp_arry,
'sub_temp_arry_left'=>$sub_temp_arry_left,
'brandlist'=>$brandlist,
'table_billadd'=>$table_billadd,
'table_cart'=>$table_cart,
'payment_ops'=>$payment_ops,
'credit_card_types'=>$credit_card_types,
'giftcardmessage'=>$giftcardmessage,
);
/*
echo "";
print_r($localvars);
echo "
";
*/
$smartyvars = array_merge($smartyvars,$localvars);
$indexfile="index_new.htm";
include_once("include/footer.inc.php");
?>
ob_start();
session_start();
/* include_once("functions/shoppingcart.inc");
include_once("functions/checkout.inc");
include_once("messagefiles/shoppingcart_message.inc");
include_once("functions/giftcertificates.inc");
include_once("functions/taxrates.inc");
include_once("functions/country_functions.inc"); */
$SiteTitle = $obj->SiteTitle;
$horizontal_image = "shop-cart-01.gif";
$temparr = 0;
$temp_total_new=0;
if(!isset($sessMemberID) || empty($sessMemberID))
{
if(!isset($fakeMember)):
header("location:".$Site_URL."index.php?file=m-login&to=shoppingcart&from=shoppingcart");
exit;
elseif(!$fakeMember["billingAddress"]):
header("location:".$Site_URL."index.php?file=m-login&to=shoppingcart&from=shoppingcart");
exit;
endif;
}
$totalcart = $shoppingCart->totalCount();
if($totalcart<=0)
{
header("index.php?file=shoppingcart");
exit;
$emptycart = 1;
$cart_msg = "Your Cart Is Empty";
$fullcart = 0;
}
else
{
$emptycart = 0;
$fullcart = 1;
$cart_msg = "";
$OrderSubTotal = 0;
}
if(isset($is_coupon) and !empty($is_coupon))
{
if(isset($coupon_code) and !empty($coupon_code))
{
session_unregister("couponcode");
$couponcode = $coupon_code;
session_register("couponcode");
}
}
if(isset($couponcode) && !empty($couponcode))
{
$coupondiscount = Check_Coupon_Discount();
if($coupondiscount)
{
if($coupondiscount=='1111')
{
session_unregister("couponcode");
$err_msg_cpn = $No_Coupon_Code;
$sess_orderinfo[2] =0;
$sess_orderinfo[3] = 0;
//header("location:".$Site_URL."index.php?file=submitorder&err_msg=$err_msg");
//exit;
}else{
$sess_orderinfo[2] = 1; // If Coupon Discount Then 1 else 0
$sess_orderinfo[3] = $coupondiscount[0]["icouponid"]; // CouponId
}
// echo $coupondiscount[0]["icouponid"];
}
else
{
$err_msg_cpn = $No_Coupon_Code;
$sess_orderinfo[2] = 0; // If Coupon Discount Then 1 else 0
$sess_orderinfo[3] = 0;
session_unregister("couponcode");
//header("location:".$Site_URL."index.php?file=checkout&err_msg=$err_msg");
//exit;
}
} else {
session_unregister("couponcode");
$sess_orderinfo[2] = 0; // If Coupon Discount Then 1 else 0
$sess_orderinfo[3] = 0; // CouponId
}
$igcid = 0;
$temp_giftcerttotal = 0;
if(isset($is_gc) and !empty($is_gc) and $is_gc=='1')
{
if(isset($gc_code) and !empty($gc_code))
{
session_unregister("gccode");
$gccode = $gc_code;
session_register("gccode");
}
}
if(isset($gccode) && !empty($gccode)):
$gcert = loadGiftCertificateWithCode($gccode, true);
if($gcert):
$igcid = $gcert["igcid"];
$temp_giftcerttotal = $gcert["fcurrentvalue"];
else:
session_unregister("gccode");
$err_msg_gc = "InValid !!";
//Header("Location: index.php?file=checkout&err_msg=$err_msg");
//exit;
endif;
endif;
$self_exist = 0;
if(strpos($HTTP_REFERER,'checkout')) /// If Comes From checkout page starts
{
for($z=0;$z<$total_addresses;$z++)
{
$title = "title_".$z;
$firstname = "firstname_".$z;
$middlename = "middlename_".$z;
$lastname = "lastname_".$z;
$address1 = "address1_".$z;
$address2 = "address2_".$z;
$city = "city_".$z;
$country = "country_".$z;
$state = "state_".$z;
$votherstate = "votherstate_".$z;
$phone = "phone_".$z;
$email = "email_".$z;
$votherstate = "votherstate_".$z;
$zip = "zip_".$z;
$vcomments = "vcomments_".$z;
/// Shipping Mode
for($add=0;$add<$totalcart;$add++)
{
$shoppingItem = $shoppingCart->items[$add];
if(strtolower(trim($shoppingItem->shipto_add_name))==strtolower($$title))
{
$shippingmode_sh = "shippingmode_".$z;
$shoppingCart->update_ship_Mode($add, $$shippingmode_sh, $$vcomments);
}
}
////
if($$country!='US')
$$state = $$votherstate;
$is_add = "is_add_".$z;
$address_sql = "select iclientaddbookid from clientaddressbook where LOWER(vaddresstitle) = '".$$title."' and iclientid = '".$iMemberid."'";
$address_res = $obj->select($address_sql);
if(count($address_res)<=0)
{
$shipping = 'n';
$billing = 'n';
$db_insert = "insert into clientaddressbook values('', '".$$title."', '$iMemberid', '".$$firstname."', '".$$middlename."', '".$$lastname."', '".$$address1."', '".$$address2."', '".$$city."', '".$$state."', '".$$country."', '".$$zip."', '".$$phone."', '".$vphone_dt."' ,'".$$email."', '".$shipping."', '".$billing."', '', 'Active')";
$db_insert = $obj->insert($db_insert);
}
else
{
if(strtolower($$title)=='self')
{
$self_exist = 1;
$sh_fname = $$firstname;
$sh_mname = $$middlename;
$sh_lname = $$lastname;
$sh_address = $$address1;
$sh_address2 = $$address2;
$sh_city = $$city;
$sh_state = $$state;
$sh_zip = $$zip;
$sh_country = $$country;
$sh_zip = $$zip;
$sh_phone = $$phone;
$sh_email = $$email;
}
$addressid = "addressid_".$z;
$db_sql ="update clientaddressbook set vfirstname='".$$firstname."',vmiddlename='".$$middlename."',vlastname='".$$lastname."',vaddress1='".$$address1."',vaddress2='".$$address2."',vcity='".$$city."',vstate='".$$state."',vcountry='".$$country."',izip='".$$zip."',vphone='".$$phone."',vemail='".$$email."' where iclientaddbookid='".$address_res[0]['iclientaddbookid']."'";
$result=$obj->sql_query($db_sql);
}
}
$shoppingCart->store();
/// To check if multishipping , end also if shiping is same as billing
if($sameasbill_add=='on')
{
// Update Billing Address
if($bl_country!='US')
$bl_state = $bl_votherstate;
$db_sql = "update client set vfirstname='$bl_firstname', vmiddlename='$bl_middlename', vlastname='$bl_lastname', vemail = '$bl_email' , vaddress1='$bl_address1', vaddress2='$bl_address2', vphone='$bl_phone', vcity='$bl_city', vstate='$bl_state', vcountry='$bl_country', izip='$bl_zip' where iclientid=$iMemberid ";
$result = $obj->edit($db_sql);
}else{
if($bl_country!='US')
$bl_state = $bl_votherstate;
if(isset($self_exist) and !empty($self_exist))
{
// $db_sql = "update client set vfirstname='$sh_fname', vmiddlename='$sh_mname', vlastname='$sh_lname', vemail = '$sh_email' , vaddress1='$sh_address', vaddress2='$sh_address2', vphone='$sh_phone', vcity='$sh_city', vstate='$sh_state', vcountry='$sh_country', izip='$sh_zip' where iclientid=$iMemberid ";
// $result = $obj->edit($db_sql);
}
}
}
/// If Comes From checkout page Ends
//// if multiple shippinf address
session_unregister("sess_shippingaddress");
unset($sess_shippingaddress);
$single_shadd = 0;
$multi_shadd = 1;
$sess_orderinfo[1] = 1; // IF MULTI SHIPPING THEN 1 else 0
for($add=0;$add<$totalcart;$add++)
{
$shoppingItem = $shoppingCart->items[$add];
$address_sql = "select iclientaddbookid from clientaddressbook where LOWER(vaddresstitle) = '".$shoppingItem->shipto_add_name."' and iclientid = '".$iMemberid."'";
$address_res = $obj->select($address_sql);
if(trim($shoppingItem->shipto_add_name)=='-1')
$temp_addid = '-1';
else
$temp_addid = $address_res[0]['iclientaddbookid'];
$shoppingCart->updateItem($add, false, false, $temp_addid);
//$sess_shoppingcart[$add][6] = $temp_addid; // Shipping AddressId From Address Book
}
//////////////////////
$billaddres = clientBillingAddress();
if($billaddres["vcountry"]=="US" || $billaddres["vcountry"]=="CA")
$credit_dispaly = 1;
if($billaddres)
{
$veristreet = $billaddres[0]["vaddress1"];
$verizip = $billaddres[0]["izip"];
$table_billadd[] = array(
'vName' => $billaddres["vfirstname"]." ".$billaddres["vmiddlename"]." ".$billaddres["vlastname"],
'vaddress1' => $billaddres["vaddress1"],
'vaddress2' => $billaddres["vaddress2"],
'vcity' => $billaddres["vcity"],
'vstate' => $billaddres["vstate"],
'vcountry' => $billaddres["vcountry"],
'izip' => $billaddres["izip"],
'vphone' => $billaddres["vphone"],
'vemail' => $billaddres["vemail"],
);
}
$totalcart = $shoppingCart->totalCount();
$totalcart_items = $shoppingCart->totalNonGCProductsCount();
//echo $billaddres["vcountry"];
//echo $sameasbill;
session_register("sess_orderinfo"); // Register Order Info In To Session
$tri = 1;
$temp_Tax = 0;
$cartitems_by_addresses = array();
$packing_value=0;
$packingcharge = 0;
for($tc=0;$tc<$totalcart;$tc++)
{
$shoppingItem = $shoppingCart->items[$tc];
$iproductid = $shoppingItem->productid;
$cate_id = $shoppingItem->icategoryid;
// echo "
cate_id : ".$cate_id;
$category_check = $shoppingCart->CategoryName_Detail($cate_id); // Code for Category Name Display
// echo "
category_check : ".$category_check;
$prosql = "select iproductid, vproductname, vshortdesc, vunitid, fsaleprice, vweight, vSKU, vproductdetail, vtype from products where iproductid='$iproductid' ";
//echo $prosql."
";
//exit;
$prores = $obj->select($prosql);
if($prores)
{
$pimgsql = "select vthumbimage from productimage where iproductid='$iproductid' and eimgstatus='Active' ";
//echo $pimgsql;
//exit;
$pimgres = $obj->select($pimgsql);
$totprice =$shoppingItem->totalPrice();
$tmp_amountarr[$tc] = $totprice;
$discount = $shoppingCart->quantityDiscountFor($tc) + $shoppingCart->specialDiscountFor($tc);
$pricewithdisc = $totprice - $discount;
$SubTotal = $SubTotal + $pricewithdisc;
$OrderSubTotal = Make_Price($SubTotal); //number_format($SubTotal,2,'.',',');
$OrderSubTotal_org = $SubTotal;
if($discount=='0' || $discount=='0.00')
$viewdiscount = "";
else
{
$temp_dis = number_format($discount,2,'.',',');
$temp_pwd = number_format($pricewithdisc,2,'.',',');
$viewdiscount = "
".Make_Price($temp_dis)."
".Make_Price($temp_pwd)." ";
}
// echo "
SES-- ".$sess_orderinfo[1];
if($sess_orderinfo[1]=='1')
{
$AddressTdTitle = "Shipping Address";
$shippingAddress = clientShippingAddress($shoppingItem->shippingAddressId);
$title_other = ucwords(strtolower($shippingAddress[vaddresstitle]));
$ship_add_id = $shippingAddress["iclientaddbookid"];
// echo "
Email:".$shoppingItem->otherPreferences["gcemail"];
$AddressTitle = $shoppingItem->isShippedPhysically() ? "".ucwords(strtolower($shippingAddress["vaddresstitle"]))."" : ("Email to: ".$shoppingItem->otherPreferences["gcemail"]);
// $temp_ShippingCharge = $temp_ShippingCharge + MultiAddress_ShippingCharge($shoppingItem->shippingAddressId);
$oldflag = 0;
// echo "
TC:".$tc;
for($old=0;$old<$tc;$old++)
{
$oldShoppingItem = $shoppingCart->items[$old];
//echo "
Old Ship:".$oldShoppingItem->shippingAddressId;
//echo "
Shop Item:".$shoppingItem->shippingAddressId;
if($oldShoppingItem->shippingAddressId==$shoppingItem->shippingAddressId)
{
$oldflag = 1;
break;
}
}
if($oldflag == 0)
{
if($tri==3)
{
$tr = " ";
//print_r($sess_orderinfo);
//exit;
if(!isset($payment_method) and !empty($payment_method))
{
Header("Location:".$SecureSite_URL."index.php?file=s-checkout&err_msg=".urlencode($m_PaymentMethodNotSpecified));
exit;
}
/*
$payment_method = in_array(strtolower($payment_method), array("phoneorfax", "authorised", "cheque"))?strtolower($payment_method):false;
if(false === $payment_method && $sess_orderinfo[11] > 0):
Header("Location:".$SecureSite_URL."index.php?file=s-checkout&err_msg=".urlencode($m_PaymentMethodNotSpecified));
exit;
endif;
*/
if(session_is_registered("sess_iorderid")) {
/* $query = "select * from ordermast where iorderid='$sess_orderid'";
$myres = $db->DirectSelect($query); */
$myres=$oOrderMaster->GetOrderDetailByID($sess_orderid);
$used_gcid = $myres["igcid"];
$used_gcvalue = $myres["fgcamount"];
$oGiftCert->cancelGiftCertificatePayment($used_gcid, $used_gcvalue);
$delres=$oOrderMaster->DeleteOrder($sess_iorderid);
/* $del_reco = "delete from ordermast where iorderid='$sess_iorderid' ";
//echo $del_reco;
//exit;
$delres = $obj->sql_query($del_reco);
*/
session_unregister("sess_iorderid");
unset($sess_iorderid);
session_unregister("x_amount");
unset($x_amount);
} else {
session_unregister("sess_iorderid");
unset($sess_iorderid);
session_unregister("x_amount");
unset($x_amount);
//exit;
}
$oAddressBook=new AddressBook();
if(!session_is_registered("sess_iorderid")) {
$billaddres = $oAddressBook->clientBillingAddress();
/*if(isset($fakeMember)){
$iMemberid = makeNewMember($billaddres, "Inactive");
// Set Affiliate In New Sign UP
include_once("lib/setsignup.php");
}*/
if($billaddres) {
$oOrderAddress->vname = addslashes($billaddres["vfirstname"])." ".addslashes($billaddres["vmiddlename"])." ".addslashes($billaddres["vlastname"]);
$oOrderAddress->vtype="Billing";
//$oOrderAddress->lastname1 = addslashes($billaddres["vlastname"]);
$oOrderAddress->vaddress1 = addslashes($billaddres["vaddress1"]);
$oOrderAddress->vaddress2 = addslashes($billaddres["vaddress2"]);
$oOrderAddress->vcity = addslashes($billaddres["vcity"]);
$oOrderAddress->vstate = $billaddres["vstate"];
$oOrderAddress->vcountry = $billaddres["vcountry"];
$oOrderAddress->izip = $billaddres["izip"];
$oOrderAddress->vphone = $billaddres["vphone"];
$oOrderAddress->vemail = $billaddres["vemail"];
$oOrderAddress->vdetail= $billaddres["vphone"];
$oOrderAddress->vremark="Pending";
$billres =$oOrderAddress->InsertOrderAddress();
//exit;
//$billsql = "INSERT INTO `orderaddress` ( `iorderaddressid` , `vname` , `vtype` , `vaddress1` , `vaddress2` , `vcity` , `vstate` , `vcountry` , `izip` , `vtrackingno` , `vdetail` , `vremark`, `vemail` ) VALUES ('', '$vName', 'Billing', '$vaddress1', '$vaddress2', '$vcity', '$vstate', '$vcountry', '$izip', '', '$vphone', 'Pending', '$vemail')";
//echo $billsql."
";
//$billres = $db->DirectInsert($billsql);
$bill_add_m .="
Adderss1: ".addslashes($billaddres["vaddress1"]);
$bill_add_m .="
Adderss2: ".addslashes($billaddres["vaddress2"]);
$bill_add_m .="
City: ".addslashes($billaddres["vcity"]);
$bill_add_m .="
State: ".$billaddres["vstate"];
$bill_add_m .="
Country: ".$billaddres["vcountry"];
$bill_add_m .="
zip: ".$billaddres["izip"];
$bill_add_m .="
vphone: ".$billaddres["vphone"];
$bill_add_m .="
Email: ".$billaddres["vemail"];
if(!empty($billres))
$sess_orderinfo[12] = $billres; // Billing Address Id
else
$sess_orderinfo[12] = 0;
}
$dDate = date('Y-m-d');
$Expdate = "Exp.".$CCExp;
//$Credit_Details = $CCType.",".base64_encode($CCNumber).",".$Expdate;
$Credit_Details = $CCType.",".$Expdate;
$cosql = "select max(iorderid) as max from ordermast where iclientid='$sessMemberID' ";
$cores = $db->DirectSelect($cosql);
$maxno = $cores[0]["max"]+1;
$ordernumber = "CO-".$maxno."-".($sessMemberID?$sessMemberID:"00");
$iorderon_m=$ordernumber;
$x_amount = str_replace('$','',$sess_orderinfo[11]);
$giftcert_status = $oGiftCert->captureGiftCertificatePayment($sess_orderinfo["igcid"], $sess_orderinfo["gift_certificate_value"]);
if( $sess_orderinfo["gift_certificate_value"]> 0 && false === $giftcert_status):
// gift certificate cannot be captured, try again
$sess_orderinfo["igcid"] = 0;
$sess_orderinfo[7] += $sess_orderinfo["gift_certificate_value"];
$sess_orderinfo["gift_certificate_value"] = 0;
$err_msg = urlencode($m_GiftCertificateError);
Header("Location:".$SecureSite_URL."index.php?file=s-checkout&msg=".$err_msg);
exit;
endif;
/*$ordersql = "INSERT INTO `ordermast` ( `iorderid` , `iclientid` , `iorderno` , `dorderdate` , `dlastmodified` , `fsubtotal` , `ftax` , `fshipping` , `fdiscount` , `fcouponamount` , `ftotalamount` , `etransactiontype` , `ipaymentdtlid` , `iorderaddressid` , `vdetail` , `estatus` , `emultiship` , `vflag` , `vremark`, `fcurrencyrate`, `igcid`, `fgcamount`, `vcustcomment`, `ichequeno`,`shippingtype`,`ccinfo`) VALUES ('', '$iMemberid', '$ordernumber', '$dDate', '$dDate' , '$sess_orderinfo[5]', '$sess_orderinfo[10]', '$sess_orderinfo[8]', '$sess_orderinfo[6]', '$sess_orderinfo[7]', '$sess_orderinfo[11]', '$payment_method', '0', '$sess_orderinfo[12]', '' , 'NO CREDITCARD', '$sess_orderinfo[1]', '$sess_orderinfo[4]', '', '".$currentCurrency["rate"]."', '".$sess_orderinfo["igcid"]."','".$sess_orderinfo["gift_certificate_value"]."', '$vcustcomment', '$check_num','".$shippingtype."','".$Credit_Details."')";*/
$oOrderMaster->iclientid=$sessMemberID;
$oOrderMaster->iorderno=$ordernumber;
$oOrderMaster->dorderdate=$dDate;
$oOrderMaster->dlastmodified=$dDate;
$oOrderMaster->fsubtotal=$sess_orderinfo[5];
$oOrderMaster->ftax=$sess_orderinfo[10];
$oOrderMaster->fshipping=$sess_orderinfo[8];
$oOrderMaster->fdiscount=$sess_orderinfo[6];
$oOrderMaster->fcouponamount=$sess_orderinfo[7];
$oOrderMaster->ftotalamount=$sess_orderinfo[11];
$oOrderMaster->etransactiontype=$payment_method;
$oOrderMaster->ipaymentdtlid=0;
$oOrderMaster->iorderaddressid=$sess_orderinfo[12];
$oOrderMaster->vdetail="";
if($payment_method=="paypal"){
$oOrderMaster->estatus="Send To Paypal";
$paypal_status="Send To Paypal";
}else{
$oOrderMaster->estatus="NO CREDITCARD";
}
$oOrderMaster->emultiship=$sess_orderinfo[1];
$oOrderMaster->vflag=$sess_orderinfo[4];
$oOrderMaster->vremark="";
$oOrderMaster->fcurrencyrate=$currentCurrency["rate"];
$oOrderMaster->igcid=$sess_orderinfo["igcid"];
$oOrderMaster->fgcamount=$sess_orderinfo["gift_certificate_value"];
$oOrderMaster->vcustcomment=$vcustcomment;
$oOrderMaster->ichequeno=$check_num;
$oOrderMaster->shippingtype=$shippingtype;
$oOrderMaster->ccinfo=$Credit_Details;
$oOrderMaster->vgiftcardmessage=$giftcardmessage;
$oOrderMaster->AddOrderMaster();
$orderres=mysql_insert_id();
$iMemberid_m=$sessMemberID;
$paypal_status_m =$paypal_status;
$total_m ="Sub Total: ".$sess_orderinfo[5];
$total_m .="Shipping Amount: ".$sess_orderinfo[8];
$total_m .="Tax Amount: ".$sess_orderinfo[10];
$total_m .="Discount: ".$sess_orderinfo[6];
$total_m .="Coupon Amount: ".$sess_orderinfo[7];
$total_m .="Total Amount: ".$sess_orderinfo[11];
$vftotalamount_m ='$'.$sess_orderinfo[11];
/*echo "
Order Mast ".$ordersql."
"; exit;*/
// Set Affiliate In New Order
include_once("lib/setorder.php");
//session_register("sess_orderinfo"); // Register Order Info In To Session
$totalcart = $shoppingCart->totalCount();
$temp_Tax = 0;
for($tc=0;$tc<$totalcart;$tc++) {
$shoppingItem = $shoppingCart->items[$tc];
$iproductid =$shoppingItem->productid;
$icategoryid = $shoppingItem->icategoryid;
$prosql = "select iproductid,vproductname, vshortdesc, vunitid, fsaleprice, vweight from products where iproductid='$iproductid' ";
//echo $prosql."
";
//exit;
$prores = $db->DirectSelect($prosql);
if($prores) {
$totprice =$shoppingItem->totalPrice();
$discount = $shoppingCart->quantityDiscountFor($tc) + $shoppingCart->specialDiscountFor($tc);
$pricewithdisc = $totprice - $discount;
$SubTotal = $SubTotal + $pricewithdisc;
$OrderSubTotal = number_format($SubTotal,2,'.',',');
if($sess_orderinfo[1]=='1') {
$oldflag = 0;
for($old=0;$old<$tc;$old++)
{
$oldShoppingItem = $shoppingCart->items[$old];
if($oldShoppingItem->shippingAddressId==$shoppingItem->shippingAddressId)
{
$oldflag = 1;
break;
}
}
if($oldflag == 0) {
// Entry In table
$vName = $oAddressBook->Get_Address_Name($shoppingItem->shippingAddressId);
$vdetail = $oAddressBook->Get_Address_Title($shoppingItem->shippingAddressId);
$iclientaddbookid = $shoppingItem->shippingAddressId;
$viewadd = $oAddressBook->clientShippingAddress($iclientaddbookid);
$vaddress1 = addslashes($viewadd["vaddress1"]);
$vaddress2 = addslashes($viewadd["vaddress2"]);
$vcity = addslashes($viewadd["vcity"]);
$vstate = $viewadd["vstate"];
$vcountry = $viewadd["vcountry"];
$izip = $viewadd["izip"];
$vemail = $viewadd["vemail"];
$vphone = $viewadd["vphone"];
$vcomments = $shoppingItem->vcomments;
if(isset($shoppingItem->shippingmodeid))
{
$query1 = "select * from shippingmode where ishippingmodeid='".$shoppingItem->shippingmodeid."'";
$myres1 = $db->DirectSelect($query1);
if($myres1)
{
$shippingtype=$myres1[0]["vtype"];
}
}
/*$shsql = "INSERT INTO `orderaddress` ( `iorderaddressid` , `vname` , `vtype` , `vaddress1` , `vaddress2` , `vcity` , `vstate` , `vcountry` , `izip` , `vtrackingno` , `vdetail` ,`shippingtype`, `vcomments`, `vremark`, `vemail` ) VALUES ('', '$vName', 'Shipping', '$vaddress1', '$vaddress2', '$vcity', '$vstate', '$vcountry', '$izip', '', '','$shippingtype', '$vcomments', 'Pending', '$vemail')";*/
// echo $shsql."
";
$oOrderAddress->vname=$vName;
$oOrderAddress->vtype="Shipping";
$oOrderAddress->vaddress1=$vaddress1;
$oOrderAddress->vaddress2=$vaddress2;
$oOrderAddress->vcity=$vcity;
$oOrderAddress->vstate=$vstate;
$oOrderAddress->vcountry=$vcountry;
$oOrderAddress->izip=$izip;
$oOrderAddress->vtrackingno="";
$oOrderAddress->vdetail=$vphone;
$oOrderAddress->shippingtype=$shippingtype;
$oOrderAddress->vcomments=$vcomments;
$oOrderAddress->vremark="Pending";
$oOrderAddress->vemail=$vemail;
$shres = $oOrderAddress->InsertOrderAddress();
$iorderaddressid = $shres;
$item_address[$tc] = $iorderaddressid;
session_register("item_address");
} else {
$iorderaddressid = $item_address[$old];
}
} else if ($sess_orderinfo[1]=='0') {
if($tc<1) {
$vName = $sess_shippingaddress["vfirstname"]." ".$sess_shippingaddress["vlastname"];
/*$shsql = "INSERT INTO `orderaddress` ( `iorderaddressid` , `vname` , `vtype` , `vaddress1` , `vaddress2` , `vcity` , `vstate` , `vcountry` , `izip` , `vtrackingno` , `vdetail` , `vremark` ) VALUES ('', '$vName', 'Shipping', '".$sess_shippingaddress["vaddress1"]."', '', '".$sess_shippingaddress["vcity"]."', '".$sess_shippingaddress["vstate"]."', '".$sess_shippingaddress["vcountry"]."', '".$sess_shippingaddress["izip"]."', '', '', 'Pending')";*/
//echo $shsql."
";
$oOrderAddress->vname=$vName;
$oOrderAddress->vtype="Shipping";
$oOrderAddress->vaddress1=$sess_shippingaddress["vaddress1"];
$oOrderAddress->vaddress2="";
$oOrderAddress->vcity=$sess_shippingaddress["vcity"];
$oOrderAddress->vstate=$sess_shippingaddress["vstate"];
$oOrderAddress->vcountry=$sess_shippingaddress["vcountry"];
$oOrderAddress->izip=$sess_shippingaddress["izip"];
$oOrderAddress->vtrackingno="";
$oOrderAddress->vdetail="";
$oOrderAddress->vremark="Pending";
$oOrderAddress->InsertOrderAddress();
$sess_orderinfo[12] = $shres;
$iorderaddressid = $shres;
} else {
$iorderaddressid = $sess_orderinfo[12];
}
} else if(($sess_orderinfo[1]=='9999')) {
$iorderaddressid = $sess_orderinfo[12];
}
$pricewithdisc = number_format($pricewithdisc,2,'.','');
$itemquantity = $shoppingItem->quantity;
//shalin 4sept
if(isset($shoppingItem->is_gift_wrap) && !empty($shoppingItem->is_gift_wrap) and $shoppingItem->is_gift_wrap=='1')
{
$egiftwrap="Yes";
$wrapper_charge += $GIFT_WRAP_CHARGE;
}
else
{
$egiftwrap="No";
}
if(isset($shoppingItem->is_gift_box) && !empty($shoppingItem->is_gift_box) and $shoppingItem->is_gift_box=='1')
{
$egiftbox="Yes";
$wrapper_charge += $GIFT_WRAP_CHARGE;
}
else
{
$egiftbox="No";
}
//
/*$itemsql = "INSERT INTO `orderdetail` ( `iorderdetailid` , `iorderid` , `iproductid` ,`icategoryid`, `iorderaddressid` , `iquantity` , `fprice` , `vdetail` , `vflag` , `estatus` , `vremark`,`egiftwrap` ) VALUES ('','$orderres','$iproductid','$icategoryid', '$iorderaddressid', '$itemquantity', '$pricewithdisc', '', '', 'Active', '','$egiftwrap')";*/
if ($shoppingItem->is_bulk=='1'){
$sqlpid=$db->DirectSelect("select * from shoppingcartitem where iindex='".$tc."' and vuniqueid='".$SHOPPING_CART_ID."'");
$secprores = $oProduct->GetProductDeatilByID($sqlpid[0]['biproductid1']);//$db->DirectSelect($prosql);
$thrdprores = $oProduct->GetProductDeatilByID($sqlpid[0]['biproductid2']);//$db->DirectSelect($prosql);
$bulk_price=$shoppingItem->bulkprice;
$is_bulk=$shoppingItem->is_bulk;
}
$oOrderDetail->iorderid=$orderres;
$oOrderDetail->iproductid=$iproductid;
$oOrderDetail->icategoryid=$icategoryid;
$oOrderDetail->iorderaddressid=$iorderaddressid;
$oOrderDetail->iquantity=$itemquantity;
$oOrderDetail->fprice=$pricewithdisc;
$oOrderDetail->vdetail="";
$oOrderDetail->vflag="";
$oOrderDetail->estatus="Active";
$oOrderDetail->vremark="";
$oOrderDetail->egiftwrap=$egiftwrap;
$oOrderDetail->egiftbox=$egiftbox;
$oOrderDetail->is_bulk =$is_bulk;
$oOrderDetail->bulkprice =$bulk_price;
$oOrderDetail->biproductid1=$secprores[0]['iproductid'];
$oOrderDetail->biproductid2=$thrdprores[0]['iproductid'];
$oOrderDetail->couponproduct=$shoppingItem->couponproduct;
$oOrderDetail->AddOrderDetail();
// echo "
Order Mast ".$itemsql."
";
//echo $itemsql."
";
// $itemres = $db->DirectUpdate($itemsql);
// add free items shipped with this order
$preferredFreeItems = $shoppingItem->preferredFreeItems();
foreach($preferredFreeItems as $freeProductId=>$freeProductQuantity){
$freeItemDetail = "Free with '".$prores[0]["vSKU"]."-".$prores[0]["vproductname"]."'";
/*$freeItemSQL = "INSERT INTO `orderdetail` ( `iorderdetailid` , `iorderid` , `iproductid` , `iorderaddressid` , `iquantity` , `fprice` , `vdetail` , `vflag` , `estatus` , `vremark` ) VALUES ('', '$orderres', '$freeProductId', '$iorderaddressid', '$freeProductQuantity', '0', '".mysql_escape_string($freeItemDetail)."', '', 'Active', '')";*/
$oOrderDetail->iorderid=$orderres;
$oOrderDetail->iproductid=$freeProductId;
$oOrderDetail->iorderaddressid=$iorderaddressid;
$oOrderDetail->iquantity=$freeProductQuantity;
$oOrderDetail->fprice=0;
$oOrderDetail->vdetail=mysql_escape_string($freeItemDetail);
$oOrderDetail->vflag="";
$oOrderDetail->estatus="Active";
$oOrderDetail->vremark="";
$oOrderDetail->AddOrderDetail();
//$freeItemRes = $db->DirectUpdate($freeItemSQL);
} // end foreach;
// if gift certificate, generate new
if($shoppingItem->isGiftCertificate()){
$orderAddress = $oAddressBook->loadOrderAddress($iorderaddressid);
$oGiftCert->iclientid=$sessMemberID?$sessMemberID:"0";
$oGiftCert->vgccode=$SHOPPING_CART_ID;
$oGiftCert->vrecipient=$shoppingItem->otherPreferences["gcemail"];
$oGiftCert->vmessage=$shoppingItem->otherPreferences["gcmessagetext"];
$oGiftCert->fgcvalue=$shoppingItem->unitPrice();
$oGiftCert->fcurrentvalue=$shoppingItem->unitPrice();
$oGiftCert->ddate=date("Y-m-d");
$oGiftCert->estatus="Invalid";
$oGiftCert->emultipleusage="Yes";
$oGiftCert->iorderdetailid=$orderres;
$oGiftCert->vsubject=$shoppingItem->otherPreferences["gcmessagesubject"];
$oGiftCert->vsignature=$shoppingItem->otherPreferences["gcmessagesignature"];
$oGiftCert->AddGiftCertificates();
$giftCertId = mysql_insert_id();
} // end if($shoppingItem->isGiftCertificate())
$pricewithdisc = 0;
$totprice = 0;
$discount = 0;
}
}
//echo "In IF
";
session_register("sess_iorderid");
session_register("x_amount");
$sess_iorderid = $orderres;
$iorderid = $orderres;
} else {
//echo "IN Else
";
$orderres = $sess_iorderid;
}
$query = "UPDATE ordermast SET wrapper_charge='$wrapper_charge' WHERE iorderid='$sess_iorderid'";
$db->DirectUpdate($query);
//echo "a".$sess_orderinfo[11]."b";exit;
// if no payment needed - when whole order is paid by Gift Certificate - automatically approve order
if($sess_orderinfo[11] == 0):
$query = "UPDATE ordermast SET estatus='Approved' WHERE iorderid='$sess_iorderid'";
$db->DirectUpdate($query);
session_unregister("sess_orderinfo");
unset($sess_orderinfo);
session_unregister("sess_shippingaddress");
unset($sess_shippingaddress);
$shoppingCart->beEmpty();
$shoppingCart->store();
//activateClient($iMemberid);
session_unregister("item_address");
unset($item_address);
//echo "p";exit;
session_unregister("sess_iorderid");
unset($sess_iorderid);
session_unregister("x_amount");
unset($x_amount);
// send email confirmation
include("orderreceiptemails.php");
Header("Location:".$Site_URL."index.php?file=od-orderreceipt&iorderid=$iorderid");
exit;
endif; // if($sess_orderinfo[11] == 0)
/////Header("Location: index.php?file=printorderreceipt&iorderid=$iorderid");
/////exit;
// include payment script based on user defined payment method
$sess_orderinfo["payment_method"] = $payment_method;
if(strpos(strtolower($payment_method),'redit'))
{
$CCExp = trim($ccemonth."/".substr($cceyear,2,2));
$CCExpireDate = $ccemonth.substr($cceyear,2,2);
$CCStreet = str_replace(" ", "_",$billaddres["vaddress1"]);
$CCZIP = $billaddres["izip"];
$CSC = substr($CSC, 0, 4); // CSC is only 3-4 digit long
$CCExp = trim($ccemonth."/".substr($cceyear,2,2));
$CCExpireDate = $ccemonth.substr($cceyear,2,2);
$CCStreet = str_replace(" ", "_",$billaddres["vaddress1"]);
$CCZIP = $billaddres["izip"];
$CSC = substr($CSC, 0, 4); // CSC is only 3-4 digit long
include_once("script/order/process_payment_authorize.php");
}elseif(strpos(strtolower($payment_method),'aypal')){
$sql="Select * from settings where varname='adminemail' and section='2' order by id";
$res = $db->DirectSelect($sql);
$vtoemail = $res[0]["setting"];
$headers = "To: $vtoemail <$vtoemail>\n" . "From: info@PowerOfPerfume.com \n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1";
$subject = "Order Placed At ".$SITE_NAME."com By Client";
$sendmessage .=''.$subject.'
';
$sendmessage .="Order No. : ".$iorderon_m.'
';
$sendmessage .="Client ID. : ".$iMemberid_m.'
';
$sendmessage .="Billing Information:
".$bill_add_m.'
';
$sendmessage .="Payment Method. : ".$payment_method.'
';
$sendmessage .="Payment Status : ".$paypal_status_m.'
';
$sendmessage .="Order Total : ".$vftotalamount_m.'
';
$sendmessage .="
Thanks
".$SITE_NAME;
$onesendstat = @mail($vtoemail, $subject, $sendmessage, $headers);
include_once("script/order/process_payment_paypal.php");
}
/*elseif(strpos(strtolower($payment_method),'heque'))
include_once("script/order/process_payment_cheque.php");
else
include_once("script/order/process_payment_phone.php");
*/
?>
ob_start();
session_start();
/* include_once("functions/shoppingcart.inc");
include_once("functions/checkout.inc");
include_once("functions/orderreceipt.inc");
include_once("messagefiles/shoppingcart_message.inc"); */
$oOrderAddress=new OrderAddress();
$iMemberid=$sessMemberID;
$SiteTitle = $obj->SiteTitle;
$horizontal_image = "shop-cart-01.gif";
$iMemberid = $HTTP_POST_VARS["x_cust_id"];
/*
$response_code=$HTTP_POST_VARS["x_response_code"];
$response_subcode=$HTTP_POST_VARS["x_response_subcode"];
$response_reason_code=$HTTP_POST_VARS["x_response_reason_code"];
$response_reason_text=$HTTP_POST_VARS["x_response_reason_text"];
*/
$response_code=$HTTP_POST_VARS["response_code"];
$response_subcode=$HTTP_POST_VARS["response_subcode"];
$response_reason_code=$HTTP_POST_VARS["response_reason_code"];
$response_reason_text=$HTTP_POST_VARS["response_reason_text"];
$auth_code=$HTTP_POST_VARS["x_auth_code"];
$Trans_ID=$HTTP_POST_VARS["x_Trans_ID"];
$refmsg = "response_code=".$response_code.">>response_subcode=".$response_subcode.">>response_reason_code=".$response_reason_code.">>response_reason_text=".$response_reason_text.">>auth_code=".$auth_code.">>Trans_ID=".$Trans_ID;
session_register("iMemberid");
$ord_cvv = $HTTP_POST_VARS["x_CVV2_Resp_Code"];
$ord_x_avs_code = $HTTP_POST_VARS["x_avs_code"];
//$ord_inv_no = trim($HTTP_POST_VARS["x_invoice_num"]);
$trans_id = $HTTP_POST_VARS["x_Trans_ID"];
$upordersql_avs = "UPDATE `ordermast` set AVSADDR ='$ord_x_avs_code', AVSZIP ='$ord_cvv',CVV2MATCH ='$trans_id' where iorderid='$ord_inv_no' ";
$uporderres_avs = $db->DirectUpdate($upordersql_avs);
/////$response_code=1;//changed by nishant for testing
if($response_code!="1" or !isset($response_code) or empty($response_code)){
$upordersql2 = "UPDATE `ordermast` set estatus='Declined' where iorderid='$ord_inv_no' ";
$uporderres2 = $db->DirectUpdate($upordersql2);
$err_msg = "Order is Declined.";
header("location:".$Site_URL."index.php?file=s-checkout&err_msg=$err_msg");
exit;
}
if($status!="Approved" or !isset($status) or empty($status)){
$upordersql3 = "UPDATE `ordermast` set estatus='Declined' where iorderid='$ord_inv_no' ";
$uporderres3 = $db->DirectUpdate($upordersql3);
$err_msg = "Order is Declined.";
header("location:".$Site_URL."index.php?file=s-checkout&err_msg=$err_msg");
exit;
}
//$ord_inv_no="1";
if(!empty($ord_inv_no))
{
$iorderid = $ord_inv_no;
//$status = 'Approved';
$linkptono = trim($HTTP_POST_VARS["PNREF"]);
$sysono = trim($HTTP_POST_VARS["ordernumber"]);
if($status=="approved" || $status=="Approved" || $status=="APPROVED" || $status=="approve" || $status=="APPROVE")
{
$pay_msg = "Payment Is Approved
";
//echo $pay_msg;
//exit;
$ord_x_AVS_Code = trim($ord_x_avs_code);
$ord_x_avs_code = trim($ord_x_avs_code);
$upordersql = "UPDATE `ordermast` set estatus='Approved', vdetail='$linkptono' where iorderid='$iorderid' ";
//echo $upordersql."
";
$uporderres = $db->DirectUpdate($upordersql);
$ordersql = "select * from ordermast where iorderid ='$iorderid' ";
$orderres = $db->DirectSelect($ordersql);
$iclientid = $orderres[0]["iclientid"];
$iorderno = $orderres[0]["iorderno"];
$err_msg = "Your Order Number : ".$iorderno."";
$dorderdate = $orderres[0]["dorderdate"];
$OrderSubTotal = number_format($orderres[0]["fsubtotal"],2,'.',',');
$Tax = number_format($orderres[0]["ftax"],2,'.',',');
$ShippingCharge = number_format($orderres[0]["fshipping"],2,'.',',');
$GC_Charge = number_format($orderres[0]["fgcamount"],2,'.',',');
$HandlingCharge = number_format(0,2,'.',',');
$totaldiscount = number_format($orderres[0]["fdiscount"],2,'.',',') + number_format($orderres[0]["fcouponamount"],2,'.',',');
$ordertotal = number_format($orderres[0]["ftotalamount"],2,'.',',');
$iorderaddressid = $orderres[0]["iorderaddressid"];
$estatus = $orderres[0]["estatus"];
$emultiship = $orderres[0]["emultiship"];
$billaddsql = "select * from orderaddress where iorderaddressid='$iorderaddressid' ";
$billaddres = $db->DirectSelect($billaddsql);
$table_billadd[] = array(
'vName' => $billaddres[0]["vname"],
'vaddress1' => $billaddres[0]["vaddress1"],
'vaddress2' => $billaddres[0]["vaddress2"],
'vcity' => $billaddres[0]["vcity"],
'vstate' => $billaddres[0]["vstate"],
'vcountry' => $billaddres[0]["vcountry"],
'izip' => $billaddres[0]["izip"],
);
$itemsql = "select * from orderdetail where iorderid='$iorderid' ";
$itemres = $db->DirectSelect($itemsql);
$totalcart = count($itemres);
$giftwrap_changes_recipt = 0;
$giftwrap_changes_recipt_price = "0.00";
for($tc=0;$tc<$totalcart;$tc++)
{
$cate_id = $itemres[$tc]["icategoryid"];
$category_check = $shoppingCart->CategoryName_Detail($cate_id); // Code for Category Name Display
$iproductid = $itemres[$tc]["iproductid"];
$giftwrap_price_final = $itemres[$tc]["egiftwrap"];
if($giftwrap_price_final=='Yes')
{
$giftwrap_changes_recipt = 1;
$giftwrap_changes_recipt_price += $GIFT_WRAP_CHARGE;
}
//echo "gift ".$giftwrap_changes_recipt_price;
$prosql = "select iproductid, vproductname, vshortdesc, vunitid, fsaleprice, vweight, vSKU, vproductdetail,vtype,vtype2 from products where iproductid='$iproductid' ";
$prores = $db->DirectSelect($prosql);
$pimgsql = "select vthumbimage from productimage where iproductid='$iproductid' and eimgstatus='Active' ";
$pimgres = $db->DirectSelect($pimgsql);
$vdetail = $itemres[$tc]["vdetail"];
$vflag = $itemres[$tc]["vflag"];
$estatus = $itemres[$tc]["estatus"];
$vremark = $itemres[$tc]["vremark"];
// $product_th_image = $thumb_image_path.$pimgres[0]["vthumbimage"];
$product_th_image = ROOT_DIR."images/products/thumbimage/".$pimgres[0]["vthumbimage"];
if(file_exists($product_th_image) and !empty($pimgres[0]["vthumbimage"]))
$image = $thumb_image_url.$pimgres[0]["vthumbimage"];
else
$image = $thumb_image_url."default_thumb_img.jpg";
$table_cart[] = array(
'loop' => $tc,
'vSKU' => $prores[0]["vSKU"],
'iproductid' => $iproductid,
'vthumbimage' => $image,
'vProductName' => $prores[0]["vproductname"],
'vtype2' => $prores[0]["vtype"].$category_check,
'vshortdesc' => $prores[0]["vshortdesc"],
'vproductdetail'=> substr(stripslashes($prores[0]["vproductdetail"]),0,200)."...",//Make_Small_Desc(stripslashes($prores[0]["vproductdetail"])),
'qty' => $itemres[$tc]["iquantity"],
'mrprice' => $itemres[$tc]["fprice"] / $itemres[$tc]["iquantity"], //Make_Price( $itemres[$tc]["fprice"] / $itemres[$tc]["iquantity"]),
'totprice' => $itemres[$tc]["fprice"],//Make_Price($itemres[$tc]["fprice"]),
'AddressName' => $oOrderAddress->Order_ShipAddress_Name($itemres[$tc]["iorderaddressid"]),
'ShipAddress' => $oOrderAddress->Order_ShipAddress($itemres[$tc]["iorderaddressid"]),
);
}
$receipt = 1;
include_once("orderreceiptemails.php");
} else {
$err_msg = rawurlencode("Sorry, Your Payment Is Declined11.
".$RESPMSG);
$upordersql = "UPDATE `ordermast` set estatus='Declined', vdetail='$linkptono' where iorderid='$iorderid' ";
$uporderres = $db->DirectUpdate($upordersql);
$receipt = 0;
$iclientid = $iMemberid;
$cname = Get_Login_Client_Name();
$vtoemail = Get_Client_Email($iclientid);
$vfromemail = Get_Info_Email();
$headers = "To: $vtoemail <$vtoemail>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1";
$subject = "Your Order No. ".Get_Order_Number($iorderid)." ".$SITE_NAME.".com.";
$sendmessage = "Dear ".$cname."
Thank you for your order with www.".$SITE_NAME.".com
Your order No. is : ".Get_Order_Number($iorderid)."
Unfortunately, your order cannot be processed for the following reasons:
1. Your credit card has been declined by your credit card company. Please contact your credit card company to resolve the issue.
If you wish order again, please visit our web site www.".$SITE_NAME.".com and create a NEW order. If there are any questions, please contact our customer service at ".$TOLL_FREE." or contact us via email at ".$salesemail."
Sincerely,
".$SITE_NAME."., Inc.
";
//echo $vtoemail."
";
//echo $subject."
";
//echo $sendmessage."
";
//echo $headers;
//exit;
//$onesendstat = mail($vtoemail, $subject, $sendmessage, $headers);
$vtoemail = generalsetting("adminemail",2);
$vfromemail = Get_Info_Email();
$headers = "To: $vtoemail <$vtoemail>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1";
$subject = "Your Order No. ".Get_Order_Number($iorderid)." ".$SITE_NAME.".com.";
//echo $subject."
";
//echo $sendmessage."
";
//echo $headers;
//exit;
$onesendstat = @mail($vtoemail, $subject, $sendmessage, $headers);
header("location:".$Site_URL."index.php?file=s-checkout&err_msg=$err_msg");
exit;
}
}
else
{
$err_msg = rawurlencode("Sorry, Your Payment Is Declined.
".$RESPMSG);
//echo $err_msg;
//exit;
//$upordersql = "UPDATE `ordermast` set estatus='Declined', vdetail='$linkptono' where iorderid='$iorderid' ";
//echo $upordersql."
";
//$uporderres = $db->DirectUpdate($upordersql);
$receipt = 0;
header("location:".$Site_URL."index.php?file=s-checkout&err_msg=$err_msg");
exit;
}
//include_once("scripts/leftnav.php");
$icatid = $catid;
//include_once("lib/navigation.php");
//$Navigation1=1;
session_unregister("sess_orderinfo");
unset($sess_orderinfo);
session_unregister("sess_shippingaddress");
unset($sess_shippingaddress);
$shoppingCart->beEmpty();
$shoppingCart->store();
session_unregister("item_address");
unset($item_address);
session_unregister("sess_iorderid");
unset($sess_iorderid);
session_unregister("x_amount");
unset($x_amount);
if($payment_type=="authorize") {
$payment_type="Credit Card";
$iscc = 0;
}
$localvars = array(
"table_cart"=>$table_cart,
"table_billadd" => $table_billadd,
'pay_msg'=>$pay_msg,
'err_msg'=>$err_msg,
'totalitems_in_cart'=>$totalitems_in_cart,
'class_detail'=>$class_detail,
'totalcart'=>$totalcart,
'OrderSubTotal'=>$OrderSubTotal,
'tc'=>$tc,
'shmodecombo'=>$shmodecombo,
'single_shipping_name'=>$single_shipping_name,
'single_shipping_address'=>$single_shipping_address,
'AddressTdTitle'=>$AddressTdTitle,
'totaldiscount'=>number_format($totaldiscount,2,'.',','),
'vcoupontitle'=>$vcoupontitle,
'ShippingCharge'=>$ShippingCharge,
'HandlingCharge'=>$HandlingCharge,
'Tax'=>$Tax,
'payment_type'=>$payment_type,
'vcouponno'=>$vcouponno,
'forderamount'=>$forderamount,
'GC_Charge'=>number_format($GC_Charge,2,'.',','),
'ordertotal'=>$ordertotal,
'fdiscount'=>number_format($fdiscount,2,'.',','),
'dexpirydate'=>$dexpirydate,
'cheque_address'=>$cheque_address,
'dstartdate'=>$dstartdate,
'xyz'=>$xyz,
'abc'=>$abc,
'giftwrap_changes_recipt_price'=>$giftwrap_changes_recipt_price,
);
$smartyvars = array_merge($smartyvars,$localvars);
$indexfile="index.htm";
include_once("include/footer.inc.php");
?>
DirectSelect("select setting from settings where varname='adminemail'");
$vfromemail=$vfromemailsql[0]['setting'];
//include_once("functions/orderreceipt.inc");
$ordersql = "select * from ordermast where iorderid ='$iorderid' ";
if(!$orderres = $db->DirectSelect($ordersql)):
die("orderreceiptemails.php: Invalid order id supplied");
endif;
$iclientid = $orderres[0]["iclientid"]; // can be 0, if the client is not registered
$pay_msg = "Payment Is Approved
";
$iorderno = $orderres[0]["iorderno"];
$err_msg = "Your Order Number : ".$iorderno."";
$dorderdate = $orderres[0]["dorderdate"];
$OrderSubTotal = "$ ".$orderres[0]["fsubtotal"];
$Tax = "$ ".$orderres[0]["ftax"];
$ShippingCharge = "$ ".$orderres[0]["fshipping"];
$GC_Charge = "$ ".number_format($orderres[0]["fgcamount"],2,'.',',');
$HandlingCharge = "$ ".number_format(0,2,'.',',');
//$totaldiscount = "$ ".$orderres[0]["fdiscount"];
$totaldiscount = "$ ".number_format($orderres[0]["fdiscount"],2,'.',',') + number_format($orderres[0]["fcouponamount"],2,'.',',');
$ordertotal = "$ ".$orderres[0]["ftotalamount"];
$payment_method = $orderres[0]["etransactiontype"];
$iorderaddressid = $orderres[0]["iorderaddressid"];
$estatus = $orderres[0]["estatus"];
$emultiship = $orderres[0]["emultiship"];
$billaddsql = "select * from orderaddress where iorderaddressid='$iorderaddressid' ";
$billaddres = $db->DirectSelect($billaddsql);
$table_billadd11[] = array(
'vName' => $billaddres[0]["vname"],
'vaddress1' => $billaddres[0]["vaddress1"],
'vaddress2' => $billaddres[0]["vaddress2"],
'vcity' => $billaddres[0]["vcity"],
'vstate' => $billaddres[0]["vstate"],
'vcountry' => $billaddres[0]["vcountry"],
'izip' => $billaddres[0]["izip"],
);
if(strpos(strtolower($payment_method),'redit'))
$payment_type = "authorize";
elseif(strpos(strtolower($payment_method),'heque'))
$payment_type = "Check";
else
$payment_type = $payment_method;
$table_chequeaddress = array();
if(strpos(strtolower($payment_method),'heque'))
{
$table_chequeaddress[] =
array(
"cheque_address"=>$GLOBALS["CHEQUE_ADDRESS"]
);
}
if($payment_method=="hone") {
$add_var_phone = "Thank you for shopping at ".$SITE_NAME.".com
Your order has been received.
**Remember, in order to process your order we need your credit card number.
Once we receive your credit card number, your order will be processed and sent to our warehouse for fulfillment.
Please send it to us by telephone or fax.
By Phone: Calls us at ".$PHONE_NO."
Monday-Friday: 9:00am-5:00pm PST.
By Fax: ".$FAX_NO."
Send us one page containing your Full name, E-mail address, Order Confirmation Number and your complete: Credit Card Type (Visa, MasterCard, Discover, or American Express), Credit Card Number and Expiration Date.
";
;
}
$itemsql = "select * from orderdetail where iorderid='$iorderid' ";
$itemres = $db->DirectSelect($itemsql);
$totalcart = count($itemres);
$giftwrap_changes_recipt = 0;
$giftwrap_changes_recipt_price = "0.00";
for($tc=0;$tc<$totalcart;$tc++)
{
$cate_id = $itemres[$tc]["icategoryid"];
$category_check = $shoppingCart->CategoryName_Detail($cate_id); // Code for Category Name Display
$iproductid = $itemres[$tc]["iproductid"];
$giftwrap_price_final = $itemres[$tc]["egiftwrap"];
if($giftwrap_price_final=='Yes')
{
$giftwrap_changes_recipt = 1;
$giftwrap_changes_recipt_price =$GIFT_WRAP_CHARGE + $giftwrap_changes_recipt_price;
}
$prosql = "select vSKU,iproductid,vproductname, vshortdesc, vunitid, fsaleprice, vweight, vtype2,vtype from products where iproductid='$iproductid' ";
$prores = $db->DirectSelect($prosql);
$pimgsql = "select vthumbimage from productimage where iproductid='$iproductid' and eimgstatus='Active' ";
$pimgres = $db->DirectSelect($pimgsql);
$vdetail = $itemres[$tc]["vdetail"];
$vflag = $itemres[$tc]["vflag"];
$estatus = $itemres[$tc]["estatus"];
$vremark = $itemres[$tc]["vremark"];
//$product_th_image = $thumb_image_path.$pimgres[0]["vthumbimage"];
$product_th_image = ROOT_DIR."images/products/thumbimage/".$pimgres[0]["vthumbimage"];
//$product_th_image ="images/products/thumbimage/".$pimgres[0]["vthumbimage"];
if(file_exists($product_th_image) and !empty($pimgres[0]["vthumbimage"]))
$image = $thumb_image_url.$pimgres[0]["vthumbimage"];
//$image = "images/products/thumbimage/".$pimgres[0]["vthumbimage"];
else
$image = $thumb_image_url."default_thumb_img.jpg";
//$image = Site_URL."images/default_thumb_img.jpg";
$table_cart11[] = array(
'loop' => $tc,
'iproductid' => $iproductid,
'vthumbimage' => $image,
'vProductName' => $prores[0]["vproductname"],
'vtype2' => $prores[0]["vtype"].$category_check,
'qty' => $itemres[$tc]["iquantity"],
'mrprice' => "$ ".$prores[0]["fsaleprice"],
'totprice' => "$ ".$itemres[$tc]["fprice"],
'AddressName' => $oOrderAddr->Order_ShipAddress_Name($itemres[$tc]["iorderaddressid"]),
'ShipAddress' => $oOrderAddr->Order_ShipAddress($itemres[$tc]["iorderaddressid"]),
);
}
//////////////////////Mail For Gift Certificate ////////////////////////
$giftsql = "select * from giftcertificate where iorderdetailid='$iorderid' ";
$giftres = $db->DirectSelect($giftsql);
for($gc=0;$gcDirectSelect($mailsql);
$sMessage = str_replace('{gccode}', $giftres[$gc]['vgccode'], $mailres[0]['vmailtext']);
$sMessage = str_replace('{recipient}', $billaddres[0]["vname"], $sMessage);
$sMessage = str_replace('{client_name}',$billaddres[0]["vname"], $sMessage);
$sMessage = str_replace('{gc_currentvalue}', $giftres[$gc]['fgcvalue'], $sMessage);
$sMessage = str_replace('{subject}',$giftres[$gc]['vsubject'],$sMessage);
$sMessage = str_replace('{message}', $giftres[$gc]['vmessage'],$sMessage);
$sMessage = str_replace('{signature}', $giftres[$gc]['vsignature'],$sMessage);
$sMessage = str_replace('{SITE_NAME}',$SITE_NAME,$sMessage);
$headers = "To: $vgtoemail <$vgtoemail>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1";
$subject = "Gift Certificate from ".$SITE_NAME.".com";
/* $messagetext = "User ".$billaddres[0]["vname"]." has purchased a gift certificate of Amount USD ".$giftres[$gc]['fgcvalue']." for you
".
"Subject: ".$giftres[$gc]['vsubject']."
".
$giftres[$gc]['vmessage']."
".
$giftres[$gc]['vsignature']."
The Gift Certificate Code is ".$giftres[$gc]['vgccode']."
With Best Regards,
$SITE_NAME";*/
$messagetext= $sMessage;
$onesendstat = @mail($vgtoemail, $subject, $messagetext, $headers);
}
//////////////////////End Mail For Gift Certificate ////////////////////////
$receipt =1;
$cheque_address = $CHEQUE_ADDRESS;
$giftwrap_changes_recipt_price = "$ ".$giftwrap_changes_recipt_price;
$smarty->assign("payment_type",$payment_type);
$smarty->assign("pay_msg",$pay_msg);
$smarty->assign("err_msg",$err_msg);
$smarty->assign("class_detail",$class_detail);
$smarty->assign("totalitems_in_cart",$totalitems_in_cart);
$smarty->assign("totalcart",$totalcart);
$smarty->assign("OrderSubTotal",$OrderSubTotal);
$smarty->assign("tc",$tc);
$smarty->assign("shmodecombo",$shmodecombo);
$smarty->assign("single_shipping_name",$single_shipping_name);
$smarty->assign("single_shipping_address",$single_shipping_address);
$smarty->assign("AddressTdTitle",$AddressTdTitle);
$smarty->assign("totaldiscount",$totaldiscount);
$smarty->assign("ShippingCharge",$ShippingCharge);
$smarty->assign("HandlingCharge",$HandlingCharge);
$smarty->assign("Tax",$Tax);
$smarty->assign("ordertotal",$ordertotal);
$smarty->assign("GC_Charge",$GC_Charge);
$smarty->assign("add_var_phone",$add_var_phone);
$smarty->assign("giftwrap_changes_recipt_price",$giftwrap_changes_recipt_price);
$smarty->assign("SITE_NAME",$SITE_NAME);
$smarty->assign("salesemail",$salesemail);
$smarty->assign("custserviceemail",$custserviceemail);
$smarty->assign("TOLL_FREE",$TOLL_FREE);
$smarty->assign("Site_URL",$Site_URL);
$smarty->assign("cheque_address",$cheque_address);
$smarty->assign("table_billadd11",$table_billadd11);
$smarty->assign("table_cart11",$table_cart11);
$smarty->assign("table_chequeaddress",$table_chequeaddress);
$smarty->assign("brand_logo",$brand_logo);
$sendmessage = $smarty->fetch(ROOT_DIR."template/email/orderreceipt_email.html");
/*
$tpl->load_file('orderreceipt','./template/email/orderreceipt_email.html');
//$tpl->parse_if('orderreceipt', 'receipt');
$tpl->parse_if('orderreceipt', 'giftwrap_changes_recipt');
$tpl->parse_loop('orderreceipt', 'table_billadd11');
$tpl->parse_loop('orderreceipt', 'table_cart11');
$tpl->parse_loop('orderreceipt', 'table_chequeaddress');
$tpl->parse_loop('orderreceipt','brand_logo');
$sendmessage = $tpl->pget('orderreceipt', array('payment_type', 'pay_msg','err_msg','class_detail', 'totalitems_in_cart', 'totalcart', 'OrderSubTotal', 'tc', 'shmodecombo', 'single_shipping_name', 'single_shipping_address', 'AddressTdTitle', 'totaldiscount', 'ShippingCharge', 'HandlingCharge', 'Tax', 'ordertotal','GC_Charge', 'add_var_phone','giftwrap_changes_recipt_price','SITE_NAME','salesemail','custserviceemail','TOLL_FREE','Site_URL','cheque_address'));
*/
if($iclientid > 0):
$vtoemail = $oMember->GetClientEmailFromID($iclientid);
else:
$vtoemail = $billaddres[0]["vemail"];
endif;
$rsMail = $oEmail->GetEmailTemplateByName("Order Confirmation email");
$subject = str_replace("{SITE_NAME}",SITE_NAME,stripslashes($rsMail->Subject));
$headers = "To: $email <$email>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1";
$message_contents = str_replace("{vemail}",$vtoemail,stripslashes($rsMail->Message));
$message_contents = str_replace("{vPassword}",$rsMail[0]["vpassword"],stripslashes($message_contents));
$message_contents = str_replace("{TOLL_FREE}",$TOLL_FREE,stripslashes($message_contents));
$message_contents = str_replace("{SITE_NAME}",SITE_NAME,stripslashes($message_contents));
$headers = "To: $vtoemail <$vtoemail>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1";
$subject = "Order Receipt from ".$SITE_NAME.".com";
$onesendstat = @mail($vtoemail, $subject, $sendmessage, $headers);
//$vtoemail = generalsetting("adminemail",2);
//$vtoemail = "chirayuoza@gmail.com";
//$vfromemail = "qualdevster@gmail.com";
//$headers = "To: $vtoemail <$vtoemail>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1";
//$subject = "Order Place At ".$SITE_NAME.".Com By Client";
//$onesendstat = @mail($vtoemail, $subject, $sendmessage, $headers);
?>
/*
!!!! this file is to be included by order confirmation script , cannot act as independent script!!!!
expects parameters passed: $ordernumber, $orderres, $x_amount
*/
$payment_gw_url = $GLOBALS["PAYPAL_GW"]["protocol"].$GLOBALS["PAYPAL_GW"]["host"].$GLOBALS["PAYPAL_GW"]["request"];
$order_receipt_url = $Site_URL."index.php?file=printorderreceipt";
$order_cancel_url = $Site_URL."index.php?file=printorderreceipt";
?>
// order is closed now
session_unregister("sess_orderinfo");
unset($sess_orderinfo);
session_unregister("sess_shippingaddress");
unset($sess_shippingaddress);
$shoppingCart->beEmpty();
$shoppingCart->store();
activateClient($iMemberid);
session_unregister("item_address");
unset($item_address);
session_unregister("sess_iorderid");
unset($sess_iorderid);
session_unregister("x_amount");
unset($x_amount);
?>
ob_start();
session_start();
$oGiftCert = new GiftCertificates();
// Shopping Cart Message
$Product_Not_Found = "Sorry, Requested Product Not Available";
$Stock_Not_Available = "Sorry, Requested Product Quantity Not Available
For ";
$Max_Stock = " Maximum Available Quantity Is ";
//Checkout Page Message
$No_Coupon_Code = "Invalid Coupon Code, Please Try Again!";
// Submit Order Page Message
$shipmode_not_selected = "Please Select The Shipping Mode, Shipping Mode Was Not Selected";
$Shipping_Method_Not_Match = "The shipping method you specified is not available to your address!";
//Start for gift certificate
$igcid = 0;
$temp_giftcerttotal = 0;
if(isset($is_gc) and !empty($is_gc) and $is_gc=='1')
{
if(isset($gc_code) and !empty($gc_code))
{
session_unregister("gccode");
$gccode = $gc_code;
session_register("gccode");
}
}
if(isset($gccode) && !empty($gccode)):
$gcert = $oGiftCert->loadGiftCertificateWithCode($gccode, true);
if($gcert):
$igcid = $gcert["igcid"];
$temp_giftcerttotal = $gcert["fcurrentvalue"];
else:
session_unregister("gccode");
$err_msg_gc = "InValid !!";
Header("Location: index.php?file=s-checkout&err_msg_gc=$err_msg_gc");
//exit;
endif;
endif;
//End for gift certificate
$temparr = 0;
$temp_total_new=0;
if(!isset($sessMemberID) || empty($sessMemberID))
{
if(!isset($fakeMember)):
header("location:".$Site_URL."index.php?file=m-login&to=shoppingcart&from=shoppingcart");
exit;
elseif(!$fakeMember["billingAddress"]):
header("location:".$Site_URL."index.php?file=m-login&to=shoppingcart&from=shoppingcart");
exit;
endif;
}
$totalcart = $shoppingCart->totalCount();
if($totalcart<=0)
{
header("index.php?file=s-shoppingcart");
exit;
$emptycart = 1;
$cart_msg = "Your Cart Is Empty";
$fullcart = 0;
}
else
{
$emptycart = 0;
$fullcart = 1;
$cart_msg = "";
$OrderSubTotal = 0;
}
if(isset($is_coupon) and !empty($is_coupon))
{
if(isset($coupon_code) and !empty($coupon_code))
{
session_unregister("couponcode");
$couponcode = $coupon_code;
session_register("couponcode");
}
}
if(isset($couponcode) && !empty($couponcode))
{
$coupondiscount = Check_Coupon_Discount();
if($coupondiscount)
{
if($coupondiscount=='1111')
{
session_unregister("couponcode");
$err_msg_cpn = $No_Coupon_Code;
$sess_orderinfo[2] =0;
$sess_orderinfo[3] = 0;
//header("location:".$Site_URL."index.php?file=submitorder&err_msg=$err_msg");
//exit;
}else{
$sess_orderinfo[2] = 1; // If Coupon Discount Then 1 else 0
$sess_orderinfo[3] = $coupondiscount[0]["icouponid"]; // CouponId
}
}
else
{
$err_msg_cpn = $No_Coupon_Code;
$sess_orderinfo[2] = 0; // If Coupon Discount Then 1 else 0
$sess_orderinfo[3] = 0;
session_unregister("couponcode");
//header("location:".$Site_URL."index.php?file=s-checkout&err_msg=$err_msg");
//exit;
}
} else {
session_unregister("couponcode");
$sess_orderinfo[2] = 0; // If Coupon Discount Then 1 else 0
$sess_orderinfo[3] = 0; // CouponId
}
$igcid = 0;
$temp_giftcerttotal = 0;
if(isset($is_gc) and !empty($is_gc) and $is_gc=='1')
{
if(isset($gc_code) and !empty($gc_code))
{
session_unregister("gccode");
$gccode = $gc_code;
session_register("gccode");
}
}
if(isset($gccode) && !empty($gccode)):
$gcert = $oGiftCert->loadGiftCertificateWithCode($gccode, true);
if($gcert):
$igcid = $gcert["igcid"];
$temp_giftcerttotal = $gcert["fcurrentvalue"];
else:
session_unregister("gccode");
$err_msg_gc = "InValid !!";
//Header("Location: index.php?file=s-checkout&err_msg=$err_msg");
//exit;
endif;
endif;
$self_exist = 0;
if(strpos($HTTP_REFERER,'checkout')) /// If Comes From checkout page starts
{
for($z=0;$z<$total_addresses;$z++)
{
$title = "title_".$z;
$firstname = "firstname_".$z;
$middlename = "middlename_".$z;
$lastname = "lastname_".$z;
$address1 = "address1_".$z;
$address2 = "address2_".$z;
$city = "city_".$z;
$country = "country_".$z;
$state = "state_".$z;
$votherstate = "votherstate_".$z;
$phone = "phone_".$z;
$email = "email_".$z;
$votherstate = "votherstate_".$z;
$zip = "zip_".$z;
$vcomments = "vcomments_".$z;
/// Shipping Mode
for($add=0;$add<$totalcart;$add++)
{
$shoppingItem = $shoppingCart->items[$add];
if(strtolower(trim($shoppingItem->shipto_add_name))==strtolower($$title))
{
$shippingmode_sh = "shippingmode_".$z;
$shoppingCart->update_ship_Mode($add, $$shippingmode_sh, $$vcomments);
}
}
////
if($$country!='US')
$$state = $$votherstate;
$is_add = "is_add_".$z;
$address_sql = "select iclientaddbookid from clientaddressbook where LOWER(vaddresstitle) = '".$$title."' and iclientid = '".$sessMemberID."'";
$address_res = $db->DirectSelect($address_sql);
if(count($address_res)<=0)
{
$shipping = 'n';
$billing = 'n';
$db_insert = "insert into clientaddressbook values('', '".$$title."', '$sessMemberID', '".$$firstname."', '".$$middlename."', '".$$lastname."', '".$$address1."', '".$$address2."', '".$$city."', '".$$state."', '".$$country."', '".$$zip."', '".$$phone."', '".$vphone_dt."' ,'".$$email."', '".$shipping."', '".$billing."', '', 'Active')";
$db_insert = $db->DirectInsert($db_insert);
}
else
{
if(strtolower($$title)=='self')
{
$self_exist = 1;
$sh_fname = $$firstname;
$sh_mname = $$middlename;
$sh_lname = $$lastname;
$sh_address = $$address1;
$sh_address2 = $$address2;
$sh_city = $$city;
$sh_state = $$state;
$sh_zip = $$zip;
$sh_country = $$country;
$sh_zip = $$zip;
$sh_phone = $$phone;
$sh_email = $$email;
}
$addressid = "addressid_".$z;
//$db_sql ="update clientaddressbook set vfirstname='".$$firstname."',vmiddlename='".$$middlename."',vlastname='".$$lastname."',vaddress1='".$$address1."',vaddress2='".$$address2."',vcity='".$$city."',vstate='".$$state."',vcountry='".$$country."',izip='".$$zip."',vphone='".$$phone."',vemail='".$$email."' where iclientaddbookid='".$address_res[0]['iclientaddbookid']."'";
// $result=$db->DirectUpdate($db_sql);
$result=$db->DirectUpdate("update clientaddressbook set vfirstname='".$$firstname."',vmiddlename='".$$middlename."',vlastname='".$$lastname."',vaddress1='".$$address1."',vaddress2='".$$address2."',vcity='".$$city."',vstate='".$$state."',vcountry='".$$country."',izip='".$$zip."',vphone='".$$phone."',vemail='".$$email."' where iclientaddbookid='".$address_res[0]['iclientaddbookid']."'");
}
}
$shoppingCart->store();
/// To check if multishipping , end also if shiping is same as billing
if($sameasbill_add=='on')
{
// Update Billing Address
if($bl_country!='US')
$bl_state = $bl_votherstate;
$db_sql = "update client set vfirstname='$bl_firstname', vmiddlename='$bl_middlename', vlastname='$bl_lastname', vemail = '$bl_email' , vaddress1='$bl_address1', vaddress2='$bl_address2', vphone='$bl_phone', vcity='$bl_city', vstate='$bl_state', vcountry='$bl_country', izip='$bl_zip' where iclientid=$sessMemberID ";
$result = $db->DirectUpdate($db_sql);
}else{
if($bl_country!='US')
$bl_state = $bl_votherstate;
if(isset($self_exist) and !empty($self_exist))
{
// $db_sql = "update client set vfirstname='$sh_fname', vmiddlename='$sh_mname', vlastname='$sh_lname', vemail = '$sh_email' , vaddress1='$sh_address', vaddress2='$sh_address2', vphone='$sh_phone', vcity='$sh_city', vstate='$sh_state', vcountry='$sh_country', izip='$sh_zip' where iclientid=$sessMemberID ";
// $result = $obj->edit($db_sql);
}
}
}
/// If Comes From checkout page Ends
//// if multiple shippinf address
session_unregister("sess_shippingaddress");
unset($sess_shippingaddress);
$single_shadd = 0;
$multi_shadd = 1;
$sess_orderinfo[1] = 1; // IF MULTI SHIPPING THEN 1 else 0
for($add=0;$add<$totalcart;$add++)
{
$shoppingItem = $shoppingCart->items[$add];
$address_sql = "select iclientaddbookid from clientaddressbook where LOWER(vaddresstitle) = '".$shoppingItem->shipto_add_name."' and iclientid = '".$sessMemberID."'";
$address_res = $db->DirectSelect($address_sql);
if(trim($shoppingItem->shipto_add_name)=='-1')
$temp_addid = '-1';
else
$temp_addid = $address_res[0]['iclientaddbookid'];
$shoppingCart->updateItem($add, false, false, $temp_addid);
//$sess_shoppingcart[$add][6] = $temp_addid; // Shipping AddressId From Address Book
}
$oAddressBook=new AddressBook();
$billaddsql = "select * from client where iclientid='$sessMemberID'";
$billaddres = $db->DirectSelect($billaddsql);
if($billaddres[0]['iclientid'])
{
//$countrycombo_bill = displaycountry($billaddres["vcountry"]);
//$statecombo_bill = displaystate($billaddres["vstate"]);
if($billaddres["vcountry"]!="US") {
$votherstate_bill = $billaddres["vstate"];
$state="";
}
$table_billadd[] = array(
'vName' => $billaddres[0]["vfirstname"]." ".$billaddres[0]["vmiddlename"]." ".$billaddres[0]["vlastname"],
'vaddress1' => $billaddres[0]["vaddress1"],
'vaddress2' => $billaddres[0]["vaddress2"],
'vcity' => $billaddres[0]["vcity"],
'vstate' => $billaddres[0]["vstate"],
'vcountry' => $billaddres[0]["vcountry"],
'izip' => $billaddres[0]["izip"],
'vphone' => $billaddres[0]["vphone"],
'vemail' => $billaddres[0]["vemail"],
);
}
$totalcart = $shoppingCart->totalCount();
$totalcart_items = $shoppingCart->totalNonGCProductsCount();
session_register("sess_orderinfo"); // Register Order Info In To Session
$tri = 1;
$temp_Tax = 0;
$cartitems_by_addresses = array();
$packing_value=0;
$packingcharge = 0;
for($tc=0;$tc<$totalcart;$tc++)
{
$shoppingItem = $shoppingCart->items[$tc];
$iproductid = $shoppingItem->productid;
$cate_id = $shoppingItem->icategoryid;
$category_check = $shoppingCart->CategoryName_Detail($cate_id); // Code for Category Name Display
$prosql = "select iproductid, vproductname, vshortdesc, vunitid, fsaleprice, vweight, vSKU, vproductdetail, vtype from products where iproductid='$iproductid' ";
$prores = $db->DirectSelect($prosql);
if($prores)
{
$pimgsql = "select vthumbimage from productimage where iproductid='$iproductid' and eimgstatus='Active' ";
$pimgres = $db->DirectSelect($pimgsql);
$totprice =$shoppingItem->totalPrice();
$tmp_amountarr[$tc] = $totprice;
$discount = $shoppingCart->quantityDiscountFor($tc) + $shoppingCart->specialDiscountFor($tc);
$pricewithdisc = $totprice - $discount;
$SubTotal = $SubTotal + $pricewithdisc;
$OrderSubTotal = $SubTotal;//Make_Price($SubTotal); //number_format($SubTotal,2,'.',',');
$OrderSubTotal_org = $SubTotal;
if($discount=='0' || $discount=='0.00')
$viewdiscount = "";
else
{
$temp_dis = number_format($discount,2,'.',',');
$temp_pwd = number_format($pricewithdisc,2,'.',',');
//$viewdiscount = "
".Make_Price($temp_dis)."
".Make_Price($temp_pwd)." ";
$viewdiscount = "
".$temp_dis."
".$temp_pwd." ";
}
if($sess_orderinfo[1]=='1')
{
$AddressTdTitle = "Shipping Address";
$shippingAddress = $oAddressBook->clientShippingAddress($shoppingItem->shippingAddressId);
$title_other = ucwords(strtolower($shippingAddress[vaddresstitle]));
$ship_add_id = $shippingAddress["iclientaddbookid"];
$AddressTitle = $shoppingItem->isShippedPhysically() ? "".ucwords(strtolower($shippingAddress["vaddresstitle"]))."" : ("Email to: ".$shoppingItem->otherPreferences["gcemail"]);
// $temp_ShippingCharge = $temp_ShippingCharge + MultiAddress_ShippingCharge($shoppingItem->shippingAddressId);
$oldflag = 0;
for($old=0;$old<$tc;$old++)
{
$oldShoppingItem = $shoppingCart->items[$old];
if($oldShoppingItem->shippingAddressId==$shoppingItem->shippingAddressId)
{
$oldflag = 1;
break;
}
}
if($oldflag == 0)
{
if($tri==3)
{
$tr = " | Dear ".$cname." Thank you for your order with www.".$SITE_NAME.".com Your order No. is : ".Get_Order_Number($iorderid)." |
| Unfortunately, your order cannot be processed for the following reasons: |
| 1. Your credit card has been declined by your credit card company. Please contact your credit card company to resolve the issue. |
| If you wish order again, please visit our web site www.".$SITE_NAME.".com and create a NEW order. |
| If there are any questions, please contact our customer service at ".$TOLL_FREE." or contact us via email at ".$salesemail." |
| Sincerely, |
| ".$SITE_NAME."., Inc. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ".$add_var_phone." |
| You may review your order status at any time at ".$Site_URL."index.php?file=login |
| If you have any questions regarding this order, please contact our Internet Sales Division at 1-0000 or contact us via email at info@powerofperfume.com |
| To view status of order, please login at www.".SITE_NAME.".com Thank you for choosing www.".SITE_NAME.".com |
| Sincerely, |
| Internet Sales Division |
| ".SITE_NAME.", Inc. |
";
$product_th_image=ROOT_DIR."images/products/thumbimage/".$prodImage["vthumbimage"];
// echo "
";
else
$freeshipImg = "";
// $disc = getSpecialDiscountFor($product_id);
$disc = 10;
if($disc==0){
$product_new_price="";
}else{
/*if(!empty()){
}*/
$newSale = $products[$i]["fsaleprice"] - $disc;
$product_new_price = "New Price : $ ".$newSale;
$product_sale_price = "| Website Name |
: |
'.$websitename.' |
| Website Url |
: |
'.$websiteurl.' |
| Company Name( Registered ) |
: |
'.$companyname.' |
| State of Registration |
: |
'.$state.' |
| Trade Name No. |
: |
'.$tradenameno.' |
| State Tax License No. or Resale Permit # |
: |
'.$statetax.' |
| First Name |
: |
'.$firstname.' |
| Last Name |
: |
'.$lastname.' |
| Email |
: |
'.$email.' |
| Address |
: |
'.$address.' |
| Telephone( daytime ) |
: |
'.$telephonedaytime.' |
| Telephone( evening ) |
: |
'.$telephoneevening.' |
| Fax: |
: |
'.$fax.' |
| Expected monthly sales ( units ) |
: |
'.$unit.' |
| Expected monthly sales ( dollars ) |
: |
'.$dollars.' |
| Company Name( Registered ) |
: |
'.$companyname.' |
| First Name |
: |
'.$firstname.' |
| Last Name |
: |
'.$lastname.' |
Intended medium of distribution |
: |
'.$medium.' |
| Website Name |
: |
'.$websitename.' |
| Website Url |
: |
'.$websiteurl.' |
| State of Registration |
: |
'.$state.' |
| Trade Name No. |
: |
'.$tradenameno.' |
| State Tax License No. or Resale Permit # |
: |
'.$statetax.' |
| Email |
: |
'.$email.' |
| Address |
: |
'.$address.' |
| Telephone( daytime ) |
: |
'.$telephonedaytime.' |
| Telephone( evening ) |
: |
'.$telephoneevening.' |
| Fax: |
: |
'.$fax.' |
| Expected monthly sales ( units ) |
: |
'.$unit.' |
| Expected monthly sales ( dollars ) |
: |
'.$dollars.' |
![]() |
||||||||||
|
"; print_r($same_products); */ for($i=0;$iDirectSelect("select vtype from `type` where match_to='".$same_products[$i]["vtype2"]."'"); $type_match_to = $res_type_for_product[0]["vtype"]; $prod_desc_type = $type_match_to." ".$same_products[$i]["vweight"]." ".$same_products[$i]["vunitid"]; if(!isset($type_match_to) or empty($type_match_to)){ $prod_desc_type = $product[$i]["vtype"]; } /////////////For FreeProduct String Display/////////////// $freesql1=$db->DirectSelect("select ibuygetfreeproductid from buygetfree_products as bp,buygetfreeoffer as bg where bp.ibuygetfreeid=bg.ibuygetfreeid and iproductid='".$same_products[$i]['iproductid']."' and bg.dvalidfrom<='$dDate' AND bg.dvalidto>='$dDate' and bg. estatus='Active'"); if(count($freesql1)>0) { $freedisp=" "; }else{ $freedisp=""; } ////////////End For FreeProduct String Display/////////////// $brand_get = $db->DirectSelect("select brand.vlink from products,brand where products.iproductid = '".$same_products[$i]['iproductid']."' and products.ibrandid = brand.ibrandid"); $vlink_brand = $brand_get[0]['vlink']; $vlink = $same_products[$i]["vlink"]; $icatid= $oHomePage->getproduct_parentid($iproductid); $category_name = $oHomePage->getcatname($icatid); $category_name = strtolower($category_name); // $link_name = $Site_URL.$vlink_brand."/".$category_name."/".$vlink."/Id/".$iproductid; $link_name = $Site_URL.$vlink_brand."/".$category_name."/".$vlink."/Id/".$same_products[$i]['iproductid']; if($same_products[$i]["egiftset"] == "Yes"){ $giftsetcount++; $productgifsetarr[]=array( "product_id"=>$same_products[$i]['iproductid'], "icategory_id"=>$same_products[$i]['icategory_id'], "product_sku"=>$same_products[$i]['vSKU'], "product_type"=>$prod_desc_type, "product_real_price" => $same_products[$i]["factualprice"], "product_stock" => $same_products[$i]["fcurrentstock"], "fminstock"=> $same_products[$i]["fminstock"], "product_sale_price"=> $same_products[$i]["fsaleprice"], "product_quantity" => "quantity".$i, "product_checkbox" => "chk".$i, "hidden" => "iproductid".$i, "hidden_cat" => "icategoryid".$i, "freedisp" => $freedisp, "link_name"=>$link_name, ); }elseif($same_products[$i]["emini"] == "Yes"){ /////////////For FreeProduct String Display/////////////// $freesql2=$db->DirectSelect("select ibuygetfreeproductid from buygetfree_products as bp,buygetfreeoffer as bg where bp.ibuygetfreeid=bg.ibuygetfreeid and iproductid='".$same_products[$i]['iproductid']."' and bg.dvalidfrom<='$dDate' AND bg.dvalidto>='$dDate' and bg. estatus='Active'"); if(count($freesql2)>0) { $freedisp="
"; }else{ $freedisp=""; } ////////////End For FreeProduct String Display/////////////// $minicount++; $productminiarr[]=array( "product_id"=>$same_products[$i]['iproductid'], "icategory_id"=>$same_products[$i]['icategory_id'], "product_sku"=>$same_products[$i]['vSKU'], "product_type"=>$prod_desc_type, "product_real_price" => $same_products[$i]["factualprice"], "product_stock" => $same_products[$i]["fcurrentstock"], "fminstock"=> $same_products[$i]["fminstock"], "product_sale_price"=> $same_products[$i]["fsaleprice"], "product_quantity" => "quantity".$i, "product_checkbox" => "chk".$i, "hidden" => "iproductid".$i, "hidden_cat" => "icategoryid".$i, "freedisp" => $freedisp, "link_name"=>$link_name, ); }elseif($same_products[$i]["etester"] == "Yes"){ /////////////For FreeProduct String Display/////////////// $freesql3=$db->DirectSelect("select ibuygetfreeproductid from buygetfree_products as bp,buygetfreeoffer as bg where bp.ibuygetfreeid=bg.ibuygetfreeid and iproductid='".$same_products[$i]['iproductid']."' and bg.dvalidfrom<='$dDate' AND bg.dvalidto>='$dDate' and bg. estatus='Active'"); if(count($freesql3)>0) { $freedisp="
"; }else{ $freedisp=""; } ////////////End For FreeProduct String Display/////////////// $testercount++; $producttesterarr[]=array( "product_id"=>$same_products[$i]['iproductid'], "icategory_id"=>$same_products[$i]['icategory_id'], "product_sku"=>$same_products[$i]['vSKU'], "product_type"=>$prod_desc_type, "product_real_price" => $same_products[$i]["factualprice"], "product_stock" => $same_products[$i]["fcurrentstock"], "product_sale_price"=> $same_products[$i]["fsaleprice"], "fminstock"=> $same_products[$i]["fminstock"], "product_quantity" => "quantity".$i, "product_checkbox" => "chk".$i, "hidden" => "iproductid".$i, "hidden_cat" => "icategoryid".$i, "freedisp" => $freedisp, "link_name"=>$link_name, ); }else{ /////////////For FreeProduct String Display/////////////// $freesql4=$db->DirectSelect("select ibuygetfreeproductid from buygetfree_products as bp,buygetfreeoffer as bg where bp.ibuygetfreeid=bg.ibuygetfreeid and iproductid='".$same_products[$i]['iproductid']."' and bg.dvalidfrom<='$dDate' AND bg.dvalidto>='$dDate' and bg. estatus='Active'"); if(count($freesql4)>0) { $freedisp="
"; }else{ $freedisp=""; } ////////////End For FreeProduct String Display/////////////// $fagcount++; $productarr[]=array( "product_id"=>$same_products[$i]['iproductid'], "icategory_id"=>$same_products[$i]['icategory_id'], "product_sku"=>$same_products[$i]['vSKU'], "product_type"=>$prod_desc_type, "product_real_price" => $same_products[$i]["factualprice"], "product_stock" => $same_products[$i]["fcurrentstock"], "fminstock"=> $same_products[$i]["fminstock"], "product_sale_price"=> $same_products[$i]["fsaleprice"], "product_quantity" => "quantity".$i, "product_checkbox" => "chk".$i, "hidden" => "iproductid".$i, "hidden_cat" => "icategoryid".$i, "freedisp" => $freedisp, "link_name"=>$link_name, ); } } $db_sql="select pc.vcategory as pid ,pc.icategoryid as pid1 from category pc,productcat p where p.icategoryid = pc.icategoryid and p.iproductid = '".$product[0]['iproductid']."'"; $catres = $db->DirectSelect($db_sql); $catname = ucwords($catres[0]["pid"]); $icatid = $catres[0]["pid1"]; if($catname=="Unisex"){ $category_name="Unisex"; $gender="C"; } else{ if($catname=="Men"){ $gender="M"; } if($catname=="Women"){ $gender="W"; } $category_name=$catname; } $prod = $product[0]['vproductname']; $home="Home"; $categoryname="".ucwords($category_name).""; $nav=" ".$home." • ".ucwords($categoryname)."• ".$prod; $localvars = array( "productname"=>stripslashes($product[0]['vproductname']), "productdetail"=>stripslashes($product[0]['vproductdetail']), "productarr"=>$productarr, "vthumbimage"=>$vthumbimage, "productgifsetarr"=>$productgifsetarr, "producttesterarr"=>$producttesterarr, "productminiarr"=>$productminiarr, "giftsetcount"=>$giftsetcount, "testercount"=>$testercount, "minicount"=>$minicount, "fagcount"=>$fagcount, "nav"=>$nav, "totalpro"=>count($same_products), "iprodid"=>$iprodid, "MetaDesc"=>$MetaDesc, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>
=$name;?> start;$i<$objPage->end;$i++) { $iproductid=$productlist[$i]['iproductid']; $vproductname=$productlist[$i]['vproductname']." ".$productlist[$i]['vweight']." ".$productlist[$i]['vunitid']; $fsaleprice= $vCurrency.$productlist[$i]['fsaleprice']; $sqlgetcatname = $db->DirectSelect("select category.vcategory from category where category.icategoryid = '$tempicatid' and category.estatus = 'Active'"); $name = $sqlgetcatname[0][0]; $brand_get = $db->DirectSelect("select brand.vlink from products,brand where products.iproductid = '$iproductid' and products.ibrandid = brand.ibrandid"); $vlink_brand = $brand_get[0]['vlink']; $vlink = $productlist[$i]["vlink"]; $icatid= $oHomePage->getproduct_parentid($iproductid); $category_name = $oHomePage->getcatname($icatid); $category_name = strtolower($category_name); // $link_name = $Site_URL.$vlink_brand."/".$category_name."/".$vlink."/Id/".$iproductid; $link_name = $Site_URL.$vlink_brand."/".$category_name."/".$vlink."/Id/".$iproductid; $productpath="images/products/thumbimage/".$productlist[$i]['vthumbimage']; if(file_exists(ROOT_DIR.$productpath) && !empty($productlist[$i]['vthumbimage'])){ $pimg=Site_URL."images/products/thumbimage/".$productlist[$i]['vthumbimage']; }else{ $pimg=Site_URL."images/default_thumb_img.jpg"; } $productlistarray[]=array( 'vproductname'=>stripslashes($productlist[$i]['vproductname']), 'fsaleprice'=>$productlist[$i]['fsaleprice'], 'link_name'=>$link_name, 'product_th_image'=>$pimg, 'factualprice'=>$productlist[$i]['factualprice'], 'vtype'=> $productlist[$i]['vtype'], ); } $sPageFooter = $objPage->doPaging($productlist); $localvars = array( "productlistarray"=>$productlistarray, "price"=>$price, "nav"=>$nav, "ptype"=>$ptype, "no"=>$no, "comb"=>$comb, "comb1"=>$comb1, "sPageFooter"=>$sPageFooter, "recordcount"=>$iCount, "pageproduct"=>$pageproduct, "gender"=>$gender, "icatid"=>$catid, "view"=>$view, "tempicatid"=>$tempicatid, "keyword"=>$keyword, "x"=>$x, "y"=>$y, "select3"=>$select3, "select4"=>$select4, "select5"=>$select5, "inproductlist"=>1, "view"=>$view, "viewflg"=>$viewflg, "viewlink"=>$viewlink, "viewpagelink"=>$viewpagelink, "keyword"=>$keyword, ); //print_r($localvars); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>= $frompri and mp.fsaleprice <= $topri ) "; else $cond = " and ( mp.fsaleprice >= $frompri ) "; } else { if($topri != "00") $cond = " and ( p.fsaleprice >= $frompri and p.fsaleprice <= $topri ) "; else $cond = " and ( p.fsaleprice >= $frompri ) "; } if($topri=="00") $mess=" Price Range : > $ $frompri and "; else $mess=" Price Range : $frompri to $topri and "; } if($category != "") { if($category=="4") { $cond .= " and p.egender='M' "; $icatid='4'; $category_name = "Men"; } elseif($category=="5") { $cond .= " and p.egender='W' "; $icatid='5'; $category_name = "Women"; } elseif($category=="10") { $cond .= " and p.egender='C' "; $icatid='10'; $category_name = "Children"; } } if(empty($list)){ if($gender==""){ if ($ptype=="egiftset"){ $category_name = "GiftSet"; } elseif ($ptype=="emini"){ $category_name = "Mini"; } elseif ($ptype=="etester"){ $category_name = "Tester"; } } if ($gender=="M"){ $midimage="menspecial"; $category_name = "Men"; } elseif ($gender=="W"){ $midimage="womenspecial"; $category_name = "Women"; } elseif ($gender=="C"){ $midimage="chidrenspecial"; $category_name = "Children"; } if ($ptype=="egiftset"){ $type = "GiftSet"; } elseif ($ptype=="emini"){ $type = "Mini"; } elseif ($ptype=="etester"){ $type = "Tester"; } $home="Home"; $catname = ucwords($catres[0]["vcategory"]); if($ptype!=""&& $gender!=""){ $nav=" ".$home." • ".ucwords($type)."• ".ucwords($category_name).""; } else{ $nav=" ".$home." • ".ucwords($category_name).""; } } else{ $nav = $oProduct->getBrandCombo($ibrandid); } $oHomePage = new HomePage(); if(empty($comb)){ $productlist=$oProduct->GetlookupProductList($prodlist); } else{ $productlist=$oProduct->GetlookupProductListOrder($prodlist,$comb); } if($productlist === false || count($productlist) == 0) { $iCount=0; } else { $iCount=count($productlist); } /*}else{ if(empty($gender)){ $productlist=$oProduct->GetProductList($icatid,$gender,$ptype); }else{ $productlist=$oProduct->GetProductList($icatid,$gender,$ptype); }*/ //} $objPage = new Paging(16,$iCount,'menulink','sbody',true,$list); if(!empty($list)){ $objPage->arg1 = "yes"; }else{ $objPage->arg1 = "file=$file&paging=yes&type=$type&icatid=$icatid&gender=$gender&ptype=$ptype"; } if(!isset($_REQUEST["pgno"])) { $_REQUEST["pgno"] = ""; } else { $pageno = $_REQUEST["pgno"]; } //for($i=0;$i start;$i<$objPage->end;$i++) { $iproductid=$productlist[$i]['iproductid']; $vproductname=$productlist[$i]['vproductname']." ".$productlist[$i]['vweight']." ".$productlist[$i]['vunitid']; $fsaleprice= $vCurrency.$productlist[$i]['fsaleprice']; $brand_get = $db->DirectSelect("select brand.vlink from products,brand where products.iproductid = '$iproductid' and products.ibrandid = brand.ibrandid"); $vlink_brand = $brand_get[0]['vlink']; $vlink = $sql_prod_res[0]["vlink"]; $icatid= $oHomePage->getproduct_parentid($iproductid); $category_name = $oHomePage->getcatname($icatid); $category_name = strtolower($category_name); $link_name = $Site_URL.$vlink_brand."/".$category_name."/".$vlink."/Id/".$iproductid; $productpath=Site_URL."images/product/thumbimage/".$productlist[$i]['vthumbimage']; if(file_exists($productpath)){ $pimg=Site_URL."images/product/thumbimage/".$productlist[$i]['vthumbimage']; }else{ $pimg=Site_URL."images/default_thumb_img.jpg"; } $productlistarray[]=array( 'vproductname'=>$productlist[$i]['vproductname'], 'fsaleprice'=>"$ ".$productlist[$i]['fsaleprice'], 'link_name'=>$link_name, 'product_th_image'=>$pimg, 'factualprice'=>$productlist[$i]['factualprice'], ); } $sPageFooter = $objPage->doPaging($productlist); $localvars = array( "productlistarray"=>$productlistarray, "nav"=>$nav, "ptype"=>$ptype, "comb"=>$comb, "recordcount"=>$iCount, "sPageFooter"=>$sPageFooter, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?> $tempicatid = $icatid; $oProduct =new Product(); $pri = $select; if($pri != "") { $apri=explode("@",$pri); $temprange=explode("-",$apri[0]); $frompri=$temprange[0]; $topri=$temprange[1]; if(isset($iMemberid) && $level_id != 0 ) { if($topri != "00") $cond = " and ( mp.fsaleprice >= $frompri and mp.fsaleprice <= $topri ) "; else $cond = " and ( mp.fsaleprice >= $frompri ) "; } else { if($topri != "00") $cond = " and ( p.fsaleprice >= $frompri and p.fsaleprice <= $topri ) "; else $cond = " and ( p.fsaleprice >= $frompri ) "; } if($topri=="00") $mess=" Price Range : > $ $frompri and "; else $mess=" Price Range : $frompri to $topri and "; } if($category != "") { if($category=="4") { $cond .= " and p.egender='M' "; $icatid='4'; } elseif($category=="6") { $cond .= " and p.egender='W' "; $icatid='6'; } elseif($category=="5") { $cond .= " and p.egender='C' "; $icatid='5'; } } if(empty($icatid)&&!empty($ankit)){ $icatid=$ankit; } $catid=$icatid ; if(empty($list)){ if($gender==""){ if ($ptype=="egiftset"){ $category_name = "GiftSet"; } elseif ($ptype=="emini"){ $category_name = "Mini"; } elseif ($ptype=="etester"){ $category_name = "Tester"; } elseif ($ptype=="eclearance"){ $type = "Clearance"; } } if ($gender=="M"){ $midimage="menspecial"; $category_name = "Men"; } elseif ($gender=="W"){ $midimage="womenspecial"; $category_name = "Women"; } elseif ($gender=="C"){ $midimage="chidrenspecial"; $category_name = "Unisex"; } if ($ptype=="egiftset"){ $type = "GiftSet"; } elseif ($ptype=="emini"){ $type = "Mini"; } elseif ($ptype=="etester"){ $type = "Tester"; } elseif ($ptype=="eclearance"){ $category_name= "Clearance"; } $home="Home"; $catname = ucwords($catres[0]["vcategory"]); if($ptype!=""&& $gender!="" && $ptype!="efeatured"){ $nav=" ".$home." • ".ucwords($type)."• ".ucwords($category_name).""; } else{ $nav=" ".$home." •".ucwords($category_name).""; } } else{ $nav = $oProduct->getBrandCombo($ibrandid); } if(!empty($keyword)){ $nav =""; } $oHomePage = new HomePage(); if(empty($comb)){$comb=2;} $productlist=$oProduct->GetlookupProductListOrder($prodlist,$comb); if($productlist === false || count($productlist) == 0) { $iCount=0; } else { $iCount=count($productlist); } //$productlist=$oProduct->GetlookupProductList($prodlist); /*}else{ if(empty($gender)){ $productlist=$oProduct->GetProductList($icatid,$gender,$ptype); }else{ $productlist=$oProduct->GetProductList($icatid,$gender,$ptype); }*/ // $iCount=count($productlist); //} if($iCount==0){ $no = "yes"; $productlist = $oProduct->GetProduct(0,4); $iCount=count($productlist); } if ($view=="all"){$pageproduct=$iCount;}else{$pageproduct=16;} $objPage = new Paging($pageproduct,$iCount,'menulink','sbody',true,$list); if(!empty($list)){ $objPage->arg1 = "/yes"; }else{ $objPage->arg1 = "&paging=yes&type=$type"; } if(!isset($_REQUEST["pgno"])) { $_REQUEST["pgno"] = ""; } else { $pageno = $_REQUEST["pgno"]; } //for($i=0;$i start;$i<$objPage->end;$i++) { $iproductid=$productlist[$i]['iproductid']; $vproductname=$productlist[$i]['vproductname']." ".$productlist[$i]['vweight']." ".$productlist[$i]['vunitid']; $fsaleprice= $vCurrency.$productlist[$i]['fsaleprice']; $brand_get = $db->DirectSelect("select brand.vlink from products,brand where products.iproductid = '$iproductid' and products.ibrandid = brand.ibrandid"); $vlink_brand = $brand_get[0]['vlink']; $vlink = $sql_prod_res[0]["vlink"]; $icatid= $oHomePage->getproduct_parentid($iproductid); $category_name = $oHomePage->getcatname($icatid); $category_name = strtolower($category_name); $link_name = $Site_URL.$vlink_brand."/".$category_name."/".$vlink."/Id/".$iproductid; $productpath="images/products/thumbimage/".$productlist[$i]['vthumbimage']; if(file_exists(ROOT_DIR.$productpath)){ $pimg=Site_URL."images/products/thumbimage/".$productlist[$i]['vthumbimage']; }else{ $pimg=Site_URL."images/default_thumb_img.jpg"; } $productlistarray[]=array( 'vproductname'=>$productlist[$i]['vproductname'], 'fsaleprice'=>$productlist[$i]['fsaleprice'], 'link_name'=>$link_name, 'product_th_image'=>$pimg, 'factualprice'=>$productlist[$i]['factualprice'], 'vtype'=> $productlist[$i]['vtype'], ); } $sPageFooter = $objPage->doPaging($productlist); $localvars = array( "productlistarray"=>$productlistarray, "price"=>$price, "nav"=>$nav, "ptype"=>$ptype, "no"=>$no, "comb"=>$comb, "sPageFooter"=>$sPageFooter, "recordcount"=>$iCount, "pageproduct"=>$pageproduct, "gender"=>$gender, "icatid"=>$catid, "view"=>$view, "tempicatid"=>$tempicatid, "keyword"=>$keyword, "x"=>$x, "y"=>$y, "select3"=>$select3, "select4"=>$select4, "select5"=>$select5, "inproductlist"=>1, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?> ob_start(); session_start(); include_once("functions/general.inc"); include_once("functions/popups.php"); $SiteTitle = $obj->SiteTitle; include_once("scripts/summary.php"); if(isset($action) and $action == "search") { session_unregister("lookupvisited"); $lookupvisited = "(-1)"; session_register("lookupvisited"); } //Price Selection $price_sort = " "; $cond = ""; $pri = $pricerange; if($pri != "") { $apri=explode("@",$pri); $temprange=explode("-",$apri[0]); $frompri=$temprange[0]; $topri=$temprange[1]; if(isset($iMemberid) && $level_id != 0 ) { if($topri != "00") $cond = " and ( mp.fsaleprice >= $frompri and mp.fsaleprice <= $topri ) "; else $cond = " and ( mp.fsaleprice >= $frompri ) "; } else { if($topri != "00") $cond = " and ( p.fsaleprice >= $frompri and p.fsaleprice <= $topri ) "; else $cond = " and ( p.fsaleprice >= $frompri ) "; } if($topri=="00") $mess=" Price Range : > $ $frompri and "; else $mess=" Price Range : $frompri to $topri and "; } $currency=generalsetting("displaycurrency",2); $general = generalsetting("",4); if($category != "all") { if($category=="M") { $cond .= " and p.egender='M' "; $icatid='33'; } elseif($category=="W") { $cond .= " and p.egender='W' "; $icatid='34'; } } ///Added By Bhavika ///For search/// if(!isset($sortby)) $sortby = "p.vproductname"; if($keyword=="Keyword Search") $keyword=""; $products_list = Get_Search_Products($keyword,$sortby,"",$list,$ilookupid,$icatid,$cond); //$lookup_list = Get_Search_LookUp_List($keyword); $lookupsearchprod = $products_list; if(isset($icatid) and !empty($icatid)) $cat_page = "&icatid=$icatid"; $var_filter = "&sortby=".$sortby.$cat_page."&action=search&keyword=".$keyword."&list=".$list."&ilookupid=".$ilookupid."&pricerange=".$pricerange."&category=".$category; /*echo $var_filter; echo $icatid;*/ $num_totrec = count($products_list); $totlookupprod = $num_totrec; $page_link=""; include_once("lib/paging.inc"); /*$var_limit=""; $var_limit="limit 0,9";*/ $products_list = Get_Search_Products($keyword,$sortby,$var_limit,$list,$ilookupid,$icatid,$cond); $page_link=" ".$page_link.""; ///Ends //echo count($products_list); exit; $no_search_product_find = 0; if (count($products_list)==0) { $search_no_record_message ="Products Not Available"; /*$search_no_record_message = "We are sorry, there were no items found matching your description.
You may try to modify your search term and try again?
The item you're looking for may be out of stock or we may not carry it
at this time. If we don't currently carry it, we may be able to special
order it for you.
Please feel free to contact us at our ".$TOLL_FREE." or email us at
".$adminemail.", and we'll be more than happy to help you locate
the item you're looking for.
You can also try entering another keyword or item number.
Thank you for shopping ".$SITE_NAME.".com ";*/ $no_search_product_find = 1; $search_product_find = 0; } if(isset($products_list) and !empty($products_list)) { for($i=0;$i'; else $nexttr=' '; /* if($i==0 || ($i%4)==0) $start_tr=" "; else $start_tr=""; $start_td=" "; $spacer_tr_td=""; */ $icatid= $products_list[$i]["icategoryid"]; $category_check = CategoryName_Brackete($icatid); // Code for Category Name Display $vtype2 = $products_list[$i]["vtype2"]; $iproductid = $products_list[$i]["iproductid"]; $alttext=$products_list[$i]["vproductname"]; //------------ Type From Type Master --------------// $select_type_for_product = "select vtype from `type` where match_to='".$vtype2."'"; $res_type_for_product = $obj->select($select_type_for_product); $type_match_to = $res_type_for_product[0]["vtype"]; $prod_desc_type = $type_match_to." ".$products_list[$i]["vweight"]." ".$products_list[$i]["vunitid"]; if(!isset($type_match_to) or empty($type_match_to)){ $prod_desc_type = $products_list[$i]["vtype"]; } //------------ Type From Type Master --------------// // Get Brand $brand_get = $obj->select("select brand.vlink from products,brand where products.iproductid = '$iproductid' and products.ibrandid = brand.ibrandid"); $vlink_brand = $brand_get[0]['vlink']; $vlink = $products_list[$i]["vlink"]; $category_name = getcatname($icatid); $category_name = strtolower($category_name); $link_name = $Site_URL.$vlink_brand."/".$category_name."/".$vlink."/Id/".$iproductid."/".$icatid; // Ends $vproductname = "".$products_list[$i]["vproductname"].""; /* if(isset($iMemberid)) { $factualprice = Get_Product_RetailPrice($iproductid,$ilevelid); $fsaleprice = Get_Product_SalePrice($iproductid,$ilevelid); } else { */ $fsaleprice=$products_list[$i]['fsaleprice']; $factualprice=$products_list[$i]['factualprice']; // } $vtypr2 = $products_list[$i]["vtype2"]; $vweight = $products_list[$i]["vweight"]." ".$products_list[$i]["vunitid"]; if($factualprice >= $fsaleprice ) { $discount = (100 * $fsaleprice)/$factualprice; $actual_discount = round (100 - $discount); }else { $actual_discount=0; } $product_th_image = $thumb_image_path.$products_list[$i]["vthumbimage"]; if(file_exists($product_th_image) and !empty($products_list[$i]["vthumbimage"])) $image = str_replace($Site_URL,"",$thumb_image_url).$products_list[$i]["vthumbimage"]; else $image = str_replace($Site_URL,"",$default_pro_thumb); $product_img_text = $products_list[$i]["vimagetext"]; // $product_th_image = " "; if(($i+1)%4==0) { $end_tr=""; $product_th_image = "
"; /* $end_td="
"; } else { $end_tr=""; $spacer_tr_td=""; } */ $table_prodlist[] = array( 'new_row' => $new_row, 'iproductid' => $iproductid, 'vproductname' => $vproductname." ".$vweight." ".$category_check, 'prod_desc_type' => $prod_desc_type, 'type2' => $vtypr2, 'size' => $vweight, 'fsaleprice' => $fsaleprice, 'factualprice' => $factualprice, 'actual_discount' => $actual_discount, 'product_th_image' => $product_th_image, 'nexttr' => $nexttr, /* 'start_tr' => $start_tr, 'start_td' => $start_td, 'end_tr' => $end_tr, 'end_td' => $end_td, 'spacer_tr_td' => $spacer_tr_td */ ); $new_row = ""; } $search_product_find = 1; } //Ends Bhavika /**********lookup code for searched products**********/ /* $lookupprod = $lookupsearchprod; $prodlist = "("; for($i=0;$i select($catsql); //echo count($catres); if(count($catres) > 1) { $iscategory = 1; for($i=0;$i $leftcatid, 'catname' => $leftcatname, 'catfile' => $catfile, 'i' => $i, ); } }else{ $iscategory = 0; } if($list=="lookup") { $tmplookuplist = $lookupvisited; $tmplookuplist = substr($tmplookuplist,0,strlen($tmplookuplist)-1); $tmplookuplist .= ",".$ilookupid.")"; $lookupvisited = $tmplookuplist; session_register("lookupvisited"); //echo $prodlist;exit; $lookupres = $obj->select("select distinct(ilookupid) from lookup_prd where iproductid in $prodlist and ilookupid not in $lookupvisited and icategoryid = '999999998'"); }else{ $lookupres = $obj->select("select distinct(ilookupid) from lookup_prd where iproductid in $prodlist and ilookupid not in $lookupvisited and icategoryid = '999999998'"); } //echo count($lookupres);exit; $lookuplist1 = "("; for($i=0;$i select("select distinct(iparentid) from lookup where ilookupid in $lookuplist1 and icategoryid = '999999998' and estatus = 'Active'"); if($parentres) { $showlookup = 1; } for($i=0;$i select("select ilookupid, vlookupname, icategoryid from lookup where ilookupid = '".$parentres[$i]["iparentid"]."' and estatus = 'Active'"); $lookup_id = $result[0]["ilookupid"]; $lookup_name = $result[0]["vlookupname"]; $sub_sql="select ilookupid, vlookupname, icategoryid from lookup where iparentid='".$lookup_id."' and ilookupid in $lookuplist1 and estatus = 'Active' order by ilookupid"; $sub_result=$obj->select($sub_sql); if(count($sub_result)==0) continue; $sublookup = ""; for($j=0;$j select("select distinct(iproductid) from lookup_prd where ilookupid = '".$sub_result[$j]["ilookupid"]."' and iproductid in $prodlist"); if($totlookupprod > count($sublookupmore)) $sublookup .= " "; } if($sublookup != "") $lookuplist[] = array( 'lookupid' => $lookup_id, 'lookupname' => $lookup_name, 'sublookup' => $sublookup, ); } $showgift = 0; $showhot = 0; $showoutlet = 0; if(count($lookuplist) == 0) $showlookup = 0; if($showlookup == 1 or $iscategory == 1) $shownorefine = 0; else $shownorefine = 1; */ /*********end lookup code*******/ if($flag_featured == 1) { if(isset($start) and $start != "1") $flag_featured = 0; else $flag_featured = 1; } $middle = $middle_dir . "search.html"; //$top = $top_dir . "top-home.html"; $local_variables = array_merge ($commonpassvariable, $popup_variables, array('showspecialclearance','showbrandspotlight','class_detail','super_blowout_link', 'top_sellers_link', 'new_arrivals_link', 'recommended_link', 'login', 'woman_name', 'woman_image', 'man_name', 'man_image', 'gift_name', 'gift_image', 'body_name' ,'body_image', 'woman_id' ,'man_id', 'gift_id', 'body_id', 'blow_name', 'blow_image', 'blow_act', 'blow_sal', 'blow_id1', 'blow_name1', 'blow_image1', 'blow_sal1', 'blow_act1', 'link_blow2', 'link_blow1', 'woman_sprice', 'woman_rprice', 'man_sprice', 'man_rprice', 'gift_sprice', 'gift_rprice', 'body_sprice', 'body_rprice', 'woman_add', 'man_add', 'gift_add', 'body_add','type' ,'page_link','num_totrec','icatid','ibrandid','ilookupid','price_sort','keyword','list','search_no_record_message' , 'pricerange' , 'category')); $tpl->load_file('default', $template_file2); $tpl->parse_loop('default','table_prodlist'); $tpl->parse_loop('default','table_products'); $tpl->parse_loop('default','lookuplist'); /*** For Top ****/ $tpl->parse_loop('default','main_category'); $tpl->parse_if('default','cat_main'); $tpl->parse_loop('default','special_prods'); $tpl->parse_if('default','flag_specials'); $tpl->parse_loop('default','top_brands'); $tpl->parse_if('default','flag_brand_top'); $tpl->parse_loop('default','temp_arry_cat'); /*** Ends Top ****/ // -------------- FOR PARENT & CHILD CATEGORY'S DISPLAY ------------ $tpl->parse_loop('default', 'temp_category_name'); $tpl->parse_loop('default', 'temp_arry'); $tpl->parse_loop('default', 'left_main_cat'); $tpl->parse_loop('default','sub_temp_arry'); $tpl->parse_loop('default','sub_temp_arry_left'); // -------------------------- END OF CATEGORY ---------------------- // -------------- FOR BRAND DISPLAY ----------------- $tpl->parse_loop('default','brandlist'); $tpl->parse_if('default','showbrand'); // ------------- END OF BRAND ---------------------- /*** For rec prod***/ $tpl->parse_loop('default','recprodlist'); $tpl->parse_if('default','showrecprod'); $tpl->parse_loop('default','reccatlist'); $tpl->parse_if('default','showreccat'); $tpl->parse_loop('default','recsearchlist'); $tpl->parse_if('default','showrecsearch'); /*** End rc prod***/ $tpl->parse_loop('default','featured_prodlist'); $tpl->parse_if('default','flag_featured'); $tpl->parse_if('default','showlookup'); $tpl->parse_if('default','no_search_product_find'); $tpl->parse_if('default','search_product_find'); $tpl->parse_loop('default','brand_logo'); $tpl->parse_loop('default','brandlist'); $tpl->parse_loop('default','catlist'); $tpl->parse_if('default','showbrand'); $tpl->parse_if('default','shownorefine'); $tpl->parse_if('default','showgift'); $tpl->parse_if('default','showextra'); $tpl->parse_if('default','showhot'); $tpl->parse_if('default','showoutlet'); $tpl->parse_if('default','iscategory'); $tpl->parse_if('default','Navigation1'); $tpl->parse_if('default','showalpha'); //$tpl->parse_loop('default','banner'); //$tpl->parse_if('default','is_banner'); //$tpl->parse_loop('default', 'big_banners'); //$tpl->parse_if('default','is_banner_big'); $tpl->pprint('default', array($local_variables)); ?> GetAddress($sessMemberID); //$db->Printsql(); $ship_name =$oAddressBook->GetShipName($SHOPPING_CART_ID); $total_addresses=count($ship_name); for($z=0;$z ".$sub_result[$j]["vlookupname"]." in checkout ship to address name is : ".$ship_name[$z]['shipto_add_name']; /////////////////////////////////////////////////////////////////////////////////////// $res_prod =$oShipping->GetShippingByName($SHOPPING_CART_ID,$ship_name[$z]['shipto_add_name']); //echo "
count for this ship address".count($res_prod); if(count($res_prod)>0){ $is_giftcertificate = 1;}else{ $is_giftcertificate = 0;} for($y=0;$yitems[$tc]; $iproductid = $shoppingItem->productid; $cate_id = $shoppingItem->icategoryid; $category_check = $shoppingCart->CategoryName_Detail($cate_id); // Code for Category Name Display $prores = $oProduct->GetProductDeatilByID($iproductid);//$db->DirectSelect($prosql); if($prores) { $pimgsql = "select vthumbimage from productimage where iproductid='$iproductid' and eimgstatus='Active' "; //for other than gift certificate if($prores[0]["vSKU"]!=$GIFT_CERT_SKUS[0]) $cart_products_temp++; $pimgres = $db->DirectSelect($pimgsql); $totprice =$shoppingItem->totalPrice(); $discount = $shoppingCart->quantityDiscountFor($tc) + $shoppingCart->specialDiscountFor($tc); $pricewithdisc = $totprice - $discount; $SubTotal = $SubTotal + $pricewithdisc; $OrderSubTotal = $SubTotal;//Make_Price($SubTotal); $OrderSubTotal_org = $SubTotal; if($discount=='0' || $discount=='0.00') $viewdiscount = ""; else{ $temp_dis = $discount;//Make_Price($discount); $temp_pwd = $pricewithdisc;//Make_Price($pricewithdisc); $viewdiscount = "
".$temp_dis."
".$temp_pwd." "; } $gift_certs_cart[] = array( 'loop' => $tc, 'vSKU' => $prores[0]["vSKU"], 'vtype' => $prores[0]["vtype"], 'iproductid' => $iproductid, 'vthumbimage' => $image, 'vProductName' => $prores[0]["vproductname"], 'vshortdesc' => $prores[0]["vshortdesc"], 'vproductdetail'=> stripslashes($prores[0]["vproductdetail"]),//Make_Small_Desc(stripslashes($prores[0]["vproductdetail"])), 'qty' => $shoppingItem->quantity, 'qtytext' => "qty_".$tc, 'mrprice' => $shoppingItem->unitPrice(),//Make_Price($shoppingItem->unitPrice()), 'totprice' => $totprice,//Make_Price($totprice), 'discount' => $discount,//Make_Price($discount), 'pricewithdisc' => $pricewithdisc,//Make_Price($pricewithdisc), 'viewdiscount' => $viewdiscount, 'AddressBookselect' =>$oAddressBook->get_AddressBookselect($shoppingItem->shippingAddressId),