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_REALDIR . "pages/LC_Page.php"); |
---|
26 | |
---|
27 | /** |
---|
28 | * 受注履歴 のページクラス. |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author LOCKON CO.,LTD. |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class LC_Page_Mypage_HistoryDetail 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 = 'mypage/history_detail.tpl'; |
---|
47 | $this->tpl_title = 'MYページ'; |
---|
48 | $this->tpl_subtitle = '購入履歴詳細'; |
---|
49 | } |
---|
50 | |
---|
51 | /** |
---|
52 | * Page のプロセス. |
---|
53 | * |
---|
54 | * @return void |
---|
55 | */ |
---|
56 | function process() { |
---|
57 | parent::process(); |
---|
58 | $this->action(); |
---|
59 | $this->sendResponse(); |
---|
60 | } |
---|
61 | |
---|
62 | /** |
---|
63 | * Page のAction. |
---|
64 | * |
---|
65 | * @return void |
---|
66 | */ |
---|
67 | function action() { |
---|
68 | $objQuery = new SC_Query(); |
---|
69 | $objCustomer = new SC_Customer(); |
---|
70 | $objDb = new SC_Helper_DB_Ex(); |
---|
71 | |
---|
72 | |
---|
73 | //不正アクセス判定 |
---|
74 | $from = "dtb_order"; |
---|
75 | $where = "del_flg = 0 AND customer_id = ? AND order_id = ? "; |
---|
76 | $arrval = array($objCustomer->getValue('customer_id'), $_POST['order_id']); |
---|
77 | //DBに情報があるか判定 |
---|
78 | $cnt = $objQuery->count($from, $where, $arrval); |
---|
79 | |
---|
80 | //ログインしていない、またはDBに情報が無い場合 |
---|
81 | if (!$objCustomer->isLoginSuccess(true) or $cnt == 0){ |
---|
82 | SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); |
---|
83 | } else { |
---|
84 | //受注詳細データの取得 |
---|
85 | $this->arrDisp = $this->lfGetOrderData($_POST['order_id']); |
---|
86 | // 支払い方法の取得 |
---|
87 | $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); |
---|
88 | // お届け時間の取得 |
---|
89 | $arrRet = $objDb->sfGetDelivTime($this->arrDisp['payment_id']); |
---|
90 | $this->arrDelivTime = SC_Utils_Ex::sfArrKeyValue($arrRet, 'time_id', 'deliv_time'); |
---|
91 | |
---|
92 | //マイページトップ顧客情報表示用 |
---|
93 | $this->CustomerName1 = $objCustomer->getvalue('name01'); |
---|
94 | $this->CustomerName2 = $objCustomer->getvalue('name02'); |
---|
95 | $this->CustomerPoint = $objCustomer->getvalue('point'); |
---|
96 | } |
---|
97 | } |
---|
98 | |
---|
99 | /** |
---|
100 | * デストラクタ. |
---|
101 | * |
---|
102 | * @return void |
---|
103 | */ |
---|
104 | function destroy() { |
---|
105 | parent::destroy(); |
---|
106 | } |
---|
107 | |
---|
108 | |
---|
109 | //受注詳細データの取得 |
---|
110 | function lfGetOrderData($order_id) { |
---|
111 | //注文番号が数字であれば |
---|
112 | if(SC_Utils_Ex::sfIsInt($order_id)) { |
---|
113 | // DBから受注情報を読み込む |
---|
114 | $objQuery = new SC_Query(); |
---|
115 | /* |
---|
116 | $col = "order_id, create_date, payment_id, subtotal, tax, use_point, add_point, discount, "; |
---|
117 | $col .= "deliv_fee, charge, payment_total, order_name01, order_name02, order_kana01, order_kana02, "; |
---|
118 | $col .= "order_zip01, order_zip02, order_pref, order_addr01, order_addr02, order_tel01, order_tel02, order_tel03, create_date "; |
---|
119 | */ |
---|
120 | $from = "dtb_order"; |
---|
121 | $where = "order_id = ?"; |
---|
122 | $arrRet = $objQuery->select("*", $from, $where, array($order_id)); |
---|
123 | $arrOrder = $arrRet[0]; |
---|
124 | // 受注詳細データの取得 |
---|
125 | $arrRet = $this->lfGetOrderDetail($order_id); |
---|
126 | $arrOrderDetail = SC_Utils_Ex::sfSwapArray($arrRet); |
---|
127 | $arrData = array_merge($arrOrder, $arrOrderDetail); |
---|
128 | } |
---|
129 | return $arrData; |
---|
130 | } |
---|
131 | |
---|
132 | // 受注詳細データの取得 |
---|
133 | function lfGetOrderDetail($order_id) { |
---|
134 | $objQuery = new SC_Query(); |
---|
135 | $col = "product_id, product_class_id, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate"; |
---|
136 | $where = "order_id = ?"; |
---|
137 | $objQuery->setOrder("product_class_id"); |
---|
138 | $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id)); |
---|
139 | return $arrRet; |
---|
140 | } |
---|
141 | } |
---|
142 | ?> |
---|