alert('No Items Found!');window.location='?page=ordernow';"; die; } $ptype=$_SESSION['pmode']; if(strlen($ptype)==0){ echo ""; die; } $take_status=$ob->checktakeawaystatus(); if($take_status['sts']==false){ if(strpos($take_status['msg'],"other option")!==false && $_SESSION['otype']==0){ echo ""; die; } if(strpos($take_status['msg'],"other option")===false && $take_status['msg']!=""){ echo ""; die; } } ?>
getcouponbycode($_SESSION['coupon']); else $coupon=array(); $sandage=$ob->getsandage(); $delivery=$_SESSION['dcharge']; $otype=$_SESSION['otype']; $ptype=$_SESSION['pmode']; $items=array(); if(!isset($_SESSION['user'])){ echo""; die; } $i=0; foreach($itemall as $item) { $items[$i]['itemid']=$item['id']; $items[$i]['qty']=$item['qty']; $sub=array(); $j=0; $k=0; foreach($item['sub'] as $subitem){ $sub[$j]['item']=$subitem['id']; $sub[$j]['qty']=$subitem['qty']; $sub[$j]['type']=$subitem['type']; $sub[$j]['ext']=$subitem['ext']; $j++; } $items[$i]['sub']=$sub; $i++; } } $total=Checkout::getTotal(); $dtotal=Checkout::getdiscountTotal(); $val=$ob->getonlinediscount(); if($dtotal<=$val['sgift']) unset($_SESSION['sgift']); else{ if(isset($_SESSION['sgift'])) $total+=number_format($_SESSION['sgift']['price']*($_SESSION['sgift']['qty']-1),2); } $val=$ob->getonlinediscount(); $sandage=$ob->getsandage(); $otype=$_SESSION['otype']; $pmode=$_SESSION['pmode']; $dtext=""; if($otype==0){ $disamount=$val['online_discount']; $dtext="Online Delivery Discount"; if($dtotal<=$val['onlineamt']) $disamount=0; if($val['type1']=='%') { $dtext.=""."($disamount %)"; $disamount=$disamount*$dtotal/100; } else $dtext.="(".$currency_symbols[$_SESSION['cur']].($_SESSION['curvalue']*$disamount).")"; if($val['dto']&&$val['dfrom']){ if($val['dfrom']>time()|| $val['dto']time()|| $val['cto']window.location='?page=ordernow'"; die; } if($items){ $user['fname']=str_replace("+"," ",urlencode(str_replace("\n"," ",$user['fname']))); $user['lname']=str_replace("+"," ",urlencode(str_replace("\n"," ",$user['lname']))); $user['dno']=str_replace("+"," ",urlencode(str_replace("\n"," ",$user['dno']))); $user['phone']=str_replace("+"," ",urlencode(str_replace("\n"," ",$user['phone']))); $user['add1']=str_replace("+"," ",urlencode(str_replace("\n"," ",$user['add1']))); $user['add2']=str_replace("+"," ",urlencode(str_replace("\n"," ",$user['add2']))); $user['postcode']=str_replace("+"," ",urlencode(str_replace("\n"," ",$user['postcode']))); $data=array('refno'=>'','ddesc'=>$dtext,'free'=>round($disamount,2),'fgift'=>$fgift,'sgift'=>$sgift,'sandage'=>$sandage,'inst'=>str_replace("+"," ",urlencode(str_replace("\n"," ",$_SESSION['inst']))),'items'=>$items,'discount'=>$discount,'coupon'=>$coupon,'delivery'=>$delivery,'user'=>$user,'otype'=>$otype,'ptype'=>$ptype); } else{ $data=$_SESSION['corder']; } $mail=new email(); $sms=new sms(); if($data['ptype']=='0' || (isset($_POST['id'])&&$_POST['object']=="token")){ if(isset($_POST['id'])&&$_POST['object']=="token"){ require_once(dirname(__FILE__).'/init.php'); $payset=$ob->getpaymentsetting(); if($payset['live']) \Stripe\Stripe::setApiKey("sk_live_KsBg66XOeYWIggKf0gKC2FFa"); else \Stripe\Stripe::setApiKey("sk_test_oApoMWqGQ1Cg6ni7WwlKEenI"); if(isset($user['email'])) $desc=$user['fname']." ".$user['lname'].", ".$user['email']; else $desc=$user['fname']." ".$user['lname']; try { $total=number_format($total+$data['delivery']+$data['sandage']['bank']+$data['sandage']['bag']-$data['discount']-$data['free'],2); $gtotal=str_replace(".","",$total); $gtotal=str_replace(",","",$gtotal); $token = $_POST['id']; $customer=\Stripe\Customer::create(array( "description" => $desc, "source" => $token // obtained with Stripe.js )); $charge=\Stripe\Charge::create(array( 'amount' => $gtotal, 'currency' => 'gbp', "customer" => $customer->id, "application_fee" => (round(($gtotal/100)*2.8)+20), "destination"=> $payset['api_id'] )); unset($_SESSION['corder']); } catch(\Stripe\Error\Card $e) { echo ""; die; } $data['refno']=json_encode($charge,true); } if(isset($_SESSION['inst'])) $data['inst']=str_replace("+"," ",urlencode(str_replace("\n"," ",$_SESSION['inst']))); $oid=$order->placeorder($data); if($oid>0){ unset($_SESSION['product']); unset($_SESSION['inst']); unset($_SESSION['discount']); unset($_SESSION['free']); unset($_SESSION['otype']); unset($_SESSION['fgift']); unset($_SESSION['sgift']); unset($_SESSION['token']); unset($_SESSION['data']); unset($_SESSION['cart']); $odet=$order->getorderbyid($oid); email::sentordermail($odet); SMS::sentordersms($odet); //header("location:success.php?oid=$oid"); echo ""; die; } else{ mail("anbarasu@hsstechs.com,hari@hsstechs.com","unable to place order at ".$_SERVER['HTTP_HOST'],"order details in json ".json_encode($data)); //header("location:error.php"); echo ""; die; } }else{ $payset=$ob->getpaymentsetting(); if(($total+$delivery+$sandage['bank']+$sandage['bag']-$data['discount']-$data['free'])<1){ echo""; die; } $_SESSION['corder']=$data; ?>