{#
This file is part of EC-CUBE
Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
http://www.ec-cube.co.jp/
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% form_theme form 'Form/form_div_layout.twig' %}
{% macro tree(Category, form) %}
{% from _self import tree %}
{% set category = attribute(Category, 'category') %}
{% set children = attribute(Category, 'children') %}
{% set selected = category.id == form.category_id.vars.value|number_format ? ' selected' : '' %}
<option value="{{ category.id }}"{{ selected }}>
{% for i in range(2, category.hierarchy) if category.hierarchy > 1 %} {% endfor %}{{ category.name }}
</option>
{% if children|length > 0 %}
{% for child in children %}
{{ tree(child, form) }}
{% endfor %}
{% endif %}
{% endmacro %}
{% from _self import tree %}
<div class="ec-headerSearch">
<form method="get" class="searchform" action="{{ path('product_list') }}">
<div class="ec-headerSearch__category">
<div class="ec-select ec-select_search">
{# form_widget(form.category_id, {'id': null, 'attr': {'class': 'category_id'}}) #}
<select name="category_id" class="category_id">
<option value="">全ての商品</option>
{% for Category in displayableCategories %}
{{ tree(Category, form) }}
{% endfor %}
</select>
</div>
</div>
<div class="ec-headerSearch__keyword">
<div class="ec-input">
{{ form_widget(form.name, {'id': null, 'attr': {'class': 'search-name', 'placeholder' : 'common.search_keyword' }} ) }}
<button class="ec-headerSearch__keywordBtn" type="submit">
<div class="ec-icon">
<img src="{{ asset('assets/icon/search-dark.svg') }}" alt="">
</div>
</button>
</div>
</div>
</form>
</div>