Page
[ class tree: Page ] [ index: Page ] [ all elements ]

Source for file LC_Page_Shopping_Confirm.php

Documentation is available at LC_Page_Shopping_Confirm.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.lockon.co.jp/
  8.  *
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  */
  23.  
  24. // {{{ requires
  25. require_once(CLASS_PATH "pages/LC_Page.php");
  26.  
  27. /**
  28.  * 入力内容確認のページクラス.
  29.  *
  30.  * @package Page
  31.  * @author LOCKON CO.,LTD.
  32.  * @version $Id:LC_Page_Shopping_Confirm.php 15532 2007-08-31 14:39:46Z nanasess $
  33.  */
  34. class LC_Page_Shopping_Confirm extends LC_Page {
  35.  
  36.     // }}}
  37.     // {{{ functions
  38.  
  39.     /**
  40.      * Page を初期化する.
  41.      *
  42.      * @return void 
  43.      */
  44.     function init({
  45.         parent::init();
  46.         $this->tpl_mainpage = 'shopping/confirm.tpl';
  47.         $this->tpl_column_num = 1;
  48.         $this->tpl_css = URL_DIR.'css/layout/shopping/confirm.css';
  49.         $this->tpl_title = "ご入力内容のご確認";
  50.         $masterData new SC_DB_MasterData();
  51.         $this->arrPref $masterData->getMasterData("mtb_pref"array("pref_id""pref_name""rank"));
  52.         $this->arrSex $masterData->getMasterData("mtb_sex");
  53.         $this->arrMAILMAGATYPE $masterData->getMasterData("mtb_mail_magazine_type");
  54.         $this->arrReminder $masterData->getMasterData("mtb_reminder");
  55.  
  56.         $this->allowClientCache();
  57.     }
  58.  
  59.     /**
  60.      * Page のプロセス.
  61.      *
  62.      * @return void 
  63.      */
  64.     function process({
  65.         global $objCampaignSess;
  66.  
  67.         $objView new SC_SiteView();
  68.         $objCartSess new SC_CartSession();
  69.         $objSiteInfo $objView->objSiteInfo;
  70.         $objSiteSess new SC_SiteSession();
  71.         $objCampaignSess new SC_CampaignSession();
  72.         $objCustomer new SC_Customer();
  73.         $arrInfo $objSiteInfo->data;
  74.         $objQuery new SC_Query();
  75.         $objDb new SC_Helper_DB_Ex();
  76.  
  77.         // 前のページで正しく登録手続きが行われた記録があるか判定
  78.         SC_Utils_Ex::sfIsPrePage($objSiteSess);
  79.  
  80.         // ユーザユニークIDの取得と購入状態の正当性をチェック
  81.         $uniqid SC_Utils_Ex::sfCheckNormalAccess($objSiteSess$objCartSess);
  82.         $this->tpl_uniqid $uniqid;
  83.  
  84.         // カート集計処理
  85.         $objDb->sfTotalCart($this$objCartSess$arrInfo);
  86.         if (strlen($this->tpl_message>= 1{
  87.             SC_Utils_Ex::sfDispSiteError(SOLD_OUT''true);
  88.         }
  89.         // 一時受注テーブルの読込
  90.         $arrData $objDb->sfGetOrderTemp($uniqid);
  91.         // カート集計を元に最終計算
  92.         $arrData $objDb->sfTotalConfirm($arrData$this$objCartSess$arrInfo$objCustomer$objCampaignSess);
  93.         // キャンペーンからの遷移で送料が無料だった場合の処理
  94.         if($objCampaignSess->getIsCampaign()) {
  95.             $deliv_free_flg $objQuery->get("dtb_campaign""deliv_free_flg""campaign_id = ?"array($objCampaignSess->getCampaignId()));
  96.             // 送料無料が設定されていた場合
  97.             if($deliv_free_flg{
  98.                 $arrData['payment_total'-= $arrData['deliv_fee'];
  99.                 $arrData['deliv_fee'0;
  100.             }
  101.         }
  102.  
  103.  
  104.         // カート内の商品の売り切れチェック
  105.         $objCartSess->chkSoldOut($objCartSess->getCartList());
  106.  
  107.         // 会員ログインチェック
  108.         if($objCustomer->isLoginSuccess()) {
  109.             $this->tpl_login '1';
  110.             $this->tpl_user_point $objCustomer->getValue('point');
  111.         }
  112.  
  113.         // 決済区分を取得する
  114.         $payment_type "";
  115.         if($objDb->sfColumnExists("dtb_payment""memo01")){
  116.             // MEMO03に値が入っている場合には、モジュール追加されたものとみなす
  117.             $sql "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
  118.             $arrPayment $objQuery->getAll($sqlarray($arrData['payment_id']));
  119.             $payment_type $arrPayment[0]["memo03"];
  120.         }
  121.         $this->payment_type $payment_type;
  122.  
  123.         if (!isset($_POST['mode'])) $_POST['mode'"";
  124.  
  125.         switch($_POST['mode']{
  126.         // 前のページに戻る
  127.         case 'return':
  128.             // 正常な推移であることを記録しておく
  129.             $objSiteSess->setRegistFlag();
  130.             $this->sendRedirect($this->getLocation(URL_SHOP_PAYMENT));
  131.             exit;
  132.             break;
  133.         case 'confirm':
  134.             // この時点で注文番号を確保しておく(クレジット、コンビニ決済で必要なため)
  135.             // postgresqlとmysqlとで処理を分ける
  136.             if (DB_TYPE == "pgsql"{
  137.                 $order_id $objQuery->nextval("dtb_order","order_id");
  138.             }elseif (DB_TYPE == "mysql"{
  139.                 $order_id $objQuery->get_auto_increment("dtb_order");
  140.             }
  141.             $arrData["order_id"$order_id;
  142.  
  143.             // セッション情報を保持
  144.             $arrData['session'serialize($_SESSION);
  145.  
  146.             // 集計結果を受注一時テーブルに反映
  147.             $objDb->sfRegistTempOrder($uniqid$arrData);
  148.             // 正常に登録されたことを記録しておく
  149.             $objSiteSess->setRegistFlag();
  150.  
  151.             // 決済方法により画面切替
  152.             if($payment_type != ""{
  153.                 // TODO 決済方法のモジュールは Plugin として実装したい
  154.                 $_SESSION["payment_id"$arrData['payment_id'];
  155.                 $this->sendRedirect($this->getLocation(URL_SHOP_MODULE));
  156.             }else{
  157.                 $this->sendRedirect($this->getLocation(URL_SHOP_COMPLETE));
  158.             }
  159.             exit;
  160.             break;
  161.         default:
  162.             break;
  163.         }
  164.  
  165.         $this->arrData $arrData;
  166.         $this->arrInfo $arrInfo;
  167.         $objView->assignobj($this);
  168.         // フレームを選択(キャンペーンページから遷移なら変更)
  169.         $objCampaignSess->pageView($objView);
  170.     }
  171.  
  172.     /**
  173.      * モバイルページを初期化する.
  174.      *
  175.      * @return void 
  176.      */
  177.     function mobileInit({
  178.         $this->init();
  179.     }
  180.  
  181.     /**
  182.      * Page のプロセス(モバイル).
  183.      *
  184.      * @return void 
  185.      */
  186.     function mobileProcess({
  187.         $objView new SC_MobileView();
  188.         $objCartSess new SC_CartSession();
  189.         $objSiteInfo $objView->objSiteInfo;
  190.         $objSiteSess new SC_SiteSession();
  191.         $objCustomer new SC_Customer();
  192.         $arrInfo $objSiteInfo->data;
  193.         $objQuery new SC_Query();
  194.         $objDb new SC_Helper_DB_Ex();
  195.  
  196.         // 前のページで正しく登録手続きが行われた記録があるか判定
  197.         SC_Utils_Ex::sfIsPrePage($objSiteSesstrue);
  198.  
  199.         // ユーザユニークIDの取得と購入状態の正当性をチェック
  200.         $uniqid SC_Utils_Ex::sfCheckNormalAccess($objSiteSess$objCartSess);
  201.         $this->tpl_uniqid $uniqid;
  202.  
  203.         // カート集計処理
  204.         $objDb->sfTotalCart($this$objCartSess$arrInfo);
  205.         // 一時受注テーブルの読込
  206.         $arrData $objDb->sfGetOrderTemp($uniqid);
  207.         // カート集計を元に最終計算
  208.         $arrData $objDb->sfTotalConfirm($arrData$this$objCartSess$arrInfo$objCustomer);
  209.  
  210.         // カート内の商品の売り切れチェック
  211.         $objCartSess->chkSoldOut($objCartSess->getCartList());
  212.  
  213.         // 会員ログインチェック
  214.         if($objCustomer->isLoginSuccess(true)) {
  215.             $this->tpl_login '1';
  216.             $this->tpl_user_point $objCustomer->getValue('point');
  217.         }
  218.  
  219.         // 決済区分を取得する
  220.         $payment_type "";
  221.         if($objDb->sfColumnExists("dtb_payment""memo01")){
  222.             // MEMO03に値が入っている場合には、モジュール追加されたものとみなす
  223.             $sql "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
  224.             $arrPayment $objQuery->getAll($sqlarray($arrData['payment_id']));
  225.             $payment_type $arrPayment[0]["memo03"];
  226.         }
  227.         $this->payment_type $payment_type;
  228.  
  229.         if (!isset($_POST['mode'])) $_POST['mode'"";
  230.  
  231.         switch($_POST['mode']{
  232.             // 前のページに戻る
  233.         case 'return':
  234.             // 正常な推移であることを記録しておく
  235.             $objSiteSess->setRegistFlag();
  236.             $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT)true);
  237.             exit;
  238.             break;
  239.         case 'confirm':
  240.             // この時点で注文番号を確保しておく(クレジット、コンビニ決済で必要なため)
  241.             // postgresqlとmysqlとで処理を分ける
  242.             if (DB_TYPE == "pgsql"{
  243.                 $order_id $objQuery->nextval("dtb_order","order_id");
  244.             }elseif (DB_TYPE == "mysql"{
  245.                 $order_id $objQuery->get_auto_increment("dtb_order");
  246.             }
  247.             $arrData["order_id"$order_id;
  248.  
  249.             // セッション情報を保持
  250.             $arrData['session'serialize($_SESSION);
  251.  
  252.             // 集計結果を受注一時テーブルに反映
  253.             $objDb->sfRegistTempOrder($uniqid$arrData);
  254.             // 正常に登録されたことを記録しておく
  255.             $objSiteSess->setRegistFlag();
  256.  
  257.             // 決済方法により画面切替
  258.             if($payment_type != ""{
  259.                 $_SESSION["payment_id"$arrData['payment_id'];
  260.                 $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_MODULE)true);
  261.             }else{
  262.                 $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_COMPLETE)true);
  263.             }
  264.             exit;
  265.             break;
  266.         default:
  267.             break;
  268.         }
  269.         $this->arrData $arrData;
  270.         $this->arrInfo $arrInfo;
  271.         $objView->assignobj($this);
  272.         $objView->display(SITE_FRAME);
  273.     }
  274.  
  275.     /**
  276.      * デストラクタ.
  277.      *
  278.      * @return void 
  279.      */
  280.     function destroy({
  281.         parent::destroy();
  282.     }
  283. }
  284. ?>

Documentation generated on Fri, 24 Feb 2012 13:59:50 +0900 by Seasoft