source: branches/version-2_12-dev/data/class/pages/mypage/LC_Page_Mypage.php @ 22563

Revision 22563, 4.3 KB checked in by Qwert, 8 years ago (diff)

#2149 (スマートフォンの購入履歴ページにて、もっと見る表示が不適切) を修正

環境によってjson_encode関数が使えないとのことで、json_encode()からSC_Utils::jsonEncode()に変更

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • 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-2013 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_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 */
34class 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        $masterData = new SC_DB_MasterData_Ex();
58        $this->arrCustomerOrderStatus = $masterData->getMasterData('mtb_customer_order_status');
59
60        $this->httpCacheControl('nocache');
61    }
62
63    /**
64     * Page のプロセス.
65     *
66     * @return void
67     */
68    function process() {
69        parent::process();
70    }
71
72    /**
73     * Page のAction.
74     *
75     * @return void
76     */
77    function action() {
78
79        $objCustomer = new SC_Customer_Ex();
80        $customer_id = $objCustomer->getvalue('customer_id');
81
82        //ページ送り用
83        $this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'],
84                                            $this->lfGetOrderHistory($customer_id),
85                                            SEARCH_PMAX,
86                                            'fnNaviPage',
87                                            NAVI_PMAX,
88                                            'pageno=#page#',
89                                            SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
90
91        $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row);
92
93        switch ($this->getMode()) {
94            case 'getList':
95                echo SC_Utils_Ex::jsonEncode($this->arrOrder);
96                SC_Response_Ex::actionExit();
97                break;
98            default:
99                break;
100        }
101        // 支払い方法の取得
102        $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList();
103        // 1ページあたりの件数
104        $this->dispNumber = SEARCH_PMAX;
105       
106        $this->json_payment = SC_Utils::jsonEncode($this->arrPayment);
107        $this->json_customer_order_status = SC_Utils::jsonEncode($this->arrCustomerOrderStatus);
108    }
109
110    /**
111     * デストラクタ.
112     *
113     * @return void
114     */
115    function destroy() {
116        parent::destroy();
117    }
118
119    /**
120     * 受注履歴を返す
121     *
122     * @param mixed $customer_id
123     * @param mixed $startno 0以上の場合は受注履歴を返却する -1の場合は件数を返す
124     * @access private
125     * @return void
126     */
127    function lfGetOrderHistory($customer_id, $startno = -1) {
128        $objQuery   = SC_Query_Ex::getSingletonInstance();
129
130        $col        = 'order_id, create_date, payment_id, payment_total, status';
131        $from       = 'dtb_order';
132        $where      = 'del_flg = 0 AND customer_id = ?';
133        $arrWhereVal = array($customer_id);
134        $order      = 'order_id DESC';
135
136        if ($startno == -1) {
137            return $objQuery->count($from, $where, $arrWhereVal);
138        }
139
140        $objQuery->setLimitOffset(SEARCH_PMAX, $startno);
141        // 表示順序
142        $objQuery->setOrder($order);
143
144        //購入履歴の取得
145        return $objQuery->select($col, $from, $where, $arrWhereVal);
146    }
147}
Note: See TracBrowser for help on using the repository browser.