Changeset 11042


Ignore:
Timestamp:
2006/12/21 11:46:15 (19 years ago)
Author:
uehara
Message:
 
Location:
temp/branches/ec-cube-beta
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • temp/branches/ec-cube-beta/data/Smarty/templates/campaign/index.tpl

    r11041 r11042  
    2222 
    2323function init() { 
    24     if(<!--{$tpl_test}-->) { 
     24    if(<!--{$tpl_init}-->) { 
    2525        var ids = fnGetIds(); 
    26         location.href = './index.php?test=1&ids=' + ids; 
     26        location.href = './index.php?init=1&ids=' + ids; 
    2727    } 
    2828} 
  • temp/branches/ec-cube-beta/html/campaign/default/index.php

    r11035 r11042  
    3030} 
    3131 
    32 sfprintr($_GET); 
    33  
    34 if($_GET['test'] != "") { 
    35     $objPage->tpl_test = 'false'; 
     32if($_GET['init'] != "") { 
     33    $objPage->tpl_init = 'false'; 
     34    lfDispProductsList($_GET['ids']); 
    3635} else { 
    37     $objPage->tpl_test = 'true';     
     36    $objPage->tpl_init = 'true';     
    3837} 
    3938 
     
    7170    return false; 
    7271} 
     72 
     73/* ¾¦ÉʰìÍ÷¤Îɽ¼¨ */ 
     74function lfDispProductsList($ids) { 
     75     
     76    global $objQuery; 
     77    global $objPage; 
     78 
     79    // µ¬³Ê̾°ìÍ÷ 
     80    $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 
     81    // µ¬³ÊʬÎà̾°ìÍ÷ 
     82    $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
     83     
     84    $arrProductIds = split('-', $ids); 
     85    if(!is_array($arrProductIds)) { 
     86        $arrProductIds[0] = $ids; 
     87    } 
     88     
     89    // where¶çÀ¸À® 
     90    $where = "IN ( ?";   
     91    foreach($arrProductIds as $key =>$val) { 
     92        $where .= ",?"; 
     93        $arrval[] = $val; 
     94    } 
     95    $where .= ")"; 
     96     
     97    // ¾¦ÉʰìÍ÷ 
     98    $arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval); 
     99     
     100    for($i = 0; $i < count($arrProducts); $i++) { 
     101        $objPage = lfMakeSelect($arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName); 
     102        // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ 
     103        $objPage = lfGetSaleLimit($arrProducts); 
     104    } 
     105 
     106    return $objPage; 
     107} 
     108 
     109/* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */ 
     110function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) { 
     111    global $objPage; 
     112     
     113    $classcat_find1 = false; 
     114    $classcat_find2 = false; 
     115    // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎ̵ͭ 
     116    $stock_find = false; 
     117     
     118    // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ    
     119    $arrProductsClass = lfGetProductsClass($product_id); 
     120     
     121    // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
     122    $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']]; 
     123    // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
     124    $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']]; 
     125     
     126    // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô  
     127    $count = count($arrProductsClass); 
     128     
     129    $classcat_id1 = ""; 
     130     
     131    $arrSele = array(); 
     132    $arrList = array(); 
     133     
     134    $list_id = 0; 
     135    $arrList[0] = "\tlist". $product_id. "_0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'"; 
     136    $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 
     137     
     138    for ($i = 0; $i < $count; $i++) { 
     139        // ºß¸Ë¤Î¥Á¥§¥Ã¥¯ 
     140        if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 
     141            continue; 
     142        } 
     143         
     144        $stock_find = true; 
     145         
     146        // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
     147        if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 
     148            $arrList[$list_id].=");\n"; 
     149            $arrVal[$list_id].=");\n"; 
     150            $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; 
     151            $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1]; 
     152            $list_id++; 
     153        } 
     154         
     155        // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
     156        $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 
     157         
     158        // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ 
     159        if($arrList[$list_id] == "") { 
     160            $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'"; 
     161        } else { 
     162            $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 
     163        } 
     164         
     165        // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ 
     166        if($arrVal[$list_id] == "") { 
     167            $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; 
     168        } else { 
     169            $arrVal[$list_id].= ", '".$classcat_id2."'"; 
     170        } 
     171    }    
     172     
     173    $arrList[$list_id].=");\n"; 
     174    $arrVal[$list_id].=");\n"; 
     175         
     176    // µ¬³Ê1 
     177    $objPage->arrClassCat1[$product_id] = $arrSele; 
     178     
     179    $lists = "\tlists".$product_id. " = new Array("; 
     180    $no = 0; 
     181    foreach($arrList as $val) { 
     182        $objPage->tpl_javascript.= $val; 
     183        if ($no != 0) { 
     184            $lists.= ",list". $product_id. "_". $no; 
     185        } else { 
     186            $lists.= "list". $product_id. "_". $no; 
     187        } 
     188        $no++; 
     189    } 
     190    $objPage->tpl_javascript.= $lists.");\n"; 
     191     
     192    $vals = "\tvals".$product_id. " = new Array("; 
     193    $no = 0; 
     194    foreach($arrVal as $val) { 
     195        $objPage->tpl_javascript.= $val; 
     196        if ($no != 0) { 
     197            $vals.= ",val". $product_id. "_". $no; 
     198        } else { 
     199            $vals.= "val". $product_id. "_". $no; 
     200        } 
     201        $no++; 
     202    } 
     203    $objPage->tpl_javascript.= $vals.");\n"; 
     204     
     205    // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID 
     206    $classcategory_id = "classcategory_id". $product_id; 
     207    $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); "; 
     208 
     209    // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
     210    if($arrProductsClass[0]['classcategory_id1'] != '0') { 
     211        $classcat_find1 = true; 
     212    } 
     213     
     214    // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
     215    if($arrProductsClass[0]['classcategory_id2'] != '0') { 
     216        $classcat_find2 = true; 
     217    } 
     218         
     219    $objPage->tpl_classcat_find1[$product_id] = $classcat_find1; 
     220    $objPage->tpl_classcat_find2[$product_id] = $classcat_find2; 
     221    $objPage->tpl_stock_find[$product_id] = $stock_find; 
     222         
     223    return $objPage; 
     224} 
     225 
     226/* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ */ 
     227function lfGetProductsClass($product_id) { 
     228    $arrRet = array(); 
     229    if(sfIsInt($product_id)) { 
     230        // ¾¦Éʵ¬³Ê¼èÆÀ 
     231        $objQuery = new SC_Query(); 
     232        $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; 
     233        $table = "vw_product_class AS prdcls"; 
     234        $where = "product_id = ?"; 
     235        $objQuery->setorder("rank1 DESC, rank2 DESC"); 
     236        $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 
     237    } 
     238    return $arrRet; 
     239} 
     240 
     241// ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê 
     242function lfGetSaleLimit($product) { 
     243    global $objPage; 
     244    //ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礭¤¤¾ì¹ç 
     245    if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 
     246        $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; 
     247    } else { 
     248        $objPage->tpl_sale_limit[$product['product_id']] = $product['sale_limit']; 
     249    } 
     250     
     251    return $objPage; 
     252} 
     253 
     254//»ÙʧÊýË¡¤Î¼èÆÀ 
     255//payment_id    1:Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñα 
     256function lfGetPayment() { 
     257    $objQuery = new SC_Query; 
     258    $col = "payment_id, rule, payment_method"; 
     259    $from = "dtb_payment"; 
     260    $where = "del_flg = 0"; 
     261    $order = "payment_id"; 
     262    $objQuery->setorder($order); 
     263    $arrRet = $objQuery->select($col, $from, $where); 
     264    return $arrRet; 
     265} 
     266 
     267?> 
Note: See TracChangeset for help on using the changeset viewer.