Changeset 19535


Ignore:
Timestamp:
2010/11/07 04:27:50 (13 years ago)
Author:
konishi
Message:

表示テスト

Location:
branches/camp/camp-2_5-C/data/class/pages/admin/products
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/camp/camp-2_5-C/data/class/pages/admin/products/LC_Page_Admin_Products_Preview.php

    r19182 r19535  
    2525require_once(CLASS_PATH . "pages/LC_Page.php"); 
    2626 
     27if (file_exists(MODULE_PATH . "mdl_gmopg/inc/function.php")) { 
     28    require_once(MODULE_PATH . "mdl_gmopg/inc/function.php"); 
     29} 
    2730/** 
    28  * 商品管理 のページクラス. 
     31 * 商品詳細 のページクラス. 
    2932 * 
    3033 * @package Page 
    3134 * @author LOCKON CO.,LTD. 
    32  * @version $Id:LC_Page_Admin_Products.php 15532 2007-08-31 14:39:46Z nanasess $ 
     35 * @version $Id:LC_Page_Products_Detail.php 15532 2007-08-31 14:39:46Z nanasess $ 
    3336 */ 
    34 class LC_Page_Admin_Products_Preview extends LC_Page { 
     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; 
    3556 
    3657    // }}} 
     
    4465    function init() { 
    4566        parent::init(); 
    46         $this->tpl_mainpage = 'products/product.tpl'; 
    47         $this->tpl_subnavi = 'products/subnavi.tpl'; 
    48         $this->tpl_mainno = 'products'; 
    49         $this->tpl_subno = 'product'; 
    50         $this->tpl_subtitle = '商品登録'; 
    51         $this->arrErr = array(); 
    52  
    5367        $masterData = new SC_DB_MasterData_Ex(); 
    54         $this->arrDISP = $masterData->getMasterData("mtb_disp"); 
    55         $this->arrCLASS = $masterData->getMasterData("mtb_class"); 
    5668        $this->arrSTATUS = $masterData->getMasterData("mtb_status"); 
    5769        $this->arrSTATUS_IMAGE = $masterData->getMasterData("mtb_status_image"); 
    5870        $this->arrDELIVERYDATE = $masterData->getMasterData("mtb_delivery_date"); 
    59         $this->arrAllowedTag = $masterData->getMasterData("mtb_allowed_tag"); 
    60         $this->arrProductType = $masterData->getMasterData("mtb_product_type"); 
    61         $this->arrMaker = SC_Helper_DB_Ex::sfGetIDValueList("dtb_maker", "maker_id", "name"); 
    62         $this->tpl_nonclass = true; 
     71        $this->arrRECOMMEND = $masterData->getMasterData("mtb_recommend"); 
    6372    } 
    6473 
     
    6978     */ 
    7079    function process() { 
    71         $objView = new SC_AdminView(); 
    72         $objSiteInfo = new SC_SiteInfo(); 
     80        // プロダクトIDの正当性チェック 
     81        $product_id = $this->lfCheckProductId(); 
     82 
     83        $objView = new SC_SiteView(strlen($_POST['mode']) == 0); 
     84        $objCustomer = new SC_Customer(); 
    7385        $objQuery = new SC_Query(); 
    7486        $objDb = new SC_Helper_DB_Ex(); 
    75         $objProduct = new SC_Product(); 
    76  
    77         // 認証可否の判定 
    78         $objSess = new SC_Session(); 
    79         SC_Utils_Ex::sfIsSuccess($objSess); 
    80  
    81         // Downファイル管理クラス 
    82         $this->objDownFile = new SC_UploadFile(DOWN_TEMP_DIR, DOWN_SAVE_DIR); 
    83         // Downファイル情報の初期化 
    84         $this->lfInitDownFile(); 
    85         // Hiddenからのデータを引き継ぐ 
    86         $this->objDownFile->setHiddenFileList($_POST); 
     87 
     88        // レイアウトデザインを取得 
     89        $helper = new SC_Helper_PageLayout_Ex(); 
     90        $helper->sfGetPageLayout($this, false, "products/detail.php"); 
     91 
     92        // ログイン中のユーザが商品をお気に入りにいれる処理 
     93        if ($objCustomer->isLoginSuccess() === true && strlen($_POST['mode']) > 0 && $_POST['mode'] == "add_favorite" && strlen($_POST['favorite_product_id']) > 0 ) { 
     94            // 値の正当性チェック 
     95            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")) { 
     96                SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 
     97                exit; 
     98            } else { 
     99                $this->arrErr = $this->lfCheckError(); 
     100                if(count($this->arrErr) == 0) { 
     101                    $customer_id = $objCustomer->getValue('customer_id'); 
     102                    $this->lfRegistFavoriteProduct($customer_id, $_POST['favorite_product_id']); 
     103                } 
     104            } 
     105        } 
     106 
     107        // パラメータ管理クラス 
     108        $this->objFormParam = new SC_FormParam(); 
     109        // パラメータ情報の初期化 
     110        $this->lfInitParam(); 
     111        // POST値の取得 
     112        $this->objFormParam->setParam($_POST); 
    87113 
    88114        // ファイル管理クラス 
    89115        $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR); 
    90  
    91116        // ファイル情報の初期化 
    92117        $this->lfInitFile(); 
    93         // Hiddenからのデータを引き継ぐ 
    94         $this->objUpFile->setHiddenFileList($_POST); 
    95  
    96         // 規格の有り無し判定 
    97         $this->tpl_nonclass = !$objDb->sfHasProductClass($_POST['product_id']); 
    98  
    99         // 検索パラメータの引き継ぎ 
    100         foreach ($_POST as $key => $val) { 
    101             if (ereg("^search_", $key)) { 
    102                 $this->arrSearchHidden[$key] = $val; 
    103             } 
    104         } 
    105  
    106         // FORMデータの引き継ぎ 
    107         $this->arrForm = $_POST; 
     118 
     119        // ログイン判定 
     120        if ($objCustomer->isLoginSuccess() === true) { 
     121            //お気に入りボタン表示 
     122            $this->tpl_login = true; 
     123 
     124        /* 閲覧ログ機能は現在未使用 
     125 
     126            $table = "dtb_customer_reading"; 
     127            $where = "customer_id = ? "; 
     128            $arrval[] = $objCustomer->getValue('customer_id'); 
     129            //顧客の閲覧商品数 
     130            $rpcnt = $objQuery->count($table, $where, $arrval); 
     131 
     132            //閲覧数が設定数以下 
     133            if ($rpcnt < CUSTOMER_READING_MAX){ 
     134                //閲覧履歴に新規追加 
     135                lfRegistReadingData($product_id, $objCustomer->getValue('customer_id')); 
     136            } else { 
     137                //閲覧履歴の中で一番古いものを削除して新規追加 
     138                $oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?"; 
     139                $old = $objQuery->getOne($oldsql, array($objCustomer->getValue("customer_id"))); 
     140                $where = "customer_id = ? AND update_date = ? "; 
     141                $arrval = array($objCustomer->getValue("customer_id"), $old); 
     142                //削除 
     143                $objQuery->delete($table, $where, $arrval); 
     144                //追加 
     145                lfRegistReadingData($product_id, $objCustomer->getValue('customer_id')); 
     146            } 
     147        */ 
     148        } 
     149 
     150        // 規格選択セレクトボックスの作成 
     151        $this->lfMakeSelect($product_id); 
     152 
     153        $objProduct = new SC_Product(); 
     154        $objProduct->setProductsClassByProductIds(array($product_id)); 
     155 
     156        // 規格1クラス名 
     157        $this->tpl_class_name1 = $objProduct->className1[$product_id]; 
     158 
     159        // 規格2クラス名 
     160        $this->tpl_class_name2 = $objProduct->className2[$product_id]; 
     161 
     162        // 規格1 
     163        $this->arrClassCat1 = $objProduct->classCats1[$product_id]; 
     164 
     165        // 規格1が設定されている 
     166        $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id]; 
     167        // 規格2が設定されている 
     168        $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id]; 
     169 
     170        $this->tpl_stock_find = $objProduct->stock_find[$product_id]; 
     171        $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['']['']['product_class_id']; 
     172        $this->tpl_product_type = $objProduct->classCategories[$product_id]['']['']['product_type']; 
     173 
     174        require_once DATA_PATH . 'module/Services/JSON.php'; 
     175        $objJson = new Services_JSON(); 
     176        $this->tpl_javascript .= 'classCategories = ' . $objJson->encode($objProduct->classCategories[$product_id]) . ';'; 
     177        $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}'; 
     178        $this->tpl_onload .= 'lnOnLoad();'; 
     179 
     180        // 商品IDをFORM内に保持する。 
     181        $this->tpl_product_id = $product_id; 
    108182 
    109183        if (!isset($_POST['mode'])) $_POST['mode'] = ""; 
     184        $arrErr = array(); 
    110185 
    111186        switch($_POST['mode']) { 
    112             // 検索画面からの編集 
    113             case 'pre_edit': 
    114             case 'copy' : 
    115                 if (!SC_Utils_Ex::sfIsInt($_POST['product_id'])) { 
    116                     SC_Utils_Ex::sfDispException(); 
    117                 } 
    118  
    119                 // DBから商品情報の読込 
    120                 $this->arrForm = $this->lfGetProduct($_POST['product_id']); 
    121                 $productStatus= $objProduct->getProductStatus(array($_POST['product_id'])); 
    122                 $this->arrForm['product_status'] = $productStatus[$_POST['product_id']]; 
    123  
    124                 // DBデータから画像ファイル名の読込 
    125                 $this->objUpFile->setDBFileList($this->arrForm); 
    126                 // DBデータからダウンロードファイル名の読込 
    127                 $this->objDownFile->setDBDownFile($this->arrForm); 
    128  
    129                 // 商品ステータスの変換 
    130                 $arrRet = SC_Utils_Ex::sfSplitCBValue($this->arrForm['product_flag'], "product_flag"); 
    131                 $this->arrForm = array_merge($this->arrForm, $arrRet); 
    132                 // DBから関連商品の読み込み 
    133                 $this->lfPreGetRecommendProducts($_POST['product_id']); 
    134  
    135                 $this->lfProductPage();     // 商品登録ページ 
    136  
    137                 if($_POST['mode'] == "copy"){ 
    138                     $this->arrForm["copy_product_id"] = $this->arrForm["product_id"]; 
    139                     $this->arrForm["product_id"] = ""; 
    140                     // 画像ファイルのコピー 
    141                     $arrKey = $this->objUpFile->keyname; 
    142                     $arrSaveFile = $this->objUpFile->save_file; 
    143  
    144                     foreach($arrSaveFile as $key => $val){ 
    145                         $this->lfMakeScaleImage($arrKey[$key], $arrKey[$key], true); 
     187            case 'cart': 
     188                // 入力値の変換 
     189                $this->objFormParam->convParam(); 
     190                $arrErr = $this->lfCheckError(); 
     191                if (count($arrErr) == 0) { 
     192                    $objCartSess = new SC_CartSession(); 
     193                    $classcategory_id1 = $_POST['classcategory_id1']; 
     194                    $classcategory_id2 = $_POST['classcategory_id2']; 
     195                    $product_class_id = $_POST['product_class_id']; 
     196                    $product_type = $_POST['product_type']; 
     197 
     198                    if (!empty($_POST['gmo_oneclick'])) { 
     199                        $objCartSess->delAllProducts(); 
    146200                    } 
     201 
     202                    // 規格1が設定されていない場合 
     203                    if(!$this->tpl_classcat_find1) { 
     204                        $classcategory_id1 = '0'; 
     205                    } 
     206 
     207                    // 規格2が設定されていない場合 
     208                    if(!$this->tpl_classcat_find2) { 
     209                        $classcategory_id2 = '0'; 
     210                    } 
     211                    $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'), $product_type); 
     212 
     213                    if (!empty($_POST['gmo_oneclick'])) { 
     214                        $objSiteSess = new SC_SiteSession; 
     215                        $objSiteSess->setRegistFlag(); 
     216                        $objCartSess->saveCurrentCart($objSiteSess->getUniqId()); 
     217 
     218                        $this->sendRedirect($this->getLocation( 
     219                            URL_DIR . 'user_data/gmopg_oneclick_confirm.php', array(), true)); 
     220                        exit; 
     221                    } 
     222 
     223                    $this->sendRedirect($this->getLocation(URL_CART_TOP)); 
     224                    exit; 
    147225                } 
    148226                break; 
    149             // 商品登録・編集 
    150             case 'edit': 
    151                 if($_POST['product_id'] == "" and SC_Utils_Ex::sfIsInt($_POST['copy_product_id'])){ 
    152                     $this->tpl_nonclass = !$objDb->sfHasProductClass($_POST['copy_product_id']); 
    153                 } 
    154  
    155                 // 入力値の変換 
    156                 $this->arrForm = $this->lfConvertParam($this->arrForm); 
    157                 // エラーチェック 
    158                 $this->arrErr = $this->lfErrorCheck($this->arrForm); 
    159                 // ファイル存在チェック 
    160                 $this->arrErr = array_merge((array)$this->arrErr, (array)$this->objUpFile->checkEXISTS()); 
    161                 // エラーなしの場合 
    162                 if(count($this->arrErr) == 0) { 
    163                     $this->lfProductConfirmPage(); // 確認ページ 
    164                 } else { 
    165                     $this->lfProductPage();     // 商品登録ページ 
    166                 } 
     227 
     228            default: 
    167229                break; 
    168             // 確認ページから完了ページへ 
    169             case 'complete': 
    170                 $this->tpl_mainpage = 'products/complete.tpl'; 
    171  
    172                 $this->arrForm['product_id'] = $this->lfRegistProduct($_POST);      // データ登録 
    173  
    174                 // 件数カウントバッチ実行 
    175                 $objDb->sfCategory_Count($objQuery); 
    176                 $objDb->sfMaker_Count($objQuery); 
    177                 // 一時ファイルを本番ディレクトリに移動する 
    178                 $this->objUpFile->moveTempFile(); 
    179                 $this->objDownFile->moveTempDownFile(); 
    180  
    181                 break; 
    182             // 画像のアップロード 
    183             case 'upload_image': 
    184                 // ファイル存在チェック 
    185                 $this->arrErr = array_merge((array)$this->arrErr, (array)$this->objUpFile->checkEXISTS($_POST['image_key'])); 
    186                 // 画像保存処理 
    187                 $this->arrErr[$_POST['image_key']] = $this->objUpFile->makeTempFile($_POST['image_key'],IMAGE_RENAME); 
    188  
    189                 // 中、小画像生成 
    190                 $this->lfSetScaleImage(); 
    191  
    192                 $this->lfProductPage(); // 商品登録ページ 
    193                 break; 
    194             // 画像の削除 
    195             case 'delete_image': 
    196                 $this->objUpFile->deleteFile($_POST['image_key']); 
    197                 $this->lfProductPage(); // 商品登録ページ 
    198                 break; 
    199             // ダウンロード商品ファイルアップロード 
    200             case 'upload_down': 
    201                 // ファイル存在チェック 
    202                 $this->arrErr = array_merge((array)$this->arrErr, (array)$this->objDownFile->checkEXISTS($_POST['down_key'])); 
    203                 // 画像保存処理 
    204                 $this->arrErr[$_POST['down_key']] = $this->objDownFile->makeTempDownFile(); 
    205  
    206                 $this->lfProductPage(); // 商品登録ページ 
    207                 break; 
    208             // ダウンロードファイルの削除 
    209             case 'delete_down': 
    210                 $this->objDownFile->deleteFile($_POST['down_key']); 
    211                 $this->lfProductPage(); // 商品登録ページ 
    212                 break; 
    213             // 確認ページからの戻り 
    214             case 'confirm_return': 
    215                 $this->lfProductPage();     // 商品登録ページ 
    216                 break; 
    217             // 関連商品選択 
    218             case 'recommend_select' : 
    219                 $this->lfProductPage();     // 商品登録ページ 
    220                 break; 
    221             default: 
    222                 $this->lfProductPage();     // 商品登録ページ 
    223                 break; 
    224         } 
    225  
    226         // 関連商品の読み込み 
    227         $this->arrRecommend = $this->lfGetRecommendProducts(); 
    228  
    229         // 基本情報を渡す 
    230         $this->arrInfo = $objSiteInfo->data; 
    231  
    232         // サブ情報の入力があるかどうかチェックする 
    233         $sub_find = false; 
    234         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { 
    235             if( (isset($this->arrForm['sub_title'.$cnt]) 
    236             && !empty($this->arrForm['sub_title'.$cnt])) || 
    237             (isset($this->arrForm['sub_comment'.$cnt]) 
    238             && !empty($this->arrForm['sub_comment'.$cnt])) || 
    239             (isset($this->arrForm['sub_image'.$cnt]) 
    240             && !empty($this->arrForm['sub_image'.$cnt])) || 
    241             (isset($this->arrForm['sub_large_image'.$cnt]) 
    242             && !empty($this->arrForm['sub_large_image'.$cnt])) || 
    243             (isset($this->arrForm['sub_image'.$cnt]) 
    244             && is_array($this->arrFile['sub_image'.$cnt])) || 
    245             (isset($this->arrForm['sub_large_image'.$cnt]) 
    246             && is_array($this->arrFile['sub_large_image'.$cnt]))) { 
    247                 $sub_find = true; 
    248                 break; 
    249             } 
    250         } 
    251  
    252         // サブ情報表示・非表示のチェックに使用する。 
    253         $this->sub_find = $sub_find; 
     230        } 
     231        $this->arrErr = $arrErr; 
     232 
     233        // 商品詳細を取得 
     234        $this->arrProduct = $objProduct->getDetail($product_id); 
     235 
     236        // サブタイトルを取得 
     237        $this->tpl_subtitle = $this->arrProduct['name']; 
     238 
     239        // 関連カテゴリを取得 
     240        $this->arrRelativeCat = $objDb->sfGetMultiCatTree($product_id); 
     241 
     242        // 商品ステータスを取得 
     243        $this->productStatus = $objProduct->getProductStatus($product_id); 
     244 
     245        // 画像ファイル指定がない場合の置換処理 
     246        $this->arrProduct['main_image'] 
     247            = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']); 
     248 
     249        $this->lfSetFile(); 
     250        // 支払方法の取得 
     251        $this->arrPayment = $this->lfGetPayment(); 
     252        // 入力情報を渡す 
     253        $this->arrForm = $this->objFormParam->getFormParamList(); 
     254        //レビュー情報の取得 
     255        $this->arrReview = $this->lfGetReviewData($product_id); 
     256        // トラックバック情報の取得 
     257 
     258        // トラックバック機能の稼働状況チェック 
     259        if (SC_Utils_Ex::sfGetSiteControlFlg(SITE_CONTROL_TRACKBACK) != 1) { 
     260            $this->arrTrackbackView = "OFF"; 
     261        } else { 
     262            $this->arrTrackbackView = "ON"; 
     263            $this->arrTrackback = $this->lfGetTrackbackData($product_id); 
     264        } 
     265        $this->trackback_url = TRACKBACK_TO_URL . $product_id; 
     266        //関連商品情報表示 
     267        $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id); 
     268 
     269        $this->lfConvertParam(); 
     270 
    254271        $objView->assignobj($this); 
    255         $objView->display(MAIN_FRAME); 
     272        $objView->display(SITE_FRAME); 
    256273    } 
    257274 
     
    266283 
    267284    /** 
    268      * 関連商品の名称などを商品マスタから読み込み、一つの配列にまとめて返す 
     285     * モバイルページを初期化する. 
    269286     * 
    270      * @return array 関連商品の情報を格納した2次元配列 
    271      */ 
    272     function lfGetRecommendProducts() { 
     287     * @return void 
     288     */ 
     289    function mobileInit() { 
     290        $this->init(); 
     291        $this->tpl_mainpage = "products/detail.tpl"; 
     292    } 
     293 
     294    /** 
     295     * Page のプロセス(モバイル). 
     296     * 
     297     * FIXME 要リファクタリング 
     298     * 
     299     * @return void 
     300     */ 
     301    function mobileProcess() { 
     302        // プロダクトIDの正当性チェック 
     303        $product_id = $this->lfCheckProductId(); 
     304 
     305        $objView = new SC_MobileView(); 
     306        $objCustomer = new SC_Customer(); 
    273307        $objQuery = new SC_Query(); 
     308        $objDb = new SC_Helper_DB_Ex(); 
     309 
     310        // パラメータ管理クラス 
     311        $this->objFormParam = new SC_FormParam(); 
     312        // パラメータ情報の初期化 
     313        $this->lfInitParam(); 
     314        // POST値の取得 
     315        $this->objFormParam->setParam($_POST); 
     316 
     317        // ファイル管理クラス 
     318        $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR); 
     319        // ファイル情報の初期化 
     320        $this->lfInitFile(); 
     321 
     322        // ログイン判定 
     323        if($objCustomer->isLoginSuccess(true)) { 
     324            //お気に入りボタン表示 
     325            $this->tpl_login = true; 
     326 
     327            /* 閲覧ログ機能は現在未使用 
     328 
     329               $table = "dtb_customer_reading"; 
     330               $where = "customer_id = ? "; 
     331               $arrval[] = $objCustomer->getValue('customer_id'); 
     332               //顧客の閲覧商品数 
     333               $rpcnt = $objQuery->count($table, $where, $arrval); 
     334 
     335               //閲覧数が設定数以下 
     336               if ($rpcnt < CUSTOMER_READING_MAX){ 
     337               //閲覧履歴に新規追加 
     338               lfRegistReadingData($product_id, $objCustomer->getValue('customer_id')); 
     339               } else { 
     340               //閲覧履歴の中で一番古いものを削除して新規追加 
     341               $oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?"; 
     342               $old = $objQuery->getOne($oldsql, array($objCustomer->getValue("customer_id"))); 
     343               $where = "customer_id = ? AND update_date = ? "; 
     344               $arrval = array($objCustomer->getValue("customer_id"), $old); 
     345               //削除 
     346               $objQuery->delete($table, $where, $arrval); 
     347               //追加 
     348               lfRegistReadingData($product_id, $objCustomer->getValue('customer_id')); 
     349               } 
     350            */ 
     351        } 
     352 
     353 
     354        // 規格選択セレクトボックスの作成 
     355        $this->lfMakeSelectMobile($this, $product_id); 
     356 
     357        // 商品IDをFORM内に保持する。 
     358        $this->tpl_product_id = $product_id; 
     359 
     360        switch($_POST['mode']) { 
     361        case 'select': 
     362            // 規格1が設定されている場合 
     363            if($this->tpl_classcat_find1) { 
     364                // templateの変更 
     365                $this->tpl_mainpage = "products/select_find1.tpl"; 
     366                break; 
     367            } 
     368 
     369        case 'select2': 
     370            $this->arrErr = $this->lfCheckError(); 
     371 
     372            // 規格1が設定されている場合 
     373            if($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) { 
     374                // templateの変更 
     375                $this->tpl_mainpage = "products/select_find1.tpl"; 
     376                break; 
     377            } 
     378 
     379            // 規格2が設定されている場合 
     380            if($this->tpl_classcat_find2) { 
     381                $this->arrErr = array(); 
     382 
     383                $this->tpl_mainpage = "products/select_find2.tpl"; 
     384                break; 
     385            } 
     386 
     387        case 'selectItem': 
     388            $this->arrErr = $this->lfCheckError(); 
     389 
     390            // 規格1が設定されている場合 
     391            if($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) { 
     392                // templateの変更 
     393                $this->tpl_mainpage = "products/select_find2.tpl"; 
     394                break; 
     395            } 
     396            // 商品数の選択を行う 
     397            $this->tpl_mainpage = "products/select_item.tpl"; 
     398            break; 
     399 
     400        case 'cart': 
     401            // 入力値の変換 
     402            $this->objFormParam->convParam(); 
     403            $this->arrErr = $this->lfCheckError(); 
     404            if(count($this->arrErr) == 0) { 
     405                $objCartSess = new SC_CartSession(); 
     406                $product_class_id = $_POST['product_class_id']; 
     407                $classcategory_id1 = $_POST['classcategory_id1']; 
     408                $classcategory_id2 = $_POST['classcategory_id2']; 
     409 
     410                // 規格1が設定されていない場合 
     411                if(!$this->tpl_classcat_find1) { 
     412                    $classcategory_id1 = '0'; 
     413                } 
     414 
     415                // 規格2が設定されていない場合 
     416                if(!$this->tpl_classcat_find2) { 
     417                    $classcategory_id2 = '0'; 
     418                } 
     419 
     420                $objCartSess->addProduct(array($_POST['product_id'], $product_class_id, $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity')); 
     421                $this->sendRedirect($this->getLocation(MOBILE_URL_CART_TOP), true); 
     422                exit; 
     423            } 
     424            break; 
     425 
     426        default: 
     427            break; 
     428        } 
     429 
     430        // 商品詳細を取得 
     431        $objProduct = new SC_Product(); 
     432        $this->arrProduct = $objProduct->getDetail($product_id); 
     433 
     434        // サブタイトルを取得 
     435        $this->tpl_subtitle = $this->arrProduct["name"]; 
     436 
     437        // 画像ファイル指定がない場合の置換処理 
     438        $this->arrProduct['main_image'] 
     439            = SC_Utils_Ex::sfNoImageMain($this->arrProduct['main_image']); 
     440 
     441        // ファイル情報のセット 
     442        $this->lfSetFile(); 
     443        // 支払方法の取得 
     444        $this->arrPayment = $this->lfGetPayment(); 
     445        // 入力情報を渡す 
     446        $this->arrForm = $this->objFormParam->getFormParamList(); 
     447        //レビュー情報の取得 
     448        $this->arrReview = $this->lfGetReviewData($product_id); 
     449        // タイトルに商品名を入れる 
     450        $this->tpl_title = "商品詳細 ". $this->arrProduct["name"]; 
     451        //関連商品情報表示 
     452        $this->arrRecommend = $this->lfPreGetRecommendProducts($product_id); 
     453 
     454        $objView->assignobj($this); 
     455        $objView->display(SITE_FRAME); 
     456    } 
     457 
     458    /* プロダクトIDの正当性チェック */ 
     459    function lfCheckProductId() { 
     460        // 管理機能からの確認の場合は、非公開の商品も表示する。 
     461        if (isset($_GET['admin']) && $_GET['admin'] == 'on') { 
     462            SC_Utils_Ex::sfIsSuccess(new SC_Session()); 
     463            $status = true; 
     464            $where = 'del_flg = 0'; 
     465        } else { 
     466            $status = false; 
     467            $where = 'del_flg = 0 AND status = 1'; 
     468        } 
     469 
     470        if (defined('MOBILE_SITE')) { 
     471            if (!isset($_POST['mode'])) $_POST['mode'] = ""; 
     472            if (!empty($_POST['mode'])) { 
     473                $product_id = $_POST['product_id']; 
     474            } else { 
     475                $product_id = $_GET['product_id']; 
     476            } 
     477        } else { 
     478            if(isset($_POST['mode']) && $_POST['mode'] != '') { 
     479                $product_id = $_POST['product_id']; 
     480            } else { 
     481                $product_id = $_GET['product_id']; 
     482            } 
     483        } 
     484 
     485        $objDb = new SC_Helper_DB_Ex(); 
     486        if(!SC_Utils_Ex::sfIsInt($product_id) 
     487            || SC_Utils_Ex::sfIsZeroFilling($product_id) 
     488            || !$objDb->sfIsRecord('dtb_products', 'product_id', (array)$product_id, $where)) 
     489            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 
     490        return $product_id; 
     491    } 
     492 
     493    /* ファイル情報の初期化 */ 
     494    function lfInitFile() { 
     495        $this->objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT); 
     496        for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { 
     497            $this->objUpFile->addFile("詳細-サブ画像$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT); 
     498        } 
     499    } 
     500 
     501    /* 規格選択セレクトボックスの作成 */ 
     502    function lfMakeSelect() { 
     503 
     504        // 選択されている規格 
     505        $classcategory_id1 
     506            = isset($_POST['classcategory_id1']) && is_numeric($_POST['classcategory_id1']) 
     507            ? $_POST['classcategory_id1'] 
     508            : ''; 
     509 
     510        $classcategory_id2 
     511            = isset($_POST['classcategory_id2']) && is_numeric($_POST['classcategory_id2']) 
     512            ? $_POST['classcategory_id2'] 
     513            : ''; 
     514 
     515        require_once DATA_PATH . 'module/Services/JSON.php'; 
     516        $this->js_lnOnload .= 'fnSetClassCategories(' 
     517            . 'document.form1, ' 
     518            . Services_JSON::encode($classcategory_id2) 
     519            . '); '; 
     520    } 
     521 
     522    /* 規格選択セレクトボックスの作成 
     523     * FIXME 要リファクタリング 
     524     */ 
     525    function lfMakeSelectMobile(&$objPage, $product_id) { 
     526 
     527        $objDb = new SC_Helper_DB_Ex(); 
     528        $classcat_find1 = false; 
     529        $classcat_find2 = false; 
     530        // 在庫ありの商品の有無 
     531        $stock_find = false; 
     532 
     533        // 規格名一覧 
     534        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name"); 
     535        // 規格分類名一覧 
     536        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
     537        /* 
     538         * FIXME 
     539         * パフォーマンスが出ないため, 
     540         * SC_Product::getProductsClassByProductIds() を使用した実装に変更 
     541         */ 
     542        // 商品規格情報の取得 
     543        $arrProductsClass = $this->lfGetProductsClass($product_id); 
     544 
     545        // 規格1クラス名の取得 
     546        $objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']]; 
     547        // 規格2クラス名の取得 
     548        $objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']]; 
     549 
     550        // すべての組み合わせ数 
     551        $count = count($arrProductsClass); 
     552 
     553        $classcat_id1 = ""; 
     554 
     555        $arrSele1 = array(); 
     556        $arrSele2 = array(); 
     557 
     558        for ($i = 0; $i < $count; $i++) { 
     559            // 在庫のチェック 
     560            if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 
     561                continue; 
     562            } 
     563 
     564            $stock_find = true; 
     565 
     566            // 規格1のセレクトボックス用 
     567            if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 
     568                $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; 
     569                $arrSele1[$classcat_id1] = $arrClassCatName[$classcat_id1]; 
     570            } 
     571 
     572            // 規格2のセレクトボックス用 
     573            if($arrProductsClass[$i]['classcategory_id1'] == $_POST['classcategory_id1'] and $classcat_id2 != $arrProductsClass[$i]['classcategory_id2']) { 
     574                $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 
     575                $arrSele2[$classcat_id2] = $arrClassCatName[$classcat_id2]; 
     576            } 
     577        } 
     578 
     579        // 規格1 
     580        $objPage->arrClassCat1 = $arrSele1; 
     581        $objPage->arrClassCat2 = $arrSele2; 
     582 
     583        // 規格1が設定されている 
     584        if($arrProductsClass[0]['classcategory_id1'] != '0') { 
     585            $classcat_find1 = true; 
     586        } 
     587 
     588        // 規格2が設定されている 
     589        if($arrProductsClass[0]['classcategory_id2'] != '0') { 
     590            $classcat_find2 = true; 
     591        } 
     592 
     593        $objPage->tpl_classcat_find1 = $classcat_find1; 
     594        $objPage->tpl_classcat_find2 = $classcat_find2; 
     595        $objPage->tpl_stock_find = $stock_find; 
     596    } 
     597 
     598    /* パラメータ情報の初期化 */ 
     599    function lfInitParam() { 
     600        $this->objFormParam->addParam("規格1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK")); 
     601        $this->objFormParam->addParam("規格2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK")); 
     602        $this->objFormParam->addParam("数量", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     603    } 
     604 
     605    /* 商品規格情報の取得 */ 
     606    function lfGetProductsClass($product_id) { 
     607        $arrRet = array(); 
     608        if(SC_Utils_Ex::sfIsInt($product_id)) { 
     609            // 商品規格取得 
     610            $objQuery = new SC_Query(); 
     611            $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; 
     612            $table = "vw_product_class AS prdcls"; 
     613            $where = "product_id = ?"; 
     614            $objQuery->setOrder("rank1 DESC, rank2 DESC"); 
     615            $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 
     616        } 
     617        return $arrRet; 
     618    } 
     619 
     620    /* 登録済み関連商品の読み込み */ 
     621    function lfPreGetRecommendProducts($product_id) { 
    274622        $arrRecommend = array(); 
    275         for($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) { 
    276             $keyname = "recommend_id" . $i; 
    277             $delkey = "recommend_delete" . $i; 
    278             $commentkey = "recommend_comment" . $i; 
    279  
    280             if (!isset($this->arrForm[$delkey])) $this->arrForm[$delkey] = null; 
    281  
    282             if((isset($this->arrForm[$keyname]) && !empty($this->arrForm[$keyname])) && $this->arrForm[$delkey] != 1) { 
    283                 $objProduct = new SC_Product(); 
    284                 $arrRecommend[$i] = $objProduct->getDetail($this->arrForm[$keyname]); 
    285                 $arrRecommend[$i]['product_id'] = $this->arrForm[$keyname]; 
    286                 $arrRecommend[$i]['comment'] = $this->arrForm[$commentkey]; 
    287             } 
    288         } 
    289         return $arrRecommend; 
    290     } 
    291  
    292     /* 関連商品の登録 */ 
    293     function lfInsertRecommendProducts($objQuery, $arrList, $product_id) { 
    294         // 一旦関連商品をすべて削除する 
    295         $objQuery->delete("dtb_recommend_products", "product_id = ?", array($product_id)); 
    296         $sqlval['product_id'] = $product_id; 
    297         $rank = RECOMMEND_PRODUCT_MAX; 
    298         for($i = 1; $i <= RECOMMEND_PRODUCT_MAX; $i++) { 
    299             $keyname = "recommend_id" . $i; 
    300             $commentkey = "recommend_comment" . $i; 
    301             $deletekey = "recommend_delete" . $i; 
    302  
    303             if (!isset($arrList[$deletekey])) $arrList[$deletekey] = null; 
    304  
    305             if($arrList[$keyname] != "" && $arrList[$deletekey] != '1') { 
    306                 $sqlval['recommend_product_id'] = $arrList[$keyname]; 
    307                 $sqlval['comment'] = $arrList[$commentkey]; 
    308                 $sqlval['rank'] = $rank; 
    309                 $sqlval['creator_id'] = $_SESSION['member_id']; 
    310                 $sqlval['create_date'] = "now()"; 
    311                 $sqlval['update_date'] = "now()"; 
    312                 $objQuery->insert("dtb_recommend_products", $sqlval); 
    313                 $rank--; 
    314             } 
    315         } 
    316     } 
    317  
    318     /** 
    319      * 指定商品の関連商品をDBから読み込む 
    320      * 
    321      * @param string $product_id 商品ID 
    322      * @return void 
    323      */ 
    324     function lfPreGetRecommendProducts($product_id) { 
    325623        $objQuery = new SC_Query(); 
    326624        $objQuery->setOrder("rank DESC"); 
    327625        $arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id)); 
    328         $no = 1; 
    329  
    330         foreach ($arrRet as $ret) { 
    331             $this->arrForm['recommend_id' . $no] = $ret['recommend_product_id']; 
    332             $this->arrForm['recommend_comment' . $no] = $ret['comment']; 
    333             $no++; 
    334         } 
    335     } 
    336  
    337     /* 商品情報の読み込み */ 
    338     function lfGetProduct($product_id) { 
     626        $max = count($arrRet); 
     627        $no = 0; 
     628        // FIXME SC_Product クラスを使用した実装 
     629        $from = "vw_products_allclass AS T1 " 
     630                . " JOIN (" 
     631                . " SELECT max(T2.rank) AS product_rank, " 
     632                . "        T2.product_id" 
     633                . "   FROM dtb_product_categories T2  " 
     634                . " GROUP BY product_id) AS T3 USING (product_id)"; 
     635        $objQuery->setOrder("T3.product_rank DESC"); 
     636        for($i = 0; $i < $max; $i++) { 
     637            $where = "del_flg = 0 AND T3.product_id = ? AND status = 1"; 
     638            $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'])); 
     639 
     640            if(count($arrProductInfo) > 0) { 
     641                $arrRecommend[$no] = $arrProductInfo[0]; 
     642                $arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id']; 
     643                $arrRecommend[$no]['comment'] = $arrRet[$i]['comment']; 
     644                $no++; 
     645            } 
     646        } 
     647        return $arrRecommend; 
     648    } 
     649 
     650    /* 入力内容のチェック */ 
     651    function lfCheckError() { 
     652        if ($_POST['mode'] == "add_favorite") { 
     653            $objCustomer = new SC_Customer(); 
     654            $objErr = new SC_CheckError(); 
     655            $customer_id = $objCustomer->getValue('customer_id'); 
     656            if (SC_Helper_DB_Ex::sfDataExists('dtb_customer_favorite_products', 'customer_id = ? AND product_id = ?', array($customer_id, $favorite_product_id))) { 
     657                $objErr->arrErr['add_favorite'.$favorite_product_id] = "※ この商品は既にお気に入りに追加されています。<br />"; 
     658            } 
     659        } else { 
     660            // 入力データを渡す。 
     661            $arrRet =  $this->objFormParam->getHashArray(); 
     662            $objErr = new SC_CheckError($arrRet); 
     663            $objErr->arrErr = $this->objFormParam->checkError(); 
     664 
     665            // 複数項目チェック 
     666            if ($this->tpl_classcat_find1) { 
     667                $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK")); 
     668            } 
     669            if ($this->tpl_classcat_find2) { 
     670                $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK")); 
     671            } 
     672        } 
     673 
     674        return $objErr->arrErr; 
     675    } 
     676 
     677    //閲覧履歴新規登録 
     678    function lfRegistReadingData($product_id, $customer_id){ 
     679        $objQuery = new SC_Query; 
     680        $sqlval['customer_id'] = $customer_id; 
     681        $sqlval['reading_product_id'] = $product_id; 
     682        $sqlval['create_date'] = 'NOW()'; 
     683        $sqlval['update_date'] = 'NOW()'; 
     684        $objQuery->insert("dtb_customer_reading", $sqlval); 
     685    } 
     686 
     687    //商品ごとのレビュー情報を取得する 
     688    function lfGetReviewData($id) { 
     689        $objQuery = new SC_Query; 
     690        //商品ごとのレビュー情報を取得する 
     691        $col = "create_date, reviewer_url, reviewer_name, recommend_level, title, comment"; 
     692        $from = "dtb_review"; 
     693        $where = "del_flg = 0 AND status = 1 AND product_id = ? ORDER BY create_date DESC LIMIT " . REVIEW_REGIST_MAX; 
     694        $arrval[] = $id; 
     695        $arrReview = $objQuery->select($col, $from, $where, $arrval); 
     696        return $arrReview; 
     697    } 
     698 
     699    /* 
     700     * 商品ごとのトラックバック情報を取得する 
     701     * 
     702     * @param $product_id 
     703     * @return $arrTrackback 
     704     */ 
     705    function lfGetTrackbackData($product_id) { 
     706 
     707        $arrTrackback = array(); 
     708 
     709        $objQuery = new SC_Query; 
     710        //商品ごとのトラックバック情報を取得する 
     711        $col = "blog_name, url, title, excerpt, title, create_date"; 
     712        $from = "dtb_trackback"; 
     713        $where = "del_flg = 0 AND status = 1 AND product_id = ? ORDER BY create_date DESC LIMIT " . TRACKBACK_VIEW_MAX; 
     714        $arrval[] = $product_id; 
     715        $arrTrackback = $objQuery->select($col, $from, $where, $arrval); 
     716        return $arrTrackback; 
     717    } 
     718 
     719    //支払方法の取得 
     720    //payment_id    1:クレジット 2:ショッピングローン 
     721    function lfGetPayment() { 
     722        $objQuery = new SC_Query; 
     723        $col = "payment_id, rule, payment_method"; 
     724        $from = "dtb_payment"; 
     725        $where = "del_flg = 0"; 
     726        $order = "payment_id"; 
     727        $objQuery->setOrder($order); 
     728        $arrRet = $objQuery->select($col, $from, $where); 
     729        return $arrRet; 
     730    } 
     731 
     732    function lfConvertParam() { 
     733        if (!isset($this->arrForm['quantity']['value'])) $this->arrForm['quantity']['value'] = ""; 
     734        $value = $this->arrForm['quantity']['value']; 
     735        $this->arrForm['quantity']['value'] = htmlspecialchars($value, ENT_QUOTES, CHAR_CODE); 
     736    } 
     737 
     738    /* 
     739     * ファイルの情報をセットする 
     740     * 
     741     */ 
     742    function lfSetFile() { 
     743        // DBからのデータを引き継ぐ 
     744        $this->objUpFile->setDBFileList($this->arrProduct); 
     745        // ファイル表示用配列を渡す 
     746        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true); 
     747 
     748        // サブ画像の有無を判定 
     749        $this->subImageFlag = false; 
     750        for ($i = 1; $i <= PRODUCTSUB_MAX; $i++) { 
     751            if ($this->arrFile["sub_image" . $i]["filepath"] != "") { 
     752                $this->subImageFlag = true; 
     753            } 
     754        } 
     755    } 
     756 
     757    /* 
     758     * お気に入り商品登録 
     759     */ 
     760    function lfRegistFavoriteProduct($customer_id, $product_id) { 
    339761        $objQuery = new SC_Query(); 
    340         $objDb = new SC_Helper_DB_Ex(); 
    341  
    342         $col = "*"; 
    343         $table = <<< __EOF__ 
    344                       dtb_products AS T1 
    345             LEFT JOIN ( 
    346                        SELECT product_id AS product_id_sub, 
    347                               product_code, 
    348                               price01, 
    349                               price02, 
    350                               stock, 
    351                               stock_unlimited, 
    352                               sale_limit, 
    353                               point_rate, 
    354                               product_type_id, 
    355                               down_filename, 
    356                               down_realfilename 
    357                          FROM dtb_products_class 
    358                         WHERE class_combination_id IS NULL 
    359                        ) AS T2 
    360                      ON T1.product_id = T2.product_id_sub 
    361 __EOF__; 
    362         $where = "product_id = ?"; 
    363  
    364         $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 
    365  
    366         // カテゴリID を取得 
    367         $arrRet[0]['category_id'] = $objQuery->getCol("dtb_product_categories", 
    368                                                       "category_id", 
    369                                                       "product_id = ?", 
    370         array($product_id)); 
    371         //編集時に規格IDが変わってしまうのを防ぐために規格が登録されていなければ規格IDを取得する 
    372         if (!$objDb->sfHasProductClass($_POST['product_id'])) { 
    373             $arrRet[0]['product_class_id'] = SC_Utils::sfGetProductClassId($product_id,"0","0"); 
    374         } 
    375         return $arrRet[0]; 
    376     } 
    377  
    378     /* 商品登録ページ表示用 */ 
    379     function lfProductPage() { 
    380         $objDb = new SC_Helper_DB_Ex(); 
    381  
    382         // カテゴリの読込 
    383         list($this->arrCatVal, $this->arrCatOut) = $objDb->sfGetLevelCatList(false); 
    384  
    385         if (isset($this->arrForm['category_id']) && !is_array($this->arrForm['category_id'])) { 
    386             $this->arrForm['category_id'] = unserialize($this->arrForm['category_id']); 
    387         } 
    388         if($this->arrForm['status'] == "") { 
    389             $this->arrForm['status'] = DEFAULT_PRODUCT_DISP; 
    390         } 
    391         if($this->arrForm['product_type_id'] == "") { 
    392             $this->arrForm['product_type_id'] = DEFAULT_PRODUCT_DOWN; 
    393         } 
    394  
    395         // HIDDEN用に配列を渡す。 
    396         $this->arrHidden = array_merge((array)$this->arrHidden, (array)$this->objUpFile->getHiddenFileList()); 
    397         $this->arrHidden = array_merge((array)$this->arrHidden, (array)$this->objDownFile->getHiddenFileList()); 
    398         // Form用配列を渡す。 
    399         $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL); 
    400  
    401         $this->arrForm['down_realfilename'] = $this->objDownFile->getFormDownFile(); 
    402  
    403         // アンカーを設定 
    404         if (isset($_POST['image_key']) && !empty($_POST['image_key'])) { 
    405             $anchor_hash = "location.hash='#" . $_POST['image_key'] . "'"; 
    406         } elseif (isset($_POST['anchor_key']) && !empty($_POST['anchor_key'])) { 
    407             $anchor_hash = "location.hash='#" . $_POST['anchor_key'] . "'"; 
    408         } else { 
    409             $anchor_hash = ""; 
    410         } 
    411  
    412         $this->tpl_onload = "fnCheckStockLimit('" . DISABLED_RGB . "'); fnMoveSelect('category_id_unselect', 'category_id');" . $anchor_hash; 
    413     } 
    414  
    415     /* ファイル情報の初期化 */ 
    416     function lfInitFile() { 
    417         $this->objUpFile->addFile("一覧-メイン画像", 'main_list_image', array('jpg', 'gif', 'png'),IMAGE_SIZE, false, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); 
    418         $this->objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT); 
    419         $this->objUpFile->addFile("詳細-メイン拡大画像", 'main_large_image', array('jpg', 'gif', 'png'), IMAGE_SIZE, false, LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT); 
    420         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { 
    421             $this->objUpFile->addFile("詳細-サブ画像$cnt", "sub_image$cnt", array('jpg', 'gif', 'png'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_WIDTH, NORMAL_SUBIMAGE_HEIGHT); 
    422             $this->objUpFile->addFile("詳細-サブ拡大画像$cnt", "sub_large_image$cnt", array('jpg', 'gif', 'png'), IMAGE_SIZE, false, LARGE_SUBIMAGE_WIDTH, LARGE_SUBIMAGE_HEIGHT); 
    423         } 
    424     } 
    425  
    426     /* 商品の登録 */ 
    427     function lfRegistProduct($arrList) { 
    428         $objQuery = new SC_Query(); 
    429         $objDb = new SC_Helper_DB_Ex(); 
    430         $objQuery->begin(); 
    431  
    432         // 配列の添字を定義 
    433         $checkArray = array("name", "status", 
    434                             "main_list_comment", "main_comment", 
    435                             "deliv_fee", "comment1", "comment2", "comment3", 
    436                             "comment4", "comment5", "comment6", "main_list_comment", 
    437                             "sale_limit", "deliv_date_id", "maker_id", "note"); 
    438         $arrList = SC_Utils_Ex::arrayDefineIndexes($arrList, $checkArray); 
    439  
    440         // INSERTする値を作成する。 
    441         $sqlval['name'] = $arrList['name']; 
    442         $sqlval['status'] = $arrList['status']; 
    443         $sqlval['main_list_comment'] = $arrList['main_list_comment']; 
    444         $sqlval['main_comment'] = $arrList['main_comment']; 
    445         $sqlval['comment1'] = $arrList['comment1']; 
    446         $sqlval['comment2'] = $arrList['comment2']; 
    447         $sqlval['comment3'] = $arrList['comment3']; 
    448         $sqlval['comment4'] = $arrList['comment4']; 
    449         $sqlval['comment5'] = $arrList['comment5']; 
    450         $sqlval['comment6'] = $arrList['comment6']; 
    451         $sqlval['main_list_comment'] = $arrList['main_list_comment']; 
    452         $sqlval['deliv_date_id'] = $arrList['deliv_date_id']; 
    453         $sqlval['maker_id'] = $arrList['maker_id']; 
    454         $sqlval['note'] = $arrList['note']; 
    455         $sqlval['update_date'] = "Now()"; 
    456         $sqlval['creator_id'] = $_SESSION['member_id']; 
    457         $arrRet = $this->objUpFile->getDBFileList(); 
    458         $sqlval = array_merge($sqlval, $arrRet); 
    459  
    460         $arrList['category_id'] = unserialize($arrList['category_id']); 
    461  
    462         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { 
    463             $sqlval['sub_title'.$cnt] = $arrList['sub_title'.$cnt]; 
    464             $sqlval['sub_comment'.$cnt] = $arrList['sub_comment'.$cnt]; 
    465         } 
    466  
    467         // 新規登録(複製時を含む) 
    468         if ($arrList['product_id'] == "") { 
    469             $product_id = $objQuery->nextVal("dtb_products_product_id"); 
     762        $count = $objQuery->count("dtb_customer_favorite_products", "customer_id = ? AND product_id = ?", array($customer_id, $product_id)); 
     763 
     764        if ($count == 0) { 
     765            $sqlval['customer_id'] = $customer_id; 
    470766            $sqlval['product_id'] = $product_id; 
    471  
    472             // INSERTの実行 
    473             $sqlval['create_date'] = "Now()"; 
    474             $objQuery->insert("dtb_products", $sqlval); 
    475  
    476             $arrList['product_id'] = $product_id; 
    477  
    478             // カテゴリを更新 
    479             $objDb->updateProductCategories($arrList['category_id'], $product_id); 
    480  
    481             // 複製商品の場合には規格も複製する 
    482             if($_POST["copy_product_id"] != "" and SC_Utils_Ex::sfIsInt($_POST["copy_product_id"])){ 
    483  
    484                 if($this->tpl_nonclass) 
    485                 { 
    486                     //規格なしの場合、複製は価格等の入力が発生しているため、その内容で追加登録を行う 
    487                     $this->lfCopyProductClass($arrList, $objQuery); 
    488                 } 
    489                 else 
    490                 { 
    491                     //規格がある場合の複製は複製元の内容で追加登録を行う 
    492                     // dtb_products_class のカラムを取得 
    493                     $dbFactory = SC_DB_DBFactory_Ex::getInstance(); 
    494                     $arrColList = $dbFactory->sfGetColumnList("dtb_products_class", $objQuery); 
    495                     $arrColList_tmp = array_flip($arrColList); 
    496  
    497                     // 複製しない列 
    498                     unset($arrColList[$arrColList_tmp["product_class_id"]]);     //規格ID 
    499                     unset($arrColList[$arrColList_tmp["product_id"]]);           //商品ID 
    500                     unset($arrColList[$arrColList_tmp["create_date"]]); 
    501  
    502                     $col = SC_Utils_Ex::sfGetCommaList($arrColList); 
    503                     $product_class_id = $objQuery->nextVal('dtb_products_class_product_class_id'); 
    504                     $objQuery->query("INSERT INTO dtb_products_class (product_class_id, product_id, create_date, ". $col .") SELECT ?, now(), " . $col. " FROM dtb_products_class WHERE product_id = ? ORDER BY product_class_id", array($product_class_id, $product_id, $_POST["copy_product_id"])); 
    505                 } 
    506             } 
    507         } 
    508         // 更新 
    509         else { 
    510             $product_id = $arrList['product_id']; 
    511             // 削除要求のあった既存ファイルの削除 
    512             $arrRet = $this->lfGetProduct($arrList['product_id']); 
    513             $this->objUpFile->deleteDBFile($arrRet); 
    514             $this->objDownFile->deleteDBDownFile($arrRet); 
    515  
    516             // UPDATEの実行 
    517             $where = "product_id = ?"; 
    518             $objQuery->update("dtb_products", $sqlval, $where, array($product_id)); 
    519  
    520             // カテゴリを更新 
    521             $objDb->updateProductCategories($arrList['category_id'], $product_id); 
    522         } 
    523  
    524         //商品登録の時は規格を生成する。複製の場合は規格も複製されるのでこの処理は不要。 
    525         if( $_POST["copy_product_id"] == "" ){ 
    526             // 規格登録 
    527             $this->lfInsertDummyProductClass($arrList); 
    528         } 
    529  
    530         // ステータス設定 
    531         $objProduct = new SC_Product(); 
    532         $objProduct->setProductStatus($product_id, $arrList['product_status']); 
    533  
    534         // 関連商品登録 
    535         $this->lfInsertRecommendProducts($objQuery, $arrList, $product_id); 
    536  
    537         $objQuery->commit(); 
    538         return $product_id; 
    539     } 
    540  
    541  
    542     /* 取得文字列の変換 */ 
    543     function lfConvertParam($array) { 
    544         /* 
    545          *  文字列の変換 
    546          *  K :  「半角(ハンカク)片仮名」を「全角片仮名」に変換 
    547          *  C :  「全角ひら仮名」を「全角かた仮名」に変換 
    548          *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します 
    549          *  n :  「全角」数字を「半角(ハンカク)」に変換 
    550          */ 
    551  
    552         // スポット商品 
    553         $arrConvList['name'] = "KVa"; 
    554         $arrConvList['main_list_comment'] = "KVa"; 
    555         $arrConvList['main_comment'] = "KVa"; 
    556         $arrConvList['price01'] = "n"; 
    557         $arrConvList['price02'] = "n"; 
    558         $arrConvList['stock'] = "n"; 
    559         $arrConvList['sale_limit'] = "n"; 
    560         $arrConvList['point_rate'] = "n"; 
    561         $arrConvList['product_code'] = "KVna"; 
    562         $arrConvList['comment1'] = "a"; 
    563         $arrConvList['deliv_fee'] = "n"; 
    564  
    565         // 詳細-サブ 
    566         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { 
    567             $arrConvList["sub_title$cnt"] = "KVa"; 
    568         } 
    569         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { 
    570             $arrConvList["sub_comment$cnt"] = "KVa"; 
    571         } 
    572  
    573         // 関連商品 
    574         for ($cnt = 1; $cnt <= RECOMMEND_PRODUCT_MAX; $cnt++) { 
    575             $arrConvList["recommend_comment$cnt"] = "KVa"; 
    576         } 
    577  
    578         // 文字変換 
    579         foreach ($arrConvList as $key => $val) { 
    580             // POSTされてきた値のみ変換する。 
    581             if(isset($array[$key])) { 
    582                 $array[$key] = mb_convert_kana($array[$key] ,$val); 
    583             } 
    584         } 
    585  
    586         if (!isset($array['product_flag'])) $array['product_flag'] = ""; 
    587         $max = max(array_keys($this->arrSTATUS)); 
    588         $array['product_flag'] = SC_Utils_Ex::sfMergeCheckBoxes($array['product_flag'], $max); 
    589  
    590         return $array; 
    591     } 
    592  
    593     // 入力エラーチェック 
    594     function lfErrorCheck($array) { 
    595  
    596         $objErr = new SC_CheckError($array); 
    597         $objErr->doFunc(array("商品名", "name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    598         $objErr->doFunc(array("一覧-メインコメント", "main_list_comment", MTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    599         $objErr->doFunc(array("詳細-メインコメント", "main_comment", LLTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    600         $objErr->doFunc(array("詳細-メインコメント", "main_comment", $this->arrAllowedTag), array("HTML_TAG_CHECK")); 
    601         $objErr->doFunc(array("ポイント付与率", "point_rate", PERCENTAGE_LEN), array("EXIST_CHECK", "NUM_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    602         $objErr->doFunc(array("商品送料", "deliv_fee", PRICE_LEN), array("NUM_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    603         $objErr->doFunc(array("備考欄(SHOP専用)", "note", LLTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    604         $objErr->doFunc(array("検索ワード", "comment3", LLTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    605         $objErr->doFunc(array("メーカーURL", "comment1", URL_LEN), array("SPTAB_CHECK", "URL_CHECK", "MAX_LENGTH_CHECK")); 
    606         $objErr->doFunc(array("発送日目安", "deliv_date_id", INT_LEN), array("NUM_CHECK")); 
    607         $objErr->doFunc(array("メーカー", 'maker_id', INT_LEN), array("NUM_CHECK")); 
    608  
    609         if($this->tpl_nonclass) { 
    610             $objErr->doFunc(array("商品コード", "product_code", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK","MAX_LENGTH_CHECK")); 
    611             $objErr->doFunc(array(NORMAL_PRICE_TITLE, "price01", PRICE_LEN), array("NUM_CHECK", "MAX_LENGTH_CHECK")); 
    612             $objErr->doFunc(array(SALE_PRICE_TITLE, "price02", PRICE_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    613  
    614             if(!isset($array['stock_unlimited']) && $array['stock_unlimited'] != "1") { 
    615                 $objErr->doFunc(array("在庫数", "stock", AMOUNT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    616             } 
    617  
    618             //ダウンロード商品チェック 
    619             if($array['product_type_id'] == PRODUCT_TYPE_DOWNLOAD) { 
    620                 $objErr->doFunc(array("ダウンロードファイル名", "down_filename", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    621                 if($array['down_realfilename'] == "") { 
    622                     $objErr->arrErr['down_realfilename'] = "※ ダウンロード商品の場合はダウンロード商品用ファイルをアップロードしてください。<br />"; 
    623                 } 
    624             } 
    625             //実商品チェック 
    626             if($array['product_type_id'] == PRODUCT_TYPE_NORMAL) { 
    627                 if($array['down_filename'] != "") { 
    628                     $objErr->arrErr['down_filename'] = "※ 通常商品の場合はダウンロードファイル名を設定できません。<br />"; 
    629                 } 
    630                 if($array['down_realfilename'] != "") { 
    631                     $objErr->arrErr['down_realfilename'] = "※ 通常商品の場合はダウンロード商品用ファイルをアップロードできません。<br />ファイルを取り消してください。<br />"; 
    632                 } 
    633             } 
    634         } 
    635  
    636         $objErr->doFunc(array("購入制限", "sale_limit", AMOUNT_LEN), array("SPTAB_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    637  
    638         for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { 
    639             $objErr->doFunc(array("詳細-サブタイトル$cnt", "sub_title$cnt", STEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    640             $objErr->doFunc(array("詳細-サブコメント$cnt", "sub_comment$cnt", LLTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    641             $objErr->doFunc(array("詳細-サブコメント$cnt", "sub_comment$cnt", $this->arrAllowedTag),  array("HTML_TAG_CHECK")); 
    642         } 
    643  
    644         for ($cnt = 1; $cnt <= RECOMMEND_PRODUCT_MAX; $cnt++) { 
    645  
    646             if (!isset($_POST["recommend_delete$cnt"]))  $_POST["recommend_delete$cnt"] = ""; 
    647  
    648             if(isset($_POST["recommend_id$cnt"]) 
    649             && $_POST["recommend_id$cnt"] != "" 
    650             && $_POST["recommend_delete$cnt"] != 1) { 
    651                 $objErr->doFunc(array("関連商品コメント$cnt", "recommend_comment$cnt", LTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    652             } 
    653         } 
    654  
    655         // カテゴリID のチェック 
    656         if (empty($array['category_id'])) { 
    657             $objErr->arrErr['category_id'] = "※ 商品カテゴリが選択されていません。<br />"; 
    658         } else { 
    659             $arrCategory_id = array(); 
    660             for ($i = 0; $i < count($array['category_id']); $i++) { 
    661                 $arrCategory_id['category_id' . $i] = $array['category_id'][$i]; 
    662             } 
    663             $objCheckCategory = new SC_CheckError($arrCategory_id); 
    664             for ($i = 0; $i < count($array['category_id']); $i++) { 
    665                 $objCheckCategory->doFunc(array("商品カテゴリ", "category_id" . $i, STEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 
    666             } 
    667             if (!empty($objCheckCategory->arrErr)) { 
    668                 $objErr->arrErr = array_merge($objErr->arrErr, 
    669                 $objCheckCategory->arrErr); 
    670             } 
    671         } 
    672         return $objErr->arrErr; 
    673     } 
    674  
    675     /* 確認ページ表示用 */ 
    676     function lfProductConfirmPage() { 
    677         $this->tpl_mainpage = 'products/confirm.tpl'; 
    678         $this->arrForm['mode'] = 'complete'; 
    679  
    680         $objDb = new SC_Helper_DB_Ex(); 
    681  
    682         // カテゴリ表示 
    683         $this->arrCategory_id = $this->arrForm['category_id']; 
    684         $this->arrCatList = array(); 
    685         list($arrCatVal, $arrCatOut) = $objDb->sfGetLevelCatList(false); 
    686         for ($i = 0; $i < count($arrCatVal); $i++) { 
    687             $this->arrCatList[$arrCatVal[$i]] = $arrCatOut[$i]; 
    688         } 
    689  
    690         // hidden に渡す値は serialize する 
    691         $this->arrForm['category_id'] = serialize($this->arrForm['category_id']); 
    692  
    693         // Form用配列を渡す。 
    694         $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL); 
    695         $this->arrForm['down_realfilename'] = $this->objDownFile->getFormDownFile(); 
    696     } 
    697  
    698     // 縮小した画像をセットする 
    699     function lfSetScaleImage(){ 
    700  
    701         $subno = str_replace("sub_large_image", "", $_POST['image_key']); 
    702         switch ($_POST['image_key']){ 
    703             case "main_large_image": 
    704                 // 詳細メイン画像 
    705                 $this->lfMakeScaleImage($_POST['image_key'], "main_image"); 
    706             case "main_image": 
    707                 // 一覧メイン画像 
    708                 $this->lfMakeScaleImage($_POST['image_key'], "main_list_image"); 
    709                 break; 
    710             case "sub_large_image" . $subno: 
    711                 // サブメイン画像 
    712                 $this->lfMakeScaleImage($_POST['image_key'], "sub_image" . $subno); 
    713                 break; 
    714             default: 
    715                 break; 
    716         } 
    717     } 
    718  
    719     // 縮小画像生成 
    720     function lfMakeScaleImage($from_key, $to_key, $forced = false){ 
    721         $arrImageKey = array_flip($this->objUpFile->keyname); 
    722  
    723         if($this->objUpFile->temp_file[$arrImageKey[$from_key]]){ 
    724             $from_path = $this->objUpFile->temp_dir . $this->objUpFile->temp_file[$arrImageKey[$from_key]]; 
    725         }elseif($this->objUpFile->save_file[$arrImageKey[$from_key]]){ 
    726             $from_path = $this->objUpFile->save_dir . $this->objUpFile->save_file[$arrImageKey[$from_key]]; 
    727         }else{ 
    728             return ""; 
    729         } 
    730  
    731         if(file_exists($from_path)){ 
    732             // 生成先の画像サイズを取得 
    733             $to_w = $this->objUpFile->width[$arrImageKey[$to_key]]; 
    734             $to_h = $this->objUpFile->height[$arrImageKey[$to_key]]; 
    735  
    736             if($forced) $this->objUpFile->save_file[$arrImageKey[$to_key]] = ""; 
    737  
    738             if(empty($this->objUpFile->temp_file[$arrImageKey[$to_key]]) && 
    739             empty($this->objUpFile->save_file[$arrImageKey[$to_key]])) { 
    740  
    741                 // リネームする際は、自動生成される画像名に一意となるように、Suffixを付ける 
    742                 $dst_file = $this->objUpFile->lfGetTmpImageName(IMAGE_RENAME, "", $this->objUpFile->temp_file[$arrImageKey[$from_key]]) . $this->lfGetAddSuffix($to_key); 
    743                 $path = $this->objUpFile->makeThumb($from_path, $to_w, $to_h, $dst_file); 
    744                 $this->objUpFile->temp_file[$arrImageKey[$to_key]] = basename($path); 
    745             } 
    746         }else{ 
    747             return ""; 
    748         } 
    749     } 
    750  
    751     /** 
    752      * リネームする際は、自動生成される画像名に一意となるように、Suffixを付ける 
    753      */ 
    754     function lfGetAddSuffix($to_key){ 
    755         if( IMAGE_RENAME === true ){ return ; } 
    756  
    757         // 自動生成される画像名 
    758         $dist_name = ""; 
    759         switch($to_key){ 
    760             case "main_list_image": 
    761                 $dist_name = '_s'; 
    762                 break; 
    763             case "main_image": 
    764                 $dist_name = '_m'; 
    765                 break; 
    766             default: 
    767                 $arrRet = explode('sub_image', $to_key); 
    768                 $dist_name = '_sub' .$arrRet[1]; 
    769                 break; 
    770         } 
    771         return $dist_name; 
    772     } 
    773  
    774     /** 
    775      * dtb_products_classの複製 
    776      * 複製後、価格や商品コードを更新する 
    777      * 
    778      * @param array $arrList 
    779      * @param array $objQuery 
    780      * @return bool 
    781      */ 
    782     function lfCopyProductClass($arrList,$objQuery) 
    783     { 
    784         // 複製元のdtb_products_classを取得(規格なしのため、1件のみの取得) 
    785         $col = "*"; 
    786         $table = "dtb_products_class"; 
    787         $where = "product_id = ?"; 
    788         $arrProductClass = $objQuery->select($col, $table, $where, array($arrList["copy_product_id"])); 
    789  
    790         //トランザクション開始 
    791         $objQuery->begin(); 
    792         $err_flag = false; 
    793         //非編集項目は複製、編集項目は上書きして登録 
    794         foreach($arrProductClass as $records) 
    795         { 
    796             foreach($records as $key => $value) 
    797             { 
    798                 if(isset($arrList[$key])) 
    799                 { 
    800                     $records[$key] = $arrList[$key]; 
    801                 } 
    802             } 
    803  
    804             $records["product_class_id"] = $objQuery->nextVal('dtb_products_class_product_class_id'); 
    805             unset($records["update_date"]); 
    806  
    807             $records["create_date"] = "Now()"; 
    808             $objQuery->insert($table, $records); 
    809             //エラー発生時は中断 
    810             if($objQuery->isError()) 
    811             { 
    812                 $err_flag = true; 
    813                 continue; 
    814             } 
    815         } 
    816         //トランザクション終了 
    817         if($err_flag) 
    818         { 
    819             $objQuery->rollback(); 
    820         } 
    821         else 
    822         { 
     767            $sqlval['update_date'] = "now()"; 
     768            $sqlval['create_date'] = "now()"; 
     769 
     770            $objQuery->begin(); 
     771            $objQuery->insert('dtb_customer_favorite_products', $sqlval); 
    823772            $objQuery->commit(); 
    824773        } 
    825         return !$err_flag; 
    826     } 
    827  
    828     /** 
    829      * 規格を設定していない商品を商品規格テーブルに登録 
    830      * 
    831      * @param array $arrList 
    832      * @return void 
    833      */ 
    834     function lfInsertDummyProductClass($arrList) { 
    835         $objQuery  = new SC_Query(); 
    836         $objDb = new SC_Helper_DB_Ex(); 
    837  
    838         $product_id = $arrList['product_id']; 
    839         // 規格登録してある商品の場合、処理しない 
    840         if ($objDb->sfHasProductClass($product_id)) return; 
    841  
    842         // 配列の添字を定義 
    843         $checkArray = array('product_class_id', 'product_id', 'product_code', 'stock', 'stock_unlimited', 'price01', 'price02', 'sale_limit', 'deliv_fee', 'point_rate' ,'product_type_id', 'down_filename', 'down_realfilename'); 
    844         $sqlval = SC_Utils_Ex::sfArrayIntersectKeys($arrList, $checkArray); 
    845         $sqlval = SC_Utils_Ex::arrayDefineIndexes($sqlval, $checkArray); 
    846  
    847         $sqlval['stock_unlimited'] = $sqlval['stock_unlimited'] ? '1' : '0'; 
    848         $sqlval['creator_id'] = strlen($_SESSION['member_id']) >= 1 ? $_SESSION['member_id'] : '0'; 
    849  
    850         if (strlen($sqlval['product_class_id']) == 0) { 
    851             $sqlval['product_class_id'] = $objQuery->nextVal('dtb_products_class_product_class_id'); 
    852             $sqlval['create_date'] = 'now()'; 
    853             $sqlval['update_date'] = 'now()'; 
    854             // INSERTの実行 
    855             $objQuery->insert('dtb_products_class', $sqlval); 
    856         } else { 
    857             $sqlval['update_date'] = 'now()'; 
    858             // UPDATEの実行 
    859             $objQuery->update('dtb_products_class', $sqlval, "product_class_id = ?", array($sqlval['product_class_id'])); 
    860  
    861         } 
    862     } 
    863  
    864     /* ダウンロードファイル情報の初期化 */ 
    865     function lfInitDownFile() { 
    866         $this->objDownFile->addFile("ダウンロード販売用ファイル", 'down_file', explode(",", DOWNLOAD_EXTENSION),DOWN_SIZE, true, 0, 0); 
    867     } 
     774    } 
     775 
    868776} 
    869777?> 
  • branches/camp/camp-2_5-C/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php

    r19533 r19535  
    245245            case 'preview': 
    246246                $_SESSION[preview] = $this->arrForm; 
    247                 //$this->tpl_javascript = "window.open('".URL_DIR."admin/products/product_preview.php"."','test')"; 
    248                 $this->tpl_javascript = "window.open('".URL_DIR."products/detail.php"."','test')"; 
     247                $this->tpl_javascript = "window.open('".URL_DIR."admin/products/product_preview.php"."','test')"; 
     248                //$this->tpl_javascript = "window.open('".URL_DIR."products/detail.php"."','test')"; 
    249249                $this->lfProductPage(); 
    250250             
Note: See TracChangeset for help on using the changeset viewer.