Changeset 13581 for branches/rel/html


Ignore:
Timestamp:
2007/05/29 09:47:57 (17 years ago)
Author:
adati
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rel/html/products/list.php

    r13494 r13581  
    1010 
    1111class LC_Page { 
    12     function LC_Page() { 
    13         global $arrSTATUS; 
    14         $this->arrSTATUS = $arrSTATUS; 
    15         global $arrSTATUS_IMAGE; 
    16         $this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE; 
    17         global $arrDELIVERYDATE; 
    18         $this->arrDELIVERYDATE = $arrDELIVERYDATE; 
    19         global $arrPRODUCTLISTMAX; 
    20         $this->arrPRODUCTLISTMAX = $arrPRODUCTLISTMAX;       
    21         /* 
    22         session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç 
    23         ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£ 
    24         private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£ 
    25         */ 
    26         session_cache_limiter('private-no-expire'); 
    27     } 
     12    function LC_Page() { 
     13        global $arrSTATUS; 
     14        $this->arrSTATUS = $arrSTATUS; 
     15        global $arrSTATUS_IMAGE; 
     16        $this->arrSTATUS_IMAGE = $arrSTATUS_IMAGE; 
     17        global $arrDELIVERYDATE; 
     18        $this->arrDELIVERYDATE = $arrDELIVERYDATE; 
     19        global $arrPRODUCTLISTMAX; 
     20        $this->arrPRODUCTLISTMAX = $arrPRODUCTLISTMAX;       
     21        /* 
     22        session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç 
     23        ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£ 
     24        private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£ 
     25        */ 
     26        session_cache_limiter('private-no-expire'); 
     27    } 
    2828} 
    2929 
     
    3333//ɽ¼¨·ï¿ô¤ÎÁªÂò 
    3434if(sfIsInt($_POST['disp_number'])) { 
    35     $objPage->disp_number = $_POST['disp_number']; 
     35    $objPage->disp_number = $_POST['disp_number']; 
    3636} else { 
    37     //ºÇ¾®É½¼¨·ï¿ô¤òÁªÂò 
    38     $objPage->disp_number = current(array_keys($arrPRODUCTLISTMAX)); 
     37    //ºÇ¾®É½¼¨·ï¿ô¤òÁªÂò 
     38    $objPage->disp_number = current(array_keys($arrPRODUCTLISTMAX)); 
    3939} 
    4040 
     
    4848$tpl_subtitle = ""; 
    4949if($_GET['mode'] == 'search'){ 
    50     $tpl_subtitle = "¸¡º÷·ë²Ì"; 
     50    $tpl_subtitle = "¸¡º÷·ë²Ì"; 
    5151}elseif ($category_id == "" ) { 
    52     $tpl_subtitle = "Á´¾¦ÉÊ"; 
     52    $tpl_subtitle = "Á´¾¦ÉÊ"; 
    5353}else{ 
    54     $arrFirstCat = sfGetFirstCat($category_id); 
    55     $tpl_subtitle = $arrFirstCat['name']; 
     54    $arrFirstCat = sfGetFirstCat($category_id); 
     55    $tpl_subtitle = $arrFirstCat['name']; 
    5656} 
    5757 
     
    6464// ¡¦¸¡º÷¥â¡¼¥É¤Ç¤Ê¤¤¡£ 
    6565if(($count >= BEST_MIN) && lfIsRootCategory($category_id) && ($_GET['mode'] != 'search') ) { 
    66     // ¾¦ÉÊTOP¤Îɽ¼¨½èÍý 
    67     /** ɬ¤º»ØÄꤹ¤ë **/ 
    68     $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl";        // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È    
    69      
    70     $objPage->arrBestItems = sfGetBestProducts($conn, $category_id); 
    71     $objPage->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2); 
     66    // ¾¦ÉÊTOP¤Îɽ¼¨½èÍý 
     67    /** ɬ¤º»ØÄꤹ¤ë **/ 
     68    $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl";        // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È     
     69     
     70    $objPage->arrBestItems = sfGetBestProducts($conn, $category_id); 
     71    $objPage->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2); 
    7272} else { 
    73     if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){ 
    74         // ¸¡º÷»þ¤Ëcategory_id¤¬GET¤Ë¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¡¢²¾¤ËËä¤á¤¿ID¤ò¶õÇò¤ËÌ᤹ 
    75         $category_id = '';   
    76     } 
    77      
    78     // ¾¦ÉÊ°ìÍ÷¤Îɽ¼¨½èÍý 
    79     $objPage = lfDispProductsList($category_id, $_GET['name'], $objPage->disp_number, $_POST['orderby']); 
    80      
    81     // ¸¡º÷¾ò·ï¤ò²èÌ̤Ëɽ¼¨ 
    82     // ¥«¥Æ¥´¥ê¡¼¸¡º÷¾ò·ï 
    83     if (strlen($_GET['category_id']) == 0) { 
    84         $arrSearch['category'] = "»ØÄê¤Ê¤·"; 
    85     }else{ 
    86         $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id)); 
    87         $arrSearch['category'] = $arrCat; 
    88     } 
    89      
    90     // ¾¦ÉÊ̾¸¡º÷¾ò·ï 
    91     if ($_GET['name'] === "") { 
    92         $arrSearch['name'] = "»ØÄê¤Ê¤·"; 
    93     }else{ 
    94         $arrSearch['name'] = $_GET['name']; 
    95     } 
     73    if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){ 
     74        // ¸¡º÷»þ¤Ëcategory_id¤¬GET¤Ë¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¡¢²¾¤ËËä¤á¤¿ID¤ò¶õÇò¤ËÌ᤹ 
     75        $category_id = '';   
     76    } 
     77     
     78    // ¾¦ÉÊ°ìÍ÷¤Îɽ¼¨½èÍý 
     79    $objPage = lfDispProductsList($category_id, $_GET['name'], $objPage->disp_number, $_POST['orderby']); 
     80     
     81    // ¸¡º÷¾ò·ï¤ò²èÌ̤Ëɽ¼¨ 
     82    // ¥«¥Æ¥´¥ê¡¼¸¡º÷¾ò·ï 
     83    if (strlen($_GET['category_id']) == 0) { 
     84        $arrSearch['category'] = "»ØÄê¤Ê¤·"; 
     85    }else{ 
     86        $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id)); 
     87        $arrSearch['category'] = $arrCat; 
     88    } 
     89     
     90    // ¾¦ÉÊ̾¸¡º÷¾ò·ï 
     91    if ($_GET['name'] === "") { 
     92        $arrSearch['name'] = "»ØÄê¤Ê¤·"; 
     93    }else{ 
     94        $arrSearch['name'] = $_GET['name']; 
     95    } 
    9696} 
    9797 
     
    100100 
    101101if($_POST['mode'] == "cart" && $_POST['product_id'] != "") { 
    102     // ÃͤÎÀµÅöÀ­¥Á¥§¥Ã¥¯ 
    103     if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) { 
    104         sfDispSiteError(PRODUCT_NOT_FOUND); 
    105     } else { 
    106         // ÆþÎÏÃͤÎÊÑ´¹ 
    107         $objPage->arrErr = lfCheckError($_POST['product_id']); 
    108         if(count($objPage->arrErr) == 0) { 
    109             $objCartSess = new SC_CartSession(); 
    110             $classcategory_id = "classcategory_id". $_POST['product_id']; 
    111             $classcategory_id1 = $_POST[$classcategory_id. '_1']; 
    112             $classcategory_id2 = $_POST[$classcategory_id. '_2']; 
    113             $quantity = "quantity". $_POST['product_id']; 
    114             // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç 
    115             if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) { 
    116                 $classcategory_id1 = '0'; 
    117             } 
    118             // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç 
    119             if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) { 
    120                 $classcategory_id2 = '0'; 
    121             } 
    122             $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 
    123             $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]); 
    124             header("Location: " . URL_CART_TOP); 
    125             exit; 
    126         } 
    127     } 
     102    // ÃͤÎÀµÅöÀ­¥Á¥§¥Ã¥¯ 
     103    if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) { 
     104        sfDispSiteError(PRODUCT_NOT_FOUND); 
     105    } else { 
     106        // ÆþÎÏÃͤÎÊÑ´¹ 
     107        $objPage->arrErr = lfCheckError($_POST['product_id']); 
     108        if(count($objPage->arrErr) == 0) { 
     109            $objCartSess = new SC_CartSession(); 
     110            $classcategory_id = "classcategory_id". $_POST['product_id']; 
     111            $classcategory_id1 = $_POST[$classcategory_id. '_1']; 
     112            $classcategory_id2 = $_POST[$classcategory_id. '_2']; 
     113            $quantity = "quantity". $_POST['product_id']; 
     114            // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç 
     115            if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) { 
     116                $classcategory_id1 = '0'; 
     117            } 
     118            // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç 
     119            if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) { 
     120                $classcategory_id2 = '0'; 
     121            } 
     122            $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 
     123            $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]); 
     124            header("Location: " . URL_CART_TOP); 
     125            exit; 
     126        } 
     127    } 
    128128} 
    129129 
     
    146146/* ¥«¥Æ¥´¥êID¤¬¥ë¡¼¥È¤«¤É¤¦¤«¤ÎȽÄê */ 
    147147function lfIsRootCategory($category_id) { 
    148     $objQuery = new SC_Query(); 
    149     $level = $objQuery->get("dtb_category", "level", "category_id = ?", array($category_id)); 
    150     if($level == 1) { 
    151         return true; 
    152     } 
    153     return false; 
     148    $objQuery = new SC_Query(); 
     149    $level = $objQuery->get("dtb_category", "level", "category_id = ?", array($category_id)); 
     150    if($level == 1) { 
     151        return true; 
     152    } 
     153    return false; 
    154154} 
    155155 
    156156/* ¾¦ÉÊ°ìÍ÷¤Îɽ¼¨ */ 
    157157function lfDispProductsList($category_id, $name, $disp_num, $orderby) { 
    158     global $objPage; 
    159     $objQuery = new SC_Query();  
    160     $objPage->tpl_pageno = $_POST['pageno']; 
    161  
    162     //ɽ¼¨·ï¿ô¤Ç¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂؤ¨¤ë 
    163     $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl";        // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È        
    164  
    165     //ɽ¼¨½ç½ø 
    166     switch($orderby) { 
    167     //²Á³Ê½ç 
    168     case 'price': 
    169         $order = "price02_min ASC"; 
    170         break; 
    171     //¿·Ãå½ç 
    172     case 'date': 
    173         $order = "create_date DESC"; 
    174         break; 
    175     default: 
    176         $order = "category_rank DESC, rank DESC"; 
    177         break; 
    178     } 
    179      
    180     // ¾¦Éʸ¡º÷¾ò·ï¤ÎºîÀ®¡Ê̤ºï½ü¡¢É½¼¨¡Ë 
    181     $where = "del_flg = 0 AND status = 1 "; 
    182     // ¥«¥Æ¥´¥ê¤«¤é¤ÎWHEREʸ»úÎó¼èÆÀ 
    183     if ( $category_id ) { 
    184         list($tmp_where, $arrval) = sfGetCatWhere($category_id); 
    185         if($tmp_where != "") { 
    186             $where.= " AND $tmp_where"; 
    187         } 
    188     } 
    189          
    190     // ¾¦ÉÊ̾¤òwhereʸ¤Ë 
    191     $name = ereg_replace(",", "", $name); 
    192     if ( strlen($name) > 0 ){ 
    193         $where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) "; 
    194         $ret = sfManualEscape($name);        
    195         $arrval[] = "%$ret%"; 
    196         $arrval[] = "%$ret%"; 
    197     } 
    198              
    199     // ¹Ô¿ô¤Î¼èÆÀ 
    200     $linemax = $objQuery->count("vw_products_allclass AS allcls", $where, $arrval); 
    201     $objPage->tpl_linemax = $linemax;   // ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ 
    202      
    203     // ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ 
    204     $objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX); 
    205      
    206     $strnavi = $objNavi->strnavi; 
    207     $strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi); 
    208     $objPage->tpl_strnavi = $strnavi;       // ɽ¼¨Ê¸»úÎó 
    209     $startno = $objNavi->start_row;                 // ³«»Ï¹Ô 
    210      
    211     // ¼èÆÀÈϰϤλØÄê(³«»Ï¹ÔÈֹ桢¹Ô¿ô¤Î¥»¥Ã¥È) 
    212     $objQuery->setlimitoffset($disp_num, $startno); 
    213     // ɽ¼¨½ç½ø 
    214     $objQuery->setorder($order); 
    215      
    216      
    217      
    218      
    219      
    220      
    221      
    222      
    223     // ¸¡º÷·ë²Ì¤Î¼èÆÀ 
    224     $objPage->arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval); 
    225      
    226     // µ¬³Ê̾°ìÍ÷ 
    227     $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 
    228     // µ¬³ÊʬÎà̾°ìÍ÷ 
    229     $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
    230     // ´ë²è¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÀßÄê 
    231     if($disp_num == 15) { 
    232         for($i = 0; $i < count($objPage->arrProducts); $i++) { 
    233             $objPage = lfMakeSelect($objPage->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName); 
    234             // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ 
    235             $objPage = lfGetSaleLimit($objPage->arrProducts[$i]); 
    236         } 
    237     } 
    238  
    239     return $objPage; 
     158    global $objPage; 
     159    $objQuery = new SC_Query();  
     160    $objPage->tpl_pageno = $_POST['pageno']; 
     161 
     162    //ɽ¼¨·ï¿ô¤Ç¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂؤ¨¤ë 
     163    $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl";        // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È         
     164 
     165    //ɽ¼¨½ç½ø 
     166    switch($orderby) { 
     167    //²Á³Ê½ç 
     168    case 'price': 
     169        $order = "price02_min ASC"; 
     170        break; 
     171    //¿·Ãå½ç 
     172    case 'date': 
     173        $order = "create_date DESC"; 
     174        break; 
     175    default: 
     176        $order = "category_rank DESC, rank DESC"; 
     177        break; 
     178    } 
     179     
     180    // ¾¦Éʸ¡º÷¾ò·ï¤ÎºîÀ®¡Ê̤ºï½ü¡¢É½¼¨¡Ë 
     181    $where = "del_flg = 0 AND status = 1 "; 
     182    // ¥«¥Æ¥´¥ê¤«¤é¤ÎWHEREʸ»úÎó¼èÆÀ 
     183    if ( $category_id ) { 
     184        list($tmp_where, $arrval) = sfGetCatWhere($category_id); 
     185        if($tmp_where != "") { 
     186            $where.= " AND $tmp_where"; 
     187        } 
     188    } 
     189         
     190    // ¾¦ÉÊ̾¤òwhereʸ¤Ë 
     191    $name = ereg_replace(",", "", $name); 
     192    if ( strlen($name) > 0 ){ 
     193        $where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) "; 
     194        $ret = sfManualEscape($name);        
     195        $arrval[] = "%$ret%"; 
     196        $arrval[] = "%$ret%"; 
     197    } 
     198             
     199    // ¹Ô¿ô¤Î¼èÆÀ 
     200    $linemax = $objQuery->count("vw_products_allclass AS allcls", $where, $arrval); 
     201    $objPage->tpl_linemax = $linemax;   // ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ 
     202     
     203    // ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ 
     204    $objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX); 
     205     
     206    $strnavi = $objNavi->strnavi; 
     207    $strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi); 
     208    $objPage->tpl_strnavi = $strnavi;       // ɽ¼¨Ê¸»úÎó 
     209    $startno = $objNavi->start_row;                 // ³«»Ï¹Ô 
     210     
     211    // ¼èÆÀÈϰϤλØÄê(³«»Ï¹ÔÈֹ桢¹Ô¿ô¤Î¥»¥Ã¥È) 
     212    $objQuery->setlimitoffset($disp_num, $startno); 
     213    // ɽ¼¨½ç½ø 
     214    $objQuery->setorder($order); 
     215     
     216     
     217     
     218     
     219     
     220     
     221     
     222     
     223    // ¸¡º÷·ë²Ì¤Î¼èÆÀ 
     224    $objPage->arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval); 
     225     
     226    // µ¬³Ê̾°ìÍ÷ 
     227    $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 
     228    // µ¬³ÊʬÎà̾°ìÍ÷ 
     229    $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
     230    // ´ë²è¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÀßÄê 
     231    if($disp_num == 15) { 
     232        for($i = 0; $i < count($objPage->arrProducts); $i++) { 
     233            $objPage = lfMakeSelect($objPage->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName); 
     234            // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ 
     235            $objPage = lfGetSaleLimit($objPage->arrProducts[$i]); 
     236        } 
     237    } 
     238 
     239    return $objPage; 
    240240} 
    241241 
    242242/* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */ 
    243243function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) { 
    244     global $objPage; 
    245      
    246     $classcat_find1 = false; 
    247     $classcat_find2 = false; 
    248     // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎ̵ͭ 
    249     $stock_find = false; 
    250      
    251     // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ    
    252     $arrProductsClass = lfGetProductsClass($product_id); 
    253      
    254     // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
    255     $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']]; 
    256     // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
    257     $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']]; 
    258      
    259     // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô  
    260     $count = count($arrProductsClass); 
    261      
    262     $classcat_id1 = ""; 
    263      
    264     $arrSele = array(); 
    265     $arrList = array(); 
    266      
    267     $list_id = 0; 
    268     $arrList[0] = "\tlist". $product_id. "_0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'"; 
    269     $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 
    270      
    271     for ($i = 0; $i < $count; $i++) { 
    272         // ºß¸Ë¤Î¥Á¥§¥Ã¥¯ 
    273         if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 
    274             continue; 
    275         } 
    276          
    277         $stock_find = true; 
    278          
    279         // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
    280         if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 
    281             $arrList[$list_id].=");\n"; 
    282             $arrVal[$list_id].=");\n"; 
    283             $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; 
    284             $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1]; 
    285             $list_id++; 
    286         } 
    287          
    288         // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
    289         $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 
    290          
    291         // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ 
    292         if($arrList[$list_id] == "") { 
    293             $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'"; 
    294         } else { 
    295             $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 
    296         } 
    297          
    298         // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ 
    299         if($arrVal[$list_id] == "") { 
    300             $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; 
    301         } else { 
    302             $arrVal[$list_id].= ", '".$classcat_id2."'"; 
    303         } 
    304     }    
    305      
    306     $arrList[$list_id].=");\n"; 
    307     $arrVal[$list_id].=");\n"; 
    308          
    309     // µ¬³Ê1 
    310     $objPage->arrClassCat1[$product_id] = $arrSele; 
    311      
    312     $lists = "\tlists".$product_id. " = new Array("; 
    313     $no = 0; 
    314     foreach($arrList as $val) { 
    315         $objPage->tpl_javascript.= $val; 
    316         if ($no != 0) { 
    317             $lists.= ",list". $product_id. "_". $no; 
    318         } else { 
    319             $lists.= "list". $product_id. "_". $no; 
    320         } 
    321         $no++; 
    322     } 
    323     $objPage->tpl_javascript.= $lists.");\n"; 
    324      
    325     $vals = "\tvals".$product_id. " = new Array("; 
    326     $no = 0; 
    327     foreach($arrVal as $val) { 
    328         $objPage->tpl_javascript.= $val; 
    329         if ($no != 0) { 
    330             $vals.= ",val". $product_id. "_". $no; 
    331         } else { 
    332             $vals.= "val". $product_id. "_". $no; 
    333         } 
    334         $no++; 
    335     } 
    336     $objPage->tpl_javascript.= $vals.");\n"; 
    337      
    338     // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID 
    339     $classcategory_id = "classcategory_id". $product_id; 
    340     $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); "; 
    341  
    342     // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
    343     if($arrProductsClass[0]['classcategory_id1'] != '0') { 
    344         $classcat_find1 = true; 
    345     } 
    346      
    347     // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
    348     if($arrProductsClass[0]['classcategory_id2'] != '0') { 
    349         $classcat_find2 = true; 
    350     } 
    351          
    352     $objPage->tpl_classcat_find1[$product_id] = $classcat_find1; 
    353     $objPage->tpl_classcat_find2[$product_id] = $classcat_find2; 
    354     $objPage->tpl_stock_find[$product_id] = $stock_find; 
    355          
    356     return $objPage; 
     244    global $objPage; 
     245     
     246    $classcat_find1 = false; 
     247    $classcat_find2 = false; 
     248    // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎ̵ͭ 
     249    $stock_find = false; 
     250     
     251    // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ     
     252    $arrProductsClass = lfGetProductsClass($product_id); 
     253     
     254    // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
     255    $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']]; 
     256    // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
     257    $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']]; 
     258     
     259    // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô    
     260    $count = count($arrProductsClass); 
     261     
     262    $classcat_id1 = ""; 
     263     
     264    $arrSele = array(); 
     265    $arrList = array(); 
     266     
     267    $list_id = 0; 
     268    $arrList[0] = "\tlist". $product_id. "_0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'"; 
     269    $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 
     270     
     271    for ($i = 0; $i < $count; $i++) { 
     272        // ºß¸Ë¤Î¥Á¥§¥Ã¥¯ 
     273        if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 
     274            continue; 
     275        } 
     276         
     277        $stock_find = true; 
     278         
     279        // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
     280        if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 
     281            $arrList[$list_id].=");\n"; 
     282            $arrVal[$list_id].=");\n"; 
     283            $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; 
     284            $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1]; 
     285            $list_id++; 
     286        } 
     287         
     288        // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
     289        $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 
     290         
     291        // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ 
     292        if($arrList[$list_id] == "") { 
     293            $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'"; 
     294        } else { 
     295            $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 
     296        } 
     297         
     298        // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ 
     299        if($arrVal[$list_id] == "") { 
     300            $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; 
     301        } else { 
     302            $arrVal[$list_id].= ", '".$classcat_id2."'"; 
     303        } 
     304    }    
     305     
     306    $arrList[$list_id].=");\n"; 
     307    $arrVal[$list_id].=");\n"; 
     308         
     309    // µ¬³Ê1 
     310    $objPage->arrClassCat1[$product_id] = $arrSele; 
     311     
     312    $lists = "\tlists".$product_id. " = new Array("; 
     313    $no = 0; 
     314    foreach($arrList as $val) { 
     315        $objPage->tpl_javascript.= $val; 
     316        if ($no != 0) { 
     317            $lists.= ",list". $product_id. "_". $no; 
     318        } else { 
     319            $lists.= "list". $product_id. "_". $no; 
     320        } 
     321        $no++; 
     322    } 
     323    $objPage->tpl_javascript.= $lists.");\n"; 
     324     
     325    $vals = "\tvals".$product_id. " = new Array("; 
     326    $no = 0; 
     327    foreach($arrVal as $val) { 
     328        $objPage->tpl_javascript.= $val; 
     329        if ($no != 0) { 
     330            $vals.= ",val". $product_id. "_". $no; 
     331        } else { 
     332            $vals.= "val". $product_id. "_". $no; 
     333        } 
     334        $no++; 
     335    } 
     336    $objPage->tpl_javascript.= $vals.");\n"; 
     337     
     338    // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID 
     339    $classcategory_id = "classcategory_id". $product_id; 
     340    $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); "; 
     341 
     342    // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
     343    if($arrProductsClass[0]['classcategory_id1'] != '0') { 
     344        $classcat_find1 = true; 
     345    } 
     346     
     347    // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
     348    if($arrProductsClass[0]['classcategory_id2'] != '0') { 
     349        $classcat_find2 = true; 
     350    } 
     351         
     352    $objPage->tpl_classcat_find1[$product_id] = $classcat_find1; 
     353    $objPage->tpl_classcat_find2[$product_id] = $classcat_find2; 
     354    $objPage->tpl_stock_find[$product_id] = $stock_find; 
     355         
     356    return $objPage; 
    357357} 
    358358/* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ */ 
    359359function lfGetProductsClass($product_id) { 
    360     $arrRet = array(); 
    361     if(sfIsInt($product_id)) { 
    362         // ¾¦Éʵ¬³Ê¼èÆÀ 
    363         $objQuery = new SC_Query(); 
    364         $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; 
    365         $table = "vw_product_class AS prdcls"; 
    366         $where = "product_id = ?"; 
    367         $objQuery->setorder("rank1 DESC, rank2 DESC"); 
    368         $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 
    369     } 
    370     return $arrRet; 
     360    $arrRet = array(); 
     361    if(sfIsInt($product_id)) { 
     362        // ¾¦Éʵ¬³Ê¼èÆÀ 
     363        $objQuery = new SC_Query(); 
     364        $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; 
     365        $table = "vw_product_class AS prdcls"; 
     366        $where = "product_id = ?"; 
     367        $objQuery->setorder("rank1 DESC, rank2 DESC"); 
     368        $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 
     369    } 
     370    return $arrRet; 
    371371} 
    372372 
    373373/* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯ */ 
    374374function lfCheckError($id) { 
    375     global $objPage; 
    376      
    377     // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£ 
    378     $objErr = new SC_CheckError(); 
    379      
    380     $classcategory_id1 = "classcategory_id". $id. "_1"; 
    381     $classcategory_id2 = "classcategory_id". $id. "_2"; 
    382     $quantity = "quantity". $id; 
    383     // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯ 
    384     if ($objPage->tpl_classcat_find1[$id]) { 
    385         $objErr->doFunc(array("µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    386     } 
    387     if ($objPage->tpl_classcat_find2[$id]) { 
    388         $objErr->doFunc(array("µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    389     } 
    390     $objErr->doFunc(array("¸Ä¿ô", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    391              
    392     return $objErr->arrErr; 
     375    global $objPage; 
     376     
     377    // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£ 
     378    $objErr = new SC_CheckError(); 
     379     
     380    $classcategory_id1 = "classcategory_id". $id. "_1"; 
     381    $classcategory_id2 = "classcategory_id". $id. "_2"; 
     382    $quantity = "quantity". $id; 
     383    // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯ 
     384    if ($objPage->tpl_classcat_find1[$id]) { 
     385        $objErr->doFunc(array("µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     386    } 
     387    if ($objPage->tpl_classcat_find2[$id]) { 
     388        $objErr->doFunc(array("µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     389    } 
     390    $objErr->doFunc(array("¸Ä¿ô", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     391             
     392    return $objErr->arrErr; 
    393393} 
    394394 
    395395// ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê 
    396396function lfGetSaleLimit($product) { 
    397     global $objPage; 
    398     //ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礭¤¤¾ì¹ç 
    399     if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 
    400         $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; 
    401     } else { 
    402         $objPage->tpl_sale_limit[$product['product_id']] = $product['sale_limit']; 
    403     } 
    404      
    405     return $objPage; 
     397    global $objPage; 
     398    //ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礭¤¤¾ì¹ç 
     399    if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 
     400        $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; 
     401    } else { 
     402        $objPage->tpl_sale_limit[$product['product_id']] = $product['sale_limit']; 
     403    } 
     404     
     405    return $objPage; 
    406406} 
    407407 
    408408//»ÙʧÊýË¡¤Î¼èÆÀ 
    409 //payment_id    1:Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñα 
     409//payment_id    1:Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñα 
    410410function lfGetPayment() { 
    411     $objQuery = new SC_Query; 
    412     $col = "payment_id, rule, payment_method"; 
    413     $from = "dtb_payment"; 
    414     $where = "del_flg = 0"; 
    415     $order = "payment_id"; 
    416     $objQuery->setorder($order); 
    417     $arrRet = $objQuery->select($col, $from, $where); 
    418     return $arrRet; 
     411    $objQuery = new SC_Query; 
     412    $col = "payment_id, rule, payment_method"; 
     413    $from = "dtb_payment"; 
     414    $where = "del_flg = 0"; 
     415    $order = "payment_id"; 
     416    $objQuery->setorder($order); 
     417    $arrRet = $objQuery->select($col, $from, $where); 
     418    return $arrRet; 
    419419} 
    420420 
Note: See TracChangeset for help on using the changeset viewer.