Changeset 21940


Ignore:
Timestamp:
2012/06/26 11:42:48 (12 years ago)
Author:
pineray
Message:

#1879 検索のページングが動作しない

動作しないJavaScriptコードを削除.
カゴに入れるフォームは商品別のものを使用するように変更.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/Smarty/templates/default/products/list.tpl

    r21867 r21940  
    4444    // カゴに入れる 
    4545    function fnInCart(productForm) { 
    46         var product_id = productForm["product_id"].value; 
    47         fnChangeAction("?#product" + product_id); 
    48         if (productForm["classcategory_id1"]) { 
    49             fnSetVal("classcategory_id1", productForm["classcategory_id1"].value); 
    50         } 
    51         if (productForm["classcategory_id2"]) { 
    52             fnSetVal("classcategory_id2", productForm["classcategory_id2"].value); 
    53         } 
    54         fnSetVal("quantity", productForm["quantity"].value); 
    55         fnSetVal("product_id", productForm["product_id"].value); 
    56         fnSetVal("product_class_id", productForm["product_class_id"].value); 
    57         fnSubmit(); 
    58     } 
    59      
    60     $(function() { 
    61     var selector = $("div.navi").find("a"); 
    62         selector.each(function(){ 
    63             var fn = $(this).attr("onclick"); 
    64             var addfn = "function(){fnSetVal('product_id', '');}" + fn; 
    65             //alert(addfn); 
    66             $(this).attr("onclick", addfn); 
    67         }); 
    68     }); 
     46        var searchForm = $("#form1"); 
     47        var cartForm = $(productForm); 
     48        // 検索条件を引き継ぐ 
     49        var hiddenValues = ['mode','category_id','maker_id','name','orderby','disp_number','pageno','rnd']; 
     50        $.each(hiddenValues, function(){ 
     51            // 商品別のフォームに検索条件の値があれば上書き 
     52            if (cartForm.has('input[name='+this+']')) { 
     53                cartForm.find('input[name='+this+']').val(searchForm.find('input[name='+this+']').val()); 
     54            } 
     55            // なければ追加 
     56            else { 
     57                cartForm.append($("<input/>").attr("name", this).val(searchForm.find('input[name='+this+']').val())); 
     58            } 
     59        }); 
     60        // 商品別のフォームを送信 
     61        cartForm.submit(); 
     62    } 
    6963//]]></script> 
    7064 
Note: See TracChangeset for help on using the changeset viewer.