app/template/default/Block/search_product.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% form_theme form 'Form/form_div_layout.twig' %}
  9. {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  10. <script>
  11. $(function(){
  12.     $(".product_btn_search").click(function(){
  13.         var strCategoryIds = "";
  14.         if($("input[name*='searchChk']:checked").length == 1){
  15.             strCategoryIds = "?category_id=" + $("input[name*='searchChk']:checked").val();
  16.         }else{
  17.             if($("input[name*='searchChk']:checked").length > 1){
  18.                 $("input[name*='searchChk']:checked").each(function( index ) {
  19.                     if(strCategoryIds != ""){
  20.                         strCategoryIds += ",";
  21.                     }
  22.                     strCategoryIds += $(this).val();
  23.                 });
  24.                 strCategoryIds = "?categories=" + strCategoryIds;
  25.             }
  26.         }
  27.         window.location.href = "{{ url('product_list') }}" + strCategoryIds;
  28.     });
  29.     $(".product_btn_del").click(function(){
  30.         $("input[name*='searchChk']:checked").prop('checked', false);
  31.     });
  32. });
  33. </script>
  34. <form method="get" class="searchform" action="{{ path('product_list') }}">
  35.     <p class="_title01">キーワード</p>
  36.     <div class="ec-headerSearch__keyword">
  37.         <div class="ec-input">
  38.             {{ form_widget(form.name, {'id': null, 'attr': {'class': 'search-name'}} ) }}
  39.             <button class="ec-headerSearch__keywordBtn" type="submit"></button>
  40.         </div>
  41.     </div>
  42.     {% for Category in Categories %}
  43.         {% if Category.children|length > 0 %}
  44.             {% if Category.id == 19 %}
  45.                 <h3 class="product_form_title _icon02"><span>こだわり条件から探す</span></h3>
  46.                 <p class="_title02">商品ステータス</p>
  47.                 <select class="product_form_select" name="searchSelect{{ Category.id }}">
  48.                     {% for ChildCategory in Category.children %}
  49.                         <option value="{{ ChildCategory.id }}">{{ ChildCategory.name }}</option>
  50.                     {% endfor %}
  51.                 </select>
  52.             {% else %}
  53.                 <h3 class="product_form_title {% if Category.id == 17 %}_icon01{% endif %}">
  54.                     <span>{{ Category.name }}</span>
  55.                 </h3>
  56.                 <ul class="product_form_checkbox">
  57.                     {% for ChildCategory in Category.children %}
  58.                     <li>
  59.                         <label>
  60.                             <input type="checkbox" name="searchChk{{ Category.id }}" value="{{ ChildCategory.id }}">{{ ChildCategory.name }}
  61.                         </label>
  62.                     </li>
  63.                     {% endfor %}
  64.                 </ul>
  65.             {% endif %}
  66.         {% endif %}
  67.     {% endfor %}
  68.     <p class="_title02">サイズ</p>
  69.     <ul class="product_size_checkbox">
  70.         <li>
  71.             <input type="checkbox" id="size01">
  72.             <label for="size01">ソプラノ</label>
  73.         </li>
  74.         <li>
  75.             <input type="checkbox" id="size02">
  76.             <label for="size02">コンサート</label>
  77.         </li>
  78.         <li>
  79.             <input type="checkbox" id="size03">
  80.             <label for="size03">テナー</label>
  81.         </li>
  82.     </ul>
  83.     <p class="_title02">ボディタイプ</p>
  84.     <select class="product_form_select" id="body_type" name="">
  85.         <option value="0">レビュー順</option>
  86.         <option value="1">レビュー順</option>
  87.         <option value="2">レビュー順</option>
  88.     </select>
  89.     <p class="_title02 icon01">塗装</p>
  90.     <ul class="product_coating_checkbox">
  91.         <li>
  92.             <input type="checkbox" id="coating01">
  93.             <label for="coating01">艶なし(マット)</label>
  94.         </li>
  95.         <li>
  96.             <input type="checkbox" id="coating02">
  97.             <label for="coating02">艶あり(グロス)</label>
  98.         </li>
  99.     </ul>
  100.     <p class="_title02">ピックアップ</p>
  101.     <select class="product_form_select" id="pickup" name="">
  102.         <option value="0">レビュー順</option>
  103.         <option value="1">レビュー順</option>
  104.         <option value="2">レビュー順</option>
  105.     </select>
  106.     <p class="_title02">価格帯</p>
  107.     <div class="product_form_price">
  108.         <select class="product_form_select" id="pickup" name="">
  109.             <option value="0">レビュー順</option>
  110.             <option value="1">レビュー順</option>
  111.             <option value="2">レビュー順</option>
  112.         </select><span class="_yen">円</span><span class="_to">〜</span>
  113.         <select class="product_form_select" id="pickup" name="">
  114.             <option value="0">レビュー順</option>
  115.             <option value="1">レビュー順</option>
  116.             <option value="2">レビュー順</option>
  117.         </select><span class="_yen">円</span>
  118.     </div>
  119.     <p class="product_btn_search">この条件で絞り込む</p>
  120.     <p class="product_btn_del">リセット</p>
  121. </form>