Ignore:
Timestamp:
2010/10/29 21:00:06 (16 years ago)
Author:
nanasess
bzr:base-revision:
svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_5-dev:18874
bzr:committer:
Kentaro Ohkouchi <[email protected]>
bzr:file-ids:

data/Smarty/templates/admin/order/product_select.tpl 17293@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcomu-ver2%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fadmin%2Forder%2Fproduct_select.tpl
data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php 15594@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Forder%2FLC_Page_Admin_Order_Edit.php
data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php 17293@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcomu-ver2%2Fdata%2Fclass%2Fpages%2Fadmin%2Forder%2FLC_Page_Admin_Order_ProductSelect.php
bzr:mapping-version:
v4
bzr:repository-uuid:
1e3b908f-19a9-db11-a64c-001125224ba8
bzr:revision-id:
[email protected]
bzr:revno:
2355
bzr:revprop:branch-nick:
branches/version-2_5-dev
bzr:root:
branches/version-2_5-dev
bzr:timestamp:
2010-10-29 21:00:01.309999943 +0900
bzr:user-agent:
bzr2.2.0+bzr-svn1.0.3
svn:original-date:
2010-10-29T12:00:01.310000Z
Message:

規格のデータベースを木構造に(#781)

  • 商品追加時の規格のプルダウンを修正
  • 追加商品検索時のパフォーマンス改善
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/Smarty/templates/admin/order/product_select.tpl

    r18873 r18875  
    2828self.moveTo(20,20);self.focus(); 
    2929 
    30 function func_submit(product_id, class_name1, class_name2) { 
     30function func_submit(product_id, class_name1, class_name2, product_class_id) { 
    3131  var err_text = ''; 
    3232  var fm = window.opener.document.form1; 
     
    4040  <!--{if $tpl_no != ''}--> 
    4141  var opner_product_id = 'edit_product_id'; 
    42   var opner_classcategory_id1 = 'edit_classcategory_id1'; 
    43   var opner_classcategory_id2 = 'edit_classcategory_id2'; 
     42  var opner_product_class_id = 'edit_product_class_id'; 
    4443  fm1.getElementById("no").value = <!--{$tpl_no}-->; 
    4544  <!--{else}--> 
    4645  var opner_product_id = 'add_product_id'; 
    47   var opner_classcategory_id1 = 'add_classcategory_id1'; 
    48   var opner_classcategory_id2 = 'add_classcategory_id2'; 
     46  var opner_product_class_id = 'add_product_class_id'; 
    4947  <!--{/if}--> 
    5048 
     
    6159 
    6260  fm1.getElementById(opner_product_id).value = product_id; 
    63   if (class1_id != '') { 
    64     fm1.getElementById(opner_classcategory_id1).value = class1_id; 
    65   } 
    66   if (class2_id != '') { 
    67     fm1.getElementById(opner_classcategory_id2).value = class2_id; 
    68   } 
     61  fm1.getElementById(opner_product_class_id).value = product_class_id; 
    6962 
    7063  fm.mode.value = 'select_product_detail'; 
     
    7871</script> 
    7972 
     73 
    8074<script type="text/javascript">//<![CDATA[ 
    81 // セレクトボックスに項目を割り当てる。 
    82 function lnSetSelect(name1, name2, id, val) { 
    83         sele1 = document.form1[name1]; 
    84         sele2 = document.form1[name2]; 
    85         lists = eval('lists' + id); 
    86         vals = eval('vals' + id); 
    87  
    88         if(sele1 && sele2) { 
    89                 index = sele1.selectedIndex; 
    90  
    91                 // セレクトボックスのクリア 
    92                 count = sele2.options.length; 
    93                 for(i = count; i >= 0; i--) { 
    94                         sele2.options[i] = null; 
     75// 規格2に選択肢を割り当てる。 
     76function fnSetClassCategories(form, classcat_id2_selected) { 
     77    sele1 = form.classcategory_id1; 
     78    sele2 = form.classcategory_id2; 
     79    product_id = form.product_id.value; 
     80 
     81    if (sele1) { 
     82        if (sele2) { 
     83            // 規格2の選択肢をクリア 
     84            count = sele2.options.length; 
     85            for(i = count; i >= 0; i--) { 
     86                sele2.options[i] = null; 
     87            } 
     88 
     89            // 規格2に選択肢を割り当てる 
     90            classcats = productsClassCategories[product_id][sele1.value]; 
     91            i = 0; 
     92            for (var classcat_id2_key in classcats) { 
     93                sele2.options[i] = new Option(classcats[classcat_id2_key].name, classcat_id2_key); 
     94                if (classcat_id2_key == classcat_id2_selected) { 
     95                    sele2.options[i].selected = true; 
    9596                } 
    96  
    97                 // セレクトボックスに値を割り当てる 
    98                 len = lists[index].length; 
    99                 for(i = 0; i < len; i++) { 
    100                         sele2.options[i] = new Option(lists[index][i], vals[index][i]); 
    101                         if(val != "" && vals[index][i] == val) { 
    102                                 sele2.options[i].selected = true; 
    103                         } 
    104                 } 
     97                i++; 
     98            } 
    10599        } 
     100        fnCheckStock(form); 
     101    } 
    106102} 
    107 //]]> 
    108 </script> 
    109  
    110  
    111 <script type="text/javascript">//<![CDATA[ 
    112     <!--{$tpl_javascript}--> 
     103 
     104function fnCheckStock(form) { 
     105    product_id = form.product_id.value; 
     106    classcat_id1 = form.classcategory_id1.value; 
     107    classcat_id2 = form.classcategory_id2 ? form.classcategory_id2.value : 0; 
     108    classcat2 = productsClassCategories[product_id][classcat_id1][classcat_id2]; 
     109    // 商品規格 
     110    eleDynamic = document.getElementById('product_class_id' + product_id); 
     111    if ( 
     112           classcat2 
     113        && typeof classcat2.product_class_id != 'undefined' 
     114        && String(classcat2.product_class_id).length >= 1 
     115    ) { 
     116        eleDynamic.value = classcat2.product_class_id; 
     117    } else { 
     118        eleDynamic.value = '' 
     119    } 
     120} 
    113121//]]> 
    114122</script> 
     
    142150  <button type="submit"><span>検索を開始</span></button> 
    143151</div> 
    144  
     152</form> 
    145153<!--▼検索結果表示--> 
    146154<!--{if $tpl_linemax}--> 
     
    160168  <!--{section name=cnt loop=$arrProducts}--> 
    161169  <!--{assign var=id value=$arrProducts[cnt].product_id}--> 
     170  <form name="product_form<!--{$id|escape}-->" action="?" onsubmit="return false;"> 
    162171  <!--▼商品<!--{$smarty.section.cnt.iteration}-->--> 
    163172  <tr> 
     
    183192      <dt><!--{$tpl_class_name1[$id]|escape}-->:</dt> 
    184193      <dd> 
    185         <select name="<!--{$class1}-->" id="<!--{$class1}-->" style="<!--{$arrErr[$class1]|sfGetErrorColor}-->"  <!--{if $tpl_classcat_find2[$id]}--> onchange="lnSetSelect('<!--{$class1}-->', '<!--{$class2}-->', '<!--{$id}-->','');"<!--{/if}-->> 
    186           <option value="">選択してください</option> 
     194        <select name="classcategory_id1" id="<!--{$class1}-->" style="<!--{$arrErr[$class1]|sfGetErrorColor}-->"  onchange="fnSetClassCategories(this.form);"> 
    187195          <!--{html_options options=$arrClassCat1[$id] selected=$arrForm[$class1]}--> 
    188196        </select> 
     
    197205      <dt><!--{$tpl_class_name2[$id]|escape}-->:</dt> 
    198206      <dd> 
    199         <select name="<!--{$class2}-->" id="<!--{$class2}-->" style="<!--{$arrErr[$class2]|sfGetErrorColor}-->"> 
    200           <option value="">選択してください</option> 
    201         </select> 
     207        <select name="classcategory_id2" id="<!--{$class2}-->" style="<!--{$arrErr[$class2]|sfGetErrorColor}-->" onchange="fnCheckStock(this.form);"></select> 
    202208        <!--{if $arrErr[$class2] != ""}--> 
    203209        <br /><span class="attention">※ <!--{$tpl_class_name2[$id]}-->を入力して下さい。</span> 
     
    207213      <input type="hidden" name="<!--{$class2}-->" id="<!--{$class2}-->" value="" /> 
    208214      <!--{/if}--> 
     215      <input type="hidden" name="product_id" value="<!--{$id|escape}-->" /> 
     216      <input type="hidden" name="product_class_id<!--{$id|escape}-->" id="product_class_id<!--{$id|escape}-->" value="<!--{$tpl_product_class_id[$id]}-->" /> 
     217      <input type="hidden" name="product_type" id="product_type<!--{$id|escape}-->" value="<!--{$tpl_product_type[$id]}-->" /> 
    209218    </td> 
    210     <td class="center"><a href="" onclick="return func_submit('<!--{$arrProducts[cnt].product_id}-->', '<!--{$tpl_class_name1[$id]}-->', '<!--{$tpl_class_name2[$id]}-->')">決定</a></td> 
     219    <td class="center"><a href="javascript:;" onclick="return func_submit('<!--{$arrProducts[cnt].product_id}-->', '<!--{$tpl_class_name1[$id]}-->', '<!--{$tpl_class_name2[$id]}-->', '<!--{$tpl_product_class_id[$id]}-->')">決定</a></td> 
    211220  </tr> 
    212221  <!--▲商品<!--{$smarty.section.cnt.iteration}-->--> 
     222</form> 
    213223  <!--{sectionelse}--> 
    214224  <tr> 
     
    220230<!--▲検索結果表示--> 
    221231 
    222 </form> 
    223232 
    224233<!--{include file="`$smarty.const.TEMPLATE_ADMIN_DIR`admin_popup_footer.tpl"}--> 
Note: See TracChangeset for help on using the changeset viewer.