{% set Categories = repository('Eccube\\Entity\\Category').getList() %}
{% block javascript %}
<script>
$(function() {
$('#type').change(function() {
var r = $('option:selected').val();
if(r == 0){
$('.search-poke').hide('fast');
$('.search-weis').show('fast');
}else{
$('.search-weis').hide('fast');
$('.search-poke').show('fast');
}
})
//onload時にtypeの値を取得して表示
var r = $('#type option:selected').val();
if(r == 0){
$('.search-poke').hide();
$('.search-weis').show();
}else{
$('.search-weis').hide();
$('.search-poke').show();
}
});
</script>
{% endblock %}
{% set catid = app.request.query.get('category_id') %}
{% set name=app.request.query.get('name') %}
{% set type=app.request.query.get('type') %}
{% set category_id1=app.request.query.get('category_id1') %}
{% set category_id2=app.request.query.get('category_id2') %}
{% set category_id3=app.request.query.get('category_id3') %}
{% set category_id4=app.request.query.get('category_id4') %}
{% set category_id5=app.request.query.get('category_id5') %}
{% set tag_id=app.request.query.get('tag_id') %}
{% if catid == 217 or catid == 218 or catid == 219 %}
<div class="wback searchbox">
<h2 class="maru">商品検索</h2>
<form method="get" action="/products/list">
<input type="hidden" name="category_id" id="category_id" value="217">
<input type="search" name="name" maxlength="50" class="search-name" placeholder="キーワードを入力" value="{{ name }}"><Br>
{# dump(Category_p) #}
<p>検索するカード</p>
<select name="type" id="type">
{# type一致でselectedする #}
<option value="0" {% if type == 0 %}selected{% endif %}>ヴァイスシュヴァルツ</option>
<option value="1" {% if type == 1 %}selected{% endif %}>ポケモン</option>
</select>
<div class="search-weis">
<p>タイトル</p>
<select name="category_id2">
{# category_id2一致でselected 0はヴァイスシュヴァルツから検索 #}
<option value="">ヴァイスシュヴァルツから検索</option>
{% for Category in Categories %}
{% if Category == "買い取り" %}
{% for ChildCategory in Category.children %}
{% if ChildCategory == "ヴァイスシュヴァルツ" %}
{% for MagoCategory in ChildCategory.children %}
{% if MagoCategory == "シュヴァルツサイド" or MagoCategory == "ヴァイスサイド"%}
{% for HimagoCategory in MagoCategory.children %}
<option value="{{ HimagoCategory.id }}" {% if category_id2 == HimagoCategory.id %}selected
{% endif %}>{{ HimagoCategory }}</option>
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</select><br>
<p>レアリティ</p>
<select name="category_id3">
{# category_id3一致でselected 0はレアリティを選択 #}
<option value="">レアリティを選択</option>
{% for Category in Categories %}
{% if Category == "買い取り" %}
{% for ChildCategory in Category.children %}
{% if ChildCategory == "ヴァイスシュヴァルツ" %}
{% for MagoCategory in ChildCategory.children %}
{% if MagoCategory != "シュヴァルツサイド" and MagoCategory != "ヴァイスサイド" and MagoCategory != "新商品" and MagoCategory != "ヴァイスシュヴァルツおすすめ" %}
<option value="{{ MagoCategory.id }}" {% if category_id3 == MagoCategory.id %}selected
{% endif %}>{{ MagoCategory }}</option>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</select><br>
</div>
<div class="search-poke">
<p>タイトル</p>
<select name="category_id4">
{# category_id4一致でselected 0はポケモンから選択 #}
<option value="">ポケモンから選択</option>
{% for Category in Categories %}
{% if Category == "買い取り" %}
{% for ChildCategory in Category.children %}
{% if ChildCategory == "ポケモン" %}
{% for MagoCategory in ChildCategory.children %}
{% if MagoCategory != "レアリティ" %}
<option value="{{ MagoCategory.id }}" {% if category_id4 == MagoCategory.id %}selected
{% endif %}>{{ MagoCategory }}</option>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</select><br>
<p>レアリティ</p>
<select name="category_id5">
{# category_id5一致でselected 0はレアリティを選択 #}
<option value="">レアリティを選択</option>
{% for Category in Categories %}
{% if Category == "買い取り" %}
{% for ChildCategory in Category.children %}
{% if ChildCategory == "ポケモン" %}
{% for MagoCategory in ChildCategory.children %}
{% if MagoCategory == "レアリティ"%}
{% for HimagoCategory in MagoCategory.children %}
<option value="{{ HimagoCategory.id }}" {% if category_id5 == HimagoCategory.id %}selected
{% endif %}>{{ HimagoCategory }}</option>
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</select><br>
</div>
<button type="submit" class="search-sub">
<img src="/html/user_data/assets/img/searchbtn.png" alt="">
</button>
</form>
</div>
{% else %}
<div class="wback searchbox">
<h2 class="maru">商品検索</h2>
<form method="get" action="/products/list">
<input type="hidden" name="category_id" id="category_id" value="428">
<input type="search" name="name" maxlength="50" class="search-name" placeholder="キーワードを入力" value="{{ name }}"><Br>
<p>検索するカード</p>
<select name="type" id="type">
{# type一致でselectedする #}
<option value="0" {% if type == 0 %}selected{% endif %}>ヴァイスシュヴァルツ</option>
<option value="1" {% if type == 1 %}selected{% endif %}>ポケモン</option>
</select>
<div class="search-weis">
<p>タイトル</p>
<select name="category_id2">
<option value="">ヴァイスシュヴァルツから検索</option>
{% for Category in Categories %}
{% if Category == "販売" %}
{% for ChildCategory in Category.children %}
{% if ChildCategory == "ヴァイスシュヴァルツ" %}
{% for MagoCategory in ChildCategory.children %}
{% if MagoCategory == "シュヴァルツサイド" or MagoCategory == "ヴァイスサイド"%}
{% for HimagoCategory in MagoCategory.children %}
<option value="{{ HimagoCategory.id }}" {% if category_id2 == HimagoCategory.id %}selected{% endif %}>{{ HimagoCategory }}</option>
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</select><br>
<p>レアリティ</p>
<select name="category_id3">
<option value="">レアリティを選択</option>
{% for Category in Categories %}
{% if Category == "販売" %}
{% for ChildCategory in Category.children %}
{% if ChildCategory == "ヴァイスシュヴァルツ" %}
{% for MagoCategory in ChildCategory.children %}
{% if MagoCategory != "シュヴァルツサイド" and MagoCategory != "ヴァイスサイド" and MagoCategory != "新商品" and MagoCategory != "ヴァイスシュヴァルツおすすめ" %}
<option value="{{ MagoCategory.id }}" {% if category_id3 == MagoCategory.id %}selected{% endif %}>{{ MagoCategory }}</option>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</select><br>
</div>
<div class="search-poke">
<p>タイトル</p>
<select name="category_id4">
<option value="">ポケモンから選択</option>
{% for Category in Categories %}
{% if Category == "販売" %}
{% for ChildCategory in Category.children %}
{% if ChildCategory == "ポケモン" %}
{% for MagoCategory in ChildCategory.children %}
{% if MagoCategory != "レアリティ" %}
<option value="{{ MagoCategory.id }}" {% if category_id4 == MagoCategory.id %}selected{% endif %}>{{ MagoCategory }}</option>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</select><br>
<p>レアリティ</p>
<select name="category_id5">
<option value="">レアリティを選択</option>
{% for Category in Categories %}
{% if Category == "販売" %}
{% for ChildCategory in Category.children %}
{% if ChildCategory == "ポケモン" %}
{% for MagoCategory in ChildCategory.children %}
{% if MagoCategory == "レアリティ"%}
{% for HimagoCategory in MagoCategory.children %}
<option value="{{ HimagoCategory.id }}" {% if category_id5 == HimagoCategory.id %}selected{% endif %}>{{ HimagoCategory }}</option>
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
</select><br>
</div>
{# tag_idがあればselected #}
{% if tag_id == 4 %}
<input type="checkbox" id="tag_id" name="tag_id" value="4" checked/><label for="horns">この商品の傷有り商品を見る</label><Br>
{% else %}
<input type="checkbox" id="tag_id" name="tag_id" value="4"/><label for="horns">この商品の傷有り商品を見る</label><Br>
{% endif %}
<button type="submit" class="search-sub">
<img src="/html/user_data/assets/img/searchbtn.png" alt="">
</button>
</form>
</div>
{% endif %}