$data[$i]["one_sub_total"] += $arr["Price"];
$data[$i]["sub_total"] += $data[$i]["Quantity"]*$arr["Price"];
$order->Price += $arr["Price"]*$proinfo[$i]["Quantity"];
$proinfo[$i]["Price"] += $arr["Price"];
$proinfo[$i]["ProductPrice"] += $arr["Price"];
$proinfo[$i]["Total"] += $arr["Price"]*$proinfo[$i]["Quantity"];
//$order->Total += $arr["Price"]*$proinfo[$i]["Quantity"];
$Coupons[0]["Amount"] = $this->webConfig['CouponAmount'];
$Coupons[0]["CouponName"] = $this->webConfig['CouponTitle'];
$Coupons[0]["CreatedTime"] = date("Y-m-d H:i:s");
$Coupons[0]["Description"] = $this->webConfig['CouponText'];
$Coupons[0]["OrderNO"] = $order->OrderNO;
$coupon = $this->webConfig['CouponAmount'];
$data[$i]["checkedFlag"]="checked=\"checked\"";
$data[$i]["one_sub_total"] = $data[$i]["ProductPrice"];
$data[$i]["one_sub_total"] = round($data[$i]["ProductPrice"]*(1-$data[$i]["Discount"]*0.01));
$data[$i]["sub_total"] = $data[$i]["Quantity"]*$data[$i]["ProductPrice"];
$data[$i]["sub_total"] = $data[$i]["Quantity"]*round($data[$i]["ProductPrice"]*(1-$data[$i]["Discount"]*0.01));
$order->Price += $proinfo[$i]["Total"];
$order->Price += $proinfo[$i]["Total"];
$order->Price = $order->Price - $Coupons[0]["Amount"];
$proinfo[$i]["Discount"] = 0;
$proinfo[$i]["Price"] = $proinfo[$i]["ProductPrice"];
$proinfo[$i]["Price"] = round($proinfo[$i]["ProductPrice"]*(1-$proinfo[$i]["Discount"]*0.01));
$proinfo[$i]["Total"] = $proinfo[$i]["Price"]*$proinfo[$i]["Quantity"];
$proinfo[$i]["Total"] = $proinfo[$i]["Price"]*$proinfo[$i]["Quantity"];
$sub_total += $data[$i]["Quantity"]*$data[$i]["ProductPrice"];
$sub_total += $data[$i]["Quantity"]*round($data[$i]["ProductPrice"]*(1-$data[$i]["Discount"]*0.01));
//$data[$i]["Price"] = round($data[$i]["ProductPrice"]*(1-$data[$i]["Discount"]*0.01));
//$order->Total += $proinfo[$i]["Quantity"]*$proinfo[$i]["ProductPrice"];
//$order->Total += $proinfo[$i]["Total"];
if($arr["Price"]>0){
parent::redirect(utility::getAppRoot()."/login.html?returnUrl=".urlencode($this->appRoot."/checkout.html"));
parent::redirect(utility::getAppRoot()."/login.html?returnUrl=".urlencode($this->appRoot."/checkout.html?isc=".$_GET['isc']));
}
}
$order->OrderProducts[$i]['Attribute'] = json_decode($order->OrderProducts[$i]["Attribute"],true);
if($arr["Price"]>0){
$Attributes = $this->getAttribute($this->cart, $proinfo[$i]["AttributeIDS"]);
$QuantityTotal += $proinfo[$i]["Quantity"];
$_SESSION[sessionKeys::$orderID] = $result;
$data[$i]["Attribute"] = $this->getAttribute($this->cart, $data[$i]["AttributeIDS"]);
$deliveryFormat[$row['DeliveryID']] = $row['Amount'];
$isc = $_GET['isc'];
$mail = new PHPMailer(true);
$order->OrderID = $_SESSION[sessionKeys::$orderID];
$order->OrderNO=date("Ymd").utility::getRandomString(6,1);
$order->ShipPrice = $this->webConfig["shipCoats"];
$order->loadRecord();
$pay = new pay();
$proinfo[$i]["Attribute"] = json_encode($Attributes, JSON_UNESCAPED_UNICODE);
$sub_qty += $data[$i]["Quantity"];
$this->cart->deleteRecord(session_id());
/*把訂單id寫入session*/
/*清空購物車*/
/*转向支付方式*/
//echo $_SESSION[sessionKeys::$orderID];
//exit;
//发邮件
echo "";
echo "";
echo json_encode(array("code"=>1, "redirectUrl"=>$pay->getRedirectUrl()));
else
exit;
for($i=0; $iOrderProducts); $i++){
foreach($Attributes as $arr){
foreach($data[$i]["Attribute"] as $arr){
if($i==0)
if($order->Price >= $this->webConfig['CouponLimit']){
if($sub_total >= $this->webConfig['CouponLimit']){
if(isset($data[$i]["Discount"]) && $data[$i]["Discount"]>0){
if(isset($proinfo[$i]["Discount"]) && $proinfo[$i]["Discount"]>0){
parent::alert("すみません、ご注文が失敗しました。");
require_once $payment->Interface;
tpl::$page->assign("PaymentName", $payment->Name);
unset($mail);
}
}
}
}
}
}
}
}else{
}else{
// parent::redirect($this->appRoot."/".$payment->Interface);
session_start();
session_start();
$Coupons = array();
$DeliveryID = $_POST["DeliveryID"];
$QuantityTotal = 0;
$country=new countryDAL();
$coupon = 0;
$data=$country->executeRecordset("a.Visible='1' AND a.ParentID='0'");
$data=$delivery->executeRecordset("a.Visible='1'", "a.OrderNO ASC");
$data=$payment->executeRecordset("Visible='1'");
$data=$this->cart->executeSumRecord("a.SessionID='".session_id()."'");
$delivery = new deliveryDAL();
$delivery->DeliveryID = $DeliveryID;
$delivery->loadRecord();
$delivery=new deliveryDAL();
$deliveryFormat = array();
$isc = "";
$order->Address=conver::toDbString(strings::isEmptyOrNull($_POST['Street1'])?$user->Address:$_POST['Street1']);
$order->City=conver::toDbString(strings::isEmptyOrNull($_POST['City'])?$user->City:$_POST['City']);
$order->Company = conver::toDbString(strings::isEmptyOrNull($_POST["Company"])?$user->Company:$_POST["Company"]);
$order->Coupons = $Coupons;
$order->CreatedTime = date("Y-m-d H:i:s"); /*創建時間*/
$order->Email=conver::toDbString(strings::isEmptyOrNull($_POST['Email'])?$user->Email:$_POST['Email']);
$order->FamilyKana=conver::toDbString(strings::isEmptyOrNull($_POST['FamilyKana'])?$user->Email:$_POST['FamilyKana']);
$order->Finished = 1;
$order->FirstName=conver::toDbString(strings::isEmptyOrNull($_POST['FirstName'])?$user->FirstName:$_POST['FirstName']);
$order->Flags = 0;
$order->GivenKana=conver::toDbString(strings::isEmptyOrNull($_POST['GivenKana'])?$user->Email:$_POST['GivenKana']);
$order->House=conver::toDbString(strings::isEmptyOrNull($_POST['Street2'])?$user->House:$_POST['Street2']);
$order->IpAddress = $_SERVER["REMOTE_ADDR"]; /*IP地址*/
$order->IsPayed = 0;
$order->IsShipped = 0;
$order->LastName=conver::toDbString(strings::isEmptyOrNull($_POST['LastName'])?$user->LastName:$_POST['LastName']);
$order->OrderNO=date("Ymd").utility::getRandomString(6,1);
$order->OrderProducts = $proinfo;
$order->PaymentID = $PaymentID; /*支付方式*/
$order->Price += $order->ShipPrice;
$order->Reply = conver::toDbString($_POST["Reply"]);
$order->State=conver::toDbString(strings::isEmptyOrNull($_POST['State'])?$user->State:$_POST['State']);
$order->Telephone=strings::isEmptyOrNull($_POST['Telephone'])?$user->Telephone:$_POST['Telephone'];
$order->Total = $order->Price;
$order->UserID = !empty(parent::getCurrentUserID())?parent::getCurrentUserID():0 ; /*用戶ID*/
$order->ZipCode=strings::isEmptyOrNull($_POST['PostalCode'])?$user->ZipCode:$_POST['PostalCode'];
$order=new orderDAL();
$payment->PaymentID = $PaymentID;
$payment->loadRecord();
$payment=new paymentDAL();
$payment=new paymentDAL();
$proinfo = $this->cart->executeRecordset("SessionID='".session_id()."'");
$result=$order->insertRecord();
$row=$data[0];
$sub_qty = 0;
$this->cart=new cartDAL();
$this->user->UserID=$userID;
$this->user->loadRecord();
$user->UserID=parent::getCurrentUserID();
$user->loadRecord();
$user=new userDAL();
$zip = explode('-',$this->user->ZipCode);
*/
/*
/*優惠劵*/
/*優惠劵*/
/*取得积分返回率*/
/*客戶個人資料*/
/*客戶留言*/
/*总价*/
/*总数量*/
/*支付方式*/
/*日本東京時間*/
/*當前用戶信息*/
/*系統默認折扣 1*/
/*訂單基本信息*/
/*讀取購物車內容*/
/*購物車信息*/
/*購物車列表*/
//$order->CountryID=strings::isEmptyOrNull($_POST["CountryID"])?$user->CountryID:$_POST["CountryID"];
//$order->Fax=strings::isEmptyOrNull($_POST["Fax"])?$user->Fax:$_POST["Fax"];
//$order->MSN=conver::toDbString(strings::isEmptyOrNull($_POST["MSN"])?$user->MSN:$_POST["MSN"]);
//$order->MobilePhone=strings::isEmptyOrNull($_POST["MobilePhone"])?$user->MobilePhone:$_POST["MobilePhone"];
//$order->OrderNO=date("Ymd")."-".registryDAL::getRegistryValue("SXY_mid")."-".utility::getRandomString(5,1); /*訂單編號*/
//$order->ShipID = $delivery->DeliveryID; /*快遞方式*/
//$order->ShipPrice = $delivery->Amount; /*運費(這裡為0,免費)*/
//$this->cart =new cartDAL();
//exit;
//exit;
//print_r($order->OrderProducts);
date_default_timezone_set('Asia/Tokyo');
for($i=0; $iwebConfig["IsFree"] ==0 && $this->webConfig["freeCoats"] > $order->Price){
if(isset($_GET['isc']) && $_GET['isc']==1 && $this->webConfig['IsCoupon']==1){
if(isset($_GET['isc']) && $_GET['isc']==1){
if(isset($_POST['IsCoupon']) && $_POST['IsCoupon']==1 && $this->webConfig['IsCoupon']==1){
tpl::$page->assign("cart", $data);
tpl::$page->assign("coupon", $coupon);
tpl::$page->assign("delivery", $data);
tpl::$page->assign("deliveryJson", json_encode($deliveryFormat));
tpl::$page->assign("isc",$isc);
tpl::$page->assign("payment",$data);
tpl::$page->assign("sub_qty",$sub_qty);
tpl::$page->assign("tel",$tel);
tpl::$page->assign("totalQuantity",$row["TotalQuantity"]);
tpl::$page->assign("user",$this->user);
while($order->checkOrderNOExists($order->OrderNO)){
{
{
{
}
}
}
}
}
}
}
}
}
}else{
private $cart;
public function loadData()
$this->loadData();
$this->saveData();
//$order->OrderNO=date("Ymd")."-ST".utility::getRandomString(6,1);
exit;
if(isset($_GET['isc']) && $_GET['isc']==1)
parent::alert("お支払い方法を選択してください!");
parent::redirect(utility::getAppRoot()."/cart.html");
$IsDiscount = $this->webConfig['IsDiscount'];
$PaymentID = $_POST["PaymentID"];
$data = $this->cart->executeRecordset("SessionID='".session_id()."'");
$discount = 1;
$returnRate = $this->webConfig['returnRate'];
$sub_total=0;
$this->user=new userDAL();
$userID=parent::getCurrentUserID();
/*折扣開關*/
/*是否選擇了支付方式*/
/*用戶信息*/
//加載模板
//父類方法
//货运列表
else
for($i=0;$iassign("sub_total",$sub_total);
tpl::show("home/checkout.html");
{
{
}
}
}
}*/
private $user;
private function saveData()
public function load()
{
{
{
}
}
}
//echo $buffer;
//exit;
$content = tpl::$page->fetch("home/order_email.html");
parent::loadData();
tpl::$page->assign("QuantityTotal", $QuantityTotal);
tpl::$page->assign("order", $order);
tpl::$page->assign("product", $proinfo);
exit;
$sub_total += $data[$i]["Quantity"]*$arr["Price"];
echo $e;
$mail->AltBody = "=?utf-8?B?".base64_encode("【Merrss】ご注文ありがとうございます")."?=";
$mail->Body = $content;
$mail->CharSet = 'UTF-8';
$mail->Host = 'smtp.gmail.com'; //Set the SMTP server to send through
$mail->Password = 'fpgsvbfibtyhsfsl'; //esor arre ttvn ulqf //SMTP password
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->SMTPDebug = 0; //Enable verbose debug output
$mail->SMTPSecure = 'ssl';
$mail->Subject = "=?utf-8?B?".base64_encode("【Merrss】ご注文ありがとうございます")."?=";
$mail->Username = 'asrrss.com@gmail.com'; //SMTP username
$mail->addAddress("asrrss.com@gmail.com");
$mail->addAddress($order->Email);
$mail->addReplyTo('asrrss.com@gmail.com', '石原智美');
$mail->clearAddresses();
$mail->isHTML(true); //Set email format to HTML
$mail->isSMTP(); //Send using SMTP
$mail->send();
$mail->send();
$mail->setFrom('asrrss.com@gmail.com', '石原智美');
//$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
//$mail->addAddress('ellen@example.com'); //Name is optional
//$mail->addAddress('joe@example.net', 'Joe User'); //Add a recipient
//Content
//Recipients
$order->Quantity += $proinfo[$i]["Quantity"];
$proinfo[$i]["AttributeArr"] = $Attributes;
*/
5
try {
}
} catch (Exception $e) {
$order->CountryID = 25;
$tel = explode('-',$this->user->Telephone);
/*
/*国家列表*/
//$order->OrderNO=date("Ymd")."-ST".utility::getRandomString(6,1); /*訂單編號*/
//$order->Sex=strings::isEmptyOrNull($_POST["Sex"])?$user->Sex:$_POST["Sex"];
tpl::$page->assign("country",$data);
tpl::$page->assign("zip",$zip);
#require_once 'bin/system/PHPMailer/PHPMailerAutoload.php';
$page->load();
$page=new _checkout();
* -------------------------------------------------------
* -------------------------------------------------------
* -------------------------------------------------------
* Author:Tomix
* Copyright:
* Created:2009
* Description:
* File:checkout.php
* Modified history:
*/
//require_once "bin/system/email.php";
//require_once "bin/web/repeater.php";
//require_once "dal/cartDAL.php";
//require_once "dal/categoryDAL.php";
//require_once "dal/couponDAL.php";
//require_once "dal/ratingDAL.php";
class _checkout extends pageBase
require_once "bin/system/conver.php";
require_once "bin/system/strings.php";
require_once "bin/system/utility.php";
require_once "controls/dropDownList.php";
require_once "dal/countryDAL.php";
require_once "dal/deliveryDAL.php";
require_once "dal/orderDAL.php";
require_once "dal/paymentDAL.php";
require_once "dal/registryDAL.php";
require_once "dal/userDAL.php";
require_once "modules/currency.php";
require_once "modules/sessionKeys.php";
require_once "pageBase.php";
require_once 'bin/system/vendor/autoload.php';
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
{
}
/*---------------------------------------------------------
// totalQuantity,totalWeight,totalPrice
/