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_EX_REALDIR . "page_extends/mypage/LC_Page_AbstractMypage_Ex.php"); |
---|
26 | |
---|
27 | /** |
---|
28 | * MyPage のページクラス. |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author LOCKON CO.,LTD. |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class LC_Page_MyPage extends LC_Page_AbstractMypage_Ex { |
---|
35 | |
---|
36 | // {{{ properties |
---|
37 | |
---|
38 | /** ページナンバー */ |
---|
39 | var $tpl_pageno; |
---|
40 | |
---|
41 | // }}} |
---|
42 | // {{{ functions |
---|
43 | |
---|
44 | /** |
---|
45 | * Page を初期化する. |
---|
46 | * |
---|
47 | * @return void |
---|
48 | */ |
---|
49 | function init() { |
---|
50 | parent::init(); |
---|
51 | $this->tpl_mypageno = 'index'; |
---|
52 | if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE){ |
---|
53 | $this->tpl_subtitle = 'MYページ'; |
---|
54 | } else { |
---|
55 | $this->tpl_subtitle = '購入履歴一覧'; |
---|
56 | } |
---|
57 | $this->httpCacheControl('nocache'); |
---|
58 | } |
---|
59 | |
---|
60 | /** |
---|
61 | * Page のプロセス. |
---|
62 | * |
---|
63 | * @return void |
---|
64 | */ |
---|
65 | function process() { |
---|
66 | parent::process(); |
---|
67 | } |
---|
68 | |
---|
69 | /** |
---|
70 | * Page のAction. |
---|
71 | * |
---|
72 | * @return void |
---|
73 | */ |
---|
74 | function action() { |
---|
75 | |
---|
76 | $objCustomer = new SC_Customer(); |
---|
77 | $customer_id = $objCustomer->getvalue('customer_id'); |
---|
78 | |
---|
79 | //ページ送り用 |
---|
80 | $this->objNavi = new SC_PageNavi($_REQUEST['pageno'], |
---|
81 | $this->lfGetOrderHistory($customer_id), |
---|
82 | SEARCH_PMAX, |
---|
83 | "fnNaviPage", |
---|
84 | NAVI_PMAX, |
---|
85 | 'pageno=#page#', |
---|
86 | SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE); |
---|
87 | |
---|
88 | $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row); |
---|
89 | |
---|
90 | // 支払い方法の取得 |
---|
91 | $this->arrPayment = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); |
---|
92 | } |
---|
93 | |
---|
94 | /** |
---|
95 | * デストラクタ. |
---|
96 | * |
---|
97 | * @return void |
---|
98 | */ |
---|
99 | function destroy() { |
---|
100 | parent::destroy(); |
---|
101 | } |
---|
102 | |
---|
103 | |
---|
104 | /** |
---|
105 | * 受注履歴を返す |
---|
106 | * |
---|
107 | * @param mixed $customer_id |
---|
108 | * @param mixed $startno 0以上の場合は受注履歴を返却する -1の場合は件数を返す |
---|
109 | * @access private |
---|
110 | * @return void |
---|
111 | */ |
---|
112 | function lfGetOrderHistory($customer_id, $startno = -1) { |
---|
113 | $objQuery = SC_Query::getSingletonInstance(); |
---|
114 | |
---|
115 | $col = "order_id, create_date, payment_id, payment_total"; |
---|
116 | $from = "dtb_order"; |
---|
117 | $where = "del_flg = 0 AND customer_id = ?"; |
---|
118 | $arrval = array($customer_id); |
---|
119 | $order = "order_id DESC"; |
---|
120 | |
---|
121 | if ($startno == -1) { |
---|
122 | return $objQuery->count($from, $where, $arrval); |
---|
123 | } |
---|
124 | |
---|
125 | $objQuery->setLimitOffset(SEARCH_PMAX, $startno); |
---|
126 | // 表示順序 |
---|
127 | $objQuery->setOrder($order); |
---|
128 | |
---|
129 | //購入履歴の取得 |
---|
130 | return $objQuery->select($col, $from, $where, $arrval); |
---|
131 | } |
---|
132 | } |
---|