src/Eccube/Resource/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. {% macro tree(Category, form) %}
  10.     {% from _self import tree %}
  11.     {% set category = attribute(Category, 'category') %}
  12.     {% set children = attribute(Category, 'children') %}
  13.     {% set selected = category.id == form.category_id.vars.value|number_format ? ' selected' : '' %}
  14.     <option value="{{ category.id }}"{{ selected }}>
  15.         {% for i in range(2, category.hierarchy) if category.hierarchy > 1 %} {% endfor %}{{ category.name }}
  16.     </option>
  17.     {% if children|length > 0 %}
  18.         {% for child in children %}
  19.             {{ tree(child, form) }}
  20.         {% endfor %}
  21.     {% endif %}
  22. {% endmacro %}
  23. {% from _self import tree %}
  24. <div class="ec-headerSearch">
  25.     <form method="get" class="searchform" action="{{ path('product_list') }}">
  26.         <div class="ec-headerSearch__category">
  27.             <div class="ec-select ec-select_search">
  28.                 {# form_widget(form.category_id, {'id': null, 'attr': {'class': 'category_id'}}) #}
  29.                 <select name="category_id" class="category_id">
  30.                     <option value="">全ての商品</option>
  31.                     {% for Category in displayableCategories %}
  32.                         {{ tree(Category, form) }}
  33.                     {% endfor %}
  34.                 </select>
  35.             </div>
  36.         </div>
  37.         <div class="ec-headerSearch__keyword">
  38.             <div class="ec-input">
  39.                 {{ form_widget(form.name, {'id': null, 'attr': {'class': 'search-name', 'placeholder' : 'common.search_keyword' }} ) }}
  40.                 <button class="ec-headerSearch__keywordBtn" type="submit">
  41.                     <div class="ec-icon">
  42.                         <img src="{{ asset('assets/icon/search-dark.svg') }}" alt="">
  43.                     </div>
  44.                 </button>
  45.             </div>
  46.         </div>
  47.     </form>
  48. </div>