>"; $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; ?> "> "> "> "> ::Cancelled Payment::

 

We're sorry, your credit card has been declined.

 

::PHP PayPal Order Form::

First Name:

Last Name:

Address1:

Address2:

City:

State:

Zip:

Email:

Phone:
- -

Item Name:

Item Number:

Size:
Color:

Amount:

Quantity:

Shipping Amount:

Tax:



::PHP PayPal Payment Button::
"> ">
::PHP PayPal::
Processing Transaction . . .
::Thank You::

 

Thank you! Your order has been successfully processed.

 


Order Number:
Date:
First Name:
Last Name:
Email:

SiteTitle; $horizontal_image = "shop-cart-01.gif"; /*if((integer)$invoice <= 0): // wrong parameters die("Not enough parameters for script"); endif;*/ // print order receipt $ordersql = "select * from ordermast where iorderno ='$invoice' "; $orderres = $db->DirectSelect($ordersql); $iorderno = $orderres[0]["iorderno"]; $err_msg = "Your Order Number : ".$iorderno.""; $dorderdate = $orderres[0]["dorderdate"]; $OrderSubTotal = Make_Price($orderres[0]["fsubtotal"]); $_subTotal = $orderres[0]["fsubtotal"]; $_orderNo = $orderres[0]["iorderno"]; $iorderno= $orderres[0]["iorderid"]; $Tax = Make_Price($orderres[0]["ftax"]); $ShippingCharge = Make_Price($orderres[0]["fshipping"]); $GC_Charge = number_format($orderres[0]["fgcamount"],2,'.',','); $HandlingCharge = Make_Price(0); $totaldiscount = Make_Price($orderres[0]["fdiscount"] + $orderres[0]["fcouponamount"]); $ordertotal = Make_Price($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_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"], ); 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(strpos(strtolower($payment_method),'hone')) { $table_phoneno[] = array( "phone_no"=>$GLOBALS["PHONE_NO"] ); } $itemsql = "select * from orderdetail where iorderid ='$iorderno' "; $itemres = $db->DirectSelect($itemsql); $totalcart = count($itemres); $giftwrap_changes_recipt = 0; $giftwrap_changes_recipt_price = "0.00"; for($tc=0;$tc<$totalcart;$tc++): $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 iproductid, vproductname, vshortdesc, vunitid, fsaleprice, vweight, vSKU, vproductdetail, 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"]; if(file_exists($product_th_image) and !empty($pimgres[0]["vthumbimage"])): $image = $thumb_image_url.$pimgres[0]["vthumbimage"]; else: $image = $default_pro_thumb; endif; $orderAddress = loadOrderAddress($itemres[$tc]["iorderaddressid"]); $table_cart[] = array( 'loop' => $tc, 'vSKU' => $prores[0]["vSKU"], 'iproductid' => $iproductid, 'vthumbimage' => $image, 'vProductName' => $prores[0]["vproductname"], 'vshortdesc' => $prores[0]["vshortdesc"], 'vtype2' => $prores[0]["vtype2"], 'vproductdetail'=> Make_Small_Desc(stripslashes($prores[0]["vproductdetail"])), 'qty' => $itemres[$tc]["iquantity"], 'mrprice' => Make_Price($prores[0]["fsaleprice"]), 'totprice' => Make_Price($itemres[$tc]["fprice"]), 'AddressName' => Order_ShipAddress_Name($itemres[$tc]["iorderaddressid"]), 'ShipAddress' => productIsGiftCertificate($prores[0]["vSKU"])?$orderAddress["vemail"]:Order_ShipAddress($itemres[$tc]["iorderaddressid"]), ); endfor; //**** Added by kunal for autocoupon discount $sSql="select * from coupon where vremark=1 and estatus='Active' and dstartdate <='" . date("Y-m-d") . "' and dexpirydate >='" . date("Y-m-d") . "' order by icouponid "; $coupon_result=$db->DirectSelect($sSql); // print_r($coupon_result); $autocoupon=0; if(count($coupon_result)>0) { $vcoupontitle=$coupon_result[0]["vcoupontitle"]; $vcouponno=$coupon_result[0]["vcouponno"]; $etype=$coupon_result[0]["etype"]; $forderamount="$" . $coupon_result[0]["forderamount"]; $fdiscount =$coupon_result[0]["fdiscount"]; $fdiscount = ($etype==0)?("$" . $fdiscount):($fdiscount . "%"); $dstartdate =$coupon_result[0]["dstartdate"]; $dexpirydate =$coupon_result[0]["dexpirydate"]; $vdetail =$coupon_result[0]["vdetail"]; $autocc_loc=generalsetting("autocc_location",2); if($autocc_loc==1 or $autocc_loc==3) { include_once("autocouponmail.php"); } if($autocc_loc==2 or $autocc_loc==3) { $autocoupon=1; } } //**** include_once("script/order/orderreceiptemails.php"); $cheque_address = $CHEQUE_ADDRESS; // echo $autocoupon; //include_once("scripts/leftnav.php"); $middle ="middle/order/orderreceipt.htm"; //include_once("scripts/summary.php"); //include_once("affiliate/check.php"); //$local_variables = array_merge ($commonpassvariable, array('payment_type', 'pay_msg','err_msg', 'totalitems_in_cart', 'totalcart', 'OrderSubTotal', 'tc', 'shmodecombo', 'single_shipping_name', 'single_shipping_address', 'AddressTdTitle', 'totaldiscount', 'ShippingCharge', 'HandlingCharge', 'Tax','GC_Charge', 'ordertotal','xyz','abc','vcoupontitle','vcouponno','forderamount','fdiscount','dstartdate','dexpirydate','vdetail','icatid','wrapcharge','top_check','_subTotal','_orderNo','giftwrap_changes_recipt_price','cheque_address')); //$tpl->load_file('shoppingcart',$template_file); /*$tpl->load_file('shoppingcart',$checkout_index); $tpl->parse_if('shoppingcart','autocoupon'); $tpl->parse_if('shoppingcart', 'receipt'); /*** For Top ****/ /*$tpl->parse_loop('shoppingcart','main_category'); $tpl->parse_if('shoppingcart','cat_main'); $tpl->parse_loop('shoppingcart','special_prods'); $tpl->parse_if('shoppingcart','flag_specials'); $tpl->parse_loop('shoppingcart','top_brands'); $tpl->parse_if('shoppingcart','flag_brand_top'); /*** Ends Top ****/ /****for left*****/ /*$tpl->parse_loop('shoppingcart','catlist'); $tpl->parse_loop('shoppingcart','extralookuplist'); $tpl->parse_if('shoppingcart','iscategory'); $tpl->parse_if('shoppingcart','showextra'); $tpl->parse_if('shoppingcart','showbrand'); $tpl->parse_if('shoppingcart','showlookup'); $tpl->parse_if('shoppingcart','shownorefine'); /*******end left*****/ /*** For rec prod***/ /*$tpl->parse_loop('shoppingcart','recsearchlist'); $tpl->parse_if('shoppingcart','showrecsearch'); $tpl->parse_if('shoppingcart','Navigation1'); $tpl->parse_loop('shoppingcart','recprodlist'); $tpl->parse_if('shoppingcart','showrecprod'); $tpl->parse_loop('shoppingcart','reccatlist'); $tpl->parse_if('shoppingcart','showreccat'); $tpl->parse_if('shoppingcart','giftwrap_changes_recipt'); $tpl->parse_if('shoppingcart','showalpha'); /*** End rc prod***/ /*$tpl->parse_loop('shoppingcart', 'table_billadd'); $tpl->parse_loop('shoppingcart', 'table_cart'); $tpl->parse_loop('shoppingcart', 'table_chequeaddress'); $tpl->parse_loop('shoppingcart', 'table_phoneno'); $tpl->pprint('shoppingcart', $local_variables);*/ $localvars=array("payment_type"=>$payment_type, "pay_msg"=>$pay_msg, "err_msg"=>$err_msg, "totalitems_in_cart"=>$totalitems_in_cart, "totalcart"=>$totalcart, 'OrderSubTotal'=>$OrderSubTotal, 'tc'=>$tc, 'shmodecombo'=>$shmodecombo, 'single_shipping_name'=>$single_shipping_name, 'single_shipping_address'=>$single_shipping_address, 'AddressTdTitle'=>$AddressTdTitle, 'totaldiscount'=>$totaldiscount, 'ShippingCharge'=>$ShippingCharge, 'HandlingCharge'=>$HandlingCharge, 'Tax'=>$Tax, 'GC_Charge'=>$GC_Charge, 'ordertotal'=>$ordertotal, 'xyz'=>$xyz, 'abc'=>$abc, 'vcoupontitle'=>$vcoupontitle, 'vcouponno'=>$vcouponno, 'forderamount'=>$forderamount, 'fdiscount'=>$fdiscount, 'dstartdate'=>$dstartdate, 'dexpirydate'=>$dexpirydate, 'vdetail'=>$vdetail, 'icatid'=>$icatid, 'wrapcharge'=>$wrapcharge, 'top_check'=>$top_check, '_subTotal'=>$_subTotal, '_orderNo'=>$_orderNo, 'giftwrap_changes_recipt_price'=>$giftwrap_changes_recipt_price, 'cheque_address'=>$cheque_address, 'autocoupon'=>$autocoupon, 'receipt'=>$receipt, 'main_category'=>$main_category, 'cat_main'=>$cat_main, 'special_prods'=>$special_prods, 'flag_specials'=>flag_specials, 'top_brands'=>$top_brands, 'flag_brand_top'=>$flag_brand_top, 'catlist'=>$catlist, 'extralookuplist'=>$extralookuplist, 'iscategory'=>$iscategory, 'showextra'=>$showextra, 'showbrand'=>$showbrand, 'showlookup'=>$showlookup, 'shownorefine'=>$shownorefine, 'recsearchlist'=>$recsearchlist, 'showrecsearch'=>$showrecsearch, 'Navigation1'=>$Navigation1, 'recprodlist'=>$recprodlist, 'showrecprod'=>$showrecprod, 'reccatlist'=>$reccatlist, 'giftwrap_changes_recipt'=>$giftwrap_changes_recipt, 'showalpha'=>$showalpha, 'table_billadd'=>$table_billadd, 'table_cart'=>$table_cart, 'table_chequeaddress'=>$table_chequeaddress, 'table_phoneno'=>$table_phoneno ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?> BrandList(); for($b=0;$b $Rsbrandlist[$b]["ibrandid"], 'brandname' => $Rsbrandlist[$b]["vbrand"], 'vlink' => $Rsbrandlist[$b]["vlink"], 'icategoryid' => $icatid, 'reset' => "Reset", ); } $localvars = array( "brand_list"=>$brand_list, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>loadundervalue("vproductname"); $iCountproductundervaule=count($products); if($products) { $product_name=""; $product_sale_price=""; $product_regular_price=""; $product_img_text=""; $product_add_to_cart=""; $product_th_image=""; $freeshipImg=""; if ($view=="all"){$pageproduct=$iCountproductundervaule; $viewflg=0;}else{$pageproduct=16;$viewflg=1;} $objPage = new Paging($pageproduct,$iCountproductundervaule,'menulink','sbody',true,$list); //echo "


site url is ".$Site_URL."


".$HTTP_REFERER; if(!empty($list)){ $objPage->arg1 = "yes"; }else{ $objPage->arg1 = "file=$file&paging=yes&flag=$flag"; } //if ($view=="all"){$pageproduct=$iCountproductundervaule; $viewflg=0;}else{$pageproduct=16;$viewflg=1;} if(!empty($list)){ $objPage->arg1 = "/yes"; $viewlink=$_SERVER['REQUEST_URI']."/all"; $viewpagelink=str_replace("/all","",$_SERVER['REQUEST_URI']); }else{ $objPage->arg1 = "&paging=yes&type=$type"; $viewlink=$_SERVER['REQUEST_URI']."&view=all"; $viewpagelink=str_replace("&view=all","",$_SERVER['REQUEST_URI']); } if(!isset($_REQUEST["pgno"])) { $_REQUEST["pgno"] = "10"; } else { $pageno = $_REQUEST["pgno"]; } for($i=$objPage->start;$i<$objPage->end;$i++) { //for($i=0;$iDirectSelect($query_cat); $tmp_icat_id = $res_cat[0]["icategoryid"]; $query = "SELECT * FROM productimage WHERE iproductid='".$products[$i]["iproductid"]."' AND eimgstatus='Active'ORDER BY iprority ASC"; $res = $db->DirectSelect($query); $prodImage = $res[0]; $product_name="".$products[$i]["vproductname"].""; $sPath = ""; $product_short_desc=$products[$i]["vshortdesc"]; $product_sale_price=$products[$i]["fsaleprice"]; $product_regular_price="Retail Price : ".$products[$i]["factualprice"]; $product_img_text=$prodImage["vimagetext"]; $product_add_to_cart=""; $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 "
product_th_image : ".$product_th_image; // exit; if(file_exists($product_th_image) && !empty($prodImage["vthumbimage"])) $image = $Site_URL."images/products/thumbimage/".$prodImage["vthumbimage"]; else { //$image=$default_blowout_th; $image="images/products/thumbimage/default_thumb_img.jpg"; } //echo $Site_URL."images/products/thumbimage/".$image; //echo "
"; $product_th_image = ""."". $product_img_text." "; //$product_th_image ="". ". $product_img_text."; $row_count=$general[$product_columns]["setting"]; if(($i+1)%$row_count==0) $tr=""; else $tr=""; // For free shipping Image if($products[$i]["fsaleprice"]>=$FREESHIPPING_VALUE) $freeshipImg = ""; 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 = "$ ".$product_sale_price.""; } $type="gender"; $table_products1[] = array( 'product_id' => $product_id, 'vproductname' => $product_name, 'product_short_desc' => $product_short_desc, 'fsaleprice' => $product_sale_price, 'product_regular_price' => $product_regular_price, 'product_img_text' => $product_img_text, 'product_add_to_cart' => $product_add_to_cart, 'product_th_image' => $product_th_image, 'product_free_shipping_img' => $freeshipImg, 'product_new_price' => $product_new_price, 'tr' => $tr, 'type' => $type, 'sPath' => $sPath, 'width' => $width, 'height' => $height, 'image' => $image ); } $sPageFooter = $objPage->doPaging($products); $localvars=array( "table_products"=>$table_products1, "iCountproductundervaule"=>$iCountproductundervaule, "path"=>$Site_URL."index.php?file=p-productdetail&iprodid=$product_id&catid=$tmp_icat_id", "tmp_icat_id"=>$tmp_icat_id, "sPageFooter"=>$sPageFooter, "flag"=>$flag, "view"=>$view, "viewflg"=>$viewflg, "viewlink"=>$viewlink, "viewpagelink"=>$viewpagelink, "recordcount"=>$iCountproductundervaule, "no"=>$no, ); } } else { $oCategory=new Category(); if ($icatid==500){ $sCatName ="Clearance"; }else{ $sCatName = $oCategory->GetCategoryName($icatid); } $midimageNew = $oCategory->getcatimage($icatid); if( isset($gender) and !empty($gender)){ $featureproductarray=$oCategory->GetCategoryList("efeatured",$gender,8,$icatid); $iCountFeatureproduct=count($featureproductarray); $vnewarrivalarray =$oCategory->GetCategoryList("vnewarrival",$gender,3,$icatid); $iCountNewArrival=count($vnewarrivalarray); $vwhtshot =$oCategory->GetCategoryList("vwhtshot",$gender,3,$icatid); $iCountWhatsHot=count($vwhtshot); $vbestsellersarray =$oCategory->GetCategoryList("vbestsellers",$gender,3,$icatid); $iCountBestSeller=count($vbestsellersarray); $eclearancearray=$oCategory->GetCategoryList("eclearance",$gender,3,$icatid); $iCountClearance=count($eclearancearray); if ($gender=="M"){ $midimage="men-special"; $type="gender"; $category_name = "Men"; } elseif ($gender=="W"){ $midimage="women-special"; $type="gender"; $category_name = "Women"; } elseif ($gender=="C"){ $midimage="chidren-special"; $type="gender"; $category_name = "Unisex"; } $home="Home"; $catname = ucwords($catres[0]["vcategory"]); $categoryname="".ucwords($category_name).""; $nav="    ".$home." • ".ucwords($categoryname)."• ".$prod; $localvars = array( "featureproductarray1"=>$featureproductarray, "vnewarrival"=>$vnewarrivalarray, "vwhtshot"=>$vwhtshot, "nav"=>$nav, "vbestsellersarray"=>$vbestsellersarray, "eclearancearray"=>$eclearancearray, "midimage"=>$midimage, "cattype"=>$cattype, "icatid"=>$icatid, "gender"=>$gender, "sCatName"=>$sCatName, "type"=>$type, "iCountFeatureproduct"=>$iCountFeatureproduct, "iCountNewArrival"=>$iCountNewArrival, "iCountWhatsHot"=>$iCountWhatsHot, "iCountBestSeller"=>$iCountBestSeller, "iCountClearance"=>$iCountClearance, "midimageNew"=>$midimageNew, "flag"=>$flag, "view"=>$view, "viewflg"=>$viewflg, "viewlink"=>$viewlink, "viewpagelink"=>$viewpagelink, "recordcount"=>$iCountproductundervaule, "no"=>$no, ); // condition for men,women,childern }else{ if ($cattype == "tester"){ $midimage="testers-special"; $category_name = "Tester"; } elseif($cattype == "giftset"){ $midimage="giftsets-special"; $category_name = "GiftSet"; } elseif($cattype == "clearance"){ //$midimage="giftsets-special"; /*$midimageNew="logo"; $category_name = "Clearance"; $eclearancearray=$oCategory->GetCategoryList("eclearance"); $iCountClearance=count($eclearancearray);*/ //$midimageNew = $oCategory->getcatimage($icatid); $midimageNew = "clearance.gif"; $category_name = "Clearance"; $eclearancearray=$oCategory->GetClearanceList("eclearance"); $iCountClearance=count($eclearancearray); if($eclearancearray) { $objPage = new Paging(16,$iCountClearance,'menulink','sbody',true,$list); if(!empty($list)){ $objPage->arg1 = "yes"; }else{ $objPage->arg1 = "file=$file&paging=yes&cattype=$cattype&icatid=$icatid"; } if(!isset($_REQUEST["pgno"])) { $_REQUEST["pgno"] = "10"; } else { $pageno = $_REQUEST["pgno"]; } for($i=$objPage->start;$i<$objPage->end;$i++) { $iproductid = $eclearancearray[$i]['iproductid']; $vthumbimage = $eclearancearray[$i]['vthumbimage']; $vtype = $eclearancearray[$i]['vtype2']; $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 = $eclearancearray[0]["vlink"]; if(isset($icatid) and !empty($icatid)) { $link_name = $Site_URL.$vlink_brand."/".$category_name."/".$vlink."/Id/".$iproductid."/".$icatid; } else { $link_name = $Site_URL.$vlink_brand."/".$category_name."/".$vlink."/Id/".$iproductid; } $product_th_image=$thumb_image_path.$vthumbimage; $size = getimagesize(Site_URL."images/products/thumbimage/".$vthumbimage); if($size[0]>70 && $size[1]>70){ $width=70; $height=70; } else{ $width=$size[0]; $height=$size[1]; } if(file_exists($product_th_image) and (!empty($vthumbimage))) $vthumbimage = $thumb_image_url.$vthumbimage; else $vthumbimage = $default_pro_thumb; $array_table[]=array( 'vproductname'=>$eclearancearray[$i]['vproductname']." ".$eclearancearray[$i]['vweight']." ".$eclearancearray[$i]['vunitid']." ".$eclearancearray[$i]['vtype2'], 'fsaleprice'=>$eclearancearray[$i]['fsaleprice'], 'product_th_image' => $product_th_image, 'iproductid' => $iproductid, 'link_name' => $link_name, 'width' =>$width, 'height' =>$height ); } $totalcount = count($eclearancearray); if($totalcount >16 ) { $sPageFooter = $objPage->doPaging($eclearancearray); } } } else{ $midimage="mini-special"; $category_name = "Mini"; } //echo $midimage; // condition for giftsets,tester,mini $oHomepage=new HomePage(); //echo $cattype; $mencatid=$oCategory->GetCategoryID('Men'); //echo "
men cate id ".$mencatid; $womencatid=$oCategory->GetCategoryID('Women'); //echo "
women cate id ".$womencatid; $childrencatid=$oCategory->GetCategoryID('Children'); //echo "
children cate id ".$childrencatid; $forman=$oHomepage->CategoryHomepageProduct($cattype,$mencatid,10); $iCountForMen=count($forman); $forwomen=$oHomepage->CategoryHomepageProduct($cattype,$womencatid,10); $iCountForWomen=count($forwomen); $forchildren=$oHomepage->CategoryHomepageProduct($cattype,$childrencatid,10); $iCountForChildren=count($forchildren); $type="gtm"; $home="Home"; $catname = ucwords($catres[0]["vcategory"]); $categoryname="".ucwords($category_name).""; $nav="    ".$home." • ".ucwords($categoryname)."• ".$prod; $localvars = array( "forman"=>$forman, "forwomen"=>$forwomen, "forchildren"=>$forchildren, "type"=>$type, "nav"=>$nav, "icatid"=>$icatid, "gender"=>$gender, "cattype"=>$cattype, "sCatName"=>$sCatName, "midimage"=>$midimage, "iCountForMen"=>$iCountForMen, "iCountForWomen"=>$iCountForWomen, "iCountForChildren"=>$iCountForChildren, "midimageNew"=>$midimageNew, "flag"=>$flag, "eclearancearray"=>$eclearancearray, "iCountClearance"=>$iCountClearance, "midimage"=>$midimage, "array_table"=>$array_table, "sPageFooter"=>$sPageFooter, "view"=>$view, "viewflg"=>$viewflg, "viewlink"=>$viewlink, "viewpagelink"=>$viewpagelink, "recordcount"=>$iCountproductundervaule, "no"=>$no, ); } } //echo "here for cattype ->".$cattype; $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>GetAddressDetailFromId($addid); include_once("functions/country_functions.inc"); $localvars = array( "iclientaddbookid" => $addressdetail[0]['iclientaddbookid'], "vaddresstitle" => $addressdetail[0]['vaddresstitle'], "iclientid" => $addressdetail[0]['iclientid'], "vfirstname" => $addressdetail[0]['vfirstname'], "vmiddlename" => $addressdetail[0]['vmiddlename'], "vlastname" => $addressdetail[0]['vlastname'], "vaddress1" => $addressdetail[0]['vaddress1'], "vaddress2" => $addressdetail[0]['vaddress2'], "vcity" => $addressdetail[0]['vcity'], "countrycombo" => displaycountry($addressdetail[0]['vcountry']), "statecombo" => displaystate($addressdetail[0]['vstate']), "izip" => $addressdetail[0]['izip'], "vphone" => $addressdetail[0]['vphone'], "vphone_dt" => $addressdetail[0]['vphone_dt'], "vemail" => $addressdetail[0]['vemail'], "edefaultbilling" => $addressdetail[0]['edefaultbilling'], "edefaultshipping" => $addressdetail[0]['edefaultshipping'], "act" => $act, ); } else { $countrycombo = $oCountry->GetCountryDropDownList(); include_once("functions/country_functions.inc"); $localvars = array( "countrycombo" => displaycountry(), "statecombo" => displaystate(), ); } $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>totalCount(); $sSQL = "Select * FROM shoppingcartitem where vuniqueid = '$SHOPPING_CART_ID' AND iindex = '$sno' "; $rsGiftCert = $db->DirectSelect($sSQL); $othere = explode("&",$rsGiftCert[0]['votherprefs']); $iproductid = $rsGiftCert[0]['iproductid']; $sid = $rsGiftCert[0]['ishoppingitemid']; $sunit = explode("=",$othere[0]); $sgcemaail = explode("=",$othere[1]); $sgcmessagesubject = explode("=",$othere[2]); $sgcmessagetext = explode("=",$othere[3]); $sgcmessagesignature = explode("=",$othere[4]); $localvars = array( "unit"=>$sunit[1], "gcemaail"=>$sgcemaail[1], "gcmessagesubject"=>$sgcmessagesubject[1], "gcmessagetext"=>$sgcmessagetext[1], 'gcmessagesignature'=>$sgcmessagesignature[1], "action" =>$action, "sno"=>$sno, "iproductid"=>$iproductid, "sid"=>$sid ); //exit; } $smartyvars = array_merge($smartyvars,$localvars); include_once("include/footer.inc.php"); ?>updateItem($index,$quantity,$is_gift_wrap=false,$shippingAddressId=false); $othereprefs = "unitPrice=$gcamount&gcemail=$gcemail&gcmessagesubject=$gcmessagesubject&gcmessagetext=$gcmessagetext&gcmessagesignature=$gcmessagesignature"; $sSQL = "Update shoppingcartitem SET votherprefs = '$othereprefs' WHERE ishoppingitemid= '$sid' "; $db->DirectUpdate($sSQL); } else{ if(!$iproductid) //$iproductid = $shoppingCart->defaultGiftCertificateProductId(); $query = "SELECT iproductid FROM products WHERE vSKU IN ('".implode("','", $GIFT_CERT_SKUS)."') AND eprodstatus='Active'"; $db_res = $db->DirectSelect($query); $iproductid = $db_res[0]["iproductid"]; $db_res = $db->DirectSelect("select icategoryid from productcat where iproductid='$iproductid'"); $cate_id = $db_res[0]["icategoryid"]; $USDAmount = $gcamount; // $itemIndex = $shopping->addItem($iproductid, 1,$cate_id); $itemIndex = $shoppingCart->addItem($iproductid, 1,$cate_id); $shoppingCart->setOtherItemPreference($itemIndex, "unitPrice", $USDAmount); $shoppingCart->setOtherItemPreference($itemIndex, "gcemail", $gcemail); $shoppingCart->setOtherItemPreference($itemIndex, "gcmessagesubject", $gcmessagesubject); $shoppingCart->setOtherItemPreference($itemIndex, "gcmessagetext", $gcmessagetext); $shoppingCart->setOtherItemPreference($itemIndex, "gcmessagesignature", $gcmessagesignature); //$shopping->store($iproductid, $quantity='1',$cate_id); $shoppingCart->store(); //$redirectto = $redirectto?$redirectto:"shoppingcart"; } header("location:".$Site_URL."index.php?file=s-shoppingcart&action=addtocart"); exit; ?>iclientaddbookid=$addid; $oMember->vaddresstitle=$title; $oMember->iclientid=$sessMemberID; $oMember->vfirstname=$vfirstname; $oMember->vmiddlename=$vmiddlename; $oMember->vlastname=$vlastname; $oMember->vaddress1=$address1; $oMember->vaddress2=$address2; $oMember->vcity=$city; if($votherstate != "" && $state == "") { $oMember->vstate=$votherstate;; } else { $oMember->vstate=$state; } $oMember->vcountry=$country; $oMember->izip=$zip; $oMember->vphone=$phone; $oMember->vphone_dt=$vphone_dt; $oMember->vemail=$email; $oMember->edefaultbilling=$shipping; $oMember->edefaultshipping=$billing; $oMember->vremark=$vremark; $oMember->estatus="Active"; $res = $oMember->UpdateClientAddressBook($addid); if($res) { header("location: index.php?file=m-addressbook"); exit; } else { header("location: index.php?file=m-addaddress&addid=$addid&act=update"); exit; } } } else { if(session_is_registered('sessMemberID')){ $oMember->vaddresstitle=$title; $oMember->iclientid=$sessMemberID; $oMember->vfirstname=$vfirstname; $oMember->vmiddlename=$vmiddlename; $oMember->vlastname=$vlastname; $oMember->vaddress1=$address1; $oMember->vaddress2=$address2; $oMember->vcity=$city; if($votherstate != "" && $state == "") { $oMember->vstate=$votherstate;; } else { $oMember->vstate=$state; } $oMember->vcountry=$country; $oMember->izip=$zip; $oMember->vphone=$phone; $oMember->vphone_dt=$vphone_dt; $oMember->vemail=$email; $oMember->edefaultbilling=$shipping; $oMember->edefaultshipping=$billing; $oMember->vremark=$vremark; $oMember->estatus="Active"; $res = $oMember->AddClientAddressBook(); if($res) { header("location: index.php?file=m-addressbook"); exit; } else { header("location: index.php?file=m-addaddress"); exit; } } else { header("location: index.php?file=m-login"); exit; } } ?>SiteTitle; $httpreferer = $HTTP_SERVER_VARS["HTTP_REFERER"];*/ if(isset($sessMemberID) & !empty($sessMemberID)) {//addressbook $result = $oMember->GetClientAddressBookDetailFromID($sessMemberID); if ($result) { /*for($i=0;$i $result[$i]["iclientaddbookid"], 'title' => $result[$i]["vaddresstitle"], 'firstname' => $result[$i]["vfirstname"], 'address1' => $result[$i]["vaddress1"], 'address2' => $result[$i]["vaddress2"], 'city' => $result[$i]["vcity"], 'state' => $result[$i]["vstate"], 'country' => $result[$i]["vcountry"], 'email' => $result[$i]["vemail"], 'billing' => $result[$i]["edefaultbilling"], 'shipping' => $result[$i]["edefaultshipping"], 'defaultbilling' => $flag1, 'defaultshipping'=> $flag, 'total' => $totalrecord ); $flag=""; $flag1=""; }*/ $localvars = array( 'defaultbilling' => $flag1, 'defaultshipping'=> $flag, 'AddressBook' => $result ); } } else { header("location: index.php?file=m-login"); exit; } $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?> 0) { for($i=0;$iDeleteClientAddressBook($ch[$i]); } } else { $msg="Please Check the Addresses To be Deleted."; } header("location: index.php?file=m-addressbook"); exit; } else { header("location: index.php?file=m-login"); exit; } $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>defaultGiftCertificateProductId(); $query = "SELECT iproductid FROM products WHERE vSKU IN ('".implode("','", $GIFT_CERT_SKUS)."') AND eprodstatus='Active'"; $db_res = $db->DirectSelect($query); $iproductid = $db_res[0]["iproductid"]; $db_res = $db->DirectSelect("select icategoryid from productcat where iproductid='$iproductid'"); $cate_id = $db_res[0]["icategoryid"]; $USDAmount = $gcamount; // $itemIndex = $shopping->addItem($iproductid, 1,$cate_id); $itemIndex = $shoppingCart->addItem($iproductid, 1,$cate_id); $shoppingCart->setOtherItemPreference($itemIndex, "unitPrice", $USDAmount); $shoppingCart->setOtherItemPreference($itemIndex, "gcemail", $gcemail); $shoppingCart->setOtherItemPreference($itemIndex, "gcmessagesubject", $gcmessagesubject); $shoppingCart->setOtherItemPreference($itemIndex, "gcmessagetext", $gcmessagetext); $shoppingCart->setOtherItemPreference($itemIndex, "gcmessagesignature", $gcmessagesignature); //$shopping->store($iproductid, $quantity='1',$cate_id); $shoppingCart->store(); //$redirectto = $redirectto?$redirectto:"shoppingcart"; header("location:".$Site_URL."index.php?file=s-shoppingcart"); exit; ?>getReminderDetails($reminderid); $res1 = $oMember->getReminderCategoriesDropDown ($iMemberid,$categoryid); for($i=0;$i$res1[$i]["icategoryid"], "cataname"=>$res1[$i]["vname"], ); } if (!$res) { showErrorMessage($middle_dir,"no record found."); } else { /*$reminderdetail[] = array( "categoryid"=>$res[0]["icategoryid"], "vtitle"=>$res[0]["vtitle"], "vname"=>$res[0]["vname"], "dreminddate"=>$res[0]["dreminddate"], "erecurring"=>$res[0]["erecurring"], "enotification"=>$res[0]["enotification"], "iremindtime"=>$res[0]["iremindtime"], "vmessage"=>$res[0]["vmessage"], };*/ $categoryname = stripslashes($res[0]["vname"]); $categorydesc = stripslashes($res[0]["vdescription"]); $actionadd=false; $actionedit=true; $localvars=array( "categoryid"=>$categoryid, "categoryname"=>$categoryname, "categorydesc"=>$categorydesc, "actionedit"=>$actionedit, "reminderdetail"=>$reminderdetail, "categoryid"=>$res[0]["icategoryid"], "vtitle"=>$res[0]["vtitle"], "vname"=>$res[0]["vname"], "dreminddate"=>$res[0]["dreminddate"], "erecurring"=>$res[0]["erecurring"], "enotification"=>$res[0]["enotification"], "iremindtime"=>$res[0]["iremindtime"], "vmessage"=>$res[0]["vmessage"], "action"=>$action, "catarray"=>$catarray, "reminderid"=>$reminderid, ); } } if (isset($action) and ($action=="save")) { $res = $oMember->changeReminderDetails($categoryid, addslashes($categoryname), addslashes($categorydesc)); if ($res==false) { showErrorMessage($middle_dir,"changes not saved."); } else { $msg = "Reminder successfully changed."; header("location:".$Site_URL."index.php?file=m-remindercat&msg=$msg"); exit; } } if (isset($action) and ($action=="editreminder")) { $res = $oMember->changeReminder($iMemberid,$categoryid,$date,$type,$title,$name,$time,$message,$recurring,$reminderid); if ($res==false) { showErrorMessage($middle_dir,"changes not saved."); } else { $msg = "Reminder successfully changed."; header("location:".$Site_URL."index.php?file=m-reminders&msg=$msg"); exit; } } if(isset($action) and ($action=="delete")) { $res = $oMember->DeleteReminders($chk); if ($res===false) { showErrorMessage($middle_dir,"wishlist not deleted."); } else { $msg = "Reminder successfully deleted."; header("location:".$Site_URL."index.php?file=m-reminders&msg=$msg"); exit; } } if(isset($action) and ($action=="addprep")) { //$restime = $oMember->getRemindTimeDropDown("5"); $res = $oMember->getReminderCategoriesDropDown ($iMemberid,$categoryid); for($i=0;$i$res[$i]["icategoryid"], "cataname"=>$res[$i]["vname"], ); } $localvars=array( "categoryid"=>$categoryid, "categoryname"=>$categoryname, "categorydesc"=>$categorydesc, "actionadd"=>$actionadd, "action"=>$action, "catarray"=>$catarray, ); /*header("location:".$Site_URL."index.php?file=m-reminders&msg=$msg"); exit;*/ } if(isset($action) and ($action=="add")) { $res = $oMember->addReminder($iMemberid,$categoryid,$date,$type,$title,$name,$time,$message); if (!$res) { showErrorMessage($middle_dir,"reminder not added"); } else { $msg = "Reminder successfully added."; header("location:".$Site_URL."index.php?file=m-reminders&categoryid=$categoryid&msg=$msg"); exit; } } if(isset($action) and ($action=="addreminder")) { $res = $oMember->AddReminderCategory (addslashes($categoryname), addslashes($categorydesc), $iMemberid); if (!$res) { showErrorMessage($middle_dir,"remindercategory not added."); } else { $msg = "Reminder successfully added."; if(isset($redirectfrom) && !empty($redirectfrom)) { header("location:".$Site_URL."index.php?file=$redirectfrom"); exit; }else { header("location:".$Site_URL."index.php?file=m-remindercat&msg=$msg"); exit; } } } if(isset($action) and ($action=="deletereminder")) { $res = $oMember->DeleteRemindersCategory($chk); if (!$res) { showErrorMessage($middle_dir,"wishlist not deleted."); } else { $msg = "Reminder successfully deleted."; header("location:".$Site_URL."index.php?file=m-remindercat&msg=$msg"); exit; } } } else { if(isset($redirectto) && !empty($redirectto)) { $msg = $login_msg; header("location:".$Site_URL."index.php?file=$redirectto&err_msg=$msg"); exit; } else { $msg=$login_msg; header("location:".$Site_URL."index.php?file=m-login&err_msg=$msg"); exit; } } $smartyvars = array_merge($smartyvars,$localvars); include_once("include/footer.inc.php"); ?>GetClientDetailFromID($sessMemberID); $localvars = array( "iclientid" =>$clientdetail[0]['iclientid'], "vpassword" =>$clientdetail[0]['vpassword'], ); }else{ header("location:index.php?m-login"); exit; } $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>iclientid=$iclientid; $oMember->vpassword=$confpass; $record = $oMember->UpdateClientPassword($iclientid); if($record) { $message = "Password Updated Successfully"; header("location: index.php?file=m-myaccount&msg=$message"); exit; } else { $message = "Password Not Updated Successfully."; header("location: index.php?file=m-myaccount&msg=$message"); exit; } } else { $message = "Please Enter Correct Old Password"; header("location: index.php?file=m-changepass&msg=$message"); exit; } ?>
nishant shah in login page

"; exit; /* $SiteTitle = $obj->SiteTitle; $httpreferer=$HTTP_SERVER_VARS["HTTP_REFERER"]; if(!session_is_registered('sessMemberID')){ header('Location:index.php?file=login'); exit; } if(isset($to) and isset($from) and strlen($to) > 0 and strlen($from) > 0){ $redirectto = $to; $redirectfrm = $from; } $db_sql="select * from client where iclientid='$sessMemberID'"; $result=$obj->select($db_sql); $firstname = $result[0]["vfirstname"]; $middlename = $result[0]["vmiddlename"]; $lastname = $result[0]["vlastname"]; $gender = $result[0]["vgender"]; $address1 = $result[0]["vaddress1"]; $address2 = $result[0]["vaddress2"]; $phone = $result[0]["vphone"]; $vphone_dt = $result[0]["vphone_dt"]; $email = $result[0]["vemail"]; $fax = $result[0]["vfax"]; $city = $result[0]["vcity"]; $state = $result[0]["vstate"]; $country = $result[0]["vcountry"]; $currencysymbol = $result[0]["vcurrencysymbol"]; $zip = $result[0]["izip"]; $middle = $middle_dir . "client_edit.html"; $top = $top_dir . "top-home.html"; if($country!="US") { $votherstate = $state; $state=""; } include_once("scripts/leftnav.php"); $countrycombo = displaycountry($country); $statecombo = displaystate($state); $vMale = ($result[0]["vgender"]=="Male")?" Selected ":""; $vFemale = ($result[0]["vgender"]=="Female")?" Selected ":""; include_once("scripts/summary.php"); $local_variables = array_merge ($commonpassvariable, array('vFemale', 'vMale','class_detail', 'redirectto','redirectfrm','msg','firstname','middlename','lastname','gender','address1','address2','phone','email','fax','city','state','country','zip', 'currencysymbol', 'countrycombo', 'votherstate', 'statecombo','vphone_dt','icatid')); $indexfile="index.htm"; include_once("include/footer.inc.php"); */ ?>$action, "to"=>$to, "from"=>$from, "productid"=>$productid, "redirectto"=>$to, "redirectfrm"=>$from, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>CheckMemberEmail($email); echo $asx = $forgotpass[0]["vpassword"]; if(count($forgotpass)>0) { //$vfromemail = generalsetting("adminemail",2); $vfromemail = $custserviceemail; $msql = "Select * from mails where imailid='3' "; $mres = $db->DirectSelect($msql); $message_contents = $mres[0]["vmailtext"]; stripslashes($message_contents); $vfromemailsql=$db->DirectSelect("select setting from settings where varname='adminemail'"); $vfromemail=$vfromemailsql[0]['setting']; $vtollfreesql=$db->DirectSelect("select setting from settings where varname='TOLL_FREE'"); $TOLL_FREE=$vtollfreesql[0]['setting']; $subject = str_replace("{SITE_NAME}",SITE_NAME,stripslashes($mres[0]["vmailsubject"])); $headers = "To: $email <$email>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"; // $tpl->load_file('sendmail','./templates/email/email.html'); //$sendmessage = $tpl->pget('sendmail', array('message_contents', 'vemail', 'vPassword','SITE_NAME','salesemail','custserviceemail','TOLL_FREE','Site_URL')); $message_contents = str_replace("{vemail}",$forgotpass[0]["vemail"],stripslashes($message_contents)); $message_contents = str_replace("{vPassword}",$forgotpass[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)); /*echo $vemail."
"; echo $subject."
"; echo $message_contents."
"; echo $headers; exit;*/ $onesendstat = mail($email, $subject, $message_contents, $headers); $msg = "Your Password has been mailed to You!"; } else { $msg = "Please Check Your Email Id!"; } header("Location:index.php?file=m-forgot_pass&msg=$msg"); exit; ?>$action, "to"=>$to, "from"=>$from, "productid"=>$productid, "redirectto"=>$to, "redirectfrm"=>$from, "msg"=>$msg, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>GetClientDetailFromEmail($vemail,$vpassword); $msg = $oMember->ErrorCode; if($rsMember === false || count($rsMember) < 1) { header("location: index.php?file=m-login&action=$action&msg=INVALID_USERNAME"); exit; } else { if($rsMember[0]['vpassword'] == $vpassword) { $sessMemberID = $rsMember[0]['iclientid']; $sessFirstname = $rsMember[0]['vfirstname']; $sessLastname = $rsMember[0]['vlastname']; $sessilevelid =$rsMember[0]['ilevelid']; $_SESSION['sessMemberID'] = $rsMember[0]['iclientid']; session_register('sessMemberID'); session_register('sessFirstname'); session_register('sessLastname'); session_register('sessilevelid'); if($action=="checkout"){ if(session_is_registered('sessMemberID')){ $SURL="https://www.powerofperfume.com/"; }else{ $SURL=Site_URL; } header("location:".$SURL."index.php?file=s-checkout"); exit; } else if($action =='reminders') { header("location:index.php?file=m-remindercat"); } else{ if($action == "after_login"){ header("location:index.php?file=s-wishlist_a&iMemberid=$sessMemberID&productid=$productid&action=$action"); exit; } else{ header("location:index.php?file=m-myaccount"); exit; } } exit; } else { header("location: index.php?file=m-login&action=$action&msg=INVALID_USERNAME"); exit; } } ?>beEmpty(); $shoppingCart->save(); }else { $login_text="Login"; $login="login"; $register_text="Register Now"; $register="signup"; } header("location:".$Site_URL."index.php"); // un set for the SSL exit; ?> $sessFirstname , "sessLastname"=> $sessLastname , ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); } ?> SiteTitle; $iMemberid = $sessMemberID; $oMember=new Member(); $httpreferer = $HTTP_SERVER_VARS["HTTP_REFERER"]; if(isset($iMemberid) & !empty($iMemberid)){ if (isset($action) and ($action=="addreminder")) { $localvars = array ( "action"=>$action, ); } if (isset($action) and ($action=="edit")) { $res = $oMember->getReminderDetails1($categoryid); if (!$res) { showErrorMessage($middle_dir,"no record found."); } else { $categoryname = stripslashes($res[0]["vname"]); $categorydesc = stripslashes($res[0]["vdescription"]); $actionadd=false; $actionedit=true; $localvars=array( "categoryid"=>$categoryid, "categoryname"=>$categoryname, "categorydesc"=>$categorydesc, "actionedit"=>$actionedit, "action"=>$action, ); } } } else { header("location:".$Site_URL."index.php?file=m-login&err_msg=$msg"); exit; } $smartyvars = array_merge($smartyvars,$localvars); include_once("include/footer.inc.php"); ?>SiteTitle; $iMemberid = $sessMemberID; $oMember=new Member(); $httpreferer = $HTTP_SERVER_VARS["HTTP_REFERER"]; if(isset($iMemberid) & !empty($iMemberid)){ //$wishcategories = $oMember->getReminderCategories($iMemberid); $remindercategories = $oMember->getReminderCategories($iMemberid); if (!count ($remindercategories)==0) { $localvars=array( "productname"=>$productname, "productid"=>$productid, "action1"=>$action1, "remindercategories"=>$remindercategories, "action2"=>$action2, "redirectto"=>$redirectto, "productpage"=>$productpage, ); }else { $err_msg="No reminders found."; } }else { if(isset($redirectto) && !empty($redirectto)) { $msg = $login_msg; header("location:".$Site_URL."index.php?file=login&to=wishcategories&from=wishcategories"); exit; }else { $msg = $login_msg; header("location:".$Site_URL."index.php?file=m-login&action=reminders"); exit; } } $smartyvars = array_merge($smartyvars,$localvars); include_once("include/footer.inc.php"); ?>getReminderDetails($reminderid); $res1 = $oMember->getReminderCategoriesDropDown ($iMemberid,$categoryid); for($i=0;$i$res1[$i]["icategoryid"], "cataname"=>$res1[$i]["vname"], ); } if ($res===false) { showErrorMessage($middle_dir,"no record found."); } else { /*$reminderdetail[] = array( "categoryid"=>$res[0]["icategoryid"], "vtitle"=>$res[0]["vtitle"], "vname"=>$res[0]["vname"], "dreminddate"=>$res[0]["dreminddate"], "erecurring"=>$res[0]["erecurring"], "enotification"=>$res[0]["enotification"], "iremindtime"=>$res[0]["iremindtime"], "vmessage"=>$res[0]["vmessage"], };*/ $categoryname = stripslashes($res[0]["vname"]); $categorydesc = stripslashes($res[0]["vdescription"]); $actionadd=false; $actionedit=true; $localvars=array( "categoryid"=>$categoryid, "categoryname"=>$categoryname, "categorydesc"=>$categorydesc, "actionedit"=>$actionedit, "reminderdetail"=>$reminderdetail, "categoryid"=>$res[0]["icategoryid"], "vtitle"=>$res[0]["vtitle"], "vname"=>$res[0]["vname"], "dreminddate"=>$res[0]["dreminddate"], "erecurring"=>$res[0]["erecurring"], "enotification"=>$res[0]["enotification"], "iremindtime"=>$res[0]["iremindtime"], "vmessage"=>$res[0]["vmessage"], "action"=>$action, "catarray"=>$catarray, "reminderid"=>$reminderid, ); } } if (isset($action) and ($action=="save")) { $res = $oMember->changeReminderDetails($categoryid, addslashes($categoryname), addslashes($categorydesc)); if ($res==false) { showErrorMessage($middle_dir,"changes not saved."); } else { $msg = "Reminder successfully changed."; header("location:".$Site_URL."index.php?file=m-remindercat&msg=$msg"); exit; } } if (isset($action) and ($action=="editreminder")) { $res = $oMember->changeReminder($iMemberid,$categoryid,$date,$type,$title,$name,$time,$message,$recurring,$reminderid); if ($res==false) { showErrorMessage($middle_dir,"changes not saved."); } else { $msg = "Reminder successfully changed."; header("location:".$Site_URL."index.php?file=m-reminders&categoryid=$categoryid&msg=$msg"); exit; } } if(isset($action) and ($action=="delete")) { $res = $oMember->DeleteReminders($chk); if ($res===false) { showErrorMessage($middle_dir,"wishlist not deleted."); } else { $msg = "Reminder successfully deleted."; header("location:".$Site_URL."index.php?file=m-reminders&msg=$msg"); exit; } } if(isset($action) and ($action=="addprep")) { //$restime = $oMember->getRemindTimeDropDown("5"); $res = $oMember->getReminderCategoriesDropDown ($iMemberid,$categoryid); for($i=0;$i$res[$i]["icategoryid"], "cataname"=>$res[$i]["vname"], ); } $localvars=array( "categoryid"=>$categoryid, "categoryname"=>$categoryname, "categorydesc"=>$categorydesc, "actionadd"=>$actionadd, "action"=>$action, "catarray"=>$catarray, ); /*header("location:".$Site_URL."index.php?file=m-reminders&msg=$msg"); exit;*/ } if(isset($action) and ($action=="add")) { $res = $oMember->addReminder($iMemberid,$categoryid,$date,$type,$title,$name,$time,$message); if (!$res) { showErrorMessage($middle_dir,"reminder not added"); } else { $msg = "Reminder successfully added."; header("location:".$Site_URL."index.php?file=m-reminders&categoryid=$categoryid&msg=$msg"); exit; } } if(isset($action) and ($action=="addreminder")) { $res = $oMember->AddReminderCategory (addslashes($categoryname), addslashes($categorydesc), $iMemberid); if (!$res) { showErrorMessage($middle_dir,"remindercategory not added."); } else { $msg = "Reminder successfully added."; if(isset($redirectfrom) && !empty($redirectfrom)) { header("location:".$Site_URL."index.php?file=$redirectfrom"); exit; }else { header("location:".$Site_URL."index.php?file=m-remindercat&msg=$msg"); exit; } } } if(isset($action) and ($action=="deletereminder")) { $res = $oMember->DeleteRemindersCategory($chk); if (!$res) { showErrorMessage($middle_dir,"wishlist not deleted."); } else { $msg = "Reminder successfully deleted."; header("location:".$Site_URL."index.php?file=m-remindercat&msg=$msg"); exit; } } } else { if(isset($redirectto) && !empty($redirectto)) { $msg = $login_msg; header("location:".$Site_URL."index.php?file=$redirectto&err_msg=$msg"); exit; } else { $msg=$login_msg; header("location:".$Site_URL."index.php?file=m-login&err_msg=$msg"); exit; } } $smartyvars = array_merge($smartyvars,$localvars); include_once("include/footer.inc.php"); ?>getReminders($iMemberid); $memberreminders = $oMember->getReminders($categoryid); if(memberreminders===false) { $foundnocategories = true; $foundcategories = false; } else { for($i=0;$i $memberreminders[$i]["icategoryid"], 'vname' => $memberreminders[$i]["vname"], 'vdescription' => substr($memberreminders[$i]["vdescription"],0,20), 'reminderid' =>$memberreminders[$i]["ireminderid"], 'categoryid' =>$memberreminders[$i]["icategoryid"], 'date' =>$memberreminders[$i]["dreminddate"], 'name' =>$memberreminders[$i]["vname"], 'title' =>$memberreminders[$i]["vtitle"], 'type' =>$memberreminders[$i]["eremindtype"], 'time' =>$memberreminders[$i]["iremindtime"], 'status' =>$memberreminders[$i]["estatus"], 'recurring' =>$memberreminders[$i]["erecurring"], ); } $foundnocategories = false; $foundcategories = true; } $localvars = array( 'memberreminders' => $memberreminders, 'remindercategories'=> $remindercategories, 'foundnocategories' => $foundnocategories, 'foundcategories' => $foundcategories, 'categoryid' => $categoryid, ); /*if (!$memberreminders) { $foundnocategories = true; $foundcategories = false; } else { $foundnocategories = false; $foundcategories = true; } $localvars = array( "foundnocategories"=>$foundnocategories, "foundcategories"=>$foundcategories, "memberreminders"=>$memberreminders, );*/ } else{ header("location: index.php?file=m-login&action=reminders"); exit; } $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>Click Here."; } $oMember=new Member(); $oCountry = new country(); $oState= new state(); include_once("functions/country_functions.inc"); if($action=="update"){ //echo "
id is :".$sessMemberID; if(session_is_registered('sessMemberID')){ $clientdetail=$oMember->GetClientDetailFromID($sessMemberID); include_once("functions/country_functions.inc"); $localvars = array( "iclientid" =>$clientdetail[0]['iclientid'], "vfirstname" =>$clientdetail[0]['vfirstname'], "vmiddlename" =>$clientdetail[0]['vmiddlename'], "vlastname" =>$clientdetail[0]['vlastname'], "vgender" =>$clientdetail[0]['vgender'], "vaddress1" =>$clientdetail[0]['vaddress1'], "vaddress2" =>$clientdetail[0]['vaddress2'], "vcity" =>$clientdetail[0]['vcity'], "countrycombo" =>displaycountry($clientdetail[0]['vcountry']), "statecombo" =>displaystate($clientdetail[0]['vstate']), "statecombo" =>displaystate($clientdetail[0]['vstate']), "vphone" =>$clientdetail[0]['vphone'], "vphone_dt" =>$clientdetail[0]['vphone_dt'], "vfax" =>$clientdetail[0]['vfax'], "izip" =>$clientdetail[0]['izip'], "vip" =>$clientdetail[0]['vip'], "vemail" => $clientdetail[0]['vemail'], "vabtus" => $clientdetail[0]['vabtus'], "action" =>$action, ); }else{ header("location: index.php?file=m-login"); exit; } }else{ if(empty($vcountry)) { $countrycombo = displaycountry("US"); }else{ $countrycombo = displaycountry($vcountry); } if (empty($vstate)){ $statecombo=displaystate(); }else{ $statecombo=displaystate($vstate); } $localvars = array( "countrycombo"=>$countrycombo, "statecombo"=>$statecombo, "action"=>$action, "err_msg"=>$err_msg, ); } $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); //} ?>vfirstname=$vfirstname; $oMember->vmiddlename=$vmiddlename; $oMember->vlastname=$vlastname; $oMember->vgender=$vgender; $oMember->vaddress1=$vaddress1; $oMember->vaddress2=$vaddress2; $oMember->vcity=$vcity; $oMember->vcountry=$vcountry; $oMember->vabtus=$vabtus; if($votherstate !== "") { $oMember->vstate=$vstate; } else { $oMember->vstate=$vstate; } $oMember->izip=$izip; $oMember->vphone=$vphone; $oMember->vphone_dt=$vphone_dt; $oMember->vfax=$vfax; $oMember->vemail=$vemail; $oMember->estatus="Active"; $record = $oMember->UpdateClient($iclientid); $clientaddressid=$oMember->GetClientAddressBookDetailFromCid($iclientid,'Self'); $oMember->vaddresstitle="Self"; $oMember->iclientid=$iclientid; $oMember->vfirstname=$vfirstname; $oMember->vmiddlename=$vmiddlename; $oMember->vlastname=$vlastname; $oMember->vaddress1=$vaddress1; $oMember->vaddress2=$vaddress2; $oMember->vcity=$vcity; $oMember->vstate=$vstate; $oMember->vcountry=$vcountry; $oMember->izip=$izip; $oMember->vphone=$vphone; $oMember->vphone_dt=$vphone_dt; $oMember->vemail=$vemail; $oMember->edefaultbilling=$edefaultbilling; $oMember->edefaultshipping=$edefaultshipping; $oMember->vremark=$vremark; $oMember->estatus=$estatus; $oMember->UpdateClientAddressBook($clientaddressid[0]['iclientaddbookid']); if($record) { $message = "Profile Updated Successfully"; header("location: index.php?file=m-myaccount&msg=$message"); exit; } else { $message = "Sorry Profile Not Updated."; header("location: index.php?file=m-myaccount&msg=$message"); exit; } } else{ $rsEmailChk=$oMember->CheckClientEmail($vemail); if ($rsEmailChk == 0){ $oMember->vfirstname=$vfirstname; $oMember->vmiddlename=$vmiddlename; $oMember->vlastname=$vlastname; $oMember->vgender=$vgender; $oMember->vaddress1=$vaddress1; $oMember->vaddress2=$vaddress2; $oMember->vphone=$vphone; $oMember->vphone_dt=$vphone_dt; $oMember->vemail=$vemail; $oMember->vfax=$vfax; $oMember->vcity=$vcity; $oMember->vstate=$vstate; $oMember->vcountry=$vcountry; $oMember->izip=$izip; //$oMember->vip=$vip; $oMember->vip=GetHostByName($REMOTE_ADDR); $oMember->vpassword=$vpassword; $oMember->vabtus=$vabtus; $oMember->estatus="Active"; /* $oMember->vtype; $oMember->ilevelid; $oMember->eusertype; $oMember->vremark; */ $oMember->AddClient(); $sessMemberID = mysql_insert_id(); $sessFirstname = $vfirstname; $sessLastname = $vlastname; session_register('sessMemberID'); session_register('sessFirstname'); session_register('sessLastname'); $oMember->vaddresstitle="Self"; $oMember->iclientid=$sessMemberID ; $oMember->AddClientAddressBook(); //Email_After_Signup(); $vfromemail = $custserviceemail; $vfromemailsql=$db->DirectSelect("select setting from settings where varname='adminemail'"); $vfromemail=$vfromemailsql[0]['setting']; $headers = "To: $vemail <$vemail>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"; $msql = "Select * from mails where imailid='4' "; //echo $msql."
"; $mres = $db->DirectSelect($msql); $subject = str_replace("{SITE_NAME}",'powerofperfume',stripslashes($mres[0]["vmailsubject"])); $message_contents = stripslashes($mres[0]["vmailtext"]); //echo $message_contents; //$tpl->load_file('sendmail1','./templates/email/email.html'); // $sendmessage = $tpl->pget('sendmail1', array('message_contents', 'vFirstName', 'vEmail', 'password','SITE_NAME','salesemail','custserviceemail','Site_URL','TOLL_FREE')); $sendmessage=str_replace("{vFirstName}",$vfirstname,stripslashes($message_contents)); $sendmessage = str_replace("{SITE_NAME}",'powerofperfume',stripslashes($sendmessage)); $sendmessage=str_replace("{vEmail}",$vemail,stripslashes($sendmessage)); $sendmessage=str_replace("{password}",$vpassword,stripslashes($sendmessage)); //echo "Message : ".$sendmessage; //exit; //echo "

Email==".$vemail; //exit; $onesendstat = mail($vemail, $subject, $sendmessage, $headers); if($onesendstat) { echo "
mail sent"; } else { echo "
mail not sent"; } if($action=="checkout"){ header("location: index.php?file=s-checkout"); exit; }else{ header("location: index.php?file=m-myaccount"); exit; } }else{ $message = "Email exist"; header("location: index.php?file=m-signup&err_msg=$message"); exit; } } ?>GetWishCategoriesFromMemberId($sessMemberID); if ($wishcategory) { for($i=0;$iGetNumberOfWishes($wishcategory[$i]["iwishcategoryid"],$sessMemberID); /*$wishcount[] = array( "wishno" => $wishno, );*/ } /*$localvars = array( "wishcategory" => $wishcategory, "wishcount" => $wishcount, );*/ } else { $err_msg="No wishes found."; } $localvars = array( "wishcategory" => $wishcategory, "wishno" => $wishno, ); } else { header("location: index.php?file=m-login"); exit; } $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>DeleteWishLists($chk); if (!$res) { $msg = "Wishlist successfully deleted."; header("location: index.php?file=m-wishcategories&msg=$msg"); exit; } else { $msg = "Sorry Wishlist not deleted."; header("location: index.php?file=m-wishcategories&msg=$msg"); exit; } } ?>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;$gc\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"; $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); ?> DirectSelect($db_sql); if($result){ $ishistory = 1; $nohistory = 0; for($i=0;$iDirectSelect($track_sql); $trackno=$track_result[0]["track"]; if($trackno != 0 && $trackno != 'Null'){ $trackno=" Track Order "; } else{ $trackno="-"; } if($viewUSD): $showCurrency = $DEFAULT_CURRENCY_SETTINGS; else: $showCurrency = array( "symbol"=>$result[$i]["vcurrencysymbol"], "rate" => $result[$i]["fcurrencyrate"]); endif; $table_orderlist[] = array( 'orderid' => $result[$i]["iorderid"], 'orderno' => $result[$i]["iorderno"], 'orderdate' => substr($result[$i]["dorderdate"],0,10), 'subtotal' => $result[$i]["fsubtotal"], 'shipping' => $result[$i]["fshipping"], 'discount' => $result[$i]["fdiscount"]+$result[$i]["fcouponamount"], 'totalamount' => $result[$i]["ftotalamount"], 'status' => $result[$i]["estatus"], 'transactiontype' => $result[$i]["etransactiontype"], 'tracking' => $trackno, ); } } else { $ishistory = 0; $nohistory = 1; //$err_msg=$order_err_msg; $err_msg="No Order History Found"; } }else { if(isset($redirectto) && !empty($redirectto)) { $msg = $login_msg; header("location:".$Site_URL."index.php?file=$redirectto&err_msg=$msg"); exit; }else { header("location:".$Site_URL."index.php?file=m-login"); $msg=$login_msg; } } /* include_once("scripts/leftnav.php"); include_once("scripts/summary.php");*/ $toggle_currency_view_link = $viewUSD?"View as purchased":"View all in US$"; $localvars = array( "table_cart"=>$table_cart, "redirectfrm"=>$totalcart, "class_detail"=>$pricerange, "msg"=>$class_detail, "toggle_currency_view_link"=>$awaylink, 'icatid'=>$awaydisp, 'awaymsg'=>$awaymsg, 'nohistory'=>$nohistory, 'err_msg'=>$cart_msg, 'table_orderlist'=>$table_orderlist, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>DirectSelect($db_sql); $billaddsql = "select * from orderaddress,ordermast where ordermast.iorderaddressid=orderaddress.iorderaddressid and ordermast.iorderid='$id' "; $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"] ); $db_sql_order="select iorderno, fdiscount, fcouponamount, ftotalamount, fshipping, fsubtotal, ftax from ordermast where iorderid='$id'"; $orderresult=$db->DirectSelect($db_sql_order); $orderno=$orderresult[0]["iorderno"]; $ordertotal= ($orderresult[0]["ftotalamount"]); $totaldiscount = ($orderresult[0]["fdiscount"] + $orderresult[0]["fcouponamount"]); $shipping= ($orderresult[0]["fshipping"]); $subtotal= ($orderresult[0]["fsubtotal"]); $couponamount = ($orderresult[0]["fcouponamount"]); $tax = ($orderresult[0]["ftax"]); /* $ordertotal= Make_Price($orderresult[0]["ftotalamount"], $showCurrency); $totaldiscount = Make_Price($orderresult[0]["fdiscount"] + $orderresult[0]["fcouponamount"], $showCurrency); $shipping= Make_Price($orderresult[0]["fshipping"], $showCurrency); $subtotal= Make_Price($orderresult[0]["fsubtotal"], $showCurrency); $couponamount = Make_Price($orderresult[0]["fcouponamount"], $showCurrency); $tax = Make_Price($orderresult[0]["ftax"], $showCurrency); */ $err_msg = "Your Order Number : ".$orderno.""; if($result){ $grandtotal=0; for($i=0;$iDirectSelect($pimgsql); // $product_th_image = $thumb_image_path.$pimgres[0]["vthumbimage"]; if(file_exists($product_th_image)) $image = $thumb_image_url.$pimgres[0]["vthumbimage"]; else{ $image = $default_pro_thumb; $prod_th_image = ".$prod_img_text."; } $prodstatus = $result[$i]["vremark"]; if($prodstatus == 'Delivered' || $prodstatus == 'Shipped'){ $trackingno=trim($result[$i]["vflag"]); if($result[$i]["shipmethods"]=="Airborne"){ $linkurl = "$trackingno "; } else { $linkurl = " $trackingno "; } // hrer i have remove link temporary on 30 june // $linkurl = $trackingno; if($trackingno != '0'){ $trackingno=$linkurl; }else{ $trackingno="-"; } }else{ $trackingno="-"; } $sksql = "select vSKU from products where iproductid='$id' "; $skres = $db->DirectSelect($sksql); $amount_total_order = "select ftotalamount from ordermast where iorderid='$orderid'"; $total_price_order = $db->DirectSelect($amount_total_order); //echo $total_price_order[0]["ftotalamount"]; exit; $table_orderdetail[] = array( 'vSKU' => $skres[0]["vSKU"], 'details' => $result[$i]["vshortdesc"], 'productname' => "".$result[$i]["name"]."", 'qty' => $result[$i]["qty"], // 'totprice' => Make_Price($result[$i]["fprice"], $showCurrency), // 'price' => Make_Price($result[$i]["fprice"]), //changed by vivek 'price' => $result[$i]["fprice"], 'name' => $result[$i]["vname"], 'vthumbimage' => $image,//$thumb_image_url.$pimgres[0]["vthumbimage"], 'ShipAddress' => $result[$i]["vaddress1"].", ".$result[$i]["vaddress2"]."
".$result[$i]["vcity"]."
".$result[$i]["vstate"]."
".$result[$i]["izip"]."
".$result[$i]["vcountry"], // 'total' => Make_Price($result[$i]["qty"] * $result[$i]["fprice"], $showCurrency), 'total' => $result[$i]["qty"] * $result[$i]["fprice"], 'trackno' => $trackingno, 'status' => $result[$i]["vremark"], 'address1' => $result[$i]["vaddress1"], 'address2' => $result[$i]["vaddress2"], 'city' => $result[$i]["vcity"], 'state' => $result[$i]["vstate"], 'country' => $result[$i]["vcountry"], 'zip' => $result[$i]["izip"], ); $grandtotal=$total_price_order[0]["ftotalamount"]; } $grandtotal=$grandtotal; } else{ header("Location:index.php?file=m-myaccount"); exit; } $localvars = array( "redirectto"=>$redirectto, "redirectfrm"=>$redirectfrm, "class_detail"=>$class_detail, "msg"=>$msg, "err_msg"=>$err_msg, "grandtotal"=>$grandtotal, 'totaldiscount'=>$totaldiscount, 'ordertotal'=>$ordertotal, 'shipping'=>$shipping, 'subtotal'=>$subtotal, "couponamount"=>$couponamount, 'tax'=>$tax, 'icatid'=>$icatid, 'Site_URL'=>$Site_URL, 'table_orderdetail'=>$table_orderdetail, "grandtotal"=>$grandtotal ); /* echo "
";
print_r($localvars);
echo "
"; */ $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index_new.htm"; include_once("include/footer.inc.php"); ?>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.
"; /*nishant code on 02112006 start*/ $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; } echo $giftbox_price_final = $itemres[$tc]["egiftbox"]; if($giftbox_price_final=='Yes') { $giftwrap_changes_recipt = 1; $giftwrap_changes_recipt_price =$GIFT_WRAP_CHARGE + $giftwrap_changes_recipt_price; } $prosql = "select 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"]; 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_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"]), ); } $receipt =1; $cheque_address = $CHEQUE_ADDRESS; $giftwrap_changes_recipt_price = "$ ".$giftwrap_changes_recipt_price; $ordersql = "select * from ordermast where iorderid ='$iorderid' "; $orderres = $db->DirectSelect($ordersql); $OrderSubTotal = "$ ".$orderres[0]["fsubtotal"]; $totaldiscount = "$ ".number_format($orderres[0]["fdiscount"],2,'.',',') + number_format($orderres[0]["fcouponamount"],2,'.',','); $GC_Charge = "$ ".number_format($orderres[0]["fgcamount"],2,'.',','); $Tax = "$ ".$orderres[0]["ftax"]; $ShippingCharge = "$ ".$orderres[0]["fshipping"]; $ordertotal = "$ ".$orderres[0]["ftotalamount"]; /* $sendmessage="
"; }; $sendmessage.="
 
This order No.: ".Get_Order_Number($iorderid)." is Declined
"; $sendmessage.="
"; for($i=0;$i
".$table_billadd11[$i]['vaddress1'].", ".$table_billadd11[$i]['vaddress2']."
".$table_billadd11[$i]['vcity']."
".$table_billadd11[$i]['vstate']." - ".$table_billadd11[$i]['izip']."
".$table_billadd11[$i]['vcountry'].""; } $sendmessage.="
"; for($i=0;$i
Item Item Desc Quantity Cost Shipping Address
".$table_cart11[$i]['vProductName']."
".$table_cart11[$i]['vtype2']."
".$table_cart11[$i]['qty']." ".$table_cart11[$i]['totprice']."    ".$table_cart11[$i]['AddressName']."
".$table_cart11[$i]['ShipAddress']."
         
Sincerely,
 
Internet Sales Division
".SITE_NAME.", Inc.
"; */ /*nishant new code for email start on 27112006*/ $sendmessage="

Your Order No.: ".Get_Order_Number($iorderid)." is Declined
 
"; for($i=0;$i< count($table_billadd11);$i++){ $sendmessage.=" "; } $sendmessage.="
Billing Address
".$table_billadd11[$i]['vName']."
".$table_billadd11[$i]['vaddress1'].", ".$table_billadd11[$i]['vaddress2']."
".$table_billadd11[$i]['vcity']."
".$table_billadd11[$i]['vstate']." - ".$table_billadd11[$i]['izip']."
".$table_billadd11[$i]['vcountry']."
"; for($i=0;$i< count($table_cart11);$i++){ $sendmessage.=" "; }; $sendmessage.="
Item Item Desc Quantity Cost Shipping Address
".$table_cart11[$i]['vProductName']."
".$table_cart11[$i]['vtype2']."
".$table_cart11[$i]['qty']." ".$table_cart11[$i]['totprice']."    ".$table_cart11[$i]['AddressName']."
".$table_cart11[$i]['ShipAddress']."
Order Sub Total :
Discount :
GiftCertificate Discount :
Gift Wrap Charges :
Shipping Charge :
Sales Tax :
Total :
{$OrderSubTotal}
$ {$totaldiscount}
 {$GC_Charge}
 {$giftwrap_changes_recipt_price}
{$ShippingCharge}
{$Tax}

{$ordertotal}
 
 

Thank you for shopping PowerofPerfume.com. We know you had choices, and we are glad you choose us. Please save this email for future reference or questions about your order.

Your order will ship directly from Power of Perfume.

Should you have any questions about your order, please contact us at info@PowerofPerfume.com.
 
Sincerely,
 
Internet Sales Division
".SITE_NAME.", Inc.
"; /*nishant new code for email end27112006*/ /*nishant code on 02112006 end*/ $vtoemail = generalsetting("adminemail",2); $vfromemail ="info@powerofperfume.com";// 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."; $onesendstat = @mail($vtoemail, $subject, $sendmessage, $headers); $SecureSite_URL ="https://www.powerofperfume.com/"; header("location:".$SecureSite_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."; $SecureSite_URL ="https://www.powerofperfume.com/"; header("location:".$SecureSite_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; } $giftbox_price_final = $itemres[$tc]["egiftbox"]; if($giftbox_price_final=='Yes') { $giftwrap_changes_recipt = 1; $giftwrap_changes_recipt_price += $GIFT_WRAP_CHARGE; } $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"]; if ($itemres[$tc]["is_bulk"]=='1'){ $secprores = $oProduct->GetProductDeatilByID($itemres[$tc]['biproductid1']);//$db->DirectSelect($prosql); $thrdprores = $oProduct->GetProductDeatilByID($itemres[$tc]['biproductid2']);//$db->DirectSelect($prosql); $bulk_price=$itemres[$tc]['bulkprice']; $is_bulk=$itemres[$tc]['is_bulk']; } // $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"]), 'bulk_price'=>$bulk_price, 'is_bulk'=>$is_bulk, 'secvtype'=>$secprores[0]["vtype"], 'secproductname'=> $secprores[0]['vproductname'], 'thrdvtype'=>$thrdprores[0]["vtype"], 'thrdproductname'=> $thrdprores[0]['vproductname'], 'couponproduct'=>$shoppingItem->couponproduct, ); //$update_product_qty=$db->DirectUpdate("UPDATE `products` SET fcurrentstock = fcurrentstock-1 WHERE `iproductid` = '$iproductid' "); } $receipt = 1; include_once("orderreceiptemails.php"); } else { echo"no";echo"
";echo $iorderid;exit; $err_msg = rawurlencode("Sorry, Your Payment Is Declined.
".$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.
"; /*nishant code on 02112006 start*/ /*nishant code on 02112006 end*/ $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."; //$onesendstat = @mail($vtoemail, $subject, $sendmessage, $headers); $SecureSite_URL ="https://www.powerofperfume.com/"; header("location:".$SecureSite_URL."index.php?file=s-checkout&err_msg=$err_msg"); exit; } } else { $err_msg = rawurlencode("Sorry, Your Payment Is Declined.
".$RESPMSG); $receipt = 0; $SecureSite_URL ="https://www.powerofperfume.com/"; header("location:".$SecureSite_URL."index.php?file=s-checkout&err_msg=$err_msg"); exit; } $icatid = $catid; 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, 'ord_inv_no'=>$ord_inv_no ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index_new.htm"; include_once("include/footer.inc.php"); ?> 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"]; $iorderid= $orderres[0]["iorderid"]; $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 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"]; 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_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"]), ); } $receipt =1; $cheque_address = $CHEQUE_ADDRESS; $giftwrap_changes_recipt_price = "$ ".$giftwrap_changes_recipt_price; /*order receipt message to client changed on 04112006 start*/ $sendmessage="

Your Order No.: ".Get_Order_Number($iorderid)."
 
"; for($i=0;$i< count($table_billadd11);$i++){ $sendmessage.=" "; } $sendmessage.="
Billing Address
".$table_billadd11[$i]['vName']."
".$table_billadd11[$i]['vaddress1'].", ".$table_billadd11[$i]['vaddress2']."
".$table_billadd11[$i]['vcity']."
".$table_billadd11[$i]['vstate']." - ".$table_billadd11[$i]['izip']."
".$table_billadd11[$i]['vcountry']."
"; for($i=0;$i< count($table_cart11);$i++){ $sendmessage.=" "; }; $sendmessage.="
Item Item Desc Quantity Cost Shipping Address
".$table_cart11[$i]['vProductName']."
".$table_cart11[$i]['vtype2']."
".$table_cart11[$i]['qty']." ".$table_cart11[$i]['totprice']."    ".$table_cart11[$i]['AddressName']."
".$table_cart11[$i]['ShipAddress']."
Order Sub Total :
Discount :
GiftCertificate Discount :
Gift Wrap Charges :
Shipping Charge :
Sales Tax :
Total :
{$OrderSubTotal}
$ {$totaldiscount}
 {$GC_Charge}
 {$giftwrap_changes_recipt_price}
{$ShippingCharge}
{$Tax}

{$ordertotal}
 
 

Thank you for shopping PowerofPerfume.com. We know you had choices, and we are glad you choose us. Please save this email for future reference or questions about your order.

Your order will ship directly from Power of Perfume.

Should you have any questions about your order, please contact us at info@PowerofPerfume.com.
 
Sincerely,
 
Internet Sales Division
".SITE_NAME.", Inc.
"; /*order receipt message to client cnaged on 04112006 end*/ /*$tpl->load_file('orderreceipt','./templates/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')); */ $sSQL="select * from client where iclientid=".$iclientid; if($iclientid > 0): $clientres = $db->DirectSelect($sSQL); $vtoemail=$clientres[0]['vemail']; else: $vtoemail = $billaddres[0]["vemail"]; endif; $vfromemailsql=$db->DirectSelect("select setting from settings where varname='adminemail'"); $vfromemail=$vfromemailsql[0]['setting']; $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 = $vfromemail; $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); $onesendstat = @mail($vfromemail, $subject, $sendmessage, $headers); ?> "; if(PAYMENT_MODE=='Yes') { $testrequest = "TRUE"; } else { $testrequest = "FALSE"; } if($HTTP_HOST=='192.168.0.5') { $return = "1,1,1,This transaction has been approved.,000000,P,0,68,,80.00,CC,auth_capture,,,,,#48 New Street,Chicago,AL,16006,US,,,,,,,,,,,,,,,,,F4E5CEE37BBDFAB46D0447A19EA7158B,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,61.11.3.44"; } else { /* script begins from here */ $url[1] = "https://secure.authorize.net/gateway/transact.dll"; $data = "x_ADC_URL=FALSE"; $data .= "&x_test_request=FALSE"; $data .= "&x_ADC_Delim_Data=TRUE"; $data .= "&x_Version=3.1"; $data .= "&x_delim_data=TRUE"; $data .= "&x_delim_char=,"; $data .= "&x_login=96C4X6gWsWqg "; // RISONAPOWER1 //$data .= "&x_password=1POWERrisona"; // Tulsigiri2703 $data .= "&x_tran_key=4gCh8Re727Y9F8q4"; $data .= "&x_amount=".$x_amount; $data .= "&x_method=CC"; $data .= "&x_invoice_num=".rawurlencode($ordernumber); // $data .= "&x_description=".rawurlencode($cInvoiceDesc); $data .= "&x_first_name=".rawurlencode(strtoupper($billaddres["vfirstname"])); $data .= "&x_last_name=".rawurlencode(strtoupper($billaddres["vlastname"])); //Add Extra // $data .= "&x_company=".rawurlencode($cCustomerCompanyName); $data .= "&x_address=".rawurlencode(strtoupper($billaddres["vaddress1"])); $data .= "&x_city=".rawurlencode(strtoupper($billaddres["vcity"])); $data .= "&x_zip=".rawurlencode($billaddres["izip"]); $data .= "&x_state=".rawurlencode(strtoupper($billaddres["vstate"])); $data .= "&x_country=".rawurlencode(strtoupper($billaddres["vcountry"])); //$data .= "&x_phone=".rawurlencode($cCustomerPhone); $data .= "&x_phone=".rawurlencode($vphone); $data .= "&x_fax=".rawurlencode($cCustomerFax); //$data .= "&x_email=".rawurlencode($cCustomerEmail); $data .= "&x_email=".rawurlencode($vemail); $merchantemail = $adminemail; $data .= "&x_merchant_email=".rawurlencode($merchantemail); $data .= "&x_email_customer=FALSE"; $data .= "&x_currency_code=USD"; $data .= "&x_type=AUTH_CAPTURE"; // AUTH_CAPTURE, CREDIT, CAPTURE_ONLY, AUTH_ONLY $data .= "&x_card_num=".trim($CCNumber); $data .= "&x_card_code=".rawurlencode($CSC); // $data .= "&x_exp_date=".rawurlencode($cExpiryMonth."-".$cExpiryYear); $data .= "&x_exp_date=".rawurlencode($CCExp); // $data .= "&x_bank_aba_code=".rawurlencode($cTrackingNo); // $data .= "&x_bank_acct_num=".rawurlencode($cBankAccountNo); // $data .= "&x_bank_acct_name=".rawurlencode($cCreditCardName); // $data .= "&x_bank_name=".rawurlencode($cBankName); // $data .= "&x_bank_acct_type=".rawurlencode($cBankAcctType); if ($REMOTE_ADDR != "") { $user_ip = $REMOTE_ADDR; } else { $user_ip = $REMOTE_HOST; } $data .= "&IP=".$user_ip; $curlok = curl_test(); if ($curlok==1) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url[1]); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec ($ch); curl_close ($ch); } elseif ($curlok==2) { $curl = setup("curl"); $return = `$curl -d "$data" $url[1]`; } else { $var_msg = "Curl not installed on this machine, safe mode is on, or your curl path is wrong!"; echo $var_msg; exit; } } $ordersql = $db->DirectUpdate("UPDATE `ordermast` SET PREFPSMSG='$return' WHERE iorderid='$iorderid' "); $return = explode(",",$return); if ($return[0] == 1) { $response = "1"; } elseif ($return[0] == 2) { $var_msg = $return[3]; $response = "2"; } elseif ($return[0] == 3) { $var_msg = $return[3]; $response = "3"; } else { $var_msg = "Unable to authenticate.Please contact your system administrator."; $response = "4"; } /* echo "
hi : ".$return[3]; echo "
vemail : ".$vemail; exit; */ if (isset($response) && !empty($response)) { $ordernumber = $return[7]; $card_code_response = $return[38]; $avs_response = $return[5]; $ord_cvv = $return[5]; $ord_x_avs_code = $return[39]; $response_subcode = $return[1]; $response_reason_code = $return[2]; $response_reason_text = $return[3]; if ($response==1) { $status = "Approved"; $cTranId = $return[6]; //transaction id returned by the payment gateway. /* $card_code_response = ""; if ($card_code_response<>"M") { $status = "Declined"; $RESPMSG = "Your Card Code did not match with credit card. Please place the order again."; } */ } else { $status = "Declined"; } } ?>
DirectSelect($db_sql1); ?>
"> "> "> "> "> "> "> ">
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); ?>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($org_total); 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; /*code by nishant for product giveing free*/ /*start*/ if($sess_orderinfo[2]=='1'){ $chkprod=$db->DirectSelect("select vsku, eorder from coupon where icouponid= '".$sess_orderinfo[3]."'"); if ($chkprod[0]['eorder']=='sku'){ $iproductid=$db->DirectSelect("select iproductid from products where vSKU='".$chkprod[0]['vsku']."'"); //echo "
here for flg->".$coupflg; //echo "here for test"; if (!session_is_registered("coupflg")){ $coupflg=1; $shoppingCart->addItem_free_coupon($iproductid[0]['iproductid'], 1,$categoryid,1); session_register("coupflg"); } $coupondiscount = 0; }else{ $coupondiscount = Count_Coupon_Discount(); } } else $coupondiscount = 0; /*end*/ $totalcart = $shoppingCart->totalCount(); //echo "here testing cart total is =>".$totalcart; /*nishant's code end*/ 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; if($$shippingmode_sh==""){ $err_msg = "Please Select The Shipping Mode, Shipping Mode Was Not Selected"; header("location:".$Site_URL."index.php?file=s-checkout&err_msg=$err_msg"); exit; } $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 = $db->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, 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 = ""; $tri = 1; } else { $tr = ""; $tri++; } $table_multishadd[] = array( 'MultiAddressTitle' => $oAddressBook-> Get_Address_Title($shoppingItem->shippingAddressId), 'multi_shipping_name' => $oAddressBook->Get_Address_Name($shoppingItem->shippingAddressId), 'multi_shipping_address'=> $oAddressBook->Get_Address($shoppingItem->shippingAddressId), 'tr' => $tr, ); if($shoppingItem->shippingAddressId!= '-1') { $sess_shippingarr[$temparr] = $shoppingItem->shippingAddressId; $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $shch=$db->DirectSelect("select icategoryid from productcat where iproductid='$iproductid' and icategoryid ='2'"); if ($shch[0]['icategoryid']=='2'){ $sess_shippingarr_totalid[$uniq_modeid] = (2 * $shoppingItem->quantity); } else{ $sess_shippingarr_totalid[$uniq_modeid] = (1 * $shoppingItem->quantity); } $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; //original $sess_shippingarr_totalid[$uniq_modeid] = (1 * $shoppingItem->quantity); $temparr++; } } else { if($shoppingItem->shippingAddressId!= '-1') { $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $shch=$db->DirectSelect("select icategoryid from productcat where iproductid='$iproductid' and icategoryid ='2'"); if ($shch[0]['icategoryid']=='2'){ $sess_shippingarr_totalid[$uniq_modeid] += (2 * $shoppingItem->quantity); } else{ $sess_shippingarr_totalid[$uniq_modeid] += (1 * $shoppingItem->quantity); } $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; //original $sess_shippingarr_totalid[$uniq_modeid] += (1 * $shoppingItem->quantity); } } // end if($oldflag==0) } // end if($sess_orderinfo[1] == '1') $product_th_image = $thumb_image_path.$pimgres[0]["vthumbimage"]; if(file_exists($product_th_image)) $image = $thumb_image_url.$pimgres[0]["vthumbimage"]; else $image = $default_pro_thumb; $cartitem_free = array(); $freeItemsText = ""; if($shoppingItem->hasFreeItems()){ $buyGetFreeOffer = $shoppingItem->freeOffer(); $freeItemsCount = $shoppingItem->freeItemsCount(); $freeItemsText = $shoppingItem->canPickFreeItems()?"
Pick free items":""; $preferredItems = $shoppingItem->preferredFreeItems(); $isFirst = true; foreach($preferredItems as $prefItem=>$prefQuantity){ $query = "SELECT * FROM products WHERE iproductid='$prefItem'"; $res = $db->DirectSelect($query); $removeFreeItemText = $shoppingItem->canPickFreeItems()?"Remove":""; $cartitem_free[] = array( 'freeItem_vSKU' => $res[0]["vSKU"], 'freeItem_iproductid' => $res[0]["iproductid"], 'freeItem_vProductName' => $res[0]["vproductname"], 'freeItem_vshortdesc' => $prores[0]["vshortdesc"], 'freeItem_vproductdetail' => substr(stripslashes($prores[0]["vproductdetail"]),0,200)."...", 'freeItem_qty' => $prefQuantity, 'freeItem_remove' => $removeFreeItemText ); } // end foreach } // end if if(isset($shoppingItem->is_gift_wrap) and !empty($shoppingItem->is_gift_wrap)) $is_gift_wrap = 'YES'; else $is_gift_wrap = 'NO'; if(isset($shoppingItem->is_gift_box) and !empty($shoppingItem->is_gift_box)) $is_gift_box = 'YES'; else $is_gift_box = 'NO'; $qty_new[$tc] = $shoppingItem->quantity; $table_cart[] = array( 'loop' => $tc, 'vSKU' => $prores[0]["vSKU"], 'vtype' => $prores[0]["vtype"], 'iproductid' => $iproductid, 'vthumbimage' => $image, 'vProductName' => $prores[0]["vproductname"].$category_check, 'vshortdesc' => $prores[0]["vshortdesc"], 'vproductdetail'=> substr(stripslashes($prores[0]["vproductdetail"]),0,200)."...", 'qty' => $shoppingItem->quantity, 'qtytext' => "qty_".$tc, 'mrprice' => "$ ".$shoppingItem->unitPrice(),//Make_Price($shoppingItem->unitPrice()),//,2,'.',','), 'totprice' => "$ ".number_format($totprice,2,'.',','),//Make_Price($totprice),//number_format($totprice,2,'.',','), 'discount' => "$ ".$discount,//Make_Price($discount),//number_format($discount,2,'.',','), 'pricewithdisc' => "$ ".$pricewithdisc,//Make_Price($pricewithdisc), //number_format($pricewithdisc,2,'.',','), 'viewdiscount' => $viewdiscount, 'AddressTitle' => $AddressTitle, 'pick_free_items' => $freeItemsText, 'is_gift_wrap' => $is_gift_wrap, 'is_gift_box' => $is_gift_box, 'couponproduct'=>$shoppingItem->couponproduct, 'cartitem_free'=>$cartitem_free, ); if ($prores[0]["vSKU"]!=$GIFT_CERT_SKUS[0]) $temp_total_new += $pricewithdisc; //by vivek if($shoppingItem->isShippedPhysically()): // if(! $addressid = $oAddressBook->Get_Address_ID($shoppingItem->shippingAddressId)): // if(! $addressid = $oAddressBook->Get_Address_ID("billing")): // header("Location: index.php?file=s-checkout&err_msg=".urlencode($m_MissingShippingAddress)).""; //exit; //endif; if (!key_exists($addressid,$cartitems_by_addresses)) { //create new line in array for this address $cartitems_by_addresses[$addressid] = array (); } //add item to array $cartitems_by_addresses[$addressid][] = $totprice; endif; $pricewithdisc = 0; $totprice = 0; $discount = 0; if(isset($shoppingItem->is_gift_wrap) and $shoppingItem->is_gift_wrap=='1') { $packing_title="
Gift Warp Charge:"; $packingcharge = number_format(($packingcharge + $GIFT_WRAP_CHARGE),2,'.',''); $packing_value = 1; } if(isset($shoppingItem->is_gift_box) and $shoppingItem->is_gift_box=='1') { $packing_title.=" + Gift Box Charge:"; $packingcharge = number_format(($packingcharge + $GIFT_WRAP_CHARGE),2,'.',''); $packing_value = 1; } } } $packingchargeval = $packingcharge; // $OrderSubTotal = number_format($SubTotal,2,'.',','); if($sess_orderinfo[2]=='1') { $coupondiscount = Count_Coupon_Discount_1(); } else $coupondiscount = 0; $temp_totaldiscount = $autodiscount + $coupondiscount; $temp_HandlingCharge = 0; // changed on 15-11-2003 $temp_total_new -= $temp_totaldiscount; // Changed the sub total after discount //echo "subtotoa". $SubTotal; //print_r( $sess_shoppingcart); for($tc=0;$tc<$totalcart;$tc++) { $temp_subtotal = $tmp_amountarr[$tc]; $temp_Tax = $temp_Tax + Count_MultiAddress_Tax($sess_shoppingcart[$tc][6]); } //$temp_Tax = $temp_Tax + Count_MultiAddress_Tax(0); //exit; ///////////// By Bhavika for shipping charge $temp_ShippingCharge = 0; //echo "
";
//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"); ?> 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 = ""; $tri = 1; } else { $tr = ""; $tri++; } $table_multishadd[] = array( 'MultiAddressTitle' => Get_Address_Title($shoppingItem->shippingAddressId), 'multi_shipping_name' => Get_Address_Name($shoppingItem->shippingAddressId), 'multi_shipping_address'=> Get_Address($shoppingItem->shippingAddressId), 'tr' => $tr, ); if($shoppingItem->shippingAddressId!= '-1') { // echo "
Ship1:".$shoppingItem->shippingAddressId; $sess_shippingarr[$temparr] = $shoppingItem->shippingAddressId; $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; $sess_shippingarr_totalid[$uniq_modeid] = (1 * $shoppingItem->quantity); $temparr++; } } else { if($shoppingItem->shippingAddressId!= '-1') { $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; $sess_shippingarr_totalid[$uniq_modeid] += (1 * $shoppingItem->quantity); } } // end if($oldflag==0) //echo $uniqaddid."
"; } // end if($sess_orderinfo[1] == '1') $product_th_image = $thumb_image_path.$pimgres[0]["vthumbimage"]; if(file_exists($product_th_image)) $image = $thumb_image_url.$pimgres[0]["vthumbimage"]; else $image = $default_pro_thumb; $cartitem_free[$tc] = array(); $freeItemsText = ""; if($shoppingItem->hasFreeItems()){ $buyGetFreeOffer = $shoppingItem->freeOffer(); $freeItemsCount = $shoppingItem->freeItemsCount(); $freeItemsText = $shoppingItem->canPickFreeItems()?"
Pick free items":""; $preferredItems = $shoppingItem->preferredFreeItems(); $isFirst = true; foreach($preferredItems as $prefItem=>$prefQuantity){ $query = "SELECT * FROM products WHERE iproductid='$prefItem'"; $res = $obj->select($query); $removeFreeItemText = $shoppingItem->canPickFreeItems()?"Remove":""; $cartitem_free[$tc][] = array( 'freeItem_vSKU' => $res[0]["vSKU"], 'freeItem_iproductid' => $res[0]["iproductid"], 'freeItem_vProductName' => $res[0]["vproductname"], 'freeItem_vshortdesc' => $prores[0]["vshortdesc"], 'freeItem_vproductdetail' =>Make_Small_Desc(stripslashes($prores[0]["vproductdetail"])), 'freeItem_qty' => $prefQuantity, 'freeItem_remove' => $removeFreeItemText ); } // end foreach } // end if if(isset($shoppingItem->is_gift_wrap) and !empty($shoppingItem->is_gift_wrap)) $is_gift_wrap = 'YES'; else $is_gift_wrap = 'NO'; $qty_new[$tc] = $shoppingItem->quantity; // echo $viewdiscount; $table_cart[] = array( 'loop' => $tc, 'vSKU' => $prores[0]["vSKU"], 'vtype' => $prores[0]["vtype"], 'iproductid' => $iproductid, 'vthumbimage' => $image, 'vProductName' => $prores[0]["vproductname"].$category_check, 'vshortdesc' => $prores[0]["vshortdesc"], 'vproductdetail'=> Make_Small_Desc(stripslashes($prores[0]["vproductdetail"])), 'qty' => $shoppingItem->quantity, 'qtytext' => "qty_".$tc, 'mrprice' => Make_Price($shoppingItem->unitPrice()),//,2,'.',','), 'totprice' => Make_Price($totprice),//number_format($totprice,2,'.',','), 'discount' => Make_Price($discount),//number_format($discount,2,'.',','), 'pricewithdisc' => Make_Price($pricewithdisc), //number_format($pricewithdisc,2,'.',','), 'viewdiscount' => $viewdiscount, 'AddressTitle' => $AddressTitle, 'pick_free_items' => $freeItemsText, 'is_gift_wrap' => $is_gift_wrap ); if ($prores[0]["vSKU"]!=$GIFT_CERT_SKUS[0]) $temp_total_new += $pricewithdisc; //by vivek if($shoppingItem->isShippedPhysically()): if(! $addressid = Get_Address_ID($shoppingItem->shippingAddressId)): Header("Location: index.php?file=checkout&err_msg=".urlencode($m_MissingShippingAddress)); exit; endif; if (!key_exists($addressid,$cartitems_by_addresses)) { //create new line in array for this address $cartitems_by_addresses[$addressid] = array (); } //add item to array $cartitems_by_addresses[$addressid][] = $totprice; endif; $pricewithdisc = 0; $totprice = 0; $discount = 0; if(isset($shoppingItem->is_gift_wrap) and $shoppingItem->is_gift_wrap=='1') { $packing_title="
Packing Charge:"; $packingcharge = number_format(($packingcharge + $GIFT_WRAP_CHARGE),2,'.',''); $packing_value = 1; } } // echo $tc."
"; } $packingchargeval = "$".$packingcharge; // $OrderSubTotal = number_format($SubTotal,2,'.',','); $autodiscount = Count_Auto_Discount(); if($sess_orderinfo[2]=='1') { $coupondiscount = Count_Coupon_Discount(); } else $coupondiscount = 0; $temp_totaldiscount = $autodiscount + $coupondiscount; $temp_HandlingCharge = 0; // changed on 15-11-2003 $temp_total_new -= $temp_totaldiscount; // Changed the sub total after discount for($tc=0;$tc<$totalcart;$tc++) { $temp_subtotal = $tmp_amountarr[$tc]; } //$temp_Tax = $temp_Tax + Count_MultiAddress_Tax(0); ///////////// By Bhavika for shipping charge $temp_ShippingCharge = 0; 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 = $obj->select($ship_id); $viewadd = clientShippingAddress($shoppingItem->shippingAddressId); $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=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=checkout&err_msg=$err_msg"); exit; } } if ($row_shipid[0]["iorderno"] == 1)//International Scheduled other then US Country { if($vcountry=="US"){ //echo "
Us Country"; $err_msg = rawurlencode($Shipping_Method_Not_Match); header("location:".$Site_URL."index.php?file=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]; $tmp_ship_charge = MultiAddress_ShippingCharge($shoppingItem->shippingAddressId,$shoppingItem->shippingmodeid); $temp_ShippingCharge = $temp_ShippingCharge + $tmp_ship_charge; //$temp_total_new = Count_Tax(); $shoppingCart->update_temp_ship_charge($tc, $tmp_ship_charge); } } ///////////// } $shoppingCart->store(); $temp_Tax = Count_Tax(); // By Bhavika For count Tax // First time Buyer Promotion Code Start Here $order_exist = "select * from ordermast where iclientid='".$iMemberid."'"; // echo $order_exist; // exit; $result_order = $obj->select($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"; // echo $sql_special; $special = $obj->select($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; } } } // $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 //echo $temp_totaldiscount; $totaldiscount = Make_Price($temp_totaldiscount); //number_format($temp_totaldiscount,2,'.',','); $ShippingCharge = Make_Price($temp_ShippingCharge); //number_format($temp_ShippingCharge,2,'.',','); $HandlingCharge = Make_Price($temp_HandlingCharge); //number_format($temp_HandlingCharge,2,'.',','); $Tax = Make_Price($temp_Tax); //number_format($temp_Tax,2,'.',','); $GiftCertificateValue = Make_Price($temp_giftcerttotal); $verisignamount = number_format($temp_ordertotal,2,'.',''); $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); //echo $paypal_checked."-".$verisign_checked."-".$cheque_checked; //echo $autodiscount; //exit; $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 = $obj->select($couponsql); if(count($couponres)>0) { $coupon_code = 1; } else { $coupon_code = 0; } // Are there any issued gift certificates available? $gift_certificate = (!$shoppingCart->containsGiftCertificates()) && (countValidGiftCertificates() > 0); /// Payment Option $payment_options = $obj->select("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 = $obj->select("select * from creditcard_options where estatus = 'Active' order by vcard_name"); for($c=0;$c $credit_options[$c]["vcard_name"], ); } ////////////// $middle = $middle_dir . "submitorder.html"; $top = $top_dir."top-home.html"; /* include_once("scripts/leftnav.php"); include_once("scripts/summary.php"); */ $localvars = array( 'cart_msg'=>$cart_msg, 'class_detail'=>$class_detail, 'err_msg'=>$err_msg, 'totalitems_in_cart'=>$totalitems_in_cart, 'totalcart'=>$totalcart, 'OrderSubTotal'=>$OrderSubTotal, 'tc'=>$tc, 'shmodecombo'=>$shmodecombo, 'single_shipping_name'=>$single_shipping_name, 'single_shipping_address'=>$single_shipping_address, 'AddressTdTitle'=>$AddressTdTitle, 'totaldiscount'=>$totaldiscount, 'ShippingCharge'=>$ShippingCharge, 'HandlingCharge'=>$HandlingCharge, 'Tax'=>$Tax, 'ordertotal'=>$ordertotal, '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, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); /*foreach($cartitem_free as $tc=>$cart_item){ $tplVarName = "cartitem_free_".$tc; $$tplVarName = $cart_item; $tpl->parse_loop('shoppingcart', $tplVarName); }*/ /*for($p=0;$pparse_if('shoppingcart', $tplVarName2); $tpl->parse_if('shoppingcart', $tplVarName3); }*/ ?> DirectSelect($sql); if ($result[0]['shipmenthods']=='UPS'){ $url="http://wwwapps.ups.com/etracking/tracking.cgi"; }elseif($result[0]['shipmenthods']=='USPS'){ $url="http://www.usps.com/shipping/trackandconfirm.htm?from=home&page=0035trackandconfirm"; }elseif($result[0]['shipmenthods']=='FedEx'){ $url="http://www.fedex.com/Tracking?cntry_code=us&link=4"; } // $db->printsql(); if($result){ for($i=0;$i 0) { ?>
>
SiteTitle; //echo "
";
//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"); */ ?>
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); ?>
"> ">
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); ?>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 = ""; $tri = 1; } else { $tr = ""; $tri++; } $table_multishadd[] = array( 'MultiAddressTitle' => $oAddressBook-> Get_Address_Title($shoppingItem->shippingAddressId), 'multi_shipping_name' => $oAddressBook->Get_Address_Name($shoppingItem->shippingAddressId), 'multi_shipping_address'=> $oAddressBook->Get_Address($shoppingItem->shippingAddressId), 'tr' => $tr, ); if($shoppingItem->shippingAddressId!= '-1') { $sess_shippingarr[$temparr] = $shoppingItem->shippingAddressId; $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; $sess_shippingarr_totalid[$uniq_modeid] = (1 * $shoppingItem->quantity); $temparr++; } } else { if($shoppingItem->shippingAddressId!= '-1') { $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; $sess_shippingarr_totalid[$uniq_modeid] += (1 * $shoppingItem->quantity); } } // end if($oldflag==0) } // end if($sess_orderinfo[1] == '1') $product_th_image = $thumb_image_path.$pimgres[0]["vthumbimage"]; if(file_exists($product_th_image)) $image = $thumb_image_url.$pimgres[0]["vthumbimage"]; else $image = $default_pro_thumb; $cartitem_free = array(); $freeItemsText = ""; if($shoppingItem->hasFreeItems()){ $buyGetFreeOffer = $shoppingItem->freeOffer(); $freeItemsCount = $shoppingItem->freeItemsCount(); $freeItemsText = $shoppingItem->canPickFreeItems()?"
Pick free items":""; $preferredItems = $shoppingItem->preferredFreeItems(); $isFirst = true; foreach($preferredItems as $prefItem=>$prefQuantity){ $query = "SELECT * FROM products WHERE iproductid='$prefItem'"; $res = $db->DirectSelect($query); $removeFreeItemText = $shoppingItem->canPickFreeItems()?"Remove":""; $cartitem_free[] = array( 'freeItem_vSKU' => $res[0]["vSKU"], 'freeItem_iproductid' => $res[0]["iproductid"], 'freeItem_vProductName' => $res[0]["vproductname"], 'freeItem_vshortdesc' => $prores[0]["vshortdesc"], 'freeItem_vproductdetail' => substr(stripslashes($prores[0]["vproductdetail"]),0,200)."...", 'freeItem_qty' => $prefQuantity, 'freeItem_remove' => $removeFreeItemText ); } // end foreach } // end if if(isset($shoppingItem->is_gift_wrap) and !empty($shoppingItem->is_gift_wrap)) $is_gift_wrap = 'YES'; else $is_gift_wrap = 'NO'; $qty_new[$tc] = $shoppingItem->quantity; $table_cart[] = array( 'loop' => $tc, 'vSKU' => $prores[0]["vSKU"], 'vtype' => $prores[0]["vtype"], 'iproductid' => $iproductid, 'vthumbimage' => $image, 'vProductName' => $prores[0]["vproductname"].$category_check, 'vshortdesc' => $prores[0]["vshortdesc"], 'vproductdetail'=> substr(stripslashes($prores[0]["vproductdetail"]),0,200)."...", 'qty' => $shoppingItem->quantity, 'qtytext' => "qty_".$tc, 'mrprice' => "$ ".$shoppingItem->unitPrice(),//Make_Price($shoppingItem->unitPrice()),//,2,'.',','), 'totprice' => "$ ".$totprice,//Make_Price($totprice),//number_format($totprice,2,'.',','), 'discount' => "$ ".$discount,//Make_Price($discount),//number_format($discount,2,'.',','), 'pricewithdisc' => "$ ".$pricewithdisc,//Make_Price($pricewithdisc), //number_format($pricewithdisc,2,'.',','), 'viewdiscount' => $viewdiscount, 'AddressTitle' => $AddressTitle, 'pick_free_items' => $freeItemsText, 'is_gift_wrap' => $is_gift_wrap, 'cartitem_free'=>$cartitem_free, ); if ($prores[0]["vSKU"]!=$GIFT_CERT_SKUS[0]) $temp_total_new += $pricewithdisc; //by vivek if($shoppingItem->isShippedPhysically()): // if(! $addressid = $oAddressBook->Get_Address_ID($shoppingItem->shippingAddressId)): // if(! $addressid = $oAddressBook->Get_Address_ID("billing")): // header("Location: index.php?file=s-checkout&err_msg=".urlencode($m_MissingShippingAddress)).""; //exit; //endif; if (!key_exists($addressid,$cartitems_by_addresses)) { //create new line in array for this address $cartitems_by_addresses[$addressid] = array (); } //add item to array $cartitems_by_addresses[$addressid][] = $totprice; endif; $pricewithdisc = 0; $totprice = 0; $discount = 0; if(isset($shoppingItem->is_gift_wrap) and $shoppingItem->is_gift_wrap=='1') { $packing_title="
Gift Warp Charge:"; $packingcharge = number_format(($packingcharge + $GIFT_WRAP_CHARGE),2,'.',''); $packing_value = 1; } } } $packingchargeval = $packingcharge; // $OrderSubTotal = number_format($SubTotal,2,'.',','); if($sess_orderinfo[2]=='1') { $coupondiscount = Count_Coupon_Discount(); } else $coupondiscount = 0; $temp_totaldiscount = $autodiscount + $coupondiscount; $temp_HandlingCharge = 0; // changed on 15-11-2003 $temp_total_new -= $temp_totaldiscount; // Changed the sub total after discount for($tc=0;$tc<$totalcart;$tc++) { $temp_subtotal = $tmp_amountarr[$tc]; } //$temp_Tax = $temp_Tax + Count_MultiAddress_Tax(0); ///////////// By Bhavika for shipping charge $temp_ShippingCharge = 0; 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(); $shoppingCart->update_temp_ship_charge($tc, $tmp_ship_charge); } } ///////////// } $shoppingCart->store(); //$temp_Tax = Count_Tax(); // By Bhavika For count Tax // 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; } } } // $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); $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); //echo $paypal_checked."-".$verisign_checked."-".$cheque_checked; //echo $autodiscount; //exit; $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"], ); } ////////////// $localvars = array( 'cart_msg'=>$cart_msg, 'class_detail'=>$class_detail, 'err_msg'=>$err_msg, 'totalitems_in_cart'=>$totalitems_in_cart, 'totalcart'=>$totalcart, 'OrderSubTotal'=>"$ ".$OrderSubTotal, 'tc'=>$tc, 'shmodecombo'=>$shmodecombo, 'single_shipping_name'=>$single_shipping_name, 'single_shipping_address'=>$single_shipping_address, 'AddressTdTitle'=>$AddressTdTitle, 'totaldiscount'=>"$ ".$totaldiscount, 'ShippingCharge'=>$ShippingCharge, 'HandlingCharge'=>$HandlingCharge, 'Tax'=>$Tax, 'ordertotal'=>"$ ".$ordertotal, '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, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index_new.htm"; include_once("include/footer.inc.php"); ?> SiteTitle; 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(); //$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); 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"); $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=""; $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->AddOrderMaster(); $orderres=mysql_insert_id(); //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"]; $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=""; $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"; } // /*$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')";*/ $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->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),'heque')) include_once("script/order/process_payment_cheque.php"); elseif(strpos(strtolower($payment_method),'aypal')) include_once("script/order/process_payment_paypal.php"); else include_once("script/order/process_payment_phone.php"); ?>
DirectSelect($db_sql); if($result){ $ishistory = 1; $nohistory = 0; for($i=0;$iDirectSelect($track_sql); $trackno=$track_result[0]["track"]; if($trackno != 0 && $trackno != 'Null'){ $trackno=" Track Order "; } else{ $trackno="-"; } if($viewUSD): $showCurrency = $DEFAULT_CURRENCY_SETTINGS; else: $showCurrency = array( "symbol"=>$result[$i]["vcurrencysymbol"], "rate" => $result[$i]["fcurrencyrate"]); endif; $table_orderlist[] = array( 'orderid' => $result[$i]["iorderid"], 'orderno' => $result[$i]["iorderno"], 'orderdate' => substr($result[$i]["dorderdate"],0,10), 'subtotal' => $result[$i]["fsubtotal"], 'shipping' => $result[$i]["fshipping"], 'discount' => $result[$i]["fdiscount"]+$result[$i]["fcouponamount"], 'totalamount' => $result[$i]["ftotalamount"], 'status' => $result[$i]["estatus"], 'transactiontype' => $result[$i]["etransactiontype"], 'tracking' => $trackno, ); } } else { $ishistory = 0; $nohistory = 1; //$err_msg=$order_err_msg; $err_msg="No Order History Found"; } }else { if(isset($redirectto) && !empty($redirectto)) { $msg = $login_msg; header("location:".$Site_URL."index.php?file=$redirectto&err_msg=$msg"); exit; }else { header("location:".$Site_URL."index.php?file=m-login"); $msg=$login_msg; } } /* include_once("scripts/leftnav.php"); include_once("scripts/summary.php");*/ $toggle_currency_view_link = $viewUSD?"View as purchased":"View all in US$"; $localvars = array( "table_cart"=>$table_cart, "redirectfrm"=>$totalcart, "class_detail"=>$pricerange, "msg"=>$class_detail, "toggle_currency_view_link"=>$awaylink, 'icatid'=>$awaydisp, 'awaymsg'=>$awaymsg, 'nohistory'=>$nohistory, 'err_msg'=>$cart_msg, 'table_orderlist'=>$table_orderlist, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>DirectSelect($db_sql); $billaddsql = "select * from orderaddress,ordermast where ordermast.iorderaddressid=orderaddress.iorderaddressid and ordermast.iorderid='$id' "; $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"] ); $db_sql_order="select iorderno, fdiscount, fcouponamount, ftotalamount, fshipping, fsubtotal, ftax from ordermast where iorderid='$id'"; $orderresult=$db->DirectSelect($db_sql_order); $orderno=$orderresult[0]["iorderno"]; $ordertotal= ($orderresult[0]["ftotalamount"]); $totaldiscount = ($orderresult[0]["fdiscount"] + $orderresult[0]["fcouponamount"]); $shipping= ($orderresult[0]["fshipping"]); $subtotal= ($orderresult[0]["fsubtotal"]); $couponamount = ($orderresult[0]["fcouponamount"]); $tax = ($orderresult[0]["ftax"]); /* $ordertotal= Make_Price($orderresult[0]["ftotalamount"], $showCurrency); $totaldiscount = Make_Price($orderresult[0]["fdiscount"] + $orderresult[0]["fcouponamount"], $showCurrency); $shipping= Make_Price($orderresult[0]["fshipping"], $showCurrency); $subtotal= Make_Price($orderresult[0]["fsubtotal"], $showCurrency); $couponamount = Make_Price($orderresult[0]["fcouponamount"], $showCurrency); $tax = Make_Price($orderresult[0]["ftax"], $showCurrency); */ $err_msg = "Your Order Number : ".$orderno.""; if($result){ $grandtotal=0; for($i=0;$iDirectSelect($pimgsql); // $product_th_image = $thumb_image_path.$pimgres[0]["vthumbimage"]; if(file_exists($product_th_image)) $image = $thumb_image_url.$pimgres[0]["vthumbimage"]; else{ $image = $default_pro_thumb; $prod_th_image = ".$prod_img_text."; } $prodstatus = $result[$i]["vremark"]; if($prodstatus == 'Delivered' || $prodstatus == 'Shipped'){ $trackingno=trim($result[$i]["vflag"]); if($result[$i]["shipmethods"]=="Airborne"){ $linkurl = "$trackingno "; } else { $linkurl = " $trackingno "; } if($trackingno != '0'){ $trackingno=$linkurl; }else{ $trackingno="-"; } }else{ $trackingno="-"; } $sksql = "select vSKU from products where iproductid='$id' "; $skres = $db->DirectSelect($sksql); $amount_total_order = "select ftotalamount from ordermast where iorderid='$orderid'"; $total_price_order = $db->DirectSelect($amount_total_order); //echo $total_price_order[0]["ftotalamount"]; exit; $table_orderdetail[] = array( 'vSKU' => $skres[0]["vSKU"], 'details' => $result[$i]["vshortdesc"], 'productname' => "".$result[$i]["name"]."", 'qty' => $result[$i]["qty"], // 'totprice' => Make_Price($result[$i]["fprice"], $showCurrency), // 'price' => Make_Price($result[$i]["fprice"]), //changed by vivek 'price' => $result[$i]["fprice"], 'name' => $result[$i]["vname"], 'vthumbimage' => $image,//$thumb_image_url.$pimgres[0]["vthumbimage"], 'ShipAddress' => $result[$i]["vaddress1"].", ".$result[$i]["vaddress2"]."
".$result[$i]["vcity"]."
".$result[$i]["vstate"]."
".$result[$i]["izip"]."
".$result[$i]["vcountry"], // 'total' => Make_Price($result[$i]["qty"] * $result[$i]["fprice"], $showCurrency), 'total' => $result[$i]["qty"] * $result[$i]["fprice"], 'trackno' => $trackingno, 'status' => $result[$i]["vremark"], 'address1' => $result[$i]["vaddress1"], 'address2' => $result[$i]["vaddress2"], 'city' => $result[$i]["vcity"], 'state' => $result[$i]["vstate"], 'country' => $result[$i]["vcountry"], 'zip' => $result[$i]["izip"], ); $grandtotal=$total_price_order[0]["ftotalamount"]; } $grandtotal=$grandtotal; } else{ header("Location:index.php?file=m-myaccount"); exit; } $localvars = array( "redirectto"=>$redirectto, "redirectfrm"=>$redirectfrm, "class_detail"=>$class_detail, "msg"=>$msg, "err_msg"=>$err_msg, "grandtotal"=>$grandtotal, 'totaldiscount'=>$totaldiscount, 'ordertotal'=>$ordertotal, 'shipping'=>$shipping, 'subtotal'=>$subtotal, "couponamount"=>$couponamount, 'tax'=>$tax, 'icatid'=>$icatid, 'table_orderdetail'=>$table_orderdetail, "grandtotal"=>$grandtotal ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index_new.htm"; include_once("include/footer.inc.php"); ?>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"]; $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); 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; } 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; } 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 = $obj->select($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 = $obj->select($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 = $obj->select($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; } $prosql = "select iproductid, vproductname, vshortdesc, vunitid, fsaleprice, vweight, vSKU, vproductdetail,vtype,vtype2 from products where iproductid='$iproductid' "; $prores = $obj->select($prosql); $pimgsql = "select vthumbimage from productimage where iproductid='$iproductid' and eimgstatus='Active' "; $pimgres = $obj->select($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"]; if(file_exists($product_th_image) and !empty($pimgres[0]["vthumbimage"])) $image = $thumb_image_url.$pimgres[0]["vthumbimage"]; else $image = $default_pro_thumb; $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'=> Make_Small_Desc(stripslashes($prores[0]["vproductdetail"])), 'qty' => $itemres[$tc]["iquantity"], 'mrprice' => Make_Price( $itemres[$tc]["fprice"] / $itemres[$tc]["iquantity"]), 'totprice' => Make_Price($itemres[$tc]["fprice"]), 'AddressName' => Order_ShipAddress_Name($itemres[$tc]["iorderaddressid"]), 'ShipAddress' => Order_ShipAddress($itemres[$tc]["iorderaddressid"]), ); } $receipt = 1; include_once("scripts/orderreceiptemails.php"); } else { $err_msg = rawurlencode("Sorry, Your Payment Is Declined.
".$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'=>$totaldiscount, 'vcoupontitle'=>$vcoupontitle, 'ShippingCharge'=>$ShippingCharge, 'HandlingCharge'=>$HandlingCharge, 'Tax'=>$Tax, 'payment_type'=>$payment_type, 'vcouponno'=>$vcouponno, 'forderamount'=>$forderamount, 'GC_Charge'=>$GC_Charge, 'ordertotal'=>$ordertotal, 'fdiscount'=>$fdiscount, '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($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 = Make_Price($orderres[0]["fsubtotal"]); $Tax = Make_Price($orderres[0]["ftax"]); $iorderid= $orderres[0]["iorderid"]; $ShippingCharge = Make_Price($orderres[0]["fshipping"]); $GC_Charge = Make_Price(number_format($orderres[0]["fgcamount"],2,'.',',')); $HandlingCharge = Make_Price(number_format(0,2,'.',',')); //$totaldiscount = Make_Price($orderres[0]["fdiscount"]); $totaldiscount = Make_Price(number_format($orderres[0]["fdiscount"],2,'.',',') + number_format($orderres[0]["fcouponamount"],2,'.',',')); $ordertotal = Make_Price($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 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 = Site_URL."images/products/thumbimage/".$pimgres[0]["vthumbimage"]; if(file_exists($product_th_image) and !empty($pimgres[0]["vthumbimage"])) $image = Site_URL."images/products/thumbimage/".$pimgres[0]["vthumbimage"]; //$thumb_image_url.$pimgres[0]["vthumbimage"]; else //$image = $default_pro_thumb; $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' => Make_Price($prores[0]["fsaleprice"]), 'totprice' => Make_Price($itemres[$tc]["fprice"]), 'AddressName' => $itemres[$tc]["iorderaddressid"], 'ShipAddress' => $itemres[$tc]["iorderaddressid"], ); } $receipt =1; $cheque_address = $CHEQUE_ADDRESS; $giftwrap_changes_recipt_price = Make_Price ($giftwrap_changes_recipt_price); $sendmessage="
"; }; $sendmessage.="
 
 
Your order for the following items has been approved and is under process:
".$err_msg."
 
"; for($i=0;$i "; } $sendmessage.="
Selected payment type: ".$payment_type."
Note: Your order will not be processed until the payment is received!
"; for($i=0;$i
".$table_billadd11[$i]['vaddress1'].", ".$table_billadd11[$i]['vaddress2']."
".$table_billadd11[$i]['vcity']."
".$table_billadd11[$i]['vstate']." - ".$table_billadd11[$i]['izip']."
".$table_billadd11[$i]['vcountry'].""; } $sendmessage.="
"; for($i=0;$i
Item Item Desc Quantity Cost Shipping Address
".$table_cart11[$i]['vProductName']."
".$table_cart11[$i]['vtype2']."
".$table_cart11[$i]['qty']." ".$table_cart11[$i]['totprice']."    ".$table_cart11[$i]['AddressName']."
".$table_cart11[$i]['ShipAddress']."
         
 
Order Sub Total :
Discount :
GiftCertificate Discount :
Shipping Charge :
Gift Wrap Charge :
Sales Tax :
Total :
".$OrderSubTotal."     
".$totaldiscount."     
".$GC_Charge."     
".$ShippingCharge."     
".$giftwrap_changes_recipt_price."     
".$Tax."     
".$ordertotal."   
 
".$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.
"; /*$tpl->load_file('orderreceipt','./templates/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')); */ $sSQL="select * from client where iclientid=".$iclientid; if($iclientid > 0): $clientres = $db->DirectSelect($sSQL); //$vtoemail = Get_Client_Email($iclientid); $vtoemail=$clientres[0]['vemail']; else: $vtoemail = $billaddres[0]["vemail"]; endif; //$vfromemail = Get_Info_Email(); $vfromemail='info@powerperfume.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 Receipt from ".$SITE_NAME.".com"; $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 = "Order Place At ".$SITE_NAME.".Com By Client"; //echo $vtoemail."
"; //echo $subject."
"; //echo $sendmessage."
"; //echo $headers; //exit; $onesendstat = @mail($vtoemail, $subject, $sendmessage, $headers); ?> "; if(PAYMENT_MODE=='Yes') { $testrequest = "TRUE"; } else { $testrequest = "FALSE"; } if($HTTP_HOST=='192.168.0.5') { $return = "1,1,1,This transaction has been approved.,000000,P,0,68,,80.00,CC,auth_capture,,,,,#48 New Street,Chicago,AL,16006,US,,,,,,,,,,,,,,,,,F4E5CEE37BBDFAB46D0447A19EA7158B,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,61.11.3.44"; } else { /* script begins from here */ $url[1] = "https://secure.authorize.net/gateway/transact.dll"; $data = "x_ADC_URL=FALSE"; $data .= "&x_test_request=TRUE"; $data .= "&x_ADC_Delim_Data=TRUE"; $data .= "&x_Version=3.1"; $data .= "&x_delim_data=TRUE"; $data .= "&x_delim_char=,"; $data .= "&x_login=96C4X6gWsWqg "; // RISONAPOWER1 //$data .= "&x_password=1POWERrisona"; // Tulsigiri2703 $data .= "&x_tran_key=4gCh8Re727Y9F8q4"; $data .= "&x_amount=".$x_amount; $data .= "&x_method=CC"; $data .= "&x_invoice_num=".rawurlencode($ordernumber); // $data .= "&x_description=".rawurlencode($cInvoiceDesc); $data .= "&x_first_name=".rawurlencode(strtoupper($billaddres["vfirstname"])); $data .= "&x_last_name=".rawurlencode(strtoupper($billaddres["vlastname"])); //Add Extra // $data .= "&x_company=".rawurlencode($cCustomerCompanyName); $data .= "&x_address=".rawurlencode(strtoupper($billaddres["vaddress1"])); $data .= "&x_city=".rawurlencode(strtoupper($billaddres["vcity"])); $data .= "&x_zip=".rawurlencode($billaddres["izip"]); $data .= "&x_state=".rawurlencode(strtoupper($billaddres["vstate"])); $data .= "&x_country=".rawurlencode(strtoupper($billaddres["vcountry"])); //$data .= "&x_phone=".rawurlencode($cCustomerPhone); $data .= "&x_phone=".rawurlencode($vphone); $data .= "&x_fax=".rawurlencode($cCustomerFax); //$data .= "&x_email=".rawurlencode($cCustomerEmail); $data .= "&x_email=".rawurlencode($vemail); $merchantemail = $adminemail; $data .= "&x_merchant_email=".rawurlencode($merchantemail); $data .= "&x_email_customer=FALSE"; $data .= "&x_currency_code=USD"; $data .= "&x_type=AUTH_CAPTURE"; // AUTH_CAPTURE, CREDIT, CAPTURE_ONLY, AUTH_ONLY $data .= "&x_card_num=".trim($CCNumber); $data .= "&x_card_code=".rawurlencode($CSC); // $data .= "&x_exp_date=".rawurlencode($cExpiryMonth."-".$cExpiryYear); $data .= "&x_exp_date=".rawurlencode($CCExp); // $data .= "&x_bank_aba_code=".rawurlencode($cTrackingNo); // $data .= "&x_bank_acct_num=".rawurlencode($cBankAccountNo); // $data .= "&x_bank_acct_name=".rawurlencode($cCreditCardName); // $data .= "&x_bank_name=".rawurlencode($cBankName); // $data .= "&x_bank_acct_type=".rawurlencode($cBankAcctType); if ($REMOTE_ADDR != "") { $user_ip = $REMOTE_ADDR; } else { $user_ip = $REMOTE_HOST; } $data .= "&IP=".$user_ip; $curlok = curl_test(); if ($curlok==1) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url[1]); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec ($ch); curl_close ($ch); } elseif ($curlok==2) { $curl = setup("curl"); $return = `$curl -d "$data" $url[1]`; } else { $var_msg = "Curl not installed on this machine, safe mode is on, or your curl path is wrong!"; echo $var_msg; exit; } } $ordersql = $db->DirectUpdate("UPDATE `ordermast` SET PREFPSMSG='$return' WHERE iorderid='$iorderid' "); $return = explode(",",$return); if ($return[0] == 1) { $response = "1"; } elseif ($return[0] == 2) { $var_msg = $return[3]; $response = "2"; } elseif ($return[0] == 3) { $var_msg = $return[3]; $response = "3"; } else { $var_msg = "Unable to authenticate.Please contact your system administrator."; $response = "4"; } /* echo "
hi : ".$return[3]; echo "
vemail : ".$vemail; exit; */ if (isset($response) && !empty($response)) { $ordernumber = $return[7]; $card_code_response = $return[38]; $avs_response = $return[5]; $ord_cvv = $return[5]; $ord_x_avs_code = $return[39]; $response_subcode = $return[1]; $response_reason_code = $return[2]; $response_reason_text = $return[3]; if ($response==1) { $status = "Approved"; $cTranId = $return[6]; //transaction id returned by the payment gateway. /* $card_code_response = ""; if ($card_code_response<>"M") { $status = "Declined"; $RESPMSG = "Your Card Code did not match with credit card. Please place the order again."; } */ } else { $status = "Declined"; } } ?>
"> "> "> "> "> "> ">
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); ?>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($org_total); 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=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 = '".$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']."'"); //$db->printsql(); } } $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 = $db->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(); /*$billaddres =$oAddressBook-> 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"], ); } */ $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' "; //exit; $prores = $db->DirectSelect($prosql); if($prores) { $pimgsql = "select vthumbimage from productimage where iproductid='$iproductid' and eimgstatus='Active' "; //exit; $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 = ""; $tri = 1; } else { $tr = ""; $tri++; } $table_multishadd[] = array( 'MultiAddressTitle' => $oAddressBook-> Get_Address_Title($shoppingItem->shippingAddressId), 'multi_shipping_name' => $oAddressBook->Get_Address_Name($shoppingItem->shippingAddressId), 'multi_shipping_address'=> $oAddressBook->Get_Address($shoppingItem->shippingAddressId), 'tr' => $tr, ); if($shoppingItem->shippingAddressId!= '-1') { $sess_shippingarr[$temparr] = $shoppingItem->shippingAddressId; $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; $sess_shippingarr_totalid[$uniq_modeid] = (1 * $shoppingItem->quantity); $temparr++; } } else { if($shoppingItem->shippingAddressId!= '-1') { $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; $sess_shippingarr_totalid[$uniq_modeid] += (1 * $shoppingItem->quantity); } } // end if($oldflag==0) } // end if($sess_orderinfo[1] == '1') $product_th_image = $thumb_image_path.$pimgres[0]["vthumbimage"]; if(file_exists($product_th_image)) $image = $thumb_image_url.$pimgres[0]["vthumbimage"]; else $image = $default_pro_thumb; $cartitem_free = array(); $freeItemsText = ""; if($shoppingItem->hasFreeItems()){ $buyGetFreeOffer = $shoppingItem->freeOffer(); $freeItemsCount = $shoppingItem->freeItemsCount(); $freeItemsText = $shoppingItem->canPickFreeItems()?"
Pick free items":""; $preferredItems = $shoppingItem->preferredFreeItems(); $isFirst = true; foreach($preferredItems as $prefItem=>$prefQuantity){ $query = "SELECT * FROM products WHERE iproductid='$prefItem'"; $res = $db->DirectSelect($query); $removeFreeItemText = $shoppingItem->canPickFreeItems()?"Remove":""; $cartitem_free[] = array( 'freeItem_vSKU' => $res[0]["vSKU"], 'freeItem_iproductid' => $res[0]["iproductid"], 'freeItem_vProductName' => $res[0]["vproductname"], 'freeItem_vshortdesc' => $prores[0]["vshortdesc"], 'freeItem_vproductdetail' => substr(stripslashes($prores[0]["vproductdetail"]),0,200)."...", 'freeItem_qty' => $prefQuantity, 'freeItem_remove' => $removeFreeItemText ); } // end foreach } // end if if(isset($shoppingItem->is_gift_wrap) and !empty($shoppingItem->is_gift_wrap)) $is_gift_wrap = 'YES'; else $is_gift_wrap = 'NO'; $qty_new[$tc] = $shoppingItem->quantity; $table_cart[] = array( 'loop' => $tc, 'vSKU' => $prores[0]["vSKU"], 'vtype' => $prores[0]["vtype"], 'iproductid' => $iproductid, 'vthumbimage' => $image, 'vProductName' => $prores[0]["vproductname"].$category_check, 'vshortdesc' => $prores[0]["vshortdesc"], 'vproductdetail'=> substr(stripslashes($prores[0]["vproductdetail"]),0,200)."...", 'qty' => $shoppingItem->quantity, 'qtytext' => "qty_".$tc, 'mrprice' => "$ ".$shoppingItem->unitPrice(),//Make_Price($shoppingItem->unitPrice()),//,2,'.',','), 'totprice' => "$ ".number_format($totprice,2,'.',','),//Make_Price($totprice),//number_format($totprice,2,'.',','), 'discount' => "$ ".$discount,//Make_Price($discount),//number_format($discount,2,'.',','), 'pricewithdisc' => "$ ".$pricewithdisc,//Make_Price($pricewithdisc), //number_format($pricewithdisc,2,'.',','), 'viewdiscount' => $viewdiscount, 'AddressTitle' => $AddressTitle, 'pick_free_items' => $freeItemsText, 'is_gift_wrap' => $is_gift_wrap, 'cartitem_free'=>$cartitem_free, ); if ($prores[0]["vSKU"]!=$GIFT_CERT_SKUS[0]) $temp_total_new += $pricewithdisc; //by vivek if($shoppingItem->isShippedPhysically()): // if(! $addressid = $oAddressBook->Get_Address_ID($shoppingItem->shippingAddressId)): // if(! $addressid = $oAddressBook->Get_Address_ID("billing")): // header("Location: index.php?file=s-checkout&err_msg=".urlencode($m_MissingShippingAddress)).""; //exit; //endif; if (!key_exists($addressid,$cartitems_by_addresses)) { //create new line in array for this address $cartitems_by_addresses[$addressid] = array (); } $cartitems_by_addresses[$addressid][] = $totprice; endif; $pricewithdisc = 0; $totprice = 0; $discount = 0; if(isset($shoppingItem->is_gift_wrap) and $shoppingItem->is_gift_wrap=='1') { $packing_title="
Packing Charge:"; $packingcharge = number_format(($packingcharge + $GIFT_WRAP_CHARGE),2,'.',''); $packing_value = 1; } } } $packingchargeval = "$".$packingcharge; // $OrderSubTotal = number_format($SubTotal,2,'.',','); //$autodiscount = Count_Auto_Discount(); if($sess_orderinfo[2]=='1') { $coupondiscount = Count_Coupon_Discount(); } else $coupondiscount = 0; $coupondiscount = Count_Coupon_Discount(); $temp_totaldiscount = $autodiscount + $coupondiscount; $temp_HandlingCharge = 0; // changed on 15-11-2003 $temp_total_new -= $temp_totaldiscount; // Changed the sub total after discount for($tc=0;$tc<$totalcart;$tc++) { $temp_subtotal = $tmp_amountarr[$tc]; } //$temp_Tax = $temp_Tax + Count_MultiAddress_Tax(0); ///////////// By Bhavika for shipping charge $temp_ShippingCharge = 0; 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&nishant"); 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&nishant1"); 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&nishant2"); 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(); $shoppingCart->update_temp_ship_charge($tc, $tmp_ship_charge); } } ///////////// } $shoppingCart->store(); //$temp_Tax = Count_Tax(); // By Bhavika For count Tax // 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; } } } // $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); //number_format($temp_totaldiscount,2,'.',','); $ShippingCharge = $temp_ShippingCharge;//Make_Price($temp_ShippingCharge); //number_format($temp_ShippingCharge,2,'.',','); $HandlingCharge = $temp_HandlingCharge;//Make_Price($temp_HandlingCharge); //number_format($temp_HandlingCharge,2,'.',','); $Tax = $temp_Tax;//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() { 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() { Global $db, $SubTotal, $OrderSubTotal, $sess_orderinfo,$shoppingCart,$prodflag; $couponsql = "select * from coupon where icouponid='$sess_orderinfo[3]' "; // echo $couponsql; // exit; $couponres =$db->DirectSelect($couponsql); 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]; /* 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 =$db->DirectSelect("select icategoryid from productcat where iproductid = '".$item->productid."'"); $maincatres =$db->DirectSelect("select iparentid from category where icategoryid = '".$subcatres[0]["icategoryid"]."'"); if($maincatres[0]["iparentid"] == $prodsku) {*/ $prodres =$db->DirectSelect("select fsaleprice from products where iproductid = '".$item->productid."'"); $saleprice += ($item->quantity*$prodres[0]["fsaleprice"]); /*} }*/ }//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($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'=>$totaldiscount, '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, 'special_prods'=>$special_prods, '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, 'table_billadd'=>$table_billadd, 'table_cart'=>$table_cart, 'payment_ops'=>$payment_ops, 'credit_card_types'=>$credit_card_types ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index_new.htm"; include_once("include/footer.inc.php"); ?> 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 = ""; $tri = 1; } else { $tr = ""; $tri++; } $table_multishadd[] = array( 'MultiAddressTitle' => Get_Address_Title($shoppingItem->shippingAddressId), 'multi_shipping_name' => Get_Address_Name($shoppingItem->shippingAddressId), 'multi_shipping_address'=> Get_Address($shoppingItem->shippingAddressId), 'tr' => $tr, ); if($shoppingItem->shippingAddressId!= '-1') { // echo "
Ship1:".$shoppingItem->shippingAddressId; $sess_shippingarr[$temparr] = $shoppingItem->shippingAddressId; $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; $sess_shippingarr_totalid[$uniq_modeid] = (1 * $shoppingItem->quantity); $temparr++; } } else { if($shoppingItem->shippingAddressId!= '-1') { $uniqaddid = $shoppingItem->shippingAddressId; $uniq_modeid = $shoppingItem->shippingmodeid; $sess_shippingarr_id[$uniq_modeid] += $pricewithdisc; $sess_shippingarr_totalid[$uniq_modeid] += (1 * $shoppingItem->quantity); } } // end if($oldflag==0) //echo $uniqaddid."
"; } // end if($sess_orderinfo[1] == '1') $product_th_image = $thumb_image_path.$pimgres[0]["vthumbimage"]; if(file_exists($product_th_image)) $image = $thumb_image_url.$pimgres[0]["vthumbimage"]; else $image = $default_pro_thumb; $cartitem_free[$tc] = array(); $freeItemsText = ""; if($shoppingItem->hasFreeItems()){ $buyGetFreeOffer = $shoppingItem->freeOffer(); $freeItemsCount = $shoppingItem->freeItemsCount(); $freeItemsText = $shoppingItem->canPickFreeItems()?"
Pick free items":""; $preferredItems = $shoppingItem->preferredFreeItems(); $isFirst = true; foreach($preferredItems as $prefItem=>$prefQuantity){ $query = "SELECT * FROM products WHERE iproductid='$prefItem'"; $res = $obj->select($query); $removeFreeItemText = $shoppingItem->canPickFreeItems()?"Remove":""; $cartitem_free[$tc][] = array( 'freeItem_vSKU' => $res[0]["vSKU"], 'freeItem_iproductid' => $res[0]["iproductid"], 'freeItem_vProductName' => $res[0]["vproductname"], 'freeItem_vshortdesc' => $prores[0]["vshortdesc"], 'freeItem_vproductdetail' =>Make_Small_Desc(stripslashes($prores[0]["vproductdetail"])), 'freeItem_qty' => $prefQuantity, 'freeItem_remove' => $removeFreeItemText ); } // end foreach } // end if if(isset($shoppingItem->is_gift_wrap) and !empty($shoppingItem->is_gift_wrap)) $is_gift_wrap = 'YES'; else $is_gift_wrap = 'NO'; $qty_new[$tc] = $shoppingItem->quantity; // echo $viewdiscount; $table_cart[] = array( 'loop' => $tc, 'vSKU' => $prores[0]["vSKU"], 'vtype' => $prores[0]["vtype"], 'iproductid' => $iproductid, 'vthumbimage' => $image, 'vProductName' => $prores[0]["vproductname"].$category_check, 'vshortdesc' => $prores[0]["vshortdesc"], 'vproductdetail'=> Make_Small_Desc(stripslashes($prores[0]["vproductdetail"])), 'qty' => $shoppingItem->quantity, 'qtytext' => "qty_".$tc, 'mrprice' => Make_Price($shoppingItem->unitPrice()),//,2,'.',','), 'totprice' => Make_Price($totprice),//number_format($totprice,2,'.',','), 'discount' => Make_Price($discount),//number_format($discount,2,'.',','), 'pricewithdisc' => Make_Price($pricewithdisc), //number_format($pricewithdisc,2,'.',','), 'viewdiscount' => $viewdiscount, 'AddressTitle' => $AddressTitle, 'pick_free_items' => $freeItemsText, 'is_gift_wrap' => $is_gift_wrap ); if ($prores[0]["vSKU"]!=$GIFT_CERT_SKUS[0]) $temp_total_new += $pricewithdisc; //by vivek if($shoppingItem->isShippedPhysically()): if(! $addressid = Get_Address_ID($shoppingItem->shippingAddressId)): Header("Location: index.php?file=checkout&err_msg=".urlencode($m_MissingShippingAddress)); exit; endif; if (!key_exists($addressid,$cartitems_by_addresses)) { //create new line in array for this address $cartitems_by_addresses[$addressid] = array (); } //add item to array $cartitems_by_addresses[$addressid][] = $totprice; endif; $pricewithdisc = 0; $totprice = 0; $discount = 0; if(isset($shoppingItem->is_gift_wrap) and $shoppingItem->is_gift_wrap=='1') { $packing_title="
Packing Charge:"; $packingcharge = number_format(($packingcharge + $GIFT_WRAP_CHARGE),2,'.',''); $packing_value = 1; } } // echo $tc."
"; } $packingchargeval = "$".$packingcharge; // $OrderSubTotal = number_format($SubTotal,2,'.',','); $autodiscount = Count_Auto_Discount(); if($sess_orderinfo[2]=='1') { $coupondiscount = Count_Coupon_Discount(); } else $coupondiscount = 0; $temp_totaldiscount = $autodiscount + $coupondiscount; $temp_HandlingCharge = 0; // changed on 15-11-2003 $temp_total_new -= $temp_totaldiscount; // Changed the sub total after discount for($tc=0;$tc<$totalcart;$tc++) { $temp_subtotal = $tmp_amountarr[$tc]; } //$temp_Tax = $temp_Tax + Count_MultiAddress_Tax(0); ///////////// By Bhavika for shipping charge $temp_ShippingCharge = 0; 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 = $obj->select($ship_id); $viewadd = clientShippingAddress($shoppingItem->shippingAddressId); $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=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=checkout&err_msg=$err_msg"); exit; } } if ($row_shipid[0]["iorderno"] == 1)//International Scheduled other then US Country { if($vcountry=="US"){ //echo "
Us Country"; $err_msg = rawurlencode($Shipping_Method_Not_Match); header("location:".$Site_URL."index.php?file=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]; $tmp_ship_charge = MultiAddress_ShippingCharge($shoppingItem->shippingAddressId,$shoppingItem->shippingmodeid); $temp_ShippingCharge = $temp_ShippingCharge + $tmp_ship_charge; //$temp_total_new = Count_Tax(); $shoppingCart->update_temp_ship_charge($tc, $tmp_ship_charge); } } ///////////// } $shoppingCart->store(); $temp_Tax = Count_Tax(); // By Bhavika For count Tax // First time Buyer Promotion Code Start Here $order_exist = "select * from ordermast where iclientid='".$iMemberid."'"; // echo $order_exist; // exit; $result_order = $obj->select($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"; // echo $sql_special; $special = $obj->select($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; } } } // $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 //echo $temp_totaldiscount; $totaldiscount = Make_Price($temp_totaldiscount); //number_format($temp_totaldiscount,2,'.',','); $ShippingCharge = Make_Price($temp_ShippingCharge); //number_format($temp_ShippingCharge,2,'.',','); $HandlingCharge = Make_Price($temp_HandlingCharge); //number_format($temp_HandlingCharge,2,'.',','); $Tax = Make_Price($temp_Tax); //number_format($temp_Tax,2,'.',','); $GiftCertificateValue = Make_Price($temp_giftcerttotal); $verisignamount = number_format($temp_ordertotal,2,'.',''); $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); //echo $paypal_checked."-".$verisign_checked."-".$cheque_checked; //echo $autodiscount; //exit; $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 = $obj->select($couponsql); if(count($couponres)>0) { $coupon_code = 1; } else { $coupon_code = 0; } // Are there any issued gift certificates available? $gift_certificate = (!$shoppingCart->containsGiftCertificates()) && (countValidGiftCertificates() > 0); /// Payment Option $payment_options = $obj->select("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 = $obj->select("select * from creditcard_options where estatus = 'Active' order by vcard_name"); for($c=0;$c $credit_options[$c]["vcard_name"], ); } ////////////// $middle = $middle_dir . "submitorder.html"; $top = $top_dir."top-home.html"; /* include_once("scripts/leftnav.php"); include_once("scripts/summary.php"); */ $localvars = array( 'cart_msg'=>$cart_msg, 'class_detail'=>$class_detail, 'err_msg'=>$err_msg, 'totalitems_in_cart'=>$totalitems_in_cart, 'totalcart'=>$totalcart, 'OrderSubTotal'=>$OrderSubTotal, 'tc'=>$tc, 'shmodecombo'=>$shmodecombo, 'single_shipping_name'=>$single_shipping_name, 'single_shipping_address'=>$single_shipping_address, 'AddressTdTitle'=>$AddressTdTitle, 'totaldiscount'=>$totaldiscount, 'ShippingCharge'=>$ShippingCharge, 'HandlingCharge'=>$HandlingCharge, 'Tax'=>$Tax, 'ordertotal'=>$ordertotal, '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, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); /*foreach($cartitem_free as $tc=>$cart_item){ $tplVarName = "cartitem_free_".$tc; $$tplVarName = $cart_item; $tpl->parse_loop('shoppingcart', $tplVarName); }*/ /*for($p=0;$pparse_if('shoppingcart', $tplVarName2); $tpl->parse_if('shoppingcart', $tplVarName3); }*/ ?> SiteTitle; /* if(!isset($iMemberid) || empty($iMemberid)) { if(!isset($fakeMember)): header("location:".$Site_URL."index.php?file=login&to=shoppingcart&from=shoppingcart"); exit; elseif(!$fakeMember["billingAddress"]): header("location:".$Site_URL."index.php?file=login&to=shoppingcart&from=shoppingcart"); exit; endif; } */ // pre-validate if(!isset($payment_method) and !empty($payment_method)) { Header("Location: 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: index.php?file=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(); //$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); if($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' "; $cosql = "select max(iorderid) as max from ordermast"; $cores = $db->DirectSelect($cosql); $maxno = $cores[0]["max"]+1; $ordernumber = "CO-".$maxno."-".($sessMemberid?$sessMemberid:"00"); $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: 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=""; $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->AddOrderMaster(); $lastorderid=mysql_insert_id(); //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"]; $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=""; $oOrderAddress->shippingtype=$shippingtype; $oOrderAddress->vcomments=$vcomments; $oOrderAddress->vremark="Pending"; $oOrderAddress->vemail=$vemail; $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"; } // /*$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')";*/ $oOrderDetail->iorderid=$lastorderid; $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->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 $rsGift = $shoppingItem->isGiftCertificate(); if($rsGift == 1){ $orderAddress = $oOrderAddress->loadOrderAddress($iorderaddressid); $giftCertId = $oGiftCert->newGiftCertificate( $iMemberid?$iMemberid:"0", $itemres, $shoppingItem->unitPrice(), 'Yes', //$orderAddress["vemail"], $shoppingItem->otherPreferences["gcemail"], $shoppingItem->otherPreferences["gcmessagesubject"], $shoppingItem->otherPreferences["gcmessagetext"], $shoppingItem->otherPreferences["gcmessagesignature"], "Invalid" ); } // 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; } // exit; $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: index.php?file=printorderreceipt&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),'heque')) include_once("script/order/process_payment_cheque.php"); elseif(strpos(strtolower($payment_method),'aypal')){ include_once("script/order/process_payment_paypal.php"); } else include_once("script/order/process_payment_phone.php"); */ 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),'heque')) include_once("script/order/process_payment_cheque.php"); elseif(strpos(strtolower($payment_method),'aypal')) include_once("script/order/process_payment_paypal.php"); else include_once("script/order/process_payment_phone.php"); ?>
$Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>DirectSelect("select * from bottomlinks where links_id=$id"); $pagedetails = stripslashes($pagedet[0]['pagedetails']); $localvars = array( "Site_URL"=>$Site_URL, "pagedetails"=>$pagedetails, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index_new.htm"; include_once("include/footer.inc.php"); ?>GetpriceList("Row 1",0,10); $rsrow120 = $oOffer->GetpriceList("Row 1",10,10); $rsrow130 = $oOffer->GetpriceList("Row 1",20,10); $rsrow210 = $oOffer->GetpriceList("Row 2",0,10); $rsrow220 = $oOffer->GetpriceList("Row 2",10,10); $rsrow230 = $oOffer->GetpriceList("Row 2",20,10); $rsrow310 = $oOffer->GetpriceList("Row 3",0,10); $rsrow320 = $oOffer->GetpriceList("Row 3",10,10); $rsrow330 = $oOffer->GetpriceList("Row 3",20,10); for($i=0;$i $rsrow110[$i]['price_sku'], ); } for($i=0;$i $rsrow120[$i]['price_sku'], ); } for($i=0;$i $rsrow130[$i]['price_sku'], ); } for($i=0;$i $rsrow210[$i]['price_sku'], ); } for($i=0;$i $rsrow220[$i]['price_sku'] ); } for($i=0;$i $rsrow230[$i]['price_sku'], ); } for($i=0;$i $rsrow310[$i]['price_sku'], ); } for($i=0;$i $rsrow320[$i]['price_sku'], ); } for($i=0;$i $rsrow330[$i]['price_sku'], ); } $localvars = array( "productlistarray110"=>$productlistarray110, "productlistarray120"=>$productlistarray120, "productlistarray130"=>$productlistarray130, "productlistarray210"=>$productlistarray210, "productlistarray220"=>$productlistarray220, "productlistarray230"=>$productlistarray230, "productlistarray310"=>$productlistarray310, "productlistarray320"=>$productlistarray320, "productlistarray330"=>$productlistarray330, "totalpro"=>'9', "sPageFooter"=>$sPageFooter, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>GetpriceList("Row1"); $pr1 = $rs1[0]['price_sku']; $pr2 = $rs1[1]['price_sku']; $pr3 = $rs1[2]['price_sku']; $localvars = array( "pr1"=>$pr1, "pr2"=>$pr2, "pr3"=>$pr3, "recordcount"=>$iCount, "sPageFooter"=>$sPageFooter, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>loadBuyGetFreeProducts("buy", "1", "vproductname", $var_limit); $table_products = array(); if($products){ $product_name=""; $product_sale_price=""; $product_regular_price=""; $product_img_text=""; $product_add_to_cart=""; $product_th_image=""; $freeshipImg=""; for($i=0;$iDirectSelect($query_cat); $tmp_icat_id = $res_cat[0]["icategoryid"]; $query = "SELECT * FROM productimage WHERE iproductid='".$products[$i]["iproductid"]."' AND eimgstatus='Active'ORDER BY iprority ASC"; $res = $db->DirectSelect($query); $prodImage = $res[0]; $product_name="".$products[$i]["vproductname"].""; $sPath = ""; $product_short_desc=$products[$i]["vshortdesc"]; $product_sale_price="Our Price : ".$products[$i]["fsaleprice"]; $product_regular_price="Retail Price : ".$products[$i]["factualprice"]; $product_img_text=$prodImage["vimagetext"]; $product_add_to_cart=""; $product_th_image=ROOT_DIR."images/products/thumbimage/".$prodImage["vthumbimage"]; // echo "
product_th_image : ".$product_th_image; // exit; if(file_exists($product_th_image) && !empty($prodImage["vthumbimage"])) $image = $Site_URL."images/products/thumbimage/".$prodImage["vthumbimage"]; else { //$image=$default_blowout_th; $image="images/products/thumbimage/default_thumb_img.jpg"; } //echo $Site_URL."images/products/thumbimage/".$image; //echo "
"; $product_th_image = ""."". $product_img_text." "; // $row_count=$general[$product_columns]["setting"]; if(($i+1)%2==0) $tr=" "; else $tr=""; // For free shipping Image if($products[$i]["fsaleprice"]>=$FREESHIPPING_VALUE) $freeshipImg = ""; 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 = "$ ".$product_sale_price.""; } $table_products[] = array( 'product_id' => $product_id, 'product_name' => $product_name, 'product_short_desc' => $product_short_desc, 'product_sale_price' => $product_sale_price, 'product_regular_price' => $product_regular_price, 'product_img_text' => $product_img_text, 'product_add_to_cart' => $product_add_to_cart, 'product_image' => $product_th_image, 'product_free_shipping_img' => $freeshipImg, 'product_new_price' => $product_new_price, 'tr' => $tr, 'sPath' => $sPath ); } } else { $msg = "Sorry, No Products Were Found!"; } $localvars=array( "table_products"=>$table_products, "path"=>$Site_URL."index.php?file=p-productdetail&iprodid=$product_id&catid=$tmp_icat_id", "tmp_icat_id"=>$tmp_icat_id, "msg"=>$msg, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>$Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>$Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>\n" . "From: $email <$email>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"; $subject="dropship"; $mailbody='
 
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.'
 
 
'; @mail("info@PowerOfPerfume.com",$subject,$mailbody,$header); header("location:index.php?file=o-dropship"); ?>$Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>$Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>CheckEmailAddress($newsletter); if(!empty($eaddress[0]['vuseremail'])){ $msg = "This Email Address Already Exists...Please Choose another Email Address..."; } else { $oNewsletter->vuseremail = $newsletter; $oNewsletter->ddate = date("Y-m-d"); $oNewsletter->AddNewsletter(); $msg = "Your Successfully Registered for Newsletter."; } $localvars = array( "msg" => $msg, ); $smartyvars = array_merge($smartyvars,$localvars); //$indexfile="index.htm"; include_once("include/footer.inc.php"); ?>GetpriceList("Row 1",0,10); $rsrow120 = $oOffer->GetpriceList("Row 1",10,10); $rsrow130 = $oOffer->GetpriceList("Row 1",20,10); $bulkprice=$p1; } if(!empty($Submit2)){ $rsrow210 = $oOffer->GetpriceList("Row 2",0,10); $rsrow220 = $oOffer->GetpriceList("Row 2",10,10); $rsrow230 = $oOffer->GetpriceList("Row 2",20,10); $bulkprice=$p2; } if(!empty($Submit3)){ $rsrow310 = $oOffer->GetpriceList("Row 3",0,10); $rsrow320 = $oOffer->GetpriceList("Row 3",10,10); $rsrow330 = $oOffer->GetpriceList("Row 3",20,10); $bulkprice=$p3; } if(!empty($Submit1)){ for($i=0;$iGetProductDeatilBySKU($rsrow110[$i]['price_sku']); $productlistarray110[]=array( "pr110" => $rsrow110[$i]['price_sku'], "prname110"=>$rsProduct[0]['vproductname'], "prsize110"=>$rsProduct[0]['vtype'], "prprice110"=>$rsProduct[0]['fsaleprice'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow120[$i]['price_sku']); $productlistarray120[]=array( "pr120" => $rsrow120[$i]['price_sku'], "prname120"=>$rsProduct[0]['vproductname'], "prsize120"=>$rsProduct[0]['vtype'], "prprice120"=>$rsProduct[0]['fsaleprice'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow130[$i]['price_sku']); $productlistarray130[]=array( "pr130" => $rsrow130[$i]['price_sku'], "prname130"=>$rsProduct[0]['vproductname'], "prsize130"=>$rsProduct[0]['vtype'], "prprice130"=>$rsProduct[0]['fsaleprice'], ); } } if(!empty($Submit2)){ for($i=0;$iGetProductDeatilBySKU($rsrow210[$i]['price_sku']); $productlistarray210[]=array( "pr210" => $rsrow210[$i]['price_sku'], "prname210"=>$rsProduct[0]['vproductname'], "prsize210"=>$rsProduct[0]['vtype'], "prprice210"=>$rsProduct[0]['fsaleprice'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow220[$i]['price_sku']); $productlistarray220[]=array( "pr220" => $rsrow220[$i]['price_sku'], "prname220"=>$rsProduct[0]['vproductname'], "prsize220"=>$rsProduct[0]['vtype'], "prprice220"=>$rsProduct[0]['fsaleprice'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow230[$i]['price_sku']); $productlistarray230[]=array( "pr230" => $rsrow230[$i]['price_sku'], "prname230"=>$rsProduct[0]['vproductname'], "prsize230"=>$rsProduct[0]['vtype'], "prprice230"=>$rsProduct[0]['fsaleprice'], ); } } if(!empty($Submit3)){ for($i=0;$iGetProductDeatilBySKU($rsrow310[$i]['price_sku']); $productlistarray310[]=array( "pr310" => $rsrow310[$i]['price_sku'], "prname310"=>$rsProduct[0]['vproductname'], "prsize310"=>$rsProduct[0]['vtype'], "prprice310"=>$rsProduct[0]['fsaleprice'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow320[$i]['price_sku']); $productlistarray320[]=array( "pr320" => $rsrow320[$i]['price_sku'], "prname320"=>$rsProduct[0]['vproductname'], "prsize320"=>$rsProduct[0]['vtype'], "prprice320"=>$rsProduct[0]['fsaleprice'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow330[$i]['price_sku']); $productlistarray330[]=array( "pr330" => $rsrow330[$i]['price_sku'], "prname330"=>$rsProduct[0]['vproductname'], "prsize330"=>$rsProduct[0]['vtype'], "prprice330"=>$rsProduct[0]['fsaleprice'], ); } } $localvars = array( "productlistarray110"=>$productlistarray110, "productlistarray120"=>$productlistarray120, "productlistarray130"=>$productlistarray130, "productlistarray210"=>$productlistarray210, "productlistarray220"=>$productlistarray220, "productlistarray230"=>$productlistarray230, "productlistarray310"=>$productlistarray310, "productlistarray320"=>$productlistarray320, "productlistarray330"=>$productlistarray330, "totalpro"=>'9', "price1"=>$price1, "price2"=>$price2, "price3"=>$price3, "p1"=>$p1, "p2"=>$p2, "p3"=>$p3, "Submit1"=>$Submit1, "Submit2"=>$Submit2, "Submit3"=>$Submit3, "bulkprice"=>$bulkprice, "sPageFooter"=>$sPageFooter, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>GetpriceList("Row1"); $pr1 = $rs1[0]['price_sku']; $pr2 = $rs1[1]['price_sku']; $pr3 = $rs1[2]['price_sku']; $localvars = array( "pr1"=>$pr1, "pr2"=>$pr2, "pr3"=>$pr3, "recordcount"=>$iCount, "sPageFooter"=>$sPageFooter, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>GetpriceList("Row 1",0,10); $rsrow120 = $oOffer->GetpriceList("Row 1",10,10); $rsrow130 = $oOffer->GetpriceList("Row 1",20,10); $bulkprice=$p1; } if(!empty($Submit2)){ $rsrow210 = $oOffer->GetpriceList("Row 2",0,10); $rsrow220 = $oOffer->GetpriceList("Row 2",10,10); $rsrow230 = $oOffer->GetpriceList("Row 2",20,10); $bulkprice=$p2; } if(!empty($Submit3)){ $rsrow310 = $oOffer->GetpriceList("Row 3",0,10); $rsrow320 = $oOffer->GetpriceList("Row 3",10,10); $rsrow330 = $oOffer->GetpriceList("Row 3",20,10); $bulkprice=$p3; } if(!empty($Submit1)){ for($i=0;$iGetProductDeatilBySKU($rsrow110[$i]['price_sku']); $productlistarray110[]=array( "pr110" => $rsrow110[$i]['price_sku'], "prname110"=>$rsProduct[0]['vproductname'], "prsize110"=>$rsProduct[0]['vweight'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow120[$i]['price_sku']); $productlistarray120[]=array( "pr120" => $rsrow120[$i]['price_sku'], "prname120"=>$rsProduct[0]['vproductname'], "prsize120"=>$rsProduct[0]['vweight'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow130[$i]['price_sku']); $productlistarray130[]=array( "pr130" => $rsrow130[$i]['price_sku'], "prname130"=>$rsProduct[0]['vproductname'], "prsize130"=>$rsProduct[0]['vweight'], ); } } if(!empty($Submit2)){ for($i=0;$iGetProductDeatilBySKU($rsrow210[$i]['price_sku']); $productlistarray210[]=array( "pr210" => $rsrow210[$i]['price_sku'], "prname210"=>$rsProduct[0]['vproductname'], "prsize210"=>$rsProduct[0]['vweight'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow220[$i]['price_sku']); $productlistarray220[]=array( "pr220" => $rsrow220[$i]['price_sku'], "prname220"=>$rsProduct[0]['vproductname'], "prsize220"=>$rsProduct[0]['vweight'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow230[$i]['price_sku']); $productlistarray230[]=array( "pr230" => $rsrow230[$i]['price_sku'], "prname230"=>$rsProduct[0]['vproductname'], "prsize230"=>$rsProduct[0]['vweight'], ); } } if(!empty($Submit3)){ for($i=0;$iGetProductDeatilBySKU($rsrow310[$i]['price_sku']); $productlistarray310[]=array( "pr310" => $rsrow310[$i]['price_sku'], "prname310"=>$rsProduct[0]['vproductname'], "prsize310"=>$rsProduct[0]['vweight'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow320[$i]['price_sku']); $productlistarray320[]=array( "pr320" => $rsrow320[$i]['price_sku'], "prname320"=>$rsProduct[0]['vproductname'], "prsize320"=>$rsProduct[0]['vweight'], ); } for($i=0;$iGetProductDeatilBySKU($rsrow330[$i]['price_sku']); $productlistarray330[]=array( "pr330" => $rsrow330[$i]['price_sku'], "prname330"=>$rsProduct[0]['vproductname'], "prsize330"=>$rsProduct[0]['vweight'], ); } } $localvars = array( "productlistarray110"=>$productlistarray110, "productlistarray120"=>$productlistarray120, "productlistarray130"=>$productlistarray130, "productlistarray210"=>$productlistarray210, "productlistarray220"=>$productlistarray220, "productlistarray230"=>$productlistarray230, "productlistarray310"=>$productlistarray310, "productlistarray320"=>$productlistarray320, "productlistarray330"=>$productlistarray330, "totalpro"=>'9', "price1"=>$price1, "price2"=>$price2, "price3"=>$price3, "p1"=>$p1, "p2"=>$p2, "p3"=>$p3, "Submit1"=>$Submit1, "Submit2"=>$Submit2, "Submit3"=>$Submit3, "bulkprice"=>$bulkprice, "sPageFooter"=>$sPageFooter, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>GetpriceList("Row 1"); $rsrow2 = $oOffer->GetpriceList("Row 2"); $rsrow3 = $oOffer->GetpriceList("Row 3"); $localvars = array( "p1"=>$rsrow1[0]['price_value'], "p2"=>$rsrow2[0]['price_value'], "p3"=>$rsrow3[0]['price_value'], "price1"=>"Price $".$rsrow1[0]['price_value'], "price2"=>"Price $".$rsrow2[0]['price_value'], "price3"=>"Price $".$rsrow3[0]['price_value'], ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>$Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>$Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>$Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>$sessMemberID, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>DirectSelect($db_sql); $sql = "select vthumbimage from productimage where iproductid ='$iproductid' and iprority=1 "; $res = $db->DirectSelect($sql); $image = $res[0]["vthumbimage"]; $image_path = $Site_URL."images/products/thumbimage/".$image; $product_name = $db_res[0]["vproductname"]; $vshortdesc = $db_res[0]["vshortdesc"]; $fsaleprice = $db_res[0]["fsaleprice"]; $factualprice = $db_res[0]["factualprice"]; $localvars = array( "image_path" => $Site_URL."images/products/thumbimage/".$image, "product_name" => $db_res[0]["vproductname"], "vshortdesc" => $db_res[0]["vshortdesc"], "fsaleprice" => $db_res[0]["fsaleprice"], "factualprice" => $db_res[0]["factualprice"], "product_page_link" => $HTTP_REFERER, "iproductid"=>$iproductid, "err_msg"=>$err_msg, ); $smartyvars = array_merge($smartyvars,$localvars); //$indexfile="index_middle.htm"; include_once("include/footer.inc.php"); ?> DirectSelect($db_sql); $message_contents = $db_res[0]["vmailtext"]; if($iproductid) { for($i=0;$i\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"; $vmessage = str_replace("\n","
",$vmessage); $message_contents = str_replace("{SITE_NAME}",$SITE_NAME,stripslashes($message_contents)); $message_contents = str_replace("{vmessage}",$vmessage,stripslashes($message_contents)); $message_contents = str_replace("{product_name}",$product_name,stripslashes($message_contents)); $message_contents = str_replace("{vshortdesc}",$vshortdesc,stripslashes($message_contents)); $message_contents = str_replace("{fsaleprice}",$fsaleprice,stripslashes($message_contents)); $message_contents = str_replace("{factualprice}",$factualprice,stripslashes($message_contents)); $message_contents = str_replace("{image_path}",$image_path,stripslashes($message_contents)); $message_contents = str_replace("{product_page_link}",$product_page_link,stripslashes($message_contents)); $onesendstat = @mail($vtoemail[$i], $subject,$message_contents, $headers); $db_sql="insert into referfriend (vfromemail ,vtoemail ,ddate)values('$vfromemail','$vtoemail[$i]','$ddate')"; //$db_res=$obj->insert($db_sql); } } if($onesendstat) $err_msg = "Mail has been Sent.Thank you for spreading the word about PowerofPerfume.com. We sincerely appreciate your support and loyalty."; // Mail has been sent successfully else $err_msg = "fail to send mail"; // Mail has been not sent successfully header("location:index.php?file=o-tellafriend&err_msg=$err_msg&iproductid=$iproductid"); exit; } else { for($i=0;$i\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"; $vmessage = str_replace("\n","
",$vmessage); //$tpl->load_file('sendmail','./templates/email/email.html'); //$sendmessage = $tpl->pget('sendmail', array('message_contents', 'product_name', 'vshortdesc', 'fsaleprice', 'factualprice', 'vmessage', 'product_page_link','image_path')); $sendmessage = "Hello ".$vtoemail[$i]."

".$SITE_NAME.".com

This is Comments From Your Friend - :
".$vmessage."

Sincerely,
Customer Service
powerofperfume Inc. "; // echo "
sendmessage : ".$sendmessage;exit; $onesendstat = @mail($vtoemail[$i], $subject, $sendmessage, $headers); $db_sql="insert into referfriend (vfromemail ,vtoemail ,ddate)values('$vfromemail','$vtoemail[$i]','$ddate')"; //db_res=$obj->insert($db_sql); } } if($onesendstat) $err_msg = "Mail has been send"; // Mail has been sent successfully else $err_msg = "fail to send mail"; // Mail has been not sent successfully //header("location:$redirectto"); header("location:index.php?file=o-tellafriend&err_msg=$err_msg"); exit; } ?> $Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>$Site_URL, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>\n" . "From: qqualdev@gmail.com \n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"; $header= "To: $to <$to>\n" . "From: $from <$from>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"; $subject="Wholesaler(".$firstname.")"; $mailbody='
 
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.'
 
 
'; mail($to,$subject,$mailbody,$header); header("location: ".Site_URL."index.php"); exit; ?>GetProductDeatilByID($iprodid); $rsImage = $oProduct->ProductImage($product[0]['vSKU']); $product_th_image="images/products/thumbimage/".$rsImage[0]['vthumbimage']; if(file_exists($product_th_image)){ $vthumbimage=Site_URL."images/products/thumbimage/".$rsImage[0]['vthumbimage']; } else{ $vthumbimage=Site_URL."images/default_large_img.jpg"; } $same_products = $oProduct->getsameproducts($product[0]['vproductname']); //$db->printsql(); $giftsetcount=0; $testercount=0; $minicount=0; $fagcount=0; 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"]; } 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, ); }elseif($same_products[$i]["emini"] == "Yes"){ $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, ); }elseif($same_products[$i]["etester"] == "Yes"){ $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, ); }else{ $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, ); } } $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="Children"; $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"=>$product[0]['vproductname'], "productdetail"=>$product[0]['vproductdetail'], "vthumbimage"=>$vthumbimage, "productarr"=>$productarr, "productgifsetarr"=>$productgifsetarr, "producttesterarr"=>$producttesterarr, "productminiarr"=>$productminiarr, "giftsetcount"=>$giftsetcount, "nav"=>$nav, "testercount"=>$testercount, "minicount"=>$minicount, "fagcount"=>$fagcount, "totalpro"=>count($same_products), "iprodid"=>$iprodid, ); $smartyvars = array_merge($smartyvars,$localvars); $indexfile="index.htm"; include_once("include/footer.inc.php"); ?>DirectInsert($db_xsql); if ($db_res == false) { $var_msg = "Sorry! Your request cannot be submitted to us ."; } else{ $vfromemail = "CustomerService@PowerOfPerfume.com"; list($yy,$mm,$dd) = explode("-",$ddateadded); $ddate = $dd."/".$mm."/".$yy; $headers = "To: $vemail <$vemail>\n" . "From: $vfromemail <$vfromemail>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"; $subject = "Customer Request"; $message_contents = "$vname has requested the $vitem product on $ddate"; $message_contents.=" size of product is $vsize"; // $sendmessage = $message_contents; $sendmessage ="
PowerOfPerfume.com
We are here to help you find what you need
E-mail messages are personally read and replied to by our customer service department - you can be sure that somebody will be working to solve your problem or take note of your comments.
 
$vname has requested the $vitem product on $ddateadded size of product is $vsize
 
Contacting us by e-mail
 
PowerOfPerfume.com,
Email: CustomerService@PowerOfPerfume.com
 
"; $onesendstat = @mail($vemail, $subject, $sendmessage, $headers); $var_msg = "Thanks! Your request for the product availability you are looking for has been received by us.
We will contact you as soon as this product becomes available."; } $localvars = array( "custserviceemail"=>$vfromemail, "Site_URL"=>$Site_URL, "ptype"=>$ptype, "comb"=>$comb, "message_contents"=>$message_contents, "var_msg"=>$var_msg, ); $smartyvars = array_merge($smartyvars,$localvars); include_once("include/footer.inc.php"); ?> GetProductDeatilByID($iprodid); $product_name1 = explode("By", $product[0]['vproductname']); $product_name2 = explode("For",$product_name1[1]); $meta = $product_name2[0].",".$product_name1[0].",".$meta; $SiteTitle = "PowerofPerfume, ".str_replace("By","Perfume By" ,ucwords(strtolower($product[0]['vproductname']))); $prod_arry = explode("By",$product[0]['vproductname']); $brnd_arry = explode("For",$prod_arry[1]); $MetaDesc = "power of perfume offers ".ucwords(strtolower($prod_arry[0]))."perfume, ".ucwords(strtolower($product_name)).",".ucwords(strtolower($brnd_arry[0])). "Perfume Items,".ucwords(strtolower($brnd_arry[0]))."fragrance, cheap fragrance for".ucwords(strtolower($brnd_arry[1])).", Discount".ucwords(strtolower($brnd_arry[0]))."perfume, Buy Discount ".ucwords(strtolower($prod_arry[0])). "Cologne Online."; $rsImage = $oProduct->ProductImage($product[0]['vSKU']); ////////Get Current Time for Free Items $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])); ////////End For Get Current Time for Free Items //$vthumbimage = $rsImage[0]['vthumbimage']; $freedisp=""; $product_th_image= $physical_path."images/products/mediumimage/".$rsImage[0]['vmediumimage']; //echo $rsImage[0]['vthumbimage'];echo "
"; if(file_exists($product_th_image) && !empty($rsImage[0]['vmediumimage'])){ $vthumbimage=Site_URL."images/products/mediumimage/".$rsImage[0]['vmediumimage']; } else{ $vthumbimage=Site_URL."images/default_large_img.jpg"; } //$db_sql_gender="select pc.vcategory as pid ,pc.icategoryid as pid1 from category pc,productcat p ,products as pd where p.icategoryid = pc.icategoryid and p.iproductid = '".$product[0]['iproductid']."' and pd.iproductid=p.iproductid and pd.egender in ('M','W')"; //echo "

".$db_sql_gender="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']."' "; $db_sql_gender="select pc.vcategory as pid ,pc.icategoryid as pid1 from category pc,productcat p ,products as pd where p.icategoryid = pc.icategoryid and p.iproductid = '".$product[0]['iproductid']."' and pd.iproductid=p.iproductid and pc.icategoryid in ('4','6')"; //echo $db_sql_gender; $catres_gender = $db->DirectSelect($db_sql_gender); $catname = ucwords($catres_gender[0]["pid"]); $icatid = $catres_gender[0]["pid1"]; if($catname=="Unisex"){ $category_name="Unisex"; $gender="C"; } else{ if($catname=="Men"){ $gender="M"; } if($catname=="Women"){ $gender="W"; } $category_name=$catname; } if (session_is_registered("sessMemberID")){ $same_products = $oProduct->getsameproductsformeber($product[0]['vproductname']); if(count($same_products) <= 0){ $same_products = $oProduct->getsameproducts($product[0]['vproductname']); } }else{ $same_products = $oProduct->getsameproducts($product[0]['vproductname']); } //$db->printsql(); $giftsetcount=0; $testercount=0; $minicount=0; $fagcount=0; /* echo "
";
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;?>




 
DirectSelect("select vlargeimage from productimage where iproductid='$iprodid'"); //print_r($rsImage[0]['vlargeimage']); $Large_Image = ROOT_DIR."images/products/largeimage/".$rsImage[0]['vlargeimage']; if(file_exists($Large_Image) && !empty($rsImage[0]['vlargeimage'])) { $vlargimage=Site_URL."images/products/largeimage/".$rsImage[0]['vlargeimage']; } else{ if (!empty($rsImage[0]['vlargeimage'])){ $vlargimage=Site_URL."images/products/mediumimage/".$rsImage[0]['vlargeimage']; }else{ $vlargimage=Site_URL."images/default_large_img.jpg"; } } ?>
 
 
= $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"; } } 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"){ $type = "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)){ if (empty($price)){ $comb=3;}else{$comb=2;}} if($ptype == "egiftset" || $ptype == "emini" || $ptype == "etester"){ $productlist=$oProduct->GetlookupProductListqTester($prodlist,$comb,$icatid,$keyword,$gender); } else{ $productlist=$oProduct->GetlookupProductListOrder($prodlist,$comb,$icatid,$keyword); } 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,$icatid); $iCount=count($productlist); } if ($view=="all"){$pageproduct=$iCount; $viewflg=0;}else{$pageproduct=16;$viewflg=1;} if($list=="brands"){ $objPage = new Paging($pageproduct,$iCount,'menulink','sbody',true,'brand'); }else { $objPage = new Paging($pageproduct,$iCount,'menulink','sbody',true,$list); } if(!empty($list) && $list!="brand"){ $objPage->arg1 = "/yes"; $viewlink=$_SERVER['REQUEST_URI']."/all"; $viewpagelink=str_replace("/all","",$_SERVER['REQUEST_URI']); }else{ $objPage->arg1 = "&paging=yes&type=$type"; $slink="http://www.powerofperfume.com/index.php?file=p-productlist"; if($category==4 || $category==5 || $category==6){ if($category==4){ $viewlink=$slink."&gender=M&icatid=$category&ibrandid=$ibrandid&list=brand&keyword=$keyword&view=all"; } if($category==5 ){ $viewlink=$slink."&gender=C&icatid=$category&ibrandid=$ibrandid&list=brand&keyword=$keyword&view=all"; } if($category==6){ $viewlink=$slink."&gender=W&icatid=$category&ibrandid=$ibrandid&list=brand&keyword=$keyword&view=all"; } }else{ if (!empty($icatid)){ $viewlink=$_SERVER['REQUEST_URI']."&view=all"; }else{ $viewlink=$slink."&ibrandid=$ibrandid&list=brand&keyword=$keyword&price=$price&view=all"; } } $viewpagelink=str_replace("&view=all","",$_SERVER['REQUEST_URI']); //$viewpagelink=str_replace("\"&keyword=".$keyword."\"","",$viewpagelink); } if(!isset($_REQUEST["pgno"])) { $_REQUEST["pgno"] = ""; } else { $pageno = $_REQUEST["pgno"]; } //for($i=0;$istart;$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;$istart;$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"); ?>= $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;$istart;$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"); ?>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;$iselect($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 = "". $product_img_text.""; $product_th_image = "$alttext"; /* $end_td=""; if(($i+1)%4==0) { $end_tr=""; $spacer_tr_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;$iselect($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;$iselect("select distinct(iparentid) from lookup where ilookupid in $lookuplist1 and icategoryid = '999999998' and estatus = 'Active'"); if($parentres) { $showlookup = 1; } for($i=0;$iselect("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;$jselect("select distinct(iproductid) from lookup_prd where ilookupid = '".$sub_result[$j]["ilookupid"]."' and iproductid in $prodlist"); if($totlookupprod > count($sublookupmore)) $sublookup .= "".$sub_result[$j]["vlookupname"].""; } 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;$zin 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),