Warning: Can't use blame annotator:
svn blame failed on branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Confirm.php: バイナリファイル 'file:///home/svn/open/branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Confirm.php' に対しては blame で各行の最終変更者を計算できません 195004

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

Revision 18859, 10.3 KB checked in by nanasess, 13 years ago (diff)

ページ間の遷移方法の改善(#783)

  • カート内集計の関数が VIEW に依存しないように修正
  • SC_Helper_DB::sfTotalCart(), SC_Helper_DB::sfTotalConfirm() を SC_CartSession に移動
  • 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
RevLine 
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        $this->cartKey = $_SESSION['cartKey'];
87        $cartItems = $objCartSess->getCartList($this->cartKey);
88        $i = 0;
89        // TODO リファクタリング
90        foreach (array_keys($cartItems) as $itemKey) {
91            $cartItem =& $cartItems[$itemKey];
92            if (!SC_Utils_Ex::isBlank($cartItem)) {
93                $this->cartItems[$i] =& $cartItem;
94                $i++;
95            }
96        }
97        $this->tpl_message = $objCartSess->checkProducts($this->cartKey);
98        $this->tpl_total_pretax[$this->cartKey] = $objCartSess->getAllProductsTotal($this->cartKey);
99        $this->tpl_total_tax[$this->cartKey] = $objCartSess->getAllProductsTax($this->cartKey);
100        // ポイント合計
101        $this->tpl_total_point[$this->cartKey] = $objCartSess->getAllProductsPoint($this->cartKey);
102
103        if (strlen($this->tpl_message) >= 1) {
104            SC_Utils_Ex::sfDispSiteError(SOLD_OUT, '', true);
105        }
106
107        // TODO リファクタリング
108        // 一時受注テーブルの読込
109        $tmpData = $objDb->sfGetOrderTemp($uniqid);
110
111        // カート集計を元に最終計算
112        // FIXME 使用ポイント, 配送都道府県, 支払い方法, 手数料の扱い
113        $arrData = array_merge($tmpData, $objCartSess->calculate($this->cartKey, $objCustomer));
114
115        // 会員ログインチェック
116        if($objCustomer->isLoginSuccess()) {
117            $this->tpl_login = '1';
118            $this->tpl_user_point = $objCustomer->getValue('point');
119        }
120
121        // 決済区分を取得する
122        $payment_type = "";
123        if($objDb->sfColumnExists("dtb_payment", "memo01")){
124            // MEMO03に値が入っている場合には、モジュール追加されたものとみなす
125            $sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
126            $arrPayment = $objQuery->getAll($sql, array($arrData['payment_id']));
127            $payment_type = $arrPayment[0]["memo03"];
128        }
129        $this->payment_type = $payment_type;
130
131        if (!isset($_POST['mode'])) $_POST['mode'] = "";
132
133        switch($_POST['mode']) {
134        // 前のページに戻る
135        case 'return':
136            // 正常な推移であることを記録しておく
137            $objSiteSess->setRegistFlag();
138            $this->sendRedirect($this->getLocation(URL_SHOP_PAYMENT));
139            exit;
140            break;
141        case 'confirm':
142            // この時点で注文番号を確保しておく(クレジット、コンビニ決済で必要なため)
143            $arrData["order_id"] = $objQuery->nextval("dtb_order_order_id");
144
145            // セッション情報を保持
146            $arrData['session'] = serialize($_SESSION);
147
148            // 集計結果を受注一時テーブルに反映
149            unset($arrData[0]); // FIXME
150            unset($arrData[1]);
151            $objDb->sfRegistTempOrder($uniqid, $arrData);
152            // 正常に登録されたことを記録しておく
153            $objSiteSess->setRegistFlag();
154
155            // 決済方法により画面切替
156            if($payment_type != "") {
157                // TODO 決済方法のモジュールは Plugin として実装したい
158                $_SESSION["payment_id"] = $arrData['payment_id'];
159                $this->sendRedirect($this->getLocation(URL_SHOP_MODULE));
160            }else{
161                $this->sendRedirect($this->getLocation(URL_SHOP_COMPLETE));
162            }
163            exit;
164            break;
165        default:
166            break;
167        }
168
169        $this->arrData = $arrData;
170        $this->arrInfo = $objSiteInfo->data;
171        $objView->assignobj($this);
172        // フレームを選択(キャンペーンページから遷移なら変更)
173        $objCampaignSess->pageView($objView);
174    }
175
176    /**
177     * モバイルページを初期化する.
178     *
179     * @return void
180     */
181    function mobileInit() {
182        $this->init();
183    }
184
185    /**
186     * Page のプロセス(モバイル).
187     *
188     * @return void
189     */
190    function mobileProcess() {
191        $objView = new SC_MobileView();
192        $objCartSess = new SC_CartSession();
193        $objSiteInfo = $objView->objSiteInfo;
194        $objSiteSess = new SC_SiteSession();
195        $objCustomer = new SC_Customer();
196        $objQuery = new SC_Query();
197        $objDb = new SC_Helper_DB_Ex();
198
199        // 前のページで正しく登録手続きが行われた記録があるか判定
200        SC_Utils_Ex::sfIsPrePage($objSiteSess);
201
202        // ユーザユニークIDの取得と購入状態の正当性をチェック
203        $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
204        $this->tpl_uniqid = $uniqid;
205
206        //ダウンロード商品判定
207        $this->cartdown = $objDb->chkCartDown($objCartSess);
208
209        // カート集計処理
210        $objDb->sfTotalCart($this, $objCartSess);
211        if (strlen($this->tpl_message) >= 1) {
212            SC_Utils_Ex::sfDispSiteError(SOLD_OUT, '', true);
213        }
214        // 一時受注テーブルの読込
215        $arrData = $objDb->sfGetOrderTemp($uniqid);
216        // カート集計を元に最終計算
217        $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, null, $objCustomer);
218
219        // 会員ログインチェック
220        if($objCustomer->isLoginSuccess(true)) {
221            $this->tpl_login = '1';
222            $this->tpl_user_point = $objCustomer->getValue('point');
223        }
224
225        // 決済区分を取得する
226        $payment_type = "";
227        if($objDb->sfColumnExists("dtb_payment", "memo01")){
228            // MEMO03に値が入っている場合には、モジュール追加されたものとみなす
229            $sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?";
230            $arrPayment = $objQuery->getAll($sql, array($arrData['payment_id']));
231            $payment_type = $arrPayment[0]["memo03"];
232        }
233        $this->payment_type = $payment_type;
234
235        if (!isset($_POST['mode'])) $_POST['mode'] = "";
236
237        switch($_POST['mode']) {
238            // 前のページに戻る
239        case 'return':
240            // 正常な推移であることを記録しておく
241            $objSiteSess->setRegistFlag();
242            $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true);
243            exit;
244            break;
245        case 'confirm':
246            // この時点で注文番号を確保しておく(クレジット、コンビニ決済で必要なため)
247            $arrData["order_id"] = $objQuery->nextVal("dtb_order_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 = $objSiteInfo->data;
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?>
Note: See TracBrowser for help on using the repository browser.