1 | <?php |
---|
2 | /* |
---|
3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
4 | * |
---|
5 | * http://www.lockon.co.jp/ |
---|
6 | */ |
---|
7 | |
---|
8 | // {{{ requires |
---|
9 | require_once(CLASS_PATH . "pages/LC_Page.php"); |
---|
10 | |
---|
11 | /** |
---|
12 | * 入力内容確認のページクラス. |
---|
13 | * |
---|
14 | * @package Page |
---|
15 | * @author LOCKON CO.,LTD. |
---|
16 | * @version $Id:LC_Page_Shopping_Confirm.php 15532 2007-08-31 14:39:46Z nanasess $ |
---|
17 | */ |
---|
18 | class LC_Page_Shopping_Confirm extends LC_Page { |
---|
19 | |
---|
20 | // }}} |
---|
21 | // {{{ functions |
---|
22 | |
---|
23 | /** |
---|
24 | * Page を初期化する. |
---|
25 | * |
---|
26 | * @return void |
---|
27 | */ |
---|
28 | function init() { |
---|
29 | parent::init(); |
---|
30 | $this->tpl_mainpage = 'shopping/confirm.tpl'; |
---|
31 | $this->tpl_css = URL_DIR.'css/layout/shopping/confirm.css'; |
---|
32 | $this->tpl_title = "ご入力内容のご確認"; |
---|
33 | $masterData = new SC_DB_MasterData(); |
---|
34 | $this->arrPref = $masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank")); |
---|
35 | $this->arrSex = $masterData->getMasterData("mtb_sex"); |
---|
36 | $this->arrMAILMAGATYPE = $masterData->getMasterData("mtb_mail_magazine_type"); |
---|
37 | $this->arrReminder = $masterData->getMasterData("mtb_reminder"); |
---|
38 | |
---|
39 | $this->allowClientCache(); |
---|
40 | } |
---|
41 | |
---|
42 | /** |
---|
43 | * Page のプロセス. |
---|
44 | * |
---|
45 | * @return void |
---|
46 | */ |
---|
47 | function process() { |
---|
48 | $objView = new SC_SiteView(); |
---|
49 | $objCartSess = new SC_CartSession(); |
---|
50 | $objSiteInfo = $objView->objSiteInfo; |
---|
51 | $objSiteSess = new SC_SiteSession(); |
---|
52 | $objCampaignSess = new SC_CampaignSession(); |
---|
53 | $objCustomer = new SC_Customer(); |
---|
54 | $arrInfo = $objSiteInfo->data; |
---|
55 | $objQuery = new SC_Query(); |
---|
56 | $objDb = new SC_Helper_DB_Ex(); |
---|
57 | |
---|
58 | // 前のページで正しく登録手続きが行われた記録があるか判定 |
---|
59 | SC_Utils_Ex::sfIsPrePage($objSiteSess); |
---|
60 | |
---|
61 | // ユーザユニークIDの取得と購入状態の正当性をチェック |
---|
62 | $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess); |
---|
63 | $this->tpl_uniqid = $uniqid; |
---|
64 | |
---|
65 | // カート集計処理 |
---|
66 | $objDb->sfTotalCart($this, $objCartSess, $arrInfo); |
---|
67 | // 一時受注テーブルの読込 |
---|
68 | $arrData = $objDb->sfGetOrderTemp($uniqid); |
---|
69 | // カート集計を元に最終計算 |
---|
70 | $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo, $objCustomer, $objCampaignSess); |
---|
71 | // キャンペーンからの遷移で送料が無料だった場合の処理 |
---|
72 | if($objCampaignSess->getIsCampaign()) { |
---|
73 | $deliv_free_flg = $objQuery->get("dtb_campaign", "deliv_free_flg", "campaign_id = ?", array($objCampaignSess->getCampaignId())); |
---|
74 | // 送料無料が設定されていた場合 |
---|
75 | if($deliv_free_flg) { |
---|
76 | $arrData['payment_total'] -= $arrData['deliv_fee']; |
---|
77 | $arrData['deliv_fee'] = 0; |
---|
78 | } |
---|
79 | } |
---|
80 | |
---|
81 | |
---|
82 | // カート内の商品の売り切れチェック |
---|
83 | $objCartSess->chkSoldOut($objCartSess->getCartList()); |
---|
84 | |
---|
85 | // 会員ログインチェック |
---|
86 | if($objCustomer->isLoginSuccess()) { |
---|
87 | $this->tpl_login = '1'; |
---|
88 | $this->tpl_user_point = $objCustomer->getValue('point'); |
---|
89 | } |
---|
90 | |
---|
91 | // 決済区分を取得する |
---|
92 | $payment_type = ""; |
---|
93 | if($objDb->sfColumnExists("dtb_payment", "memo01")){ |
---|
94 | // MEMO03に値が入っている場合には、モジュール追加されたものとみなす |
---|
95 | $sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?"; |
---|
96 | $arrPayment = $objQuery->getall($sql, array($arrData['payment_id'])); |
---|
97 | $payment_type = $arrPayment[0]["memo03"]; |
---|
98 | } |
---|
99 | $this->payment_type = $payment_type; |
---|
100 | |
---|
101 | if (!isset($_POST['mode'])) $_POST['mode'] = ""; |
---|
102 | |
---|
103 | switch($_POST['mode']) { |
---|
104 | // 前のページに戻る |
---|
105 | case 'return': |
---|
106 | // 正常な推移であることを記録しておく |
---|
107 | $objSiteSess->setRegistFlag(); |
---|
108 | header("Location: " . URL_SHOP_PAYMENT); |
---|
109 | exit; |
---|
110 | break; |
---|
111 | case 'confirm': |
---|
112 | // この時点でオーダーIDを確保しておく(クレジット、コンビニ決済で必要なため) |
---|
113 | // postgresqlとmysqlとで処理を分ける |
---|
114 | if (DB_TYPE == "pgsql") { |
---|
115 | $order_id = $objQuery->nextval("dtb_order","order_id"); |
---|
116 | }elseif (DB_TYPE == "mysql") { |
---|
117 | $order_id = $objQuery->get_auto_increment("dtb_order"); |
---|
118 | } |
---|
119 | $arrData["order_id"] = $order_id; |
---|
120 | |
---|
121 | // セッション情報を保持 |
---|
122 | $arrData['session'] = serialize($_SESSION); |
---|
123 | |
---|
124 | // 集計結果を受注一時テーブルに反映 |
---|
125 | sfRegistTempOrder($uniqid, $arrData); |
---|
126 | // 正常に登録されたことを記録しておく |
---|
127 | $objSiteSess->setRegistFlag(); |
---|
128 | |
---|
129 | // 決済方法により画面切替 |
---|
130 | if($payment_type != "") { |
---|
131 | // TODO 決済方法のモジュールは Plugin として実装したい |
---|
132 | $_SESSION["payment_id"] = $arrData['payment_id']; |
---|
133 | header("Location: " . URL_SHOP_MODULE); |
---|
134 | }else{ |
---|
135 | header("Location: " . URL_SHOP_COMPLETE); |
---|
136 | } |
---|
137 | break; |
---|
138 | default: |
---|
139 | break; |
---|
140 | } |
---|
141 | |
---|
142 | $this->arrData = $arrData; |
---|
143 | $this->arrInfo = $arrInfo; |
---|
144 | $objView->assignobj($this); |
---|
145 | // フレームを選択(キャンペーンページから遷移なら変更) |
---|
146 | $objCampaignSess->pageView($objView); |
---|
147 | } |
---|
148 | |
---|
149 | /** |
---|
150 | * デストラクタ. |
---|
151 | * |
---|
152 | * @return void |
---|
153 | */ |
---|
154 | function destroy() { |
---|
155 | parent::destroy(); |
---|
156 | } |
---|
157 | } |
---|
158 | ?> |
---|