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

Open in your IDE?
  1. {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  2. {% block javascript %}
  3. <script>
  4. $(function() {
  5.     $('#type').change(function() {
  6.         var r = $('option:selected').val();
  7.         if(r == 0){
  8.             $('.search-poke').hide('fast');
  9.             $('.search-weis').show('fast');
  10.         }else{
  11.             $('.search-weis').hide('fast');
  12.             $('.search-poke').show('fast');
  13.         }
  14.     
  15.     })
  16.     //onload時にtypeの値を取得して表示
  17.     var r = $('#type option:selected').val();
  18.     if(r == 0){
  19.         $('.search-poke').hide();
  20.         $('.search-weis').show();
  21.     }else{
  22.         $('.search-weis').hide();
  23.         $('.search-poke').show();
  24.     }
  25. });
  26. </script>    
  27. {% endblock %}
  28. {% set catid = app.request.query.get('category_id') %}
  29. {% set name=app.request.query.get('name') %}
  30. {% set type=app.request.query.get('type') %}
  31. {% set category_id1=app.request.query.get('category_id1') %}
  32. {% set category_id2=app.request.query.get('category_id2') %}
  33. {% set category_id3=app.request.query.get('category_id3') %}
  34. {% set category_id4=app.request.query.get('category_id4') %}
  35. {% set category_id5=app.request.query.get('category_id5') %}
  36. {% set tag_id=app.request.query.get('tag_id') %}
  37. {% if catid ==  217 or catid ==  218 or catid ==  219  %}
  38.     <div class="wback searchbox">
  39.         <h2 class="maru">商品検索</h2>
  40.         <form method="get" action="/products/list">
  41.             <input type="hidden" name="category_id" id="category_id" value="217">
  42.             <input type="search" name="name" maxlength="50" class="search-name" placeholder="キーワードを入力" value="{{ name }}"><Br>
  43.             {# dump(Category_p) #}
  44.             <p>検索するカード</p>
  45.             <select name="type" id="type">
  46.                 {# type一致でselectedする #}
  47.                 <option value="0" {% if type == 0 %}selected{% endif %}>ヴァイスシュヴァルツ</option>
  48.                 <option value="1" {% if type == 1 %}selected{% endif %}>ポケモン</option>
  49.             </select>
  50.             
  51.             <div class="search-weis">
  52.             <p>タイトル</p>
  53.             <select name="category_id2">
  54.                 {# category_id2一致でselected 0はヴァイスシュヴァルツから検索 #}
  55.                 <option value="">ヴァイスシュヴァルツから検索</option>
  56.                 {% for Category in Categories %}
  57.                     {% if Category == "買い取り" %}
  58.                         {% for ChildCategory in Category.children %}
  59.                             {% if ChildCategory == "ヴァイスシュヴァルツ" %}
  60.                                 {% for MagoCategory in ChildCategory.children %}
  61.                                     {% if MagoCategory == "シュヴァルツサイド" or MagoCategory == "ヴァイスサイド"%}
  62.                                         {% for HimagoCategory in MagoCategory.children %}
  63.                                             <option value="{{ HimagoCategory.id }}" {% if category_id2 == HimagoCategory.id %}selected
  64.                                             {% endif %}>{{ HimagoCategory }}</option>
  65.                                         {% endfor %}
  66.                                     {% endif %}
  67.                                 {% endfor %}
  68.                             {% endif %}
  69.                         {% endfor %}
  70.                     {% endif %}
  71.                 {% endfor %}
  72.             </select><br>
  73.             
  74.             <p>レアリティ</p>
  75.             <select name="category_id3">
  76.                 {# category_id3一致でselected 0はレアリティを選択 #}
  77.                 <option value="">レアリティを選択</option>
  78.                 {% for Category in Categories %}
  79.                     {% if Category == "買い取り" %}
  80.                         {% for ChildCategory in Category.children %}
  81.                             {% if ChildCategory == "ヴァイスシュヴァルツ" %}
  82.                                 {% for MagoCategory in ChildCategory.children %}
  83.                                     {% if MagoCategory != "シュヴァルツサイド" and MagoCategory != "ヴァイスサイド" and MagoCategory != "新商品" and MagoCategory != "ヴァイスシュヴァルツおすすめ" %}
  84.                                         <option value="{{ MagoCategory.id }}" {% if category_id3 == MagoCategory.id %}selected
  85.                                         {% endif %}>{{ MagoCategory }}</option>
  86.                                     {% endif %}
  87.                                 {% endfor %}
  88.                             {% endif %}
  89.                         {% endfor %}
  90.                     {% endif %}
  91.                 {% endfor %}
  92.             </select><br>
  93.             </div>
  94.             <div class="search-poke">
  95.             <p>タイトル</p>
  96.             <select name="category_id4">
  97.                 {# category_id4一致でselected 0はポケモンから選択 #}
  98.                 <option value="">ポケモンから選択</option>
  99.                 {% for Category in Categories %}
  100.                     {% if Category == "買い取り" %}
  101.                         {% for ChildCategory in Category.children %}
  102.                             {% if ChildCategory == "ポケモン" %}
  103.                                 {% for MagoCategory in ChildCategory.children %}
  104.                                     {% if MagoCategory != "レアリティ" %}
  105.                                         <option value="{{ MagoCategory.id }}" {% if category_id4 == MagoCategory.id %}selected
  106.                                         {% endif %}>{{ MagoCategory }}</option>
  107.                                     {% endif %}
  108.                                 {% endfor %}
  109.                             {% endif %}
  110.                         {% endfor %}
  111.                     {% endif %}
  112.                 {% endfor %}
  113.             </select><br>
  114.             
  115.             <p>レアリティ</p>
  116.             <select name="category_id5">
  117.                 {# category_id5一致でselected 0はレアリティを選択 #}
  118.                 <option value="">レアリティを選択</option>
  119.                 {% for Category in Categories %}
  120.                     {% if Category == "買い取り" %}
  121.                         {% for ChildCategory in Category.children %}
  122.                             {% if ChildCategory == "ポケモン" %}
  123.                                 {% for MagoCategory in ChildCategory.children %}
  124.                                     {% if MagoCategory == "レアリティ"%}
  125.                                         {% for HimagoCategory in MagoCategory.children %}
  126.                                             <option value="{{ HimagoCategory.id }}" {% if category_id5 == HimagoCategory.id %}selected
  127.                                             {% endif %}>{{ HimagoCategory }}</option>
  128.                                         {% endfor %}
  129.                                     {% endif %}
  130.                                 {% endfor %}
  131.                             {% endif %}
  132.                         {% endfor %}
  133.                     {% endif %}
  134.                 {% endfor %}
  135.             </select><br>
  136.             </div>
  137.     
  138.             <button type="submit" class="search-sub">
  139.                     <img src="/html/user_data/assets/img/searchbtn.png" alt="">
  140.             </button>
  141.     
  142.     
  143.         </form>
  144.     </div>
  145. {% else %}
  146.     <div class="wback searchbox">
  147.         <h2 class="maru">商品検索</h2>
  148.         <form method="get" action="/products/list">
  149.     
  150.             <input type="hidden" name="category_id" id="category_id" value="428">
  151.             <input type="search" name="name" maxlength="50" class="search-name" placeholder="キーワードを入力" value="{{ name }}"><Br>
  152.             <p>検索するカード</p>
  153.             <select name="type" id="type">
  154.                 {# type一致でselectedする #}
  155.                 <option value="0" {% if type == 0 %}selected{% endif %}>ヴァイスシュヴァルツ</option>
  156.                 <option value="1" {% if type == 1 %}selected{% endif %}>ポケモン</option>
  157.             </select>
  158.             
  159.             <div class="search-weis">
  160.             <p>タイトル</p>
  161.             <select name="category_id2">
  162.                 <option value="">ヴァイスシュヴァルツから検索</option>
  163.                 {% for Category in Categories %}
  164.                     {% if Category == "販売" %}
  165.                         {% for ChildCategory in Category.children %}
  166.                            
  167.                             {% if ChildCategory == "ヴァイスシュヴァルツ" %}
  168.                                 {% for MagoCategory in ChildCategory.children %}
  169.                                     {% if MagoCategory == "シュヴァルツサイド" or MagoCategory == "ヴァイスサイド"%}
  170.                                         {% for HimagoCategory in MagoCategory.children %}
  171.                                             <option value="{{ HimagoCategory.id }}" {% if category_id2 == HimagoCategory.id %}selected{% endif %}>{{ HimagoCategory }}</option>
  172.                                         {% endfor %}
  173.                                     {% endif %}
  174.                                 {% endfor %}
  175.                             {% endif %}
  176.                         {% endfor %}
  177.                     {% endif %}
  178.                 {% endfor %}
  179.             </select><br>
  180.             
  181.             <p>レアリティ</p>
  182.             <select name="category_id3">
  183.                 <option value="">レアリティを選択</option>
  184.                 {% for Category in Categories %}
  185.                     {% if Category == "販売" %}
  186.                         {% for ChildCategory in Category.children %}
  187.                            
  188.                             {% if ChildCategory == "ヴァイスシュヴァルツ" %}
  189.                                 {% for MagoCategory in ChildCategory.children %}
  190.                                     {% if MagoCategory != "シュヴァルツサイド" and MagoCategory != "ヴァイスサイド" and MagoCategory != "新商品" and MagoCategory != "ヴァイスシュヴァルツおすすめ" %}
  191.                                         <option value="{{ MagoCategory.id }}" {% if category_id3 == MagoCategory.id %}selected{% endif %}>{{ MagoCategory }}</option>
  192.     
  193.                                     {% endif %}
  194.                                 {% endfor %}
  195.                             {% endif %}
  196.                         {% endfor %}
  197.                     {% endif %}
  198.                 {% endfor %}
  199.             </select><br>
  200.             </div>
  201.             <div class="search-poke">
  202.             <p>タイトル</p>
  203.             <select name="category_id4">
  204.                 <option value="">ポケモンから選択</option>
  205.                 {% for Category in Categories %}
  206.                     {% if Category == "販売" %}
  207.                         {% for ChildCategory in Category.children %}
  208.                             {% if ChildCategory == "ポケモン" %}
  209.                                 {% for MagoCategory in ChildCategory.children %}
  210.                                     {% if MagoCategory != "レアリティ" %}
  211.                                         <option value="{{ MagoCategory.id }}" {% if category_id4 == MagoCategory.id %}selected{% endif %}>{{ MagoCategory }}</option>
  212.                                     {% endif %}
  213.                                 {% endfor %}
  214.                             {% endif %}
  215.                         {% endfor %}
  216.                     {% endif %}
  217.                 {% endfor %}
  218.             </select><br>
  219.             
  220.             <p>レアリティ</p>
  221.             <select name="category_id5">
  222.                 <option value="">レアリティを選択</option>
  223.                 {% for Category in Categories %}
  224.                     {% if Category == "販売" %}
  225.                         {% for ChildCategory in Category.children %}
  226.                            
  227.                             {% if ChildCategory == "ポケモン" %}
  228.                                 {% for MagoCategory in ChildCategory.children %}
  229.                                     {% if MagoCategory == "レアリティ"%}
  230.                                         {% for HimagoCategory in MagoCategory.children %}
  231.                                             <option value="{{ HimagoCategory.id }}" {% if category_id5 == HimagoCategory.id %}selected{% endif %}>{{ HimagoCategory }}</option>
  232.                                         {% endfor %}
  233.                                     {% endif %}
  234.                                 {% endfor %}
  235.                             {% endif %}
  236.                         {% endfor %}
  237.                     {% endif %}
  238.                 {% endfor %}
  239.             </select><br>
  240.             </div>
  241.             {# tag_idがあればselected #}
  242.             {% if tag_id == 4 %}
  243.                 <input type="checkbox" id="tag_id" name="tag_id" value="4" checked/><label for="horns">この商品の傷有り商品を見る</label><Br>
  244.             {% else %}
  245.                 <input type="checkbox" id="tag_id" name="tag_id" value="4"/><label for="horns">この商品の傷有り商品を見る</label><Br>
  246.             {% endif %}
  247.     
  248.             <button type="submit" class="search-sub">
  249.                     <img src="/html/user_data/assets/img/searchbtn.png" alt="">
  250.             </button>
  251.     
  252.     
  253.         </form>
  254.     </div>
  255. {% endif %}