| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of EC-CUBE |
|---|
| 4 | * |
|---|
| 5 | * Copyright(c) 2000-2007 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_PATH . "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 | } |
|---|
| 47 | |
|---|
| 48 | /** |
|---|
| 49 | * Page のプロセス. |
|---|
| 50 | * |
|---|
| 51 | * @return void |
|---|
| 52 | */ |
|---|
| 53 | function process() { |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | /** |
|---|
| 57 | * モバイルページを初期化する. |
|---|
| 58 | * |
|---|
| 59 | * @return void |
|---|
| 60 | */ |
|---|
| 61 | function mobileInit() { |
|---|
| 62 | $this->tpl_mainpage = 'mypage/history_detail.tpl'; |
|---|
| 63 | $this->tpl_title = "MYページ/購入履歴詳細"; |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | /** |
|---|
| 67 | * Page のプロセス(モバイル). |
|---|
| 68 | * |
|---|
| 69 | * @return void |
|---|
| 70 | */ |
|---|
| 71 | function mobileProcess() { |
|---|
| 72 | $objView = new SC_MobileView(); |
|---|
| 73 | $objQuery = new SC_Query(); |
|---|
| 74 | $objCustomer = new SC_Customer(); |
|---|
| 75 | $objDb = new SC_Helper_DB_Ex(); |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | //不正アクセス判定 |
|---|
| 79 | $from = "dtb_order"; |
|---|
| 80 | $where = "del_flg = 0 AND customer_id = ? AND order_id = ? "; |
|---|
| 81 | $arrval = array($objCustomer->getValue('customer_id'), $_POST['order_id']); |
|---|
| 82 | //DBに情報があるか判定 |
|---|
| 83 | $cnt = $objQuery->count($from, $where, $arrval); |
|---|
| 84 | |
|---|
| 85 | //ログインしていない、またはDBに情報が無い場合 |
|---|
| 86 | if (!$objCustomer->isLoginSuccess(true) or $cnt == 0){ |
|---|
| 87 | SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true); |
|---|
| 88 | } else { |
|---|
| 89 | //受注詳細データの取得 |
|---|
| 90 | $this->arrDisp = $this->lfGetOrderData($_POST['order_id']); |
|---|
| 91 | // 支払い方法の取得 |
|---|
| 92 | $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); |
|---|
| 93 | // 配送時間の取得 |
|---|
| 94 | $arrRet = $objDb->sfGetDelivTime($this->arrDisp['payment_id']); |
|---|
| 95 | $this->arrDelivTime = SC_Utils_Ex::sfArrKeyValue($arrRet, 'time_id', 'deliv_time'); |
|---|
| 96 | |
|---|
| 97 | //マイページトップ顧客情報表示用 |
|---|
| 98 | $this->CustomerName1 = $objCustomer->getvalue('name01'); |
|---|
| 99 | $this->CustomerName2 = $objCustomer->getvalue('name02'); |
|---|
| 100 | $this->CustomerPoint = $objCustomer->getvalue('point'); |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | $objView->assignobj($this); |
|---|
| 104 | $objView->display(SITE_FRAME); |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | /** |
|---|
| 108 | * デストラクタ. |
|---|
| 109 | * |
|---|
| 110 | * @return void |
|---|
| 111 | */ |
|---|
| 112 | function destroy() { |
|---|
| 113 | parent::destroy(); |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | //受注詳細データの取得 |
|---|
| 118 | function lfGetOrderData($order_id) { |
|---|
| 119 | //受注番号が数字であれば |
|---|
| 120 | if(SC_Utils_Ex::sfIsInt($order_id)) { |
|---|
| 121 | // DBから受注情報を読み込む |
|---|
| 122 | $objQuery = new SC_Query(); |
|---|
| 123 | $col = "order_id, create_date, payment_id, subtotal, tax, use_point, add_point, discount, "; |
|---|
| 124 | $col .= "deliv_fee, charge, payment_total, deliv_name01, deliv_name02, deliv_kana01, deliv_kana02, "; |
|---|
| 125 | $col .= "deliv_zip01, deliv_zip02, deliv_pref, deliv_addr01, deliv_addr02, deliv_tel01, deliv_tel02, deliv_tel03, deliv_time_id, deliv_date "; |
|---|
| 126 | $from = "dtb_order"; |
|---|
| 127 | $where = "order_id = ?"; |
|---|
| 128 | $arrRet = $objQuery->select($col, $from, $where, array($order_id)); |
|---|
| 129 | $arrOrder = $arrRet[0]; |
|---|
| 130 | // 受注詳細データの取得 |
|---|
| 131 | $arrRet = $this->lfGetOrderDetail($order_id); |
|---|
| 132 | $arrOrderDetail = SC_Utils_Ex::sfSwapArray($arrRet); |
|---|
| 133 | $arrData = array_merge($arrOrder, $arrOrderDetail); |
|---|
| 134 | } |
|---|
| 135 | return $arrData; |
|---|
| 136 | } |
|---|
| 137 | |
|---|
| 138 | // 受注詳細データの取得 |
|---|
| 139 | function lfGetOrderDetail($order_id) { |
|---|
| 140 | $objQuery = new SC_Query(); |
|---|
| 141 | $col = "product_id, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate"; |
|---|
| 142 | $where = "order_id = ?"; |
|---|
| 143 | $objQuery->setorder("classcategory_id1, classcategory_id2"); |
|---|
| 144 | $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id)); |
|---|
| 145 | return $arrRet; |
|---|
| 146 | } |
|---|
| 147 | } |
|---|
| 148 | ?> |
|---|