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

Revision 19962, 23.6 KB checked in by kotani, 13 years ago (diff)

#880(mobile/sphoneディレクトリを削除)に対応。

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