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

Revision 23230, 4.4 KB checked in by m_uehara, 11 years ago (diff)

#2363 r23177, r23181 - r23186, r23188 - r23191, r23194, r23197, r23199 - r23218, r23220, r23223 - r23225 をマージ

  • 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
RevLine 
[16066]1<?php
2/*
[16582]3 * This file is part of EC-CUBE
4 *
[22206]5 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
[16066]6 *
7 * http://www.lockon.co.jp/
[16582]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.
[16066]22 */
23
[20534]24require_once CLASS_EX_REALDIR . 'page_extends/mypage/LC_Page_AbstractMypage_Ex.php';
[16066]25
26/**
27 * MyPage のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id$
32 */
[23038]33class LC_Page_Mypage extends LC_Page_AbstractMypage_Ex
[22567]34{
[16066]35    /** ページナンバー */
[23124]36    public $tpl_pageno;
[16066]37
38    /**
39     * Page を初期化する.
40     *
41     * @return void
42     */
[23124]43    public function init()
[22567]44    {
[16066]45        parent::init();
[20155]46        $this->tpl_mypageno = 'index';
[21441]47        if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
[19959]48            $this->tpl_subtitle = 'MYページ';
49        } else {
50            $this->tpl_subtitle = '購入履歴一覧';
51        }
[21951]52        $masterData = new SC_DB_MasterData_Ex();
[21942]53        $this->arrCustomerOrderStatus = $masterData->getMasterData('mtb_customer_order_status');
[21981]54
[18187]55        $this->httpCacheControl('nocache');
[16066]56    }
57
58    /**
59     * Page のプロセス.
60     *
61     * @return void
62     */
[23124]63    public function process()
[22567]64    {
[19661]65        parent::process();
66    }
[20148]67
[19661]68    /**
69     * Page のAction.
70     *
71     * @return void
72     */
[23124]73    public function action()
[22567]74    {
[23055]75        //決済処理中ステータスのロールバック
76        $objPurchase = new SC_Helper_Purchase_Ex();
[23230]77        $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG);
[23124]78
[20490]79        $objCustomer = new SC_Customer_Ex();
[22949]80        $customer_id = $objCustomer->getValue('customer_id');
[16066]81
82        //ページ送り用
[20491]83        $this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'],
[21527]84                                            $this->lfGetOrderHistory($customer_id),
85                                            SEARCH_PMAX,
[23066]86                                            'eccube.movePage',
[21527]87                                            NAVI_PMAX,
88                                            'pageno=#page#',
89                                            SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
[16066]90
[20155]91        $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row);
[16066]92
[21441]93        switch ($this->getMode()) {
[21610]94            case 'getList':
95                echo SC_Utils_Ex::jsonEncode($this->arrOrder);
[21743]96                SC_Response_Ex::actionExit();
[21051]97                break;
98            default:
99                break;
100        }
[20155]101        // 支払い方法の取得
[22537]102        $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList();
[21051]103        // 1ページあたりの件数
104        $this->dispNumber = SEARCH_PMAX;
[22856]105
[22563]106        $this->json_payment = SC_Utils::jsonEncode($this->arrPayment);
107        $this->json_customer_order_status = SC_Utils::jsonEncode($this->arrCustomerOrderStatus);
[20155]108    }
[16066]109
[20155]110    /**
111     * 受注履歴を返す
112     *
113     * @param mixed $customer_id
[23124]114     * @param mixed $startno     0以上の場合は受注履歴を返却する -1の場合は件数を返す
[20155]115     * @access private
116     * @return void
117     */
[23124]118    public function lfGetOrderHistory($customer_id, $startno = -1)
[22567]119    {
[20507]120        $objQuery   = SC_Query_Ex::getSingletonInstance();
[19959]121
[21942]122        $col        = 'order_id, create_date, payment_id, payment_total, status';
[21481]123        $from       = 'dtb_order';
[21514]124        $where      = 'del_flg = 0 AND customer_id = ?';
[21563]125        $arrWhereVal = array($customer_id);
[21514]126        $order      = 'order_id DESC';
[19959]127
[20155]128        if ($startno == -1) {
[21563]129            return $objQuery->count($from, $where, $arrWhereVal);
[19959]130        }
[20148]131
[20155]132        $objQuery->setLimitOffset(SEARCH_PMAX, $startno);
[16066]133        // 表示順序
[18675]134        $objQuery->setOrder($order);
[16066]135
[21866]136        //購入履歴の取得
137        return $objQuery->select($col, $from, $where, $arrWhereVal);
138    }
139}
Note: See TracBrowser for help on using the repository browser.