Changeset 16166


Ignore:
Timestamp:
2007/09/28 20:34:45 (16 years ago)
Author:
nanasess
Message:

モバイル対応

Location:
branches/feature-module-update
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/pages/products/LC_Page_Products_Detail.php

    r16030 r16166  
    244244    } 
    245245 
     246    /** 
     247     * モバイルページを初期化する. 
     248     * 
     249     * @return void 
     250     */ 
     251    function mobileInit() { 
     252        $this->init(); 
     253        $this->tpl_mainpage = "products/detail.tpl"; 
     254    } 
     255 
     256    /** 
     257     * Page のプロセス(モバイル). 
     258     * 
     259     * @return void 
     260     */ 
     261    function mobileProcess() { 
     262        $objView = new SC_MobileView(); 
     263        $objCustomer = new SC_Customer(); 
     264        $objQuery = new SC_Query(); 
     265        $objDb = new SC_Helper_DB_Ex(); 
     266 
     267        // レイアウトデザインを取得 
     268        // $objPage = sfGetPageLayout($objPage, false, "products/detail.php"); 
     269 
     270        // パラメータ管理クラス 
     271        $this->objFormParam = new SC_FormParam(); 
     272        // パラメータ情報の初期化 
     273        $this->lfInitParam(); 
     274        // POST値の取得 
     275        $this->objFormParam->setParam($_POST); 
     276 
     277        // ファイル管理クラス 
     278        $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR); 
     279        // ファイル情報の初期化 
     280        $this->lfInitFile(); 
     281 
     282        // 管理ページからの確認の場合は、非公開の商品も表示する。 
     283        if($_GET['admin'] == 'on') { 
     284            $where = "del_flg = 0"; 
     285        } else { 
     286            $where = "del_flg = 0 AND status = 1"; 
     287        } 
     288 
     289        if($_POST['mode'] != "") { 
     290            $tmp_id = $_POST['product_id']; 
     291        } else { 
     292            $tmp_id = $_GET['product_id']; 
     293        } 
     294 
     295        // 値の正当性チェック 
     296        /*if(!SC_Utils_Ex::sfIsInt($_GET['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) { 
     297            SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND, "", false, "", true); 
     298            }*/ 
     299        // ログイン判定 
     300        if($objCustomer->isLoginSuccess()) { 
     301            //お気に入りボタン表示 
     302            $this->tpl_login = true; 
     303 
     304            /* 閲覧ログ機能は現在未使用 
     305 
     306               $table = "dtb_customer_reading"; 
     307               $where = "customer_id = ? "; 
     308               $arrval[] = $objCustomer->getValue('customer_id'); 
     309               //顧客の閲覧商品数 
     310               $rpcnt = $objQuery->count($table, $where, $arrval); 
     311 
     312               //閲覧数が設定数以下 
     313               if ($rpcnt < CUSTOMER_READING_MAX){ 
     314               //閲覧履歴に新規追加 
     315               lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id')); 
     316               } else { 
     317               //閲覧履歴の中で一番古いものを削除して新規追加 
     318               $oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?"; 
     319               $old = $objQuery->getone($oldsql, array($objCustomer->getValue("customer_id"))); 
     320               $where = "customer_id = ? AND update_date = ? "; 
     321               $arrval = array($objCustomer->getValue("customer_id"), $old); 
     322               //削除 
     323               $objQuery->delete($table, $where, $arrval); 
     324               //追加 
     325               lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id')); 
     326               } 
     327            */ 
     328        } 
     329 
     330 
     331        // 規格選択セレクトボックスの作成 
     332        $this->lfMakeSelect($tmp_id); 
     333 
     334        // 商品IDをFORM内に保持する。 
     335        $this->tpl_product_id = $tmp_id; 
     336 
     337        switch($_POST['mode']) { 
     338        case 'select': 
     339            // 規格1が設定されている場合 
     340            if($this->tpl_classcat_find1) { 
     341                // templateの変更 
     342                $this->tpl_mainpage = "products/select_find1.tpl"; 
     343                break; 
     344            } 
     345 
     346        case 'select2': 
     347            $this->arrErr = $this->lfCheckError(); 
     348 
     349            // 規格1が設定されている場合 
     350            if($this->tpl_classcat_find1 and $this->arrErr['classcategory_id1']) { 
     351                // templateの変更 
     352                $this->tpl_mainpage = "products/select_find1.tpl"; 
     353                break; 
     354            } 
     355 
     356            // 規格2が設定されている場合 
     357            if($this->tpl_classcat_find2) { 
     358                $this->arrErr = array(); 
     359 
     360                $this->tpl_mainpage = "products/select_find2.tpl"; 
     361                break; 
     362            } 
     363 
     364        case 'selectItem': 
     365            $this->arrErr = $this->lfCheckError(); 
     366 
     367            // 規格1が設定されている場合 
     368            if($this->tpl_classcat_find2 and $this->arrErr['classcategory_id2']) { 
     369                // templateの変更 
     370                $this->tpl_mainpage = "products/select_find2.tpl"; 
     371                break; 
     372            } 
     373            // 商品数の選択を行う 
     374            $this->tpl_mainpage = "products/select_item.tpl"; 
     375            break; 
     376 
     377        case 'cart': 
     378            // 入力値の変換 
     379            $this->objFormParam->convParam(); 
     380            $this->arrErr = $this->lfCheckError(); 
     381            if(count($this->arrErr) == 0) { 
     382                $objCartSess = new SC_CartSession(); 
     383                $classcategory_id1 = $_POST['classcategory_id1']; 
     384                $classcategory_id2 = $_POST['classcategory_id2']; 
     385 
     386                // 規格1が設定されていない場合 
     387                if(!$this->tpl_classcat_find1) { 
     388                    $classcategory_id1 = '0'; 
     389                } 
     390 
     391                // 規格2が設定されていない場合 
     392                if(!$this->tpl_classcat_find2) { 
     393                    $classcategory_id2 = '0'; 
     394                } 
     395 
     396                $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 
     397                $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity')); 
     398                $this->sendRedirect(SC_Helper_Mobile_Ex::gfAddSessionId(MOBILE_URL_CART_TOP)); 
     399                exit; 
     400            } 
     401            break; 
     402 
     403        default: 
     404            break; 
     405        } 
     406 
     407        $objQuery = new SC_Query(); 
     408        // DBから商品情報を取得する。 
     409        $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id)); 
     410        $this->arrProduct = $arrRet[0]; 
     411 
     412        // 商品コードの取得 
     413        $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code"; 
     414        $arrProductCode = $objQuery->getall($code_sql, array($tmp_id)); 
     415        $arrProductCode = SC_Utils_Ex::sfswaparray($arrProductCode); 
     416        $this->arrProductCode = $arrProductCode["product_code"]; 
     417 
     418        // 購入制限数を取得 
     419        if($this->arrProduct['sale_unlimited'] == 1 || $this->arrProduct['sale_limit'] > SALE_LIMIT_MAX) { 
     420            $this->tpl_sale_limit = SALE_LIMIT_MAX; 
     421        } else { 
     422            $this->tpl_sale_limit = $this->arrProduct['sale_limit']; 
     423        } 
     424 
     425        // サブタイトルを取得 
     426        $arrFirstCat = $objDb->sfGetFirstCat($arrRet[0]['category_id']); 
     427        $tpl_subtitle = $arrFirstCat['name']; 
     428        $this->tpl_subtitle = $tpl_subtitle; 
     429 
     430        // DBからのデータを引き継ぐ 
     431        $this->objUpFile->setDBFileList($this->arrProduct); 
     432        // ファイル表示用配列を渡す 
     433        $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true); 
     434        // 支払方法の取得 
     435        $this->arrPayment = $this->lfGetPayment(); 
     436        // 入力情報を渡す 
     437        $this->arrForm = $this->objFormParam->getFormParamList(); 
     438        //レビュー情報の取得 
     439        $this->arrReview = $this->lfGetReviewData($tmp_id); 
     440        // タイトルに商品名を入れる 
     441        $this->tpl_title = "商品詳細 ". $this->arrProduct["name"]; 
     442        //オススメ商品情報表示 
     443        $this->arrRecommend = $this->lfPreGetRecommendProducts($tmp_id); 
     444        //この商品を買った人はこんな商品も買っています 
     445        $this->arrRelateProducts = $this->lfGetRelateProducts($tmp_id); 
     446 
     447        // 拡大画像のウィンドウサイズをセット 
     448        list($large_width, $large_height) = getimagesize(IMAGE_SAVE_DIR . basename($this->arrFile["main_large_image"]["filepath"])); 
     449        $this->tpl_large_width = $large_width + 60; 
     450        $this->tpl_large_height = $large_height + 80; 
     451 
     452        $objView->assignobj($this); 
     453        $objView->display(SITE_FRAME); 
     454    } 
     455 
    246456    /* ファイル情報の初期化 */ 
    247457    function lfInitFile() { 
  • branches/feature-module-update/html/mobile/products/category_list.php

    r15532 r16166  
    11<?php 
    22/** 
    3  *  
     3 * 
    44 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 
    55 * 
    66 * http://www.lockon.co.jp/ 
    7  *  
    87 * 
    9  * モバイルサイト/カテゴリー一覧 
     8 * 
     9 * モバイルサイト/カテゴリリスト 
    1010 */ 
    1111 
    12 require_once('../require.php'); 
     12// {{{ requires 
     13require_once("../require.php"); 
     14require_once(CLASS_PATH . "page_extends/products/LC_Page_Products_CategoryList_Ex.php"); 
    1315 
    14 class LC_Page { 
    15     function LC_Page() { 
    16         /** 必ず指定する **/ 
    17         $this->tpl_mainpage = 'products/category_list.tpl';         // メインテンプレート 
    18         $this->tpl_title = 'カテゴリ一覧ページ'; 
    19     } 
    20 } 
     16// }}} 
     17// {{{ generate page 
    2118 
    22 $objPage = new LC_Page(); 
    23 $objView = new SC_MobileView(); 
    24  
    25 // レイアウトデザインを取得 
    26 $objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT); 
    27  
    28 // カテゴリー情報を取得する。 
    29 lfGetCategories(@$_GET['category_id'], true, $objPage); 
    30  
    31 $objView->assignobj($objPage); 
    32 $objView->display(SITE_FRAME); 
    33  
    34 //----------------------------------------------------------------------------------------------------------------------------------- 
    35  
    36 /** 
    37  * 選択されたカテゴリーとその子カテゴリーの情報を取得し、 
    38  * ページオブジェクトに格納する。 
    39  * 
    40  * @param string $category_id カテゴリーID 
    41  * @param boolean $count_check 有効な商品がないカテゴリーを除くかどうか 
    42  * @param object &$objPage ページオブジェクト 
    43  * @return void 
    44  */ 
    45 function lfGetCategories($category_id, $count_check = false, &$objPage) { 
    46     // カテゴリーの正しいIDを取得する。 
    47     $category_id = sfGetCategoryId('', $category_id); 
    48     if ($category_id == 0) { 
    49         sfDispSiteError(CATEGORY_NOT_FOUND, "", false, "", true); 
    50     } 
    51  
    52     $arrCategory = null;    // 選択されたカテゴリー 
    53     $arrChildren = array(); // 子カテゴリー 
    54  
    55     $arrAll = sfGetCatTree($category_id, $count_check); 
    56     foreach ($arrAll as $category) { 
    57         // 選択されたカテゴリーの場合 
    58         if ($category['category_id'] == $category_id) { 
    59             $arrCategory = $category; 
    60             continue; 
    61         } 
    62  
    63         // 関係のないカテゴリーはスキップする。 
    64         if ($category['parent_category_id'] != $category_id) { 
    65             continue; 
    66         } 
    67  
    68         // 子カテゴリーの場合は、孫カテゴリーが存在するかどうかを調べる。 
    69         $arrGrandchildrenID = sfGetUnderChildrenArray($arrAll, 'parent_category_id', 'category_id', $category['category_id']); 
    70         $category['has_children'] = count($arrGrandchildrenID) > 0; 
    71         $arrChildren[] = $category; 
    72     } 
    73  
    74     if (!isset($arrCategory)) { 
    75         sfDispSiteError(CATEGORY_NOT_FOUND, "", false, "", true); 
    76     } 
    77  
    78     // 子カテゴリーの商品数を合計する。 
    79     $children_product_count = 0; 
    80     foreach ($arrChildren as $category) { 
    81         $children_product_count += $category['product_count']; 
    82     } 
    83  
    84     // 選択されたカテゴリーに直属の商品がある場合は、子カテゴリーの先頭に追加する。 
    85     if ($arrCategory['product_count'] > $children_product_count) { 
    86         $arrCategory['product_count'] -= $children_product_count;   // 子カテゴリーの商品数を除く。 
    87         $arrCategory['has_children'] = false;   // 商品一覧ページに遷移させるため。 
    88         array_unshift($arrChildren, $arrCategory); 
    89     } 
    90  
    91     // 結果を格納する。 
    92     $objPage->arrCategory = $arrCategory; 
    93     $objPage->arrChildren = $arrChildren; 
    94 } 
     19$objPage = new LC_Page_Products_CategoryList_Ex(); 
     20$objPage->mobileInit(); 
     21$objPage->mobileProcess(); 
     22register_shutdown_function(array($objPage, "destroy")); 
    9523?> 
  • branches/feature-module-update/html/mobile/products/detail.php

    r15532 r16166  
    11<?php 
    22/** 
    3  *  
     3 * 
    44 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 
    55 * 
    66 * http://www.lockon.co.jp/ 
    7  *  
     7 * 
     8 * 
     9 * モバイルサイト/商品詳細 
    810 */ 
     11 
     12// {{{ requires 
    913require_once("../require.php"); 
    10 require_once(DATA_PATH . "include/page_layout.inc"); 
     14require_once(CLASS_PATH . "page_extends/products/LC_Page_Products_Detail_Ex.php"); 
    1115 
    12 class LC_Page { 
    13     function LC_Page() { 
    14         /** 必ず指定する **/ 
    15         global $arrSTATUS; 
    16         $this->arrSTATUS = $arrSTATUS; 
    17         global $arrSTATUS_IMAGE; 
    18         $this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE; 
    19         global $arrDELIVERYDATE; 
    20         $this->arrDELIVERYDATE = $arrDELIVERYDATE; 
    21         global $arrRECOMMEND; 
    22         $this->arrRECOMMEND = $arrRECOMMEND; 
    23          
    24         $this->tpl_mainpage="products/detail.tpl"; 
    25          
    26         /* 
    27          session_start時のno-cacheヘッダーを抑制することで 
    28          「戻る」ボタン使用時の有効期限切れ表示を抑制する。 
    29          private-no-expire:クライアントのキャッシュを許可する。 
    30         */ 
    31         session_cache_limiter('private-no-expire'); 
    32     } 
    33 } 
     16// }}} 
     17// {{{ generate page 
    3418 
    35 $objPage = new LC_Page(); 
    36 $objView = new SC_MobileView(); 
    37 $objCustomer = new SC_Customer(); 
    38 $objQuery = new SC_Query(); 
    39  
    40 // レイアウトデザインを取得 
    41 $objPage = sfGetPageLayout($objPage, false, "products/detail.php"); 
    42  
    43 // パラメータ管理クラス 
    44 $objFormParam = new SC_FormParam(); 
    45 // パラメータ情報の初期化 
    46 lfInitParam(); 
    47 // POST値の取得 
    48 $objFormParam->setParam($_POST); 
    49  
    50 // ファイル管理クラス 
    51 $objUpFile = new SC_UploadFile(IMAGE_TEMP_DIR, IMAGE_SAVE_DIR); 
    52 // ファイル情報の初期化 
    53 lfInitFile(); 
    54  
    55 // 管理ページからの確認の場合は、非公開の商品も表示する。 
    56 if($_GET['admin'] == 'on') { 
    57     $where = "del_flg = 0"; 
    58 } else { 
    59     $where = "del_flg = 0 AND status = 1"; 
    60 } 
    61  
    62 if($_POST['mode'] != "") { 
    63     $tmp_id = $_POST['product_id']; 
    64 } else { 
    65     $tmp_id = $_GET['product_id']; 
    66 } 
    67  
    68 // 値の正当性チェック 
    69 if(!sfIsInt($_GET['product_id']) || !sfIsRecord("dtb_products", "product_id", $tmp_id, $where)) { 
    70     sfDispSiteError(PRODUCT_NOT_FOUND, "", false, "", true); 
    71 } 
    72 // ログイン判定 
    73 if($objCustomer->isLoginSuccess()) { 
    74     //お気に入りボタン表示 
    75     $objPage->tpl_login = true; 
    76  
    77 /* 閲覧ログ機能は現在未使用 
    78      
    79     $table = "dtb_customer_reading"; 
    80     $where = "customer_id = ? "; 
    81     $arrval[] = $objCustomer->getValue('customer_id'); 
    82     //顧客の閲覧商品数 
    83     $rpcnt = $objQuery->count($table, $where, $arrval); 
    84  
    85     //閲覧数が設定数以下 
    86     if ($rpcnt < CUSTOMER_READING_MAX){ 
    87         //閲覧履歴に新規追加 
    88         lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id')); 
    89     } else { 
    90         //閲覧履歴の中で一番古いものを削除して新規追加 
    91         $oldsql = "SELECT MIN(update_date) FROM ".$table." WHERE customer_id = ?"; 
    92         $old = $objQuery->getone($oldsql, array($objCustomer->getValue("customer_id"))); 
    93         $where = "customer_id = ? AND update_date = ? "; 
    94         $arrval = array($objCustomer->getValue("customer_id"), $old); 
    95         //削除 
    96         $objQuery->delete($table, $where, $arrval); 
    97         //追加 
    98         lfRegistReadingData($tmp_id, $objCustomer->getValue('customer_id')); 
    99     } 
    100 */ 
    101 } 
    102  
    103  
    104 // 規格選択セレクトボックスの作成 
    105 $objPage = lfMakeSelect($objPage, $tmp_id); 
    106  
    107 // 商品IDをFORM内に保持する。 
    108 $objPage->tpl_product_id = $tmp_id; 
    109  
    110 switch($_POST['mode']) { 
    111 case 'select': 
    112     // 規格1が設定されている場合 
    113     if($objPage->tpl_classcat_find1) { 
    114         // templateの変更 
    115         $objPage->tpl_mainpage = "products/select_find1.tpl"; 
    116         break; 
    117     } 
    118  
    119 case 'select2': 
    120     $objPage->arrErr = lfCheckError(); 
    121  
    122     // 規格1が設定されている場合 
    123     if($objPage->tpl_classcat_find1 and $objPage->arrErr['classcategory_id1']) { 
    124         // templateの変更 
    125         $objPage->tpl_mainpage = "products/select_find1.tpl"; 
    126         break; 
    127     } 
    128  
    129     // 規格2が設定されている場合 
    130     if($objPage->tpl_classcat_find2) { 
    131         $objPage->arrErr = array(); 
    132  
    133         $objPage->tpl_mainpage = "products/select_find2.tpl"; 
    134         break; 
    135     } 
    136  
    137 case 'selectItem': 
    138     $objPage->arrErr = lfCheckError(); 
    139  
    140     // 規格1が設定されている場合 
    141     if($objPage->tpl_classcat_find2 and $objPage->arrErr['classcategory_id2']) { 
    142         // templateの変更 
    143         $objPage->tpl_mainpage = "products/select_find2.tpl"; 
    144         break; 
    145     } 
    146     // 商品数の選択を行う 
    147     $objPage->tpl_mainpage = "products/select_item.tpl"; 
    148     break; 
    149  
    150 case 'cart': 
    151     // 入力値の変換 
    152     $objFormParam->convParam(); 
    153     $objPage->arrErr = lfCheckError(); 
    154     if(count($objPage->arrErr) == 0) { 
    155         $objCartSess = new SC_CartSession(); 
    156         $classcategory_id1 = $_POST['classcategory_id1']; 
    157         $classcategory_id2 = $_POST['classcategory_id2']; 
    158                  
    159         // 規格1が設定されていない場合 
    160         if(!$objPage->tpl_classcat_find1) { 
    161             $classcategory_id1 = '0'; 
    162         } 
    163          
    164         // 規格2が設定されていない場合 
    165         if(!$objPage->tpl_classcat_find2) { 
    166             $classcategory_id2 = '0'; 
    167         } 
    168          
    169         $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 
    170         $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $objFormParam->getValue('quantity')); 
    171  
    172         header("Location: " . gfAddSessionId(MOBILE_URL_CART_TOP)); 
    173  
    174         exit; 
    175     } 
    176     break; 
    177          
    178 default: 
    179     break; 
    180 } 
    181  
    182 $objQuery = new SC_Query(); 
    183 // DBから商品情報を取得する。 
    184 $arrRet = $objQuery->select("*", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($tmp_id)); 
    185 $objPage->arrProduct = $arrRet[0]; 
    186  
    187 // 商品コードの取得 
    188 $code_sql = "SELECT product_code FROM dtb_products_class AS prdcls WHERE prdcls.product_id = ? GROUP BY product_code ORDER BY product_code"; 
    189 $arrProductCode = $objQuery->getall($code_sql, array($tmp_id)); 
    190 $arrProductCode = sfswaparray($arrProductCode); 
    191 $objPage->arrProductCode = $arrProductCode["product_code"]; 
    192  
    193 // 購入制限数を取得 
    194 if($objPage->arrProduct['sale_unlimited'] == 1 || $objPage->arrProduct['sale_limit'] > SALE_LIMIT_MAX) { 
    195   $objPage->tpl_sale_limit = SALE_LIMIT_MAX; 
    196 } else { 
    197   $objPage->tpl_sale_limit = $objPage->arrProduct['sale_limit']; 
    198 } 
    199  
    200 // サブタイトルを取得 
    201 $arrFirstCat = sfGetFirstCat($arrRet[0]['category_id']); 
    202 $tpl_subtitle = $arrFirstCat['name']; 
    203 $objPage->tpl_subtitle = $tpl_subtitle; 
    204  
    205 // DBからのデータを引き継ぐ 
    206 $objUpFile->setDBFileList($objPage->arrProduct); 
    207 // ファイル表示用配列を渡す 
    208 $objPage->arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL, true); 
    209 // 支払方法の取得 
    210 $objPage->arrPayment = lfGetPayment(); 
    211 // 入力情報を渡す 
    212 $objPage->arrForm = $objFormParam->getFormParamList(); 
    213 //レビュー情報の取得 
    214 $objPage->arrReview = lfGetReviewData($tmp_id); 
    215 // タイトルに商品名を入れる 
    216 $objPage->tpl_title = "商品詳細 ". $objPage->arrProduct["name"]; 
    217 //オススメ商品情報表示 
    218 $objPage->arrRecommend = lfPreGetRecommendProducts($tmp_id); 
    219 //この商品を買った人はこんな商品も買っています 
    220 $objPage->arrRelateProducts = lfGetRelateProducts($tmp_id); 
    221  
    222 // 拡大画像のウィンドウサイズをセット 
    223 list($large_width, $large_height) = getimagesize(IMAGE_SAVE_DIR . basename($objPage->arrFile["main_large_image"]["filepath"])); 
    224 $objPage->tpl_large_width = $large_width + 60; 
    225 $objPage->tpl_large_height = $large_height + 80; 
    226  
    227 $objView->assignobj($objPage); 
    228 $objView->display(SITE_FRAME); 
    229 //----------------------------------------------------------------------------------------------------------------------------------- 
    230 /* ファイル情報の初期化 */ 
    231 function lfInitFile() { 
    232     global $objUpFile; 
    233     $objUpFile->addFile("一覧-メイン画像", 'main_list_image', array('jpg','gif'),IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); 
    234     $objUpFile->addFile("詳細-メイン画像", 'main_image', array('jpg'), IMAGE_SIZE, true, NORMAL_IMAGE_WIDTH, NORMAL_IMAGE_HEIGHT); 
    235     $objUpFile->addFile("詳細-メイン拡大画像", 'main_large_image', array('jpg'), IMAGE_SIZE, false, LARGE_IMAGE_HEIGHT, LARGE_IMAGE_HEIGHT); 
    236     for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { 
    237         $objUpFile->addFile("詳細-サブ画像$cnt", "sub_image$cnt", array('jpg'), IMAGE_SIZE, false, NORMAL_SUBIMAGE_HEIGHT, NORMAL_SUBIMAGE_HEIGHT);    
    238         $objUpFile->addFile("詳細-サブ拡大画像$cnt", "sub_large_image$cnt", array('jpg'), IMAGE_SIZE, false, LARGE_SUBIMAGE_HEIGHT, LARGE_SUBIMAGE_HEIGHT); 
    239     } 
    240     $objUpFile->addFile("商品比較画像", 'file1', array('jpg'), IMAGE_SIZE, false, NORMAL_IMAGE_HEIGHT, NORMAL_IMAGE_HEIGHT); 
    241     $objUpFile->addFile("商品詳細ファイル", 'file2', array('pdf'), PDF_SIZE, false, 0, 0, false); 
    242 } 
    243  
    244 /* 規格選択セレクトボックスの作成 */ 
    245 function lfMakeSelect($objPage, $product_id) { 
    246     global $objPage; 
    247     $classcat_find1 = false; 
    248     $classcat_find2 = false; 
    249     // 在庫ありの商品の有無 
    250     $stock_find = false; 
    251      
    252     // 規格名一覧 
    253     $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 
    254     // 規格分類名一覧 
    255     $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
    256     // 商品規格情報の取得     
    257     $arrProductsClass = lfGetProductsClass($product_id); 
    258      
    259     // 規格1クラス名の取得 
    260     $objPage->tpl_class_name1 = $arrClassName[$arrProductsClass[0]['class_id1']]; 
    261     // 規格2クラス名の取得 
    262     $objPage->tpl_class_name2 = $arrClassName[$arrProductsClass[0]['class_id2']]; 
    263      
    264     // すべての組み合わせ数    
    265     $count = count($arrProductsClass); 
    266      
    267     $classcat_id1 = ""; 
    268      
    269     $arrSele1 = array(); 
    270     $arrSele2 = array(); 
    271     $arrList = array(); 
    272      
    273     $list_id = 0; 
    274     $arrList[0] = "\tlist0 = new Array('選択してください'"; 
    275     $arrVal[0] = "\tval0 = new Array(''"; 
    276      
    277     for ($i = 0; $i < $count; $i++) { 
    278         // 在庫のチェック 
    279         if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 
    280             continue; 
    281         } 
    282          
    283         $stock_find = true; 
    284          
    285         // 規格1のセレクトボックス用 
    286         if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 
    287             $arrList[$list_id].=");\n"; 
    288             $arrVal[$list_id].=");\n"; 
    289             $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; 
    290             $arrSele1[$classcat_id1] = $arrClassCatName[$classcat_id1]; 
    291         } 
    292  
    293         // 規格2のセレクトボックス用 
    294         if($arrProductsClass[$i]['classcategory_id1'] == $_POST['classcategory_id1'] and $classcat_id2 != $arrProductsClass[$i]['classcategory_id2']) { 
    295             $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 
    296             $arrSele2[$classcat_id2] = $arrClassCatName[$classcat_id2]; 
    297         } 
    298  
    299         $list_id++; 
    300  
    301         // セレクトボックス表示値 
    302         if($arrList[$list_id] == "") { 
    303             $arrList[$list_id] = "\tlist".$list_id." = new Array('選択してください', '".$arrClassCatName[$classcat_id2]."'"; 
    304         } else { 
    305             $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 
    306         } 
    307          
    308         // セレクトボックスPOST値 
    309         if($arrVal[$list_id] == "") { 
    310             $arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'"; 
    311         } else { 
    312             $arrVal[$list_id].= ", '".$classcat_id2."'"; 
    313         } 
    314     }    
    315      
    316     //$arrList[$list_id].=");\n"; 
    317     $arrVal[$list_id].=");\n"; 
    318          
    319     // 規格1 
    320     $objPage->arrClassCat1 = $arrSele1; 
    321     $objPage->arrClassCat2 = $arrSele2; 
    322      
    323     //$lists = "\tlists = new Array("; 
    324     //$no = 0; 
    325      
    326     //foreach($arrList as $val) { 
    327     //  $objPage->tpl_javascript.= $val; 
    328     //  if ($no != 0) { 
    329     //      $lists.= ",list".$no; 
    330     //  } else { 
    331     //      $lists.= "list".$no; 
    332     //  } 
    333     //  $no++; 
    334     //} 
    335     //$objPage->tpl_javascript.=$lists.");\n"; 
    336      
    337     $vals = "\tvals = new Array("; 
    338     $no = 0; 
    339      
    340     //foreach($arrVal as $val) { 
    341     //  $objPage->tpl_javascript.= $val; 
    342     //  if ($no != 0) { 
    343     //      $vals.= ",val".$no; 
    344     //  } else { 
    345     //      $vals.= "val".$no; 
    346     //  } 
    347     //  $no++; 
    348     //} 
    349     //$objPage->tpl_javascript.=$vals.");\n"; 
    350      
    351     // 選択されている規格2ID 
    352     $objPage->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . $_POST['classcategory_id2'] . "');"; 
    353  
    354     // 規格1が設定されている 
    355     if($arrProductsClass[0]['classcategory_id1'] != '0') { 
    356         $classcat_find1 = true; 
    357     } 
    358      
    359     // 規格2が設定されている 
    360     if($arrProductsClass[0]['classcategory_id2'] != '0') { 
    361         $classcat_find2 = true; 
    362     } 
    363          
    364     $objPage->tpl_classcat_find1 = $classcat_find1; 
    365     $objPage->tpl_classcat_find2 = $classcat_find2; 
    366     $objPage->tpl_stock_find = $stock_find; 
    367          
    368     return $objPage; 
    369 } 
    370  
    371 /* パラメータ情報の初期化 */ 
    372 function lfInitParam() { 
    373     global $objFormParam; 
    374  
    375     $objFormParam->addParam("規格1", "classcategory_id1", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK")); 
    376     $objFormParam->addParam("規格2", "classcategory_id2", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK")); 
    377     $objFormParam->addParam("個数", "quantity", INT_LEN, "n", array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    378 } 
    379  
    380 /* 商品規格情報の取得 */ 
    381 function lfGetProductsClass($product_id) { 
    382     $arrRet = array(); 
    383     if(sfIsInt($product_id)) { 
    384         // 商品規格取得 
    385         $objQuery = new SC_Query(); 
    386         $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; 
    387         $table = "vw_product_class AS prdcls"; 
    388         $where = "product_id = ?"; 
    389         $objQuery->setorder("rank1 DESC, rank2 DESC"); 
    390         $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 
    391     } 
    392     return $arrRet; 
    393 } 
    394  
    395 /* 登録済みオススメ商品の読み込み */ 
    396 function lfPreGetRecommendProducts($product_id) { 
    397     $objQuery = new SC_Query(); 
    398     $objQuery->setorder("rank DESC"); 
    399     $arrRet = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id)); 
    400     $max = count($arrRet); 
    401     $no = 0; 
    402     for($i = 0; $i < $max; $i++) { 
    403         $where = "del_flg = 0 AND product_id = ? AND status = 1"; 
    404         $arrProductInfo = $objQuery->select("main_list_image, price02_min, price02_max, price01_min, price01_max, name, point_rate", "vw_products_allclass  AS allcls", $where, array($arrRet[$i]['recommend_product_id']));  
    405                  
    406         if(count($arrProductInfo) > 0) { 
    407             $arrRecommend[$no] = $arrProductInfo[0]; 
    408             $arrRecommend[$no]['product_id'] = $arrRet[$i]['recommend_product_id']; 
    409             $arrRecommend[$no]['comment'] = $arrRet[$i]['comment']; 
    410             $no++; 
    411         }    
    412     } 
    413     return $arrRecommend; 
    414 } 
    415  
    416 /* 入力内容のチェック */ 
    417 function lfCheckError() { 
    418     global $objFormParam; 
    419     global $objPage; 
    420     // 入力データを渡す。 
    421     $arrRet =  $objFormParam->getHashArray(); 
    422     $objErr = new SC_CheckError($arrRet); 
    423     $objErr->arrErr = $objFormParam->checkError(); 
    424          
    425     // 複数項目チェック 
    426     if ($objPage->tpl_classcat_find1) { 
    427         $objErr->doFunc(array("規格1", "classcategory_id1"), array("EXIST_CHECK")); 
    428     } 
    429     if ($objPage->tpl_classcat_find2) { 
    430         $objErr->doFunc(array("規格2", "classcategory_id2"), array("EXIST_CHECK")); 
    431     } 
    432  
    433     return $objErr->arrErr; 
    434 } 
    435  
    436 //閲覧履歴新規登録 
    437 function lfRegistReadingData($tmp_id, $customer_id){ 
    438     $objQuery = new SC_Query; 
    439     $sqlval['customer_id'] = $customer_id; 
    440     $sqlval['reading_product_id'] = $tmp_id; 
    441     $sqlval['create_date'] = 'NOW()'; 
    442     $sqlval['update_date'] = 'NOW()'; 
    443     $objQuery->insert("dtb_customer_reading", $sqlval); 
    444 } 
    445  
    446 //この商品を買った人はこんな商品も買っています 
    447 function lfGetRelateProducts($tmp_id) { 
    448     $objQuery = new SC_Query; 
    449     //自動抽出 
    450     $objQuery->setorder("random()"); 
    451     //表示件数の制限 
    452     $objQuery->setlimit(RELATED_PRODUCTS_MAX); 
    453     //検索条件 
    454     $col = "name, main_list_image, price01_min, price02_min, price01_max, price02_max, point_rate"; 
    455     $from = "vw_products_allclass AS allcls "; 
    456     $where = "del_flg = 0 AND status = 1 AND (stock_max <> 0 OR stock_max IS NULL) AND product_id = ? "; 
    457     $arrval[] = $tmp_id; 
    458     //結果の取得 
    459     $arrProducts = $objQuery->select($col, $from, $where, $arrval); 
    460      
    461     return $arrProducts; 
    462 } 
    463  
    464 //商品ごとのレビュー情報を取得する 
    465 function lfGetReviewData($id) { 
    466     $objQuery = new SC_Query; 
    467     //商品ごとのレビュー情報を取得する 
    468     $col = "create_date, reviewer_url, reviewer_name, recommend_level, title, comment"; 
    469     $from = "dtb_review"; 
    470     $where = "del_flg = 0 AND status = 1 AND product_id = ? "; 
    471     $arrval[] = $id; 
    472     $arrReview = $objQuery->select($col, $from, $where, $arrval); 
    473     return $arrReview;  
    474 } 
    475  
    476 //支払方法の取得 
    477 //payment_id    1:クレジット 2:ショッピングローン  
    478 function lfGetPayment() { 
    479     $objQuery = new SC_Query; 
    480     $col = "payment_id, rule, payment_method"; 
    481     $from = "dtb_payment"; 
    482     $where = "del_flg = 0"; 
    483     $order = "payment_id"; 
    484     $objQuery->setorder($order); 
    485     $arrRet = $objQuery->select($col, $from, $where); 
    486     return $arrRet; 
    487 } 
     19$objPage = new LC_Page_Products_Detail_Ex(); 
     20$objPage->mobileInit(); 
     21$objPage->mobileProcess(); 
     22register_shutdown_function(array($objPage, "destroy")); 
    48823?> 
Note: See TracChangeset for help on using the changeset viewer.