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

Revision 18830, 9.9 KB checked in by nanasess, 14 years ago (diff)

商品種別によってカートを分ける(#823)

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