Changeset 18257


Ignore:
Timestamp:
2009/08/06 05:12:33 (15 years ago)
Author:
Seasoft
Message:

商品一覧の改訂

Location:
branches/comu-ver2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/Smarty/templates/default/list.tpl

    r18254 r18257  
    2222<script type="text/javascript">//<![CDATA[ 
    2323// セレクトボックスに項目を割り当てる。 
    24 function lnSetSelect(name1, name2, id, val) { 
    25     sele1 = document.form1[name1]; 
    26     sele2 = document.form1[name2]; 
     24function fnSetSelect(form, val) { 
     25    sele1 = form['classcategory_id1']; 
     26    sele2 = form['classcategory_id2']; 
     27    id = form['product_id'].value; 
    2728    lists = eval('lists' + id); 
    2829    vals = eval('vals' + id); 
     
    4748    } 
    4849} 
     50// 並び順を変更 
     51function fnChangeOrderby(orderby) { 
     52    fnSetVal('orderby', orderby); 
     53    fnSetVal('pageno', 1); 
     54    fnSubmit(); 
     55} 
     56// カゴに入れる 
     57function fnInCart(productForm) { 
     58    var product_id = productForm["product_id"].value; 
     59    fnChangeAction("?#product" + product_id); 
     60    if (productForm["classcategory_id1"]) { 
     61        fnSetVal("classcategory_id1", productForm["classcategory_id1"].value); 
     62    } 
     63    if (productForm["classcategory_id2"]) { 
     64        fnSetVal("classcategory_id2", productForm["classcategory_id2"].value); 
     65    } 
     66    fnSetVal("quantity", productForm["quantity"].value); 
     67    fnSetVal("product_id", productForm["product_id"].value); 
     68    fnSubmit(); 
     69} 
    4970//]]> 
    5071</script> 
     
    5980        <input type="hidden" name="name" value="<!--{$arrSearchData.name|escape}-->" /> 
    6081        <!--{* ▲検索条件 *}--> 
     82        <!--{* ▼ページナビ関連 *}--> 
    6183        <input type="hidden" name="orderby" value="<!--{$orderby|escape}-->" /> 
    6284        <input type="hidden" name="disp_number" value="<!--{$disp_number|escape}-->" /> 
    6385        <input type="hidden" name="pageno" value="<!--{$tpl_pageno|escape}-->" /> 
     86        <!--{* ▲ページナビ関連 *}--> 
     87        <!--{* ▼注文関連 *}--> 
    6488        <input type="hidden" name="product_id" value="" /> 
    65          
    66         <!--★タイトル★--> 
    67         <h2 class="title"><!--{$tpl_subtitle|escape}--></h2> 
    68          
    69         <!--▼検索条件--> 
    70         <!--{if $tpl_subtitle == "検索結果"}--> 
    71             <ul class="pagecondarea"> 
    72                 <li><strong>商品カテゴリ:</strong><!--{$arrSearch.category|escape}--></li> 
    73                 <!--{if $arrSearch.maker|strlen >= 1}--><li><strong>メーカー:</strong><!--{$arrSearch.maker|escape}--></li><!--{/if}--> 
    74                 <li><strong>商品名:</strong><!--{$arrSearch.name|escape}--></li> 
    75             </ul> 
    76         <!--{/if}--> 
    77         <!--▲検索条件--> 
    78  
    79         <!--▼件数--> 
     89        <input type="hidden" name="classcategory_id1" value="" /> 
     90        <input type="hidden" name="classcategory_id2" value="" /> 
     91        <input type="hidden" name="quantity" value="" /> 
     92        <!--{* ▲注文関連 *}--> 
     93    </form> 
     94     
     95    <!--★タイトル★--> 
     96    <h2 class="title"><!--{$tpl_subtitle|escape}--></h2> 
     97     
     98    <!--▼検索条件--> 
     99    <!--{if $tpl_subtitle == "検索結果"}--> 
     100        <ul class="pagecondarea"> 
     101            <li><strong>商品カテゴリ:</strong><!--{$arrSearch.category|escape}--></li> 
     102            <!--{if $arrSearch.maker|strlen >= 1}--><li><strong>メーカー:</strong><!--{$arrSearch.maker|escape}--></li><!--{/if}--> 
     103            <li><strong>商品名:</strong><!--{$arrSearch.name|escape}--></li> 
     104        </ul> 
     105    <!--{/if}--> 
     106    <!--▲検索条件--> 
     107 
     108    <!--▼ページナビ(上部)--> 
     109    <form name="page_navi_top" id="page_navi_top" action="?"> 
    80110        <!--{if $tpl_linemax > 0}--> 
    81111            <ul class="pagenumberarea"> 
    82112                <li class="left"><span class="pagenumber"><!--{$tpl_linemax}--></span>件の商品がございます。</li> 
    83113                <li class="center"><!--{$tpl_strnavi}--></li> 
    84                 <li class="right"><!--{if $orderby != 'price'}--> 
    85                     <a href="javascript:fnModeSubmit('', 'orderby', 'price')">価格順</a> 
    86                 <!--{else}--> 
    87                     <strong>価格順</strong> 
    88                 <!--{/if}-->&nbsp; 
    89                 <!--{if $orderby != "date"}--> 
    90                     <a href="javascript:fnModeSubmit('', 'orderby', 'date')">新着順</a> 
    91                 <!--{else}--> 
    92                     <strong>新着順</strong> 
    93                 <!--{/if}--> 
    94                   表示件数 
    95                     <select name="disp_number_top" onchange="javascript:fnModeSubmit('','disp_number',this.value);"> 
    96                 <!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}--> 
    97                     <!--{if $num == $disp_number}--> 
    98                     <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option> 
    99                     <!--{else}--> 
    100                     <option value="<!--{$num}-->" ><!--{$dispnum}--></option> 
    101                     <!--{/if}--> 
    102                 <!--{/foreach}--> 
     114                <li class="right"> 
     115                    <!--{if $orderby != 'price'}--> 
     116                        <a href="javascript:fnChangeOrderby('price');">価格順</a> 
     117                    <!--{else}--> 
     118                        <strong>価格順</strong> 
     119                    <!--{/if}-->&nbsp; 
     120                    <!--{if $orderby != "date"}--> 
     121                        <a href="javascript:fnChangeOrderby('date');">新着順</a> 
     122                    <!--{else}--> 
     123                        <strong>新着順</strong> 
     124                    <!--{/if}--> 
     125                    表示件数 
     126                    <select name="disp_number" onchange="javascript:fnModeSubmit('','disp_number',this.value);"> 
     127                        <!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}--> 
     128                            <!--{if $num == $disp_number}--> 
     129                                <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option> 
     130                            <!--{else}--> 
     131                                <option value="<!--{$num}-->" ><!--{$dispnum}--></option> 
     132                            <!--{/if}--> 
     133                        <!--{/foreach}--> 
    103134                    </select> 
    104135                </li> 
    105136            </ul> 
    106              
    107137        <!--{else}--> 
    108138            <!--{include file="frontparts/search_zero.tpl"}--> 
    109139        <!--{/if}--> 
    110         <!--▲件数--> 
    111  
    112         <!--{section name=cnt loop=$arrProducts}--> 
    113             <!--{assign var=id value=$arrProducts[cnt].product_id}--> 
    114             <!--▼商品--> 
    115             <div class="listarea"> 
    116                 <div class="listphoto"> 
    117                     <!--★画像★--> 
    118                     <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProducts[cnt].product_id}-->" class="over"><!--商品写真--><img src="<!--{$smarty.const.IMAGE_SAVE_URL|sfTrimURL}-->/<!--{$arrProducts[cnt].main_list_image|sfNoImageMainList|escape}-->" alt="<!--{$arrProducts[cnt].name|escape}-->" class="picture" /></a> 
    119                 </div> 
    120                  
    121                 <div class="listrightblock"> 
    122                     <!--アイコン--> 
    123                     <!--商品ステータス--> 
    124                     <!--{if count($arrProducts[cnt].product_flag) > 0}--> 
    125                         <ul class="status_icon"> 
    126                             <!--{section name=flg loop=$arrProducts[cnt].product_flag|count_characters}--> 
    127                                 <!--{if $arrProducts[cnt].product_flag[flg] == "1"}--> 
    128                                     <!--{assign var=key value="`$smarty.section.flg.iteration`"}--> 
    129                                     <li><img src="<!--{$TPL_DIR}--><!--{$arrSTATUS_IMAGE[$key]}-->" width="65" height="17" alt="<!--{$arrSTATUS[$key]}-->"/></li> 
    130                                     <!--{assign var=sts_cnt value=$sts_cnt+1}--> 
    131                                 <!--{/if}--> 
    132                             <!--{/section}--> 
    133                         </ul> 
    134                     <!--{/if}--> 
    135                     <!--商品ステータス--> 
    136                     <!--アイコン--> 
     140    </form> 
     141    <!--▲ページナビ(上部)--> 
     142 
     143    <!--{foreach from=$arrProducts item=arrProduct}--> 
     144        <!--{assign var=id value=$arrProduct.product_id}--> 
     145        <!--▼商品--> 
     146        <div class="listarea"> 
     147            <a name="product<!--{$id|escape}-->" /> 
     148            <div class="listphoto"> 
     149                <!--★画像★--> 
     150                <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->" class="over"><!--商品写真--><img src="<!--{$smarty.const.IMAGE_SAVE_URL|sfTrimURL}-->/<!--{$arrProduct.main_list_image|sfNoImageMainList|escape}-->" alt="<!--{$arrProduct.name|escape}-->" class="picture" /></a> 
     151            </div> 
     152             
     153            <div class="listrightblock"> 
     154                <!--アイコン--> 
     155                <!--商品ステータス--> 
     156                <!--{if count($arrProduct.product_flag) > 0}--> 
     157                    <ul class="status_icon"> 
     158                        <!--{section name=flg loop=$arrProduct.product_flag|count_characters}--> 
     159                            <!--{if $arrProduct.product_flag[flg] == "1"}--> 
     160                                <!--{assign var=key value="`$smarty.section.flg.iteration`"}--> 
     161                                <li><img src="<!--{$TPL_DIR}--><!--{$arrSTATUS_IMAGE[$key]}-->" width="65" height="17" alt="<!--{$arrSTATUS[$key]}-->"/></li> 
     162                                <!--{assign var=sts_cnt value=$sts_cnt+1}--> 
     163                            <!--{/if}--> 
     164                        <!--{/section}--> 
     165                    </ul> 
     166                <!--{/if}--> 
     167                <!--商品ステータス--> 
     168                <!--アイコン--> 
     169                 
     170                <!--★商品名★--> 
     171                <h3> 
     172                    <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->"><!--{$arrProduct.name|escape}--></a> 
     173                </h3> 
     174                 
     175                <!--★コメント★--> 
     176                <p class="listcomment"><!--{$arrProduct.main_list_comment|escape|nl2br}--></p> 
     177                 
     178                <p> 
     179                    <span class="pricebox sale_price"> 
     180                        <!--{$smarty.const.SALE_PRICE_TITLE}--><span class="mini">(税込)</span>: 
     181                        <span class="price"> 
     182                        <!--{if $arrProduct.price02_min == $arrProduct.price02_max}--> 
     183                            <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}--> 
     184                        <!--{else}--> 
     185                            <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->~<!--{$arrProduct.price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}--> 
     186                        <!--{/if}-->円</span> 
     187                    </span> 
    137188                     
    138                     <!--★商品名★--> 
    139                     <h3> 
    140                         <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProducts[cnt].product_id}-->"><!--{$arrProducts[cnt].name|escape}--></a> 
    141                     </h3> 
    142                      
    143                     <!--★コメント★--> 
    144                     <p class="listcomment"><!--{$arrProducts[cnt].main_list_comment|escape|nl2br}--></p> 
    145                      
    146                     <p> 
    147                         <span class="pricebox sale_price"> 
    148                             <!--{$smarty.const.SALE_PRICE_TITLE}--><span class="mini">(税込)</span>: 
    149                             <span class="price"> 
    150                             <!--{if $arrProducts[cnt].price02_min == $arrProducts[cnt].price02_max}--> 
    151                                 <!--{$arrProducts[cnt].price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}--> 
    152                             <!--{else}--> 
    153                                 <!--{$arrProducts[cnt].price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->~<!--{$arrProducts[cnt].price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}--> 
    154                             <!--{/if}-->円</span> 
    155                         </span> 
    156                          
    157                         <!--★詳細ボタン★--> 
    158                         <span class="btnbox"> 
    159                             <!--{assign var=name value="detail`$smarty.section.cnt.iteration`"}--> 
    160                             <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProducts[cnt].product_id}-->" onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_detail_on.gif','<!--{$name}-->');" onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_detail.gif','<!--{$name}-->');"> 
    161                                 <img src="<!--{$TPL_DIR}-->img/products/b_detail.gif" width="115" height="25" alt="詳しくはこちら" name="<!--{$name}-->" id="<!--{$name}-->" /></a> 
    162                         </span> 
    163                     </p> 
    164  
    165                     <!--{if $arrProducts[cnt].stock_max == 0 && $arrProducts[cnt].stock_unlimited_max != 1}--> 
    166                         <p class="soldout"><em>申し訳ございませんが、只今品切れ中です。</em></p> 
    167                     <!--{else}--> 
    168                         <!--▼買い物かご--> 
     189                    <!--★詳細ボタン★--> 
     190                    <span class="btnbox"> 
     191                        <!--{assign var=name value="detail`$id`"}--> 
     192                        <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->" onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_detail_on.gif','<!--{$name}-->');" onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_detail.gif','<!--{$name}-->');"> 
     193                            <img src="<!--{$TPL_DIR}-->img/products/b_detail.gif" width="115" height="25" alt="詳しくはこちら" name="<!--{$name}-->" id="<!--{$name}-->" /></a> 
     194                    </span> 
     195                </p> 
     196 
     197                <!--{if $arrProduct.stock_max == 0 && $arrProduct.stock_unlimited_max != 1}--> 
     198                    <p class="soldout"><em>申し訳ございませんが、只今品切れ中です。</em></p> 
     199                <!--{else}--> 
     200                    <!--▼買い物かご--> 
     201                    <form name="product_form<!--{$id|escape}-->" action="?"> 
     202                        <input type="hidden" name="product_id" value="<!--{$id|escape}-->" /> 
    169203                        <div class="in_cart"> 
    170                             <!--{assign var=class1 value=classcategory_id`$id`_1}--> 
    171                             <!--{assign var=class2 value=classcategory_id`$id`_2}--> 
    172204                            <dl> 
    173205                                <!--{if $tpl_classcat_find1[$id]}--> 
    174206                                    <dt><!--{$tpl_class_name1[$id]|escape}-->:</dt> 
    175207                                    <dd> 
    176                                         <select name="<!--{$class1}-->" style="<!--{$arrErr[$class1]|sfGetErrorColor}-->" onchange="lnSetSelect('<!--{$class1}-->', '<!--{$class2}-->', '<!--{$id}-->','');"> 
     208                                        <select name="classcategory_id1" style="<!--{$arrProduct.arrErr.classcategory_id1|sfGetErrorColor}-->" onchange="fnSetSelect(this.form);"> 
    177209                                        <option value="">選択してください</option> 
    178                                         <!--{html_options options=$arrClassCat1[$id] selected=$arrForm[$class1]}--> 
     210                                        <!--{html_options options=$arrClassCat1[$id] selected=$arrProduct.classcategory_id1}--> 
    179211                                        </select> 
    180                                         <!--{if $arrErr[$class1] != ""}--> 
     212                                        <!--{if $arrProduct.arrErr.classcategory_id1 != ""}--> 
    181213                                            <br /><span class="attention">※ <!--{$tpl_class_name1[$id]}-->を入力して下さい。</span> 
    182214                                        <!--{/if}--> 
     
    186218                                    <dt><!--{$tpl_class_name2[$id]|escape}-->:</dt> 
    187219                                    <dd> 
    188                                         <select name="<!--{$class2}-->" style="<!--{$arrErr[$class2]|sfGetErrorColor}-->"> 
     220                                        <select name="classcategory_id2" style="<!--{$arrProduct.arrErr.classcategory_id2|sfGetErrorColor}-->"> 
    189221                                        <option value="">選択してください</option> 
    190222                                        </select> 
    191                                         <!--{if $arrErr[$class2] != ""}--> 
     223                                        <!--{if $arrProduct.arrErr.classcategory_id2 != ""}--> 
    192224                                            <br /><span class="attention">※ <!--{$tpl_class_name2[$id]}-->を入力して下さい。</span> 
    193225                                        <!--{/if}--> 
     
    195227                                <!--{/if}--> 
    196228 
    197                                 <!--{assign var=quantity value=quantity`$id`}--> 
    198229                                <dt>数量:</dt> 
    199230                                <dd> 
    200                                     <input type="text" name="<!--{$quantity|escape}-->" size="3" class="box54" value="<!--{$arrForm[$quantity]|default:1|escape}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr[$quantity]|sfGetErrorColor}-->" /> 
    201                                     <!--{if $arrErr[$quantity] != ""}--> 
    202                                         <br /><span class="attention"><!--{$arrErr[$quantity]}--></span> 
     231                                    <input type="text" name="quantity" size="3" class="box54" value="<!--{$arrProduct.quantity|default:1|escape}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrProduct.arrErr.quantity|sfGetErrorColor}-->" /> 
     232                                    <!--{if $arrProduct.arrErr.quantity != ""}--> 
     233                                        <br /><span class="attention"><!--{$arrProduct.arrErr.quantity}--></span> 
    203234                                    <!--{/if}--> 
    204235                                </dd> 
    205236                            </dl> 
    206237                            <div class="cartbtn"> 
    207                                 <a 
    208                                     href="?" 
    209                                     onclick="fnChangeAction('?#product<!--{$id}-->'); fnModeSubmit('cart','product_id','<!--{$id}-->'); return false;" 
    210                                     onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif','cart<!--{$id}-->');" 
    211                                     onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif','cart<!--{$id}-->');" 
    212                                 > 
    213                                     <img src="<!--{$TPL_DIR}-->img/products/b_cartin.gif" width="115" height="25" alt="カゴに入れる" name="cart<!--{$id}-->" id="cart<!--{$id}-->" /></a> 
     238                                <input 
     239                                    type="image" 
     240                                    id="cart<!--{$id}-->" 
     241                                    src="<!--{$TPL_DIR}-->img/products/b_cartin.gif" 
     242                                    alt="カゴに入れる" 
     243                                    onclick="fnInCart(this.form); return false;" 
     244                                    onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif', this);" 
     245                                    onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif', this);" 
     246                                /> 
    214247                            </div> 
    215248                        </div> 
    216                         <!--▲買い物かご--> 
    217                     <!--{/if}--> 
    218                      
    219                 </div> 
     249                    </form> 
     250                    <!--▲買い物かご--> 
     251                <!--{/if}--> 
     252                 
    220253            </div> 
    221             <!--▲商品--> 
    222         <!--{/section}--> 
    223  
    224         <!--▼件数--> 
     254        </div> 
     255        <!--▲商品--> 
     256    <!--{/foreach}--> 
     257 
     258    <!--▼ページナビ(下部)--> 
     259    <form name="page_navi_bottom" id="page_navi_bottom" action="?"> 
    225260        <!--{if $tpl_linemax > 0}--> 
    226261            <ul class="pagenumberarea"> 
     
    229264                <li class="right"> 
    230265                    <!--{if $orderby != 'price'}--> 
    231                         <a href="javascript:fnModeSubmit('', 'orderby', 'price')">価格順</a> 
     266                        <a href="javascript:fnChangeOrderby('price');">価格順</a> 
    232267                    <!--{else}--> 
    233268                        <strong>価格順</strong> 
    234269                    <!--{/if}-->&nbsp; 
    235270                    <!--{if $orderby != "date"}--> 
    236                         <a href="javascript:fnModeSubmit('', 'orderby', 'date')">新着順</a> 
     271                        <a href="javascript:fnChangeOrderby('date');">新着順</a> 
    237272                    <!--{else}--> 
    238273                        <strong>新着順</strong> 
    239274                    <!--{/if}--> 
    240275                     表示件数 
    241                     <select name="disp_number_bottom" onchange="javascript:fnModeSubmit('','disp_number',this.value);"> 
    242                     <!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}--> 
    243                     <!--{if $num == $disp_number}--> 
    244                     <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option> 
    245                     <!--{else}--> 
    246                     <option value="<!--{$num}-->" ><!--{$dispnum}--></option> 
    247                     <!--{/if}--> 
    248                 <!--{/foreach}--> 
     276                    <select name="disp_number" onchange="javascript:fnModeSubmit('','disp_number',this.value);"> 
     277                        <!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}--> 
     278                            <!--{if $num == $disp_number}--> 
     279                                <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option> 
     280                            <!--{else}--> 
     281                                <option value="<!--{$num}-->" ><!--{$dispnum}--></option> 
     282                            <!--{/if}--> 
     283                        <!--{/foreach}--> 
    249284                    </select> 
    250285                </li> 
    251286            </ul> 
    252287        <!--{/if}--> 
    253         <!--▲件数--> 
    254288    </form> 
     289    <!--▲ページナビ(下部)--> 
    255290</div> 
    256291<!--▲CONTENTS--> 
  • branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php

    r18255 r18257  
    8383        $this->lfLoadParam(); 
    8484 
    85         $objView = new SC_SiteView($this->mode != 'cart'); 
     85        $objView = new SC_SiteView(!$this->inCart); 
    8686        $conn = new SC_DBConn(); 
    8787        $objDb = new SC_Helper_DB_Ex(); 
     
    130130        $layout->sfGetPageLayout($this, false, "products/list.php"); 
    131131 
    132         if ($this->mode == 'cart') { 
    133             // の正当性チェック 
     132        if ($this->inCart) { 
     133            // 商品IDの正当性チェック 
    134134            if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $this->arrForm['product_id'], "del_flg = 0 AND status = 1")) { 
    135135                SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 
    136136            } 
    137             // 入力値の変換 
    138             $this->arrErr = $this->lfCheckError($this->arrForm['product_id']); 
    139             if (count($this->arrErr) == 0) { 
    140                 $classcategory_id = "classcategory_id". $this->arrForm['product_id']; 
    141                 $classcategory_id1 = $this->arrForm[$classcategory_id. '_1']; 
    142                 $classcategory_id2 = $this->arrForm[$classcategory_id. '_2']; 
    143                 $quantity = "quantity". $this->arrForm['product_id']; 
     137            $product_id = $this->arrForm['product_id']; 
     138            // 入力内容のチェック 
     139            $arrErr = $this->lfCheckError($product_id); 
     140            if (count($arrErr) == 0) { 
     141                $classcategory_id1 = $this->arrForm['classcategory_id1']; 
     142                $classcategory_id2 = $this->arrForm['classcategory_id2']; 
    144143                // 規格1が設定されていない場合 
    145                 if (!$this->tpl_classcat_find1[$this->arrForm['product_id']]) { 
     144                if (!$this->tpl_classcat_find1[$product_id]) { 
    146145                    $classcategory_id1 = '0'; 
    147146                } 
    148147                // 規格2が設定されていない場合 
    149                 if (!$this->tpl_classcat_find2[$this->arrForm['product_id']]) { 
     148                if (!$this->tpl_classcat_find2[$product_id]) { 
    150149                    $classcategory_id2 = '0'; 
    151150                } 
    152151                $objCartSess = new SC_CartSession(); 
    153                 $objCartSess->addProduct(array($this->arrForm['product_id'], $classcategory_id1, $classcategory_id2), $this->arrForm[$quantity]); 
     152                $objCartSess->addProduct(array($product_id, $classcategory_id1, $classcategory_id2), $this->arrForm['quantity']); 
    154153                $this->sendRedirect($this->getLocation(URL_CART_TOP)); 
    155154                exit; 
     155            } 
     156            $this->tpl_onload .= "fnSetSelect(document.product_form{$product_id}, '{$this->arrForm['classcategory_id2']}');"; 
     157            foreach (array_keys($this->arrProducts) as $key) { 
     158                $arrProduct =& $this->arrProducts[$key]; 
     159                if ($arrProduct['product_id'] == $product_id) { 
     160                    $arrProduct['classcategory_id1'] = $this->arrForm['classcategory_id1']; 
     161                    $arrProduct['classcategory_id2'] = $this->arrForm['classcategory_id2']; 
     162                    $arrProduct['quantity'] = $this->arrForm['quantity']; 
     163                    $arrProduct['arrErr'] = $arrErr; 
     164                } 
    156165            } 
    157166        } 
     
    573582 
    574583        // 選択されている規格2ID 
    575         $classcategory_id = "classcategory_id". $product_id; 
    576  
    577         $classcategory_id_2 = $classcategory_id . "_2"; 
    578         if (!isset($classcategory_id_2)) $classcategory_id_2 = ""; 
    579         if (!isset($this->arrForm[$classcategory_id_2]) || !is_numeric($this->arrForm[$classcategory_id_2])) $this->arrForm[$classcategory_id_2] = ""; 
    580  
    581         $this->tpl_onload .= "lnSetSelect('" . $classcategory_id ."_1', " 
    582             . "'" . $classcategory_id_2 . "'," 
    583             . "'" . $product_id . "'," 
    584             . "'" . $this->arrForm[$classcategory_id_2] ."'); "; 
    585  
     584        if (!isset($this->arrForm['classcategory_id2']) || !is_numeric($this->arrForm['classcategory_id2'])) { 
     585            $this->arrForm['classcategory_id2'] = ''; 
     586        } 
     587         
    586588        // 規格1が設定されている 
    587589        if ($arrProductsClass[0]['classcategory_id1'] != '0') { 
     
    620622        $objErr = new SC_CheckError($this->arrForm); 
    621623 
    622         $classcategory_id1 = "classcategory_id". $id. "_1"; 
    623         $classcategory_id2 = "classcategory_id". $id. "_2"; 
    624         $quantity = "quantity". $id; 
    625624        // 複数項目チェック 
    626625        if ($this->tpl_classcat_find1[$id]) { 
    627             $objErr->doFunc(array("規格1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     626            $objErr->doFunc(array("規格1", 'classcategory_id1', INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    628627        } 
    629628        if ($this->tpl_classcat_find2[$id]) { 
    630             $objErr->doFunc(array("規格2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    631         } 
    632         $objErr->doFunc(array("数量", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     629            $objErr->doFunc(array("規格2", 'classcategory_id2', INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
     630        } 
     631        $objErr->doFunc(array("数量", 'quantity', INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 
    633632 
    634633        return $objErr->arrErr; 
     
    669668        } 
    670669        $this->tpl_pageno = $this->arrForm['pageno']; 
     670        $this->inCart = strlen($this->arrForm['product_id']) >= 1; 
    671671    } 
    672672} 
  • branches/comu-ver2/html/user_data/packages/default/js/site.js

    r16708 r18257  
    180180} 
    181181 
     182function fnSetVal(key, val) { 
     183    fnSetFormVal('form1', key, val); 
     184} 
     185 
    182186function fnSetFormVal(form, key, val) { 
    183187    document.forms[form][key].value = val; 
     
    200204    } 
    201205 
    202     function fnSubmit(){ 
     206function fnSubmit(){ 
    203207    document.form1.submit(); 
    204208} 
Note: See TracChangeset for help on using the changeset viewer.