source: branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Confirm.php @ 18820

Revision 18820, 9.8 KB checked in by nanasess, 14 years ago (diff)

#781(規格のデータベースを木構造に)

  • 規格の無い商品が品切れになってしまう不具合修正
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
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
25require_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 */
34class 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        $this->httpCacheControl('nocache');
56    }
57
58    /**
59     * Page のプロセス.
60     *
61     * @return void
62     */
63    function process() {
64        global $objCampaignSess;
65
66        $objView = new SC_SiteView();
67        $objCartSess = new SC_CartSession();
68        $objSiteInfo = $objView->objSiteInfo;
69        $objSiteSess = new SC_SiteSession();
70        $objCampaignSess = new SC_CampaignSession();
71        $objCustomer = new SC_Customer();
72        $objQuery = new SC_Query();
73        $objDb = new SC_Helper_DB_Ex();
74
75        // 前のページで正しく登録手続きが行われた記録があるか判定
76        SC_Utils_Ex::sfIsPrePage($objSiteSess);
77
78        // ユーザユニークIDの取得と購入状態の正当性をチェック
79        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
80        $this->tpl_uniqid = $uniqid;
81
82        //ダウンロード商品判定
83        $this->cartdown = $objDb->chkCartDown($objCartSess);
84
85        // カート集計処理
86        $objDb->sfTotalCart($this, $objCartSess);
87        if (strlen($this->tpl_message) >= 1) {
88            SC_Utils_Ex::sfDispSiteError(SOLD_OUT, '', true);
89        }
90        // 一時受注テーブルの読込
91        $arrData = $objDb->sfGetOrderTemp($uniqid);
92        // カート集計を元に最終計算
93        $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, null, $objCustomer);
94        // キャンペーンからの遷移で送料が無料だった場合の処理
95        if($objCampaignSess->getIsCampaign()) {
96            $deliv_free_flg = $objQuery->get("dtb_campaign", "deliv_free_flg", "campaign_id = ?", array($objCampaignSess->getCampaignId()));
97            // 送料無料が設定されていた場合
98            if($deliv_free_flg) {
99                $arrData['payment_total'] -= $arrData['deliv_fee'];
100                $arrData['deliv_fee'] = 0;
101            }
102        }
103
104        // 会員ログインチェック
105        if($objCustomer->isLoginSuccess()) {
106            $this->tpl_login = '1';
107            $this->tpl_user_point = $objCustomer->getValue('point');
108        }
109
110        // 決済区分を取得する
111        $payment_type = "";
112        if($objDb->sfColumnExists("dtb_payment", "memo01")){
113            // MEMO03に値が入っている場合には、モジュール追加されたものとみなす
114            $sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
115            $arrPayment = $objQuery->getAll($sql, array($arrData['payment_id']));
116            $payment_type = $arrPayment[0]["memo03"];
117        }
118        $this->payment_type = $payment_type;
119
120        if (!isset($_POST['mode'])) $_POST['mode'] = "";
121
122        switch($_POST['mode']) {
123        // 前のページに戻る
124        case 'return':
125            // 正常な推移であることを記録しておく
126            $objSiteSess->setRegistFlag();
127            $this->sendRedirect($this->getLocation(URL_SHOP_PAYMENT));
128            exit;
129            break;
130        case 'confirm':
131            // この時点で注文番号を確保しておく(クレジット、コンビニ決済で必要なため)
132            $arrData["order_id"] = $objQuery->nextval("dtb_order_order_id");
133
134            // セッション情報を保持
135            $arrData['session'] = serialize($_SESSION);
136
137            // 集計結果を受注一時テーブルに反映
138            $objDb->sfRegistTempOrder($uniqid, $arrData);
139            // 正常に登録されたことを記録しておく
140            $objSiteSess->setRegistFlag();
141
142            // 決済方法により画面切替
143            if($payment_type != "") {
144                // TODO 決済方法のモジュールは Plugin として実装したい
145                $_SESSION["payment_id"] = $arrData['payment_id'];
146                $this->sendRedirect($this->getLocation(URL_SHOP_MODULE));
147            }else{
148                $this->sendRedirect($this->getLocation(URL_SHOP_COMPLETE));
149            }
150            exit;
151            break;
152        default:
153            break;
154        }
155
156        $this->arrData = $arrData;
157        $this->arrInfo = $objSiteInfo->data;
158        $objView->assignobj($this);
159        // フレームを選択(キャンペーンページから遷移なら変更)
160        $objCampaignSess->pageView($objView);
161    }
162
163    /**
164     * モバイルページを初期化する.
165     *
166     * @return void
167     */
168    function mobileInit() {
169        $this->init();
170    }
171
172    /**
173     * Page のプロセス(モバイル).
174     *
175     * @return void
176     */
177    function mobileProcess() {
178        $objView = new SC_MobileView();
179        $objCartSess = new SC_CartSession();
180        $objSiteInfo = $objView->objSiteInfo;
181        $objSiteSess = new SC_SiteSession();
182        $objCustomer = new SC_Customer();
183        $objQuery = new SC_Query();
184        $objDb = new SC_Helper_DB_Ex();
185
186        // 前のページで正しく登録手続きが行われた記録があるか判定
187        SC_Utils_Ex::sfIsPrePage($objSiteSess);
188
189        // ユーザユニークIDの取得と購入状態の正当性をチェック
190        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
191        $this->tpl_uniqid = $uniqid;
192
193        //ダウンロード商品判定
194        $this->cartdown = $objDb->chkCartDown($objCartSess);
195
196        // カート集計処理
197        $objDb->sfTotalCart($this, $objCartSess);
198        if (strlen($this->tpl_message) >= 1) {
199            SC_Utils_Ex::sfDispSiteError(SOLD_OUT, '', true);
200        }
201        // 一時受注テーブルの読込
202        $arrData = $objDb->sfGetOrderTemp($uniqid);
203        // カート集計を元に最終計算
204        $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, null, $objCustomer);
205
206        // 会員ログインチェック
207        if($objCustomer->isLoginSuccess(true)) {
208            $this->tpl_login = '1';
209            $this->tpl_user_point = $objCustomer->getValue('point');
210        }
211
212        // 決済区分を取得する
213        $payment_type = "";
214        if($objDb->sfColumnExists("dtb_payment", "memo01")){
215            // MEMO03に値が入っている場合には、モジュール追加されたものとみなす
216            $sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
217            $arrPayment = $objQuery->getAll($sql, array($arrData['payment_id']));
218            $payment_type = $arrPayment[0]["memo03"];
219        }
220        $this->payment_type = $payment_type;
221
222        if (!isset($_POST['mode'])) $_POST['mode'] = "";
223
224        switch($_POST['mode']) {
225            // 前のページに戻る
226        case 'return':
227            // 正常な推移であることを記録しておく
228            $objSiteSess->setRegistFlag();
229            $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true);
230            exit;
231            break;
232        case 'confirm':
233            // この時点で注文番号を確保しておく(クレジット、コンビニ決済で必要なため)
234            $arrData["order_id"] = $objQuery->nextVal("dtb_order_order_id");
235
236            // セッション情報を保持
237            $arrData['session'] = serialize($_SESSION);
238
239            // 集計結果を受注一時テーブルに反映
240            $objDb->sfRegistTempOrder($uniqid, $arrData);
241            // 正常に登録されたことを記録しておく
242            $objSiteSess->setRegistFlag();
243
244            // 決済方法により画面切替
245            if($payment_type != "") {
246                $_SESSION["payment_id"] = $arrData['payment_id'];
247                $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_MODULE), true);
248            }else{
249                $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_COMPLETE), true);
250            }
251            exit;
252            break;
253        default:
254            break;
255        }
256        $this->arrData = $arrData;
257        $this->arrInfo = $objSiteInfo->data;
258        $objView->assignobj($this);
259        $objView->display(SITE_FRAME);
260    }
261
262    /**
263     * デストラクタ.
264     *
265     * @return void
266     */
267    function destroy() {
268        parent::destroy();
269    }
270}
271?>
Note: See TracBrowser for help on using the repository browser.