Source for file LC_Page_Shopping_Complete.php
Documentation is available at LC_Page_Shopping_Complete.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(CLASS_PATH .
"pages/LC_Page.php");
* @author LOCKON CO.,LTD.
* @version $Id:LC_Page_Shopping_Complete.php 15532 2007-08-31 14:39:46Z nanasess $
$this->arrCONVENIENCE =
$masterData->getMasterData("mtb_convenience");
$this->arrCONVENIMESSAGE =
$masterData->getMasterData("mtb_conveni_message");
$objSiteInfo =
$objView->objSiteInfo;
$this->arrInfo =
$objSiteInfo->data;
// 前のページで正しく登録手続きが行われたか判定
// ユーザユニークIDの取得と購入状態の正当性をチェック
$uniqid =
SC_Utils_Ex::sfCheckNormalAccess($this->objSiteSess, $this->objCartSess);
$this->objCustomer->updateSession();
$mailHelper->sfSendOrderMail($order_id, '1');
$arrResults =
$objQuery->getall("SELECT memo02, memo05 FROM dtb_order WHERE order_id = ? ", array($order_id));
if (count($arrResults) >
0) {
if (isset
($arrResults[0]["memo02"]) || isset
($arrResults[0]["memo05"])) {
$arrModuleParam =
unserialize($arrResults[0]["memo05"]);
foreach($arrOther as $key =>
$val){
if (preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $val["value"])) {
$arrOther[$key]["value"] =
"<a href='".
$val["value"] .
"' target=\"_blank\">" .
$val["value"] .
"</a>";
$this->arrOther =
$arrOther;
$this->arrModuleParam =
$arrModuleParam;
$this->tpl_conv_page =
AFF_SHOPPING_COMPLETE;
$this->tpl_aff_option =
"order_id=$order_id";
$total =
$objQuery->get("dtb_order", "total", "order_id = ? ", array($order_id));
$this->tpl_aff_option.=
"|total=$total";
$this->is_campaign =
$this->objCampaignSess->getIsCampaign();
$this->campaign_dir =
$this->objCampaignSess->getCampaignDir();
$objView->assignobj($this);
// フレームを選択(キャンペーンページから遷移なら変更)
$this->objCampaignSess->pageView($objView);
$this->objCampaignSess->delCampaign();
$objSiteInfo =
$objView->objSiteInfo;
$this->arrInfo =
$objSiteInfo->data;
// 前のページで正しく登録手続きが行われたか判定
// ユーザユニークIDの取得と購入状態の正当性をチェック
$uniqid =
SC_Utils_Ex::sfCheckNormalAccess($this->objSiteSess, $this->objCartSess);
$this->objCustomer->updateSession();
$mailHelper->sfSendOrderMail($order_id, '2');
$other_data =
$objQuery->get("dtb_order", "memo02", "order_id = ? ", array($order_id));
foreach($arrOther as $key =>
$val){
if (preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $val["value"])) {
$arrOther[$key]["value"] =
"<a href='".
$val["value"].
"'>".
$val["value"].
"</a>";
$this->arrOther =
$arrOther;
$this->tpl_conv_page =
AFF_SHOPPING_COMPLETE;
$this->tpl_aff_option =
"order_id=$order_id";
$total =
$objQuery->get("dtb_order", "total", "order_id = ? ", array($order_id));
$this->tpl_aff_option.=
"|total=$total";
$objView->assignobj($this);
$objView->display(SITE_FRAME);
$col =
"customer_id, total, order_sex, order_job, to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) AS order_age";
$arrRet =
$objQuery->select($col, "dtb_order", "order_id = ?", array($order_id));
if($arrRet[0]['customer_id'] >
0) {
$arrEbis['m1id'] =
$arrRet[0]['customer_id'];
$arrEbis['a1id'] =
$arrRet[0]['total'];
$arrEbis['o2id'] =
$arrRet[0]['order_sex'];
$arrEbis['o3id'] =
$arrRet[0]['order_age'];
$arrEbis['o4id'] =
$arrRet[0]['order_job'];
$objQuery->setgroupby("product_id");
$arrRet =
$objQuery->select("product_id", "dtb_order_detail", "order_id = ?", array($order_id));
$arrProducts =
sfSwapArray($arrRet);
foreach($arrProducts['product_id'] as $val) {
$arrEbis['o1id'] =
$line;
* @param object $objQuery
* @return string $order_id
$arrData =
$objDb->sfGetOrderTemp($uniqid);
if ($this->objCustomer->isLoginSuccess(true)) {
$this->lfSetNewAddr($uniqid, $this->objCustomer->getValue('customer_id'));
switch(PURCHASE_CUSTOMER_REGIST) {
if(isset
($arrData['member_check']) &&
$arrData['member_check'] ==
'1') {
$order_id =
$this->lfRegistOrder($objQuery, $arrData, $this->objCampaignSess);
if($this->objCampaignSess->getIsCampaign() and $this->objCartSess->chkCampaign($this->objCampaignSess->getCampaignId())) {
$this->objCartSess->delAllProducts();
$this->objSiteSess->unsetUniqId();
$sqlval['name01'] =
$arrData['order_name01'];
$sqlval['name02'] =
$arrData['order_name02'];
$sqlval['kana01'] =
$arrData['order_kana01'];
$sqlval['kana02'] =
$arrData['order_kana02'];
$sqlval['zip01'] =
$arrData['order_zip01'];
$sqlval['zip02'] =
$arrData['order_zip02'];
$sqlval['pref'] =
$arrData['order_pref'];
$sqlval['addr01'] =
$arrData['order_addr01'];
$sqlval['addr02'] =
$arrData['order_addr02'];
$sqlval['email'] =
$arrData['order_email'];
$sqlval['tel01'] =
$arrData['order_tel01'];
$sqlval['tel02'] =
$arrData['order_tel02'];
$sqlval['tel03'] =
$arrData['order_tel03'];
$sqlval['fax01'] =
$arrData['order_fax01'];
$sqlval['fax02'] =
$arrData['order_fax02'];
$sqlval['fax03'] =
$arrData['order_fax03'];
$sqlval['sex'] =
$arrData['order_sex'];
$sqlval['password'] =
$arrData['password'];
$sqlval['reminder'] =
$arrData['reminder'];
$sqlval['reminder_answer'] =
$arrData['reminder_answer'];
switch($arrData['mail_flag']) {
$sqlval['mailmaga_flg'] =
$mail_flag;
$sqlval['secret_key'] =
SC_Utils_Ex::sfGetUniqRandomId("t");
$sqlval['create_date'] =
"now()";
$sqlval['update_date'] =
"now()";
$objQuery->insert("dtb_customer", $sqlval);
$arrRet =
$objQuery->select("customer_id", "dtb_customer", "secret_key = ?", array($sqlval['secret_key']));
$customer_id =
$arrRet[0]['customer_id'];
$objMailPage->to_name01 =
$arrData['order_name01'];
$objMailPage->to_name02 =
$arrData['order_name02'];
$objMailPage->CONF =
$arrInfo;
$objMailPage->uniqid =
$sqlval['secret_key'];
$objMailView->assignobj($objMailPage);
$body =
$objMailView->fetch("mail_templates/customer_mail.tpl");
, $mailHelper->sfMakeSubject("会員登録のご確認") // サブジェクト
, $arrInfo['email03'] // 配送元アドレス
, $arrInfo['shop_name'] // 配送元 名前
, $arrInfo["email03"] // reply_to
, $arrInfo["email04"] // return_path
, $arrInfo["email04"] // Errors_to
, $arrInfo["email01"] // Bcc
$name =
$arrData['order_name01'] .
$arrData['order_name02'] .
" 様";
$objMail->setTo($arrData['order_email'], $name);
function lfRegistOrder($objQuery, $arrData, $objCampaignSess =
null) {
unset
($sqlval['mailmaga_flg']); // メルマガチェック
unset
($sqlval['deliv_check']); // 別のお届け先チェック
unset
($sqlval['point_check']); // ポイント利用チェック
unset
($sqlval['member_check']); // 購入時会員チェック
unset
($sqlval['password']); // ログインパスワード
unset
($sqlval['reminder']); // リマインダー質問
unset
($sqlval['reminder_answer']); // リマインダー答え
unset
($sqlval['mail_flag']); // メールフラグ
unset
($sqlval['session']); // セッション情報
// 注文ステータス:指定が無ければ新規受付に設定
if($sqlval["status"] ==
""){
// 別のお届け先を指定していない場合、配送先に登録住所をコピーする。
if($arrData["deliv_check"] ==
"-1") {
$sqlval['deliv_name01'] =
$arrData['order_name01'];
$sqlval['deliv_name02'] =
$arrData['order_name02'];
$sqlval['deliv_kana01'] =
$arrData['order_kana01'];
$sqlval['deliv_kana02'] =
$arrData['order_kana02'];
$sqlval['deliv_pref'] =
$arrData['order_pref'];
$sqlval['deliv_zip01'] =
$arrData['order_zip01'];
$sqlval['deliv_zip02'] =
$arrData['order_zip02'];
$sqlval['deliv_addr01'] =
$arrData['order_addr01'];
$sqlval['deliv_addr02'] =
$arrData['order_addr02'];
$sqlval['deliv_tel01'] =
$arrData['order_tel01'];
$sqlval['deliv_tel02'] =
$arrData['order_tel02'];
$sqlval['deliv_tel03'] =
$arrData['order_tel03'];
$order_id =
$arrData['order_id']; // オーダーID
$sqlval['create_date'] =
'now()'; // 受注日
if($objCampaignSess->getIsCampaign()) $sqlval['campaign_id'] =
$objCampaignSess->getCampaignId();
//$sqlval = lfGetInsParam($sqlval);
$objQuery->insert("dtb_order", $sqlval);
$arrCart =
$objCartSess->getCartList();
$objQuery->delete("dtb_order_detail", "order_id = $order_id");
$arrClassName =
$objDb->sfGetIDValueList("dtb_class", "class_id", "name");
$arrClassCatName =
$objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
for ($i =
0; $i <
$max; $i++
) {
$arrData =
$objDb->sfGetProductsClass($arrCart[$i]['id']);
$sqlval['order_id'] =
$order_id;
$sqlval['product_id'] =
$arrCart[$i]['id'][0];
$sqlval['classcategory_id1'] =
$arrCart[$i]['id'][1];
$sqlval['classcategory_id2'] =
$arrCart[$i]['id'][2];
$sqlval['product_name'] =
$arrData['name'];
$sqlval['product_code'] =
$arrData['product_code'];
$sqlval['classcategory_name1'] =
$arrClassCatName[$arrData['classcategory_id1']];
$sqlval['classcategory_name2'] =
$arrClassCatName[$arrData['classcategory_id2']];
$sqlval['point_rate'] =
$arrCart[$i]['point_rate'];
$sqlval['price'] =
$arrCart[$i]['price'];
$sqlval['quantity'] =
$arrCart[$i]['quantity'];
$this->lfReduceStock($objQuery, $arrCart[$i]['id'], $arrCart[$i]['quantity']);
$objQuery->insert("dtb_order_detail", $sqlval);
SC_Utils_Ex::sfDispSiteError(CART_NOT_FOUND, "", false, "", true);
$cols =
"order_id, campaign_id, customer_id, message, order_name01, order_name02,".
"order_kana01, order_kana02, order_email, order_tel01, order_tel02, order_tel03,".
"order_fax01, order_fax02, order_fax03, order_zip01, order_zip02, order_pref, order_addr01,".
"order_addr02, order_sex, order_birth, order_job, deliv_name01, deliv_name02, deliv_kana01,".
"deliv_kana02, deliv_tel01, deliv_tel02, deliv_tel03, deliv_fax01, deliv_fax02, deliv_fax03,".
"deliv_zip01, deliv_zip02, deliv_pref, deliv_addr01, deliv_addr02, payment_total";
$arrOrder =
$objQuery->select($cols, "dtb_order", "order_id = ?", array($order_id));
$sqlval['create_date'] =
'now()';
$objQuery->insert("dtb_campaign_order", $sqlval);
$total_count =
$objQuery->get("dtb_campaign", "total_count", "campaign_id = ?", array($sqlval['campaign_id']));
$arrCampaign['total_count'] =
$total_count +=
1;
$objQuery->update("dtb_campaign", $arrCampaign, "campaign_id = ?", array($sqlval['campaign_id']));
$where =
"order_temp_id = ?";
$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
// $objQuery->delete("dtb_order_temp", $where, array($uniqid));
// 受注一時テーブルの住所が登録済みテーブルと異なる場合は、別のお届け先に追加する
$col =
"deliv_name01,deliv_name02,deliv_kana01,deliv_kana02,deliv_tel01,deliv_tel02,deliv_tel03,deliv_zip01,deliv_zip02,deliv_pref,deliv_addr01,deliv_addr02";
$where =
"order_temp_id = ?";
$arrRet =
$objQuery->select($col, "dtb_order_temp", $where, array($uniqid));
foreach($arrRet[0] as $key =>
$val) {
$arrNew[$keyname] =
$val;
$col =
"name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
$where =
"customer_id = ?";
$arrCustomerAddr =
$objQuery->select($col, "dtb_customer", $where, array($customer_id));
if($arrNew !=
$arrCustomerAddr[0]) {
$col =
"name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
$where =
"customer_id = ?";
$arrOtherAddr =
$objQuery->select($col, "dtb_other_deliv", $where, array($customer_id));
foreach($arrOtherAddr as $arrval) {
// 新しいお届け先が登録済みのものと異なる場合は別のお届け先テーブルに登録する
$sqlval['customer_id'] =
$customer_id;
$objQuery->insert("dtb_other_deliv", $sqlval);
$col =
"first_buy_date, last_buy_date, buy_times, buy_total, point";
$where =
"customer_id = ?";
$arrRet =
$objQuery->select($col, "dtb_customer", $where, array($customer_id));
if($sqlval['first_buy_date'] ==
"") {
$sqlval['first_buy_date'] =
"Now()";
$sqlval['last_buy_date'] =
"Now()";
$sqlval['buy_total']+=
$arrData['total'];
if (USE_POINT !==
false) {
$sqlval['point'] -=
$arrData['use_point'];
if($sqlval['point'] <
0) {
$objQuery->update("dtb_customer", $sqlval, $where, array($customer_id));
$where =
"product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
$arrRet =
$objQuery->select("stock, stock_unlimited", "dtb_products_class", $where, $arrID);
if(($arrRet[0]['stock_unlimited'] !=
'1' &&
$arrRet[0]['stock'] <
$quantity) ||
$quantity ==
0) {
} elseif($arrRet[0]['stock_unlimited'] ==
'1') {
$objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
$sqlval['stock'] =
($arrRet[0]['stock'] -
$quantity);
if($sqlval['stock'] ==
"") {
$objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
if (NOSTOCK_HIDDEN ===
true) {
$objDb->sfCategory_Count($objQuery);
foreach($_GET as $key =>
$val){
if($objDb->sfColumnExists("dtb_order", $key)) $sqlVal[$key] =
$val;
Documentation generated on Tue, 28 Apr 2009 18:12:53 +0900 by phpDocumentor 1.4.2