Warning: Can't use blame annotator:
svn blame failed on branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php: バイナリファイル 'file:///home/svn/open/branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php' に対しては blame で各行の最終変更者を計算できません 195004

source: branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php @ 19826

Revision 19826, 24.6 KB checked in by kotani, 13 years ago (diff)

#880(mobile/sphoneディレクトリを削除)に対応。まずmobileのみ意図通りの動作になるように一部コミット(products/detail.php)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
RevLine 
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
25require_once(CLASS_REALDIR . "pages/LC_Page.php");
26
27if (file_exists(MODULE_REALDIR . "mdl_gmopg/inc/function.php")) {
28    require_once(MODULE_REALDIR . "mdl_gmopg/inc/function.php");
29}
30/**
31 * 商品詳細 のページクラス.
32 *
33 * @package Page
34 * @author LOCKON CO.,LTD.
35 * @version $Id:LC_Page_Products_Detail.php 15532 2007-08-31 14:39:46Z nanasess $
36 */
37class LC_Page_Products_Detail extends LC_Page {
38
39    /** ステータス */
40    var $arrSTATUS;
41
42    /** ステータス画像 */
43    var $arrSTATUS_IMAGE;
44
45    /** 発送予定日 */
46    var $arrDELIVERYDATE;
47
48    /** おすすめレベル */
49    var $arrRECOMMEND;
50
51    /** フォームパラメータ */
52    var $objFormParam;
53
54    /** アップロードファイル */
55    var $objUpFile;
56
57    // }}}
58    // {{{ functions
59
60    /**
61     * Page を初期化する.
62     *
63     * @return void
64     */
65    function init() {
66        parent::init();
67        $masterData = new SC_DB_MasterData_Ex();
68        $this->arrSTATUS = $masterData->getMasterData("mtb_status");
69        $this->arrSTATUS_IMAGE = $masterData->getMasterData("mtb_status_image");
70        $this->arrDELIVERYDATE = $masterData->getMasterData("mtb_delivery_date");
71        $this->arrRECOMMEND = $masterData->getMasterData("mtb_recommend");
72    }
73
74    /**
75     * Page のプロセス.
76     *
77     * @return void
78     */
79    function process() {
80        parent::process();
81        $this->action();
82        $this->sendResponse();
83    }
84
85    /**
86     * Page のAction.
87     *
88     * @return void
89     */
90    function action() {
91        // プロダクトIDの正当性チェック
92        $product_id = $this->lfCheckProductId();
93
94        // XXX 削除可能か、SC_SiteViewクラスコンストラクタ内の処理を要確認
95        $objView = new SC_SiteView(strlen($_POST['mode']) == 0);
96       
97        $objCustomer = new SC_Customer();
98        $objDb = new SC_Helper_DB_Ex();
99        $objProduct = new SC_Product();
100
101        // ログイン中のユーザが商品をお気に入りにいれる処理
102        if ($objCustomer->isLoginSuccess() === true && strlen($_POST['mode']) > 0 && $_POST['mode'] == "add_favorite" && strlen($_POST['favorite_product_id']) > 0 ) {
103            // 値の正当性チェック
104            if(!SC_Utils_Ex::sfIsInt($_POST['favorite_product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $_POST['favorite_product_id'], "del_flg = 0 AND status = 1")) {
105                SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
106                exit;
107            } else {
108                $this->arrErr = $this->lfCheckError();
109                if(count($this->arrErr) == 0) {
110                    $customer_id = $objCustomer->getValue('customer_id');
111                    $this->lfRegistFavoriteProduct($customer_id, $_POST['favorite_product_id']);
112                }
113            }
114        }
115
116        // パラメータ管理クラス
117        $this->objFormParam = new SC_FormParam();
118        // パラメータ情報の初期化
119        $this->lfInitParam();
120        // POST値の取得
121        $this->objFormParam->setParam($_POST);
122
123        // ファイル管理クラス
124        $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR);
125        // ファイル情報の初期化
126        $this->lfInitFile();
127
128        // ログイン判定
129        if ($objCustomer->isLoginSuccess() === true) {
130            //お気に入りボタン表示
131            $this->tpl_login = true;
132        }
133
134        // 規格選択セレクトボックスの作成
135        if(Net_UserAgent_Mobile::isMobile() === true) {
136            $this->lfMakeSelectMobile($this, $product_id);
137        } else {
138            $this->lfMakeSelect($product_id);
139
140            $objProduct->setProductsClassByProductIds(array($product_id));
141
142            // 規格1クラス名
143            $this->tpl_class_name1 = $objProduct->className1[$product_id];
144
145            // 規格2クラス名
146            $this->tpl_class_name2 = $objProduct->className2[$product_id];
147
148            // 規格1
149            $this->arrClassCat1 = $objProduct->classCats1[$product_id];
150
151            // 規格1が設定されている
152            $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id];
153            // 規格2が設定されている
154            $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id];
155
156            $this->tpl_stock_find = $objProduct->stock_find[$product_id];
157            $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['']['']['product_class_id'];
158            $this->tpl_product_type = $objProduct->classCategories[$product_id]['']['']['product_type'];
159
160            $objJson = new Services_JSON();
161            $this->tpl_javascript .= 'classCategories = ' . $objJson->encode($objProduct->classCategories[$product_id]) . ';';
162            $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}';
163            $this->tpl_onload .= 'lnOnLoad();';
164        }
165
166        // 商品IDをFORM内に保持する
167        $this->tpl_product_id = $product_id;
168
169        // POSTされるmodeにより処理切り替え
170        if (!isset($_POST['mode'])) $_POST['mode'] = "";
171        if(Net_UserAgent_Mobile::isMobile() === true) {
172            $this->lfPostActionMobile();
173        } else {
174            $this->arrErr = $this->lfPostAction();
175        }
176
177        // 商品詳細を取得
178        $this->arrProduct = $objProduct->getDetail($product_id);
179
180        // サブタイトルを取得
181        $this->tpl_subtitle = $this->arrProduct['name'];
182
183        // 関連カテゴリを取得
184        $this->arrRelativeCat = $objDb->sfGetMultiCatTree($product_id);
185
186        // 商品ステータスを取得
187        $this->productStatus = $objProduct->getProductStatus($product_id);
188
189        // 画像ファイル指定がない場合の置換処理
190        $this->arrProduct['main_image']
191            = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']);
192
193        $this->lfSetFile();
194        // 支払方法の取得
195        $this->arrPayment = $this->lfGetPayment();
196        // 入力情報を渡す
197        $this->arrForm = $this->objFormParam->getFormParamList();
198        //レビュー情報の取得
199        $this->arrReview = $this->lfGetReviewData($product_id);
200        // トラックバック情報の取得
201
202        // トラックバック機能の稼働状況チェック
203        if (SC_Utils_Ex::sfGetSiteControlFlg(SITE_CONTROL_TRACKBACK) != 1) {
204            $this->arrTrackbackView = "OFF";
205        } else {
206            $this->arrTrackbackView = "ON";
207            $this->arrTrackback = $this->lfGetTrackbackData($product_id);
208        }
209        $this->trackback_url = TRACKBACK_TO_URL . $product_id;
210        //関連商品情報表示
211        $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id);
212
213        $this->lfConvertParam();
214    }
215
216    /**
217     * デストラクタ.
218     *
219     * @return void
220     */
221    function destroy() {
222        parent::destroy();
223    }
224
225    /**
226     * POSTされるmodeにより処理切り替え
227     *
228     * @return array Error messages.
229     */
230    function lfPostAction() {
231        $arrErr = array();
232       
233        switch($_POST['mode']) {
234            case 'cart':
235                // 入力値の変換
236                $this->objFormParam->convParam();
237                $arrErr = $this->lfCheckError();
238                if (count($arrErr) == 0) {
239                    $objCartSess = new SC_CartSession();
240                    $classcategory_id1 = $_POST['classcategory_id1'];
241                    $classcategory_id2 = $_POST['classcategory_id2'];
242                    $product_class_id = $_POST['product_class_id'];
243                    $product_type = $_POST['product_type'];
244
245                    if (!empty($_POST['gmo_oneclick'])) {
246                        $objCartSess->delAllProducts();
247                    }
248
249                    // 規格1が設定されていない場合
250                    if(!$this->tpl_classcat_find1) {
251                        $classcategory_id1 = '0';
252                    }
253
254                    // 規格2が設定されていない場合
255                    if(!$this->tpl_classcat_find2) {
256                        $classcategory_id2 = '0';
257                    }
258                    $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'), $product_type);
259
260                    if (!empty($_POST['gmo_oneclick'])) {
261                        $objSiteSess = new SC_SiteSession;
262                        $objSiteSess->setRegistFlag();
263                        $objCartSess->saveCurrentCart($objSiteSess->getUniqId());
264
265                        $this->objDisplay->redirect($this->getLocation(
266                            URL_PATH . USER_DIR . 'gmopg_oneclick_confirm.php', array(), true));
267                        exit;
268                    }
269
270                    $this->objDisplay->redirect($this->getLocation(URL_CART_TOP));
271                    exit;
272                }
273                break;
274
275            default:
276                break;
277        }
278
279        return $arrErr;
280    }
281
282    /**
283     * POSTされるmodeにより処理切り替え(モバイル)
284     *
285     * @return void
286     */
287    function lfPostActionMobile() {
288        switch($_POST['mode']) {
289            case 'select':
290                // 規格1が設定されている場合
291                if($this->tpl_classcat_find1) {
292                    // templateの変更
293                    $this->tpl_mainpage = "products/select_find1.tpl";
294                    break;
295                }
296
297            case 'select2':
298                $this->arrErr = $this->lfCheckError();
299
300                // 規格1が設定されている場合
301                if($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) {
302                    // templateの変更
303                    $this->tpl_mainpage = "products/select_find1.tpl";
304                    break;
305                }
306
307                // 規格2が設定されている場合
308                if($this->tpl_classcat_find2) {
309                    $this->arrErr = array();
310
311                    $this->tpl_mainpage = "products/select_find2.tpl";
312                    break;
313                }
314
315            case 'selectItem':
316                $this->arrErr = $this->lfCheckError();
317
318                // 規格1が設定されている場合
319                if($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) {
320                    // templateの変更
321                    $this->tpl_mainpage = "products/select_find2.tpl";
322                    break;
323                }
324                // 商品数の選択を行う
325                $this->tpl_mainpage = "products/select_item.tpl";
326                break;
327
328            case 'cart':
329                // 入力値の変換
330                $this->objFormParam->convParam();
331                $this->arrErr = $this->lfCheckError();
332                if(count($this->arrErr) == 0) {
333                    $objCartSess = new SC_CartSession();
334                    $product_class_id = $_POST['product_class_id'];
335                    $classcategory_id1 = $_POST['classcategory_id1'];
336                    $classcategory_id2 = $_POST['classcategory_id2'];
337
338                    // 規格1が設定されていない場合
339                    if(!$this->tpl_classcat_find1) {
340                        $classcategory_id1 = '0';
341                    }
342
343                    // 規格2が設定されていない場合
344                    if(!$this->tpl_classcat_find2) {
345                        $classcategory_id2 = '0';
346                    }
347
348                    $objCartSess->addProduct(array($_POST['product_id'], $product_class_id, $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));
349                    $this->objDisplay->redirect($this->getLocation(URL_CART_TOP));
350                    exit;
351                }
352                break;
353
354            default:
355                $this->tpl_mainpage = "products/detail.tpl";
356                break;
357        }
358    }
359
360    /* プロダクトIDの正当性チェック */
361    function lfCheckProductId() {
362        // 管理機能からの確認の場合は、非公開の商品も表示する。
363        if (isset($_GET['admin']) && $_GET['admin'] == 'on') {
364            SC_Utils_Ex::sfIsSuccess(new SC_Session());
365            $status = true;
366            $where = 'del_flg = 0';
367        } else {
368            $status = false;
369            $where = 'del_flg = 0 AND status = 1';
370        }
371
372        if (defined('MOBILE_SITE')) {
373            if (!isset($_POST['mode'])) $_POST['mode'] = "";
374            if (!empty($_POST['mode'])) {
375                $product_id = $_POST['product_id'];
376            } else {
377                $product_id = $_GET['product_id'];
378            }
379        } else {
380            if(isset($_POST['mode']) && $_POST['mode'] != '') {
381                $product_id = $_POST['product_id'];
382            } else {
383                $product_id = $_GET['product_id'];
384            }
385        }
386
387        $objDb = new SC_Helper_DB_Ex();
388        if(!SC_Utils_Ex::sfIsInt($product_id)
389            || SC_Utils_Ex::sfIsZeroFilling($product_id)
390            || !$objDb->sfIsRecord('dtb_products', 'product_id', (array)$product_id, $where))
391            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
392        return $product_id;
393    }
394
395    /* ファイル情報の初期化 */
396    function lfInitFile() {
397        $this->objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT);
398        for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) {
399            $this->objUpFile->addFile("詳細-サブ画像$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT);
400        }
401    }
402
403    /* 規格選択セレクトボックスの作成 */
404    function lfMakeSelect() {
405
406        // 選択されている規格
407        $classcategory_id1
408            = isset($_POST['classcategory_id1']) && is_numeric($_POST['classcategory_id1'])
409            ? $_POST['classcategory_id1']
410            : '';
411
412        $classcategory_id2
413            = isset($_POST['classcategory_id2']) && is_numeric($_POST['classcategory_id2'])
414            ? $_POST['classcategory_id2']
415            : '';
416
417        $this->js_lnOnload .= 'fnSetClassCategories('
418            . 'document.form1, '
419            . Services_JSON::encode($classcategory_id2)
420            . '); ';
421    }
422
423    /* 規格選択セレクトボックスの作成(モバイル) */
424    function lfMakeSelectMobile(&$objPage, $product_id) {
425
426        $objDb = new SC_Helper_DB_Ex();
427        $classcat_find1 = false;
428        $classcat_find2 = false;
429        // 在庫ありの商品の有無
430        $stock_find = false;
431
432        // 規格名一覧
433        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
434        // 規格分類名一覧
435        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
436        /*
437         * FIXME
438         * パフォーマンスが出ないため,
439         * SC_Product::getProductsClassByProductIds() を使用した実装に変更
440         */
441        // 商品規格情報の取得
442        $arrProductsClass = $this->lfGetProductsClass($product_id);
443
444        // 規格1クラス名の取得
445        $objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']];
446        // 規格2クラス名の取得
447        $objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']];
448
449        // すべての組み合わせ数
450        $count = count($arrProductsClass);
451
452        $classcat_id1 = "";
453
454        $arrSele1 = array();
455        $arrSele2 = array();
456
457        for ($i = 0; $i < $count; $i++) {
458            // 在庫のチェック
459            if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
460                continue;
461            }
462
463            $stock_find = true;
464
465            // 規格1のセレクトボックス用
466            if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
467                $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
468                $arrSele1[$classcat_id1] = $arrClassCatName[$classcat_id1];
469            }
470
471            // 規格2のセレクトボックス用
472            if($arrProductsClass[$i]['classcategory_id1'] == $_POST['classcategory_id1'] and $classcat_id2 != $arrProductsClass[$i]['classcategory_id2']) {
473                $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
474                $arrSele2[$classcat_id2] = $arrClassCatName[$classcat_id2];
475            }
476        }
477
478        // 規格1
479        $objPage->arrClassCat1 = $arrSele1;
480        $objPage->arrClassCat2 = $arrSele2;
481
482        // 規格1が設定されている
483        if($arrProductsClass[0]['classcategory_id1'] != '0') {
484            $classcat_find1 = true;
485        }
486
487        // 規格2が設定されている
488        if($arrProductsClass[0]['classcategory_id2'] != '0') {
489            $classcat_find2 = true;
490        }
491
492        $objPage->tpl_classcat_find1 = $classcat_find1;
493        $objPage->tpl_classcat_find2 = $classcat_find2;
494        $objPage->tpl_stock_find = $stock_find;
495    }
496
497    /* パラメータ情報の初期化 */
498    function lfInitParam() {
499        $this->objFormParam->addParam("規格1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
500        $this->objFormParam->addParam("規格2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
501        $this->objFormParam->addParam("数量", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
502    }
503
504    /* 商品規格情報の取得 */
505    function lfGetProductsClass($product_id) {
506        $objProduct = new SC_Product();
507        return $objProduct->getProductsClassFullByProductId($product_id);
508    }
509
510    /* 登録済み関連商品の読み込み */
511    function lfPreGetRecommendProducts($product_id) {
512        $arrRecommend = array();
513        $objQuery = new SC_Query();
514        $objQuery->setOrder("rank DESC");
515        $arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
516        $max = count($arrRet);
517        $no = 0;
518        // FIXME SC_Product クラスを使用した実装
519        $from = "vw_products_allclass AS T1 "
520                . " JOIN ("
521                . " SELECT max(T2.rank) AS product_rank, "
522                . "        T2.product_id"
523                . "   FROM dtb_product_categories T2  "
524                . " GROUP BY product_id) AS T3 USING (product_id)";
525        $objQuery->setOrder("T3.product_rank DESC");
526        for($i = 0; $i < $max; $i++) {
527            $where = "del_flg = 0 AND T3.product_id = ? AND status = 1";
528            $arrProductInfo = $objQuery->select("DISTINCT main_list_image, price02_min, price02_max, price01_min, price01_max, name, T3.product_rank", $from, $where, array($arrRet[$i]['recommend_product_id']));
529
530            if(count($arrProductInfo) > 0) {
531                $arrRecommend[$no] = $arrProductInfo[0];
532                $arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id'];
533                $arrRecommend[$no]['comment'] = $arrRet[$i]['comment'];
534                $no++;
535            }
536        }
537        return $arrRecommend;
538    }
539
540    /* 入力内容のチェック */
541    function lfCheckError() {
542        if ($_POST['mode'] == "add_favorite") {
543            $objCustomer = new SC_Customer();
544            $objErr = new SC_CheckError();
545            $customer_id = $objCustomer->getValue('customer_id');
546            if (SC_Helper_DB_Ex::sfDataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($customer_id, $favorite_product_id))) {
547                $objErr->arrErr['add_favorite'.$favorite_product_id] = "※ この商品は既にお気に入りに追加されています。<br />";
548            }
549        } else {
550            // 入力データを渡す。
551            $arrRet =  $this->objFormParam->getHashArray();
552            $objErr = new SC_CheckError($arrRet);
553            $objErr->arrErr = $this->objFormParam->checkError();
554
555            // 複数項目チェック
556            if ($this->tpl_classcat_find1) {
557                $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK"));
558            }
559            if ($this->tpl_classcat_find2) {
560                $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK"));
561            }
562        }
563
564        return $objErr->arrErr;
565    }
566
567    //閲覧履歴新規登録
568    function lfRegistReadingData($product_id, $customer_id){
569        $objQuery = new SC_Query;
570        $sqlval['customer_id'] = $customer_id;
571        $sqlval['reading_product_id'] = $product_id;
572        $sqlval['create_date'] = 'NOW()';
573        $sqlval['update_date'] = 'NOW()';
574        $objQuery->insert("dtb_customer_reading", $sqlval);
575    }
576
577    //商品ごとのレビュー情報を取得する
578    function lfGetReviewData($id) {
579        $objQuery = new SC_Query;
580        //商品ごとのレビュー情報を取得する
581        $col = "create_date, reviewer_url, reviewer_name, recommend_level, title, comment";
582        $from = "dtb_review";
583        $where = "del_flg = 0 AND status = 1 AND product_id = ? ORDER BY create_date DESC LIMIT " . REVIEW_REGIST_MAX;
584        $arrval[] = $id;
585        $arrReview = $objQuery->select($col, $from, $where, $arrval);
586        return $arrReview;
587    }
588
589    /*
590     * 商品ごとのトラックバック情報を取得する
591     *
592     * @param $product_id
593     * @return $arrTrackback
594     */
595    function lfGetTrackbackData($product_id) {
596
597        $arrTrackback = array();
598
599        $objQuery = new SC_Query;
600        //商品ごとのトラックバック情報を取得する
601        $col = "blog_name, url, title, excerpt, title, create_date";
602        $from = "dtb_trackback";
603        $where = "del_flg = 0 AND status = 1 AND product_id = ? ORDER BY create_date DESC LIMIT " . TRACKBACK_VIEW_MAX;
604        $arrval[] = $product_id;
605        $arrTrackback = $objQuery->select($col, $from, $where, $arrval);
606        return $arrTrackback;
607    }
608
609    //支払方法の取得
610    //payment_id    1:クレジット 2:ショッピングローン
611    function lfGetPayment() {
612        $objQuery = new SC_Query;
613        $col = "payment_id, rule, payment_method";
614        $from = "dtb_payment";
615        $where = "del_flg = 0";
616        $order = "payment_id";
617        $objQuery->setOrder($order);
618        $arrRet = $objQuery->select($col, $from, $where);
619        return $arrRet;
620    }
621
622    function lfConvertParam() {
623        if (!isset($this->arrForm['quantity']['value'])) $this->arrForm['quantity']['value'] = "";
624        $value = $this->arrForm['quantity']['value'];
625        $this->arrForm['quantity']['value'] = htmlspecialchars($value, ENT_QUOTES, CHAR_CODE);
626    }
627
628    /*
629     * ファイルの情報をセットする
630     *
631     */
632    function lfSetFile() {
633        // DBからのデータを引き継ぐ
634        $this->objUpFile->setDBFileList($this->arrProduct);
635        // ファイル表示用配列を渡す
636        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true);
637
638        // サブ画像の有無を判定
639        $this->subImageFlag = false;
640        for ($i = 1; $i <= PRODUCTSUB_MAX; $i++) {
641            if ($this->arrFile["sub_image" . $i]["filepath"] != "") {
642                $this->subImageFlag = true;
643            }
644        }
645    }
646
647    /*
648     * お気に入り商品登録
649     */
650    function lfRegistFavoriteProduct($customer_id, $product_id) {
651        $objQuery = new SC_Query();
652        $count = $objQuery->count("dtb_customer_favorite_products", "customer_id = ? AND product_id = ?", array($customer_id, $product_id));
653
654        if ($count == 0) {
655            $sqlval['customer_id'] = $customer_id;
656            $sqlval['product_id'] = $product_id;
657            $sqlval['update_date'] = "now()";
658            $sqlval['create_date'] = "now()";
659
660            $objQuery->begin();
661            $objQuery->insert('dtb_customer_favorite_products', $sqlval);
662            $objQuery->commit();
663        }
664    }
665
666}
667?>
Note: See TracBrowser for help on using the repository browser.