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

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