{% extends 'default_frame.twig' %}
{% set body_class = 'preload' %}
{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/product-list.css', 'user_data') }}">
{% endblock %}
{% block javascript %}
<script>
eccube.productsClassCategories = {
{% for Product in pagination %}
"{{ Product.id|escape('js') }}": {{ class_categories_as_json(Product)|raw }}{% if loop.last == false %}, {% endif %}
{% endfor %}
};
$(function() {
// 表示件数を変更
$('.disp-number').change(function() {
var dispNumber = $(this).val();
$('#disp_number').val(dispNumber);
$('#pageno').val(1);
$("#form1").submit();
});
// 並び順を変更
$('.order-by').change(function() {
var orderBy = $(this).val();
$('#orderby').val(orderBy);
$('#pageno').val(1);
$("#form1").submit();
});
});
</script>
{% endblock %}
{% block main %}
<div class="common-bg">
{{ include('Block/pankuzu.twig') }}
<div class="content__wrapper">
<section class="product-list">
<div class="h__ttl">{{ 'Item list'|trans }}</div>
<h1 class="h__ttl02">{{ '商品一覧'|trans }}</h1>
{% if search_form.category_id.vars.errors|length > 0 %}
<div style="margin: 2rem; text-align: center;">
<p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
</div>
{% else %}
<form name="form1" id="form1" method="get" action="?">
{% for item in search_form %}
<input type="hidden" id="{{ item.vars.id }}"
name="{{ item.vars.full_name }}"
{% if item.vars.value is not empty %}value="{{ item.vars.value }}" {% endif %}/>
{% endfor %}
</form>
<div class="product-list__top">
{% if pagination.totalItemCount > 0 %}
{{ '<div class="product-list__top__txt">%count%件の商品が見つかりました</div>'|trans({ '%count%': pagination.totalItemCount })|raw }}
{% else %}
<div class="product-list__top__txt" style="margin: 2rem;">{{ 'お探しの商品は見つかりませんでした'|trans }}</div>
{% endif %}
{% if pagination.totalItemCount > 0 %}
<div class="product-list__select__wrap">
<div class="product-list__top__select">
<div class="form__input quantity quantity01">
{{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number'}}) }}
</div>
</div>
<div class="product-list__top__select">
<div class="form__input quantity quantity02">
{{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'order-by'}}) }}
</div>
</div>
</div>
{% endif %}
</div>
{% if pagination.totalItemCount > 0 %}
<ul class="product-list__info">
{% for Product in pagination %}
<li>
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<div class="product-list__info__img"><img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}></div>
<div class="product-list__info__name">{{ Product.name }}</div>
<div class="product-list__info__plice">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{{ Product.getPrice02IncTaxMin|price }}
{% else %}
{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
{% endif %}
{% else %}
{{ Product.getPrice02IncTaxMin|price }}
{% endif %}
(税込)
</div>
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
</section>
</div>
</div>
{% endblock %}