Changeset 11019 for temp/branches


Ignore:
Timestamp:
2006/12/21 10:06:19 (19 years ago)
Author:
uehara
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • temp/branches/ec-cube-beta/html/admin/contents/campaign_create_tag.php

    r10988 r11019  
    127127$objPage->arrCatList = sfGetCategoryList(); 
    128128 
    129 sfprintr(lfGetJavascript($_POST['product_id'])); 
    130  
    131129//----¡¡¥Ú¡¼¥¸É½¼¨ 
    132130$objView->assignobj($objPage); 
     
    157155} 
    158156 
    159  
    160157/* ¥¿¥°¤òÀ¸À® */ 
    161158function lfGetCreateTag($product_id, $arrProductClass) { 
    162159     
    163160    global $objQuery; 
    164      
    165     $create_tag .= "<select name=\"classcategory_id1_$product_id\" style=\"\" onchange=\"lnSetSelect('classcategory_id1_$product_id');\">\n"; 
    166     $create_tag .= "<option value=\"\">ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤</option>\n"; 
    167     foreach($arrProductClass as $arrVal) { 
    168         $classcategory_name = $objQuery->get("dtb_classcategory", "name", "classcategory_id = ?", array($arrVal['classcategory_id1'])); 
    169         $create_tag .= "<option label=\"$classcategory_name\" value=\"" . $arrVal['classcategory_id1'] . "\">" . $classcategory_name . "</option>\n"; 
    170     } 
    171     $create_tag .= "</select>\n"; 
    172     $create_tag .= "<a href=\"#\" onclick=\"fnFormModeSubmit('form1', 'cart', 'product_id', 404)\"><img src=\"images/top/button_03.jpg\" alt=\"¹ØÆþ¤¹¤ë\" width=\"138\" height=\"60\" border=\"0\" style=\"margin-left:10px;\" /></a>\n"; 
    173  
     161 
     162     
     163    // ½ñ¤­¹þ¤ß¥¿¥° 
     164    $write_tag .= "<div id=\"$product_id\">"; 
     165    $write_tag .= '<!--{assign var=id value=$arrProducts".['. $product_id .'].product_id}-->'; 
     166    $write_tag .= ' 
     167    <!--¢§Ç㤤ʪ¤«¤´--> 
     168    <table width="420" border="0" cellspacing="0" cellpadding="0" summary=" "> 
     169        <tr><td height=5></td></tr> 
     170        <tr valign="top" align="right" id="price"> 
     171            <td id="right" colspan=2> 
     172                <table cellspacing="0" cellpadding="0" summary=" " id="price"> 
     173                    <tr> 
     174                        <td align="center"> 
     175                        <table width="285" cellspacing="0" cellpadding="0" summary=" "> 
     176                            <!--{if $tpl_classcat_find1[$id]}--> 
     177                            <!--{assign var=class1 value=classcategory_id`$id`_1}--> 
     178                            <!--{assign var=class2 value=classcategory_id`$id`_2}--> 
     179                            <tr><td colspan="2" height="10" align="center" class="fs12"><span class="redst"><!--{if $arrErr[$class1] != ""}-->¢¨ <!--{$tpl_class_name1[$id]}-->¤òÆþÎϤ·¤Æ²¼¤µ¤¤¡£<!--{/if}--></span></td></tr> 
     180                            <tr> 
     181                                <td align="right" class="fs12st"><!--{$tpl_class_name1[$id]|escape}-->¡§ </td> 
     182                                <td> 
     183                                    <select name="<!--{$class1}-->" style="<!--{$arrErr[$class1]|sfGetErrorColor}-->" onchange="lnSetSelect(\'<!--{$class1}-->\', \'<!--{$class2}-->\', \'<!--{$id}-->\',\'\');"> 
     184                                    <option value="">ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤</option> 
     185                                    <!--{html_options options=$arrClassCat1[$id] selected=$arrForm[$class1]}--> 
     186                                    </select> 
     187                                </td> 
     188                            </tr> 
     189                            <!--{/if}--> 
     190                            <!--{if $tpl_classcat_find2[$id]}--> 
     191                            <tr><td colspan="2" height="5" align="center" class="fs12"><span class="redst"><!--{if $arrErr[$class2] != ""}-->¢¨ <!--{$tpl_class_name2[$id]}-->¤òÆþÎϤ·¤Æ²¼¤µ¤¤¡£<!--{/if}--></span></td></tr> 
     192                            <tr> 
     193                                <td align="right" class="fs12st"><!--{$tpl_class_name2[$id]|escape}-->¡§ </td> 
     194                                <td> 
     195                                    <select name="<!--{$class2}-->" style="<!--{$arrErr[$class2]|sfGetErrorColor}-->"> 
     196                                    <option value="">ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤</option> 
     197                                    </select> 
     198                                </td> 
     199                            </tr> 
     200                            <!--{/if}--> 
     201                            <!--{assign var=quantity value=quantity`$id`}-->         
     202                            <tr><td colspan="2" height="10" align="center" class="fs12"><span class="redst"><!--{$arrErr[$quantity]}--></span></td></tr> 
     203                            <tr> 
     204                                <td align="right" width="115" class="fs12st">¸Ä¿ô¡§  
     205                                    <!--{if $arrErr.quantity != ""}--><br/><span class="redst"><!--{$arrErr.quantity}--></span><!--{/if}--> 
     206                                    <input type="text" name="<!--{$quantity}-->" size="3" class="box3" value="<!--{$arrForm[$quantity]|default:1}-->" maxlength=<!--{$smarty.const.INT_LEN}--> style="<!--{$arrErr[$quantity]|sfGetErrorColor}-->" > 
     207                                </td> 
     208                                <td width="170" align="center"> 
     209                                    <a href="" onclick="fnChangeAction(\'<!--{$smarty.server.REQUEST_URI|escape}-->#product<!--{$id}-->\'); fnModeSubmit(\'cart\',\'product_id\',\'<!--{$id}-->\'); return false;" onmouseover="chgImg(\'<!--{$smarty.const.URL_DIR}-->img/products/b_cartin_on.gif\',\'cart<!--{$id}-->\');" onmouseout="chgImg(\'<!--{$smarty.const.URL_DIR}-->img/products/b_cartin.gif\',\'cart<!--{$id}-->\');"><img src="<!--{$smarty.const.URL_DIR}-->img/products/b_cartin.gif" width="115" height="25" alt="¥«¥´¤ËÆþ¤ì¤ë" name="cart<!--{$id}-->" id="cart<!--{$id}-->" /></a> 
     210                                </td> 
     211                            </tr> 
     212                            <tr><td height="10"></td></tr> 
     213                        </table> 
     214                        </td> 
     215                    </tr> 
     216                </table> 
     217            </td> 
     218        </tr> 
     219    </table> 
     220    </div> 
     221    <!--¢¥Ç㤤ʪ¤«¤´-->'; 
     222     
     223    // ¥«¡¼¥È¥¿¥°ÊݸÍÑ¥Õ¥¡¥¤¥ëºîÀ® 
     224    $cart_tag_path = CAMPAIGN_TEMPLATE_PATH."cart_tag/"; 
     225    if(!file_exists($cart_tag_path)) { 
     226        sfCreateFile($cart_tag_path, 0777); 
     227    } 
     228    // ½ñ¤­¹þ¤ß 
     229    sfWriteFile($write_tag, $cart_tag_path."cart_tag_$product_id", "w");     
     230     
     231    $create_tag .= ""; 
     232     
    174233    return $create_tag;  
    175234} 
    176  
    177 /* javascript¼èÆÀ */ 
    178 function lfGetJavascript($product_id) { 
    179      
    180     // µ¬³Ê̾°ìÍ÷ 
    181     $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 
    182     // µ¬³ÊʬÎà̾°ìÍ÷ 
    183     $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 
    184     // javascriptÀ¸À® 
    185     $objPage = lfMakeSelect($product_id, $arrClassName, $arrClassCatName); 
    186     // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ 
    187     //$objPage = lfGetSaleLimit($objPage->arrProducts[$i]); 
    188  
    189     return $objPage; 
    190 } 
    191  
    192 /* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ® */ 
    193 function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) { 
    194     global $objPage; 
    195      
    196     $classcat_find1 = false; 
    197     $classcat_find2 = false; 
    198     // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎ̵ͭ 
    199     $stock_find = false; 
    200      
    201     // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ    
    202     $arrProductsClass = lfGetProductsClass($product_id); 
    203      
    204     // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
    205     $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']]; 
    206     // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ 
    207     $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']]; 
    208      
    209     // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô  
    210     $count = count($arrProductsClass); 
    211      
    212     $classcat_id1 = ""; 
    213      
    214     $arrSele = array(); 
    215     $arrList = array(); 
    216      
    217     $list_id = 0; 
    218     $arrList[0] = "\tlist". $product_id. "_0 = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'"; 
    219     $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 
    220      
    221     for ($i = 0; $i < $count; $i++) { 
    222         // ºß¸Ë¤Î¥Á¥§¥Ã¥¯ 
    223         if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 
    224             continue; 
    225         } 
    226          
    227         $stock_find = true; 
    228          
    229         // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
    230         if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 
    231             $arrList[$list_id].=");\n"; 
    232             $arrVal[$list_id].=");\n"; 
    233             $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; 
    234             $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1]; 
    235             $list_id++; 
    236         } 
    237          
    238         // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ 
    239         $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 
    240          
    241         // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ 
    242         if($arrList[$list_id] == "") { 
    243             $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'"; 
    244         } else { 
    245             $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 
    246         } 
    247          
    248         // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ 
    249         if($arrVal[$list_id] == "") { 
    250             $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; 
    251         } else { 
    252             $arrVal[$list_id].= ", '".$classcat_id2."'"; 
    253         } 
    254     }    
    255      
    256     $arrList[$list_id].=");\n"; 
    257     $arrVal[$list_id].=");\n"; 
    258          
    259     // µ¬³Ê1 
    260     $objPage->arrClassCat1[$product_id] = $arrSele; 
    261      
    262     $lists = "\tlists".$product_id. " = new Array("; 
    263     $no = 0; 
    264     foreach($arrList as $val) { 
    265         $objPage->tpl_javascript.= $val; 
    266         if ($no != 0) { 
    267             $lists.= ",list". $product_id. "_". $no; 
    268         } else { 
    269             $lists.= "list". $product_id. "_". $no; 
    270         } 
    271         $no++; 
    272     } 
    273     $objPage->tpl_javascript.= $lists.");\n"; 
    274      
    275     $vals = "\tvals".$product_id. " = new Array("; 
    276     $no = 0; 
    277     foreach($arrVal as $val) { 
    278         $objPage->tpl_javascript.= $val; 
    279         if ($no != 0) { 
    280             $vals.= ",val". $product_id. "_". $no; 
    281         } else { 
    282             $vals.= "val". $product_id. "_". $no; 
    283         } 
    284         $no++; 
    285     } 
    286     $objPage->tpl_javascript.= $vals.");\n"; 
    287      
    288     // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID 
    289     $classcategory_id = "classcategory_id". $product_id; 
    290     $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); "; 
    291  
    292     // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
    293     if($arrProductsClass[0]['classcategory_id1'] != '0') { 
    294         $classcat_find1 = true; 
    295     } 
    296      
    297     // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë 
    298     if($arrProductsClass[0]['classcategory_id2'] != '0') { 
    299         $classcat_find2 = true; 
    300     } 
    301          
    302     $objPage->tpl_classcat_find1[$product_id] = $classcat_find1; 
    303     $objPage->tpl_classcat_find2[$product_id] = $classcat_find2; 
    304     $objPage->tpl_stock_find[$product_id] = $stock_find; 
    305          
    306     return $objPage; 
    307 } 
    308  
    309 /* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ */ 
    310 function lfGetProductsClass($product_id) { 
    311     $arrRet = array(); 
    312     if(sfIsInt($product_id)) { 
    313         // ¾¦Éʵ¬³Ê¼èÆÀ 
    314         $objQuery = new SC_Query(); 
    315         $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; 
    316         $table = "vw_product_class AS prdcls"; 
    317         $where = "product_id = ?"; 
    318         $objQuery->setorder("rank1 DESC, rank2 DESC"); 
    319         $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 
    320     } 
    321     return $arrRet; 
    322 } 
    323  
    324 // ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê 
    325 function lfGetSaleLimit($product) { 
    326 /* 
    327     global $objPage; 
    328     //ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礭¤¤¾ì¹ç 
    329     if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 
    330         $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; 
    331     } else { 
    332         $objPage->tpl_sale_limit[$product['product_id']] = $product['sale_limit']; 
    333     } 
    334      
    335     return $objPage; 
    336 */ 
    337 } 
    338  
    339235?> 
Note: See TracChangeset for help on using the changeset viewer.