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

Revision 22537, 8.1 KB checked in by pineray, 11 years ago (diff)

pageクラスからdtb_paymentテーブルを直接指定している箇所をなくす

以下のファイルが残っている.
LC_Page_Shopping_LoadPaymentModule.php
LC_Page_Admin_Home.php

  • 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 
[16102]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.
[16102]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.
[16102]22 */
23
24// {{{ requires
[20534]25require_once CLASS_EX_REALDIR . 'page_extends/mypage/LC_Page_AbstractMypage_Ex.php';
[16102]26
27/**
28 * 購入履歴 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
[20162]34class LC_Page_Mypage_History extends LC_Page_AbstractMypage_Ex {
[16102]35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
[20144]46        $this->tpl_mypageno     = 'index';
47        $this->tpl_subtitle     = '購入履歴詳細';
[18187]48        $this->httpCacheControl('nocache');
[20144]49
50        $masterData             = new SC_DB_MasterData_Ex();
[21481]51        $this->arrMAILTEMPLATE  = $masterData->getMasterData('mtb_mail_template');
[20144]52        $this->arrPref          = $masterData->getMasterData('mtb_pref');
[21481]53        $this->arrWDAY          = $masterData->getMasterData('mtb_wday');
54        $this->arrProductType   = $masterData->getMasterData('mtb_product_type');
[21527]55    }
[16102]56
57    /**
58     * Page のプロセス.
59     *
60     * @return void
61     */
62    function process() {
[19661]63        parent::process();
64    }
65
66    /**
67     * Page のAction.
68     *
69     * @return void
70     */
71    function action() {
[21596]72
[20490]73        $objCustomer    = new SC_Customer_Ex();
[20144]74        $objDb          = new SC_Helper_DB_Ex();
[20167]75        $objPurchase = new SC_Helper_Purchase_Ex();
[22271]76        $objProduct  = new SC_Product();
[16102]77
[18399]78        if (!SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
[20144]79            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
[18399]80        }
81
[22271]82        $order_id               = $_GET['order_id'];
83        $this->is_price_change  = false;
[18399]84
[20167]85        //受注データの取得
86        $this->tpl_arrOrderData = $objPurchase->getOrder($order_id, $objCustomer->getValue('customer_id'));
87
[21441]88        if (empty($this->tpl_arrOrderData)) {
[16102]89            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
90        }
91
[20694]92        $this->arrShipping      = $this->lfGetShippingDate($objPurchase, $order_id, $this->arrWDAY);
[20144]93
94        $this->isMultiple       = count($this->arrShipping) > 1;
[18399]95        // 支払い方法の取得
[22537]96        $this->arrPayment       = SC_Helper_Payment_Ex::getIDValueList();
[18399]97        // 受注商品明細の取得
[20167]98        $this->tpl_arrOrderDetail = $objPurchase->getOrderDetail($order_id);
[22271]99        foreach ($this->tpl_arrOrderDetail as $product_index => $arrOrderProductDetail) {
100            //必要なのは商品の販売金額のみなので、遅い場合は、別途SQL作成した方が良い
101            $arrTempProductDetail = $objProduct->getProductsClass($arrOrderProductDetail['product_class_id']);
102            if($this->tpl_arrOrderDetail[$product_index]['price'] != $arrTempProductDetail['price02']) {
103                $this->is_price_change = true;
104            }
105            $this->tpl_arrOrderDetail[$product_index]['product_price'] = ($arrTempProductDetail['price02'])?$arrTempProductDetail['price02']:0;
106        }
107       
[21046]108        $this->tpl_arrOrderDetail = $this->setMainListImage($this->tpl_arrOrderDetail);
[20888]109        $objPurchase->setDownloadableFlgTo($this->tpl_arrOrderDetail);
[21354]110        // モバイルダウンロード対応処理
111        $this->lfSetAU($this->tpl_arrOrderDetail);
[18399]112        // 受注メール送信履歴の取得
[20144]113        $this->tpl_arrMailHistory = $this->lfGetMailHistory($order_id);
[21596]114
[18399]115
[16102]116    }
117
118    /**
119     * デストラクタ.
120     *
121     * @return void
122     */
123    function destroy() {
124        parent::destroy();
125    }
126
[16234]127    /**
[18399]128     * 受注メール送信履歴の取得
129     *
[20144]130     * @param integer $order_id 注文番号
[18399]131     * @return array 受注メール送信履歴の内容
132     */
[20144]133    function lfGetMailHistory($order_id) {
[20507]134        $objQuery   =& SC_Query_Ex::getSingletonInstance();
[20144]135        $col        = 'send_date, subject, template_id, send_id';
136        $where      = 'order_id = ?';
[18675]137        $objQuery->setOrder('send_date DESC');
[20144]138        return $objQuery->select($col, 'dtb_mail_history', $where, array($order_id));
[18399]139    }
[20583]140
141    /**
142     * 受注お届け先情報の取得
143     *
144     * @param $objPurchase object SC_Helper_Purchaseクラス
145     * @param $order_id integer 注文番号
146     * @param $arrWDAY array 曜日データの配列
147     * @return array お届け先情報
148     */
[20585]149    function lfGetShippingDate(&$objPurchase, $order_id, $arrWDAY) {
[20583]150        $arrShipping = $objPurchase->getShippings($order_id);
151
[21441]152        foreach ($arrShipping as $shipping_index => $shippingData) {
153            foreach ($shippingData as $key => $val) {
154                if ($key == 'shipping_date' && SC_Utils_Ex::isBlank($val) == false) {
[20583]155                    // お届け日を整形
[21514]156                    list($y, $m, $d, $w) = explode(' ', date('Y m d w' , strtotime($val)));
157                    $arrShipping[$shipping_index]['shipping_date'] = sprintf('%04d/%02d/%02d(%s)', $y, $m, $d, $arrWDAY[$w]);
[20583]158                }
159            }
160        }
161
162        return $arrShipping;
163    }
[21420]164
[21046]165    /**
166     * 購入履歴商品に画像をセット
167     *
168     * @param $arrOrderDetail 購入履歴の配列
169     * @return array 画像をセットした購入履歴の配列
170     */
171    function setMainListImage($arrOrderDetails) {
172        $i = 0;
173        foreach ($arrOrderDetails as $arrOrderDetail) {
174            $objQuery =& SC_Query_Ex::getSingletonInstance();
175            $arrProduct = $objQuery->select('main_list_image', 'dtb_products', 'product_id = ?', array($arrOrderDetail['product_id']));
176            $arrOrderDetails[$i]['main_list_image'] = $arrProduct[0]['main_list_image'];
[21071]177            $i++;
[21046]178        }
179        return $arrOrderDetails;
180    }
[21354]181
182    /**
183     * 購入履歴商品にMIMETYPE、ファイル名をセット
184     *
185     * @param $arrOrderDetail 購入履歴の配列
186     * @return array MIMETYPE、ファイル名をセットした購入履歴の配列
187     */
188    function lfSetMimetype($arrOrderDetails) {
189        $objHelperMobile = new SC_Helper_Mobile_Ex();
190        $i = 0;
191        foreach ($arrOrderDetails as $arrOrderDetail) {
192            $objQuery =& SC_Query_Ex::getSingletonInstance();
193            $arrProduct = $objQuery->select('down_realfilename,down_filename', 'dtb_products_class', 'product_id = ? AND product_class_id = ?', array($arrOrderDetail['product_id'],$arrOrderDetail['product_class_id']));
194            $arrOrderDetails[$i]['mime_type'] = $objHelperMobile->getMimeType($arrProduct[0]['down_realfilename']);
195            $arrOrderDetails[$i]['down_filename'] = $arrProduct[0]['down_filename'];
196            $i++;
197        }
198        return $arrOrderDetails;
199    }
200
201    /**
202     * 特定キャリア(AU)モバイルダウンロード処理
203     * キャリアがAUのモバイル端末からダウンロードする場合は単純に
204     * Aタグでダウンロードできないケースがある為、対応する。
205     *
206     * @param integer $order_id 注文番号
207     * @param $arrOrderDetail 購入履歴の配列
208     */
209    function lfSetAU($arrOrderDetails) {
210        $this->isAU = false;
211        // モバイル端末かつ、キャリアがAUの場合に処理を行う
[21441]212        if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && SC_MobileUserAgent::getCarrier() == 'ezweb') {
[21354]213            // MIMETYPE、ファイル名のセット
214            $this->tpl_arrOrderDetail = $this->lfSetMimetype($arrOrderDetails);
[21636]215
216            // @deprecated 2.12.0 PHP 定数 SID を使うこと
[21354]217            $this->phpsessid = $_GET['PHPSESSID'];
[21636]218
[21354]219            $this->isAU = true;
220        }
221    }
[16102]222}
Note: See TracBrowser for help on using the repository browser.