{#
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.
#}
{% extends 'default_frame.twig' %}
{% set body_class = 'product_page' %}
{% set main_class = 'l-main l-main--products' %}
{% 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();
});
$('.add-cart').on('click', function(e) {
var $form = $(this).parents('li').find('form');
// 個数フォームのチェック
var $quantity = $form.parent().find('.quantity');
if ($quantity.val() < 1) {
$quantity[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
setTimeout(function() {
loadingOverlay('hide');
}, 100);
return true;
} else {
$quantity[0].setCustomValidity('');
}
e.preventDefault();
$.ajax({
url: $form.attr('action'),
type: $form.attr('method'),
data: $form.serialize(),
dataType: 'json',
beforeSend: function(xhr, settings) {
// Buttonを無効にする
$('.add-cart').prop('disabled', true);
}
}).done(function(data) {
// レスポンス内のメッセージをalertで表示
$.each(data.messages, function() {
$('#ec-modal-header').html(this);
});
$('.ec-modal').show()
// カートブロックを更新する
$.ajax({
url: '{{ url('block_cart') }}',
type: 'GET',
dataType: 'html'
}).done(function(html) {
$('.ec-headerRole__cart').html(html);
});
}).fail(function(data) {
alert('{{ 'カートへの追加に失敗しました。'|trans }}');
}).always(function(data) {
// Buttonを有効にする
$('.add-cart').prop('disabled', false);
});
});
});
$('.ec-modal-wrap').on('click', function(e) {
// モーダル内の処理は外側にバブリングさせない
e.stopPropagation();
});
$('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function() {
$('.ec-modal').hide()
});
</script>
{% endblock %}
{% block main %}
<div class="l-page-heading">
<ul class="c-breadcrumb">
<li class="c-breadcrumb__item"><a href="{{ url('homepage') }}" class="c-breadcrumb__link c-btn-txt">TOP</a></li>
<li class="c-breadcrumb__item"><span class="c-breadcrumb__txt">商品リスト</span></li>
</ul>
<h1 class="l-page-heading__ttl">
<span class="l-page-heading__ttl-jp">商品リスト</span>
<span class="l-page-heading__ttl-en">PRODUCTS</span>
</h1>
</div>
{% if search_form.category_id.vars.errors|length > 0 %}
<div class="ec-searchnavRole">
<p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
</div>
{% else %}
<div class="ec-searchnavRole">
<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>
{% if Category is null or Category is not null and Category.id != '11' %}
<ul class="p-products-cat">
<li class="p-products-cat__item{% if Category is null %} current{% endif %}">
<a href="{{ url('product_list') }}" class="p-products-cat__link">
<span class="p-products-cat__large">すべて</span>
<span class="p-products-cat__small">(ALL)</span>
</a>
</li>
<li class="p-products-cat__item{% if Category is not null and Category.id == '8' %} current{% endif %}">
<a href="{{ url('product_list') }}?category_id=8" class="p-products-cat__link">
<span class="p-products-cat__large">MUYU-SEN Nature.</span>
<span class="p-products-cat__small">(むゆうせんナチュレ)</span>
</a>
</li>
<li class="p-products-cat__item{% if Category is not null and Category.id == '9' or Category is not null and Category.id == '13' or Category is not null and Category.id == '14' or Category is not null and Category.id == '15' %} current{% endif %}">
<a href="{{ url('product_list') }}?category_id=9" class="p-products-cat__link">
<span class="p-products-cat__large">Nature.Dog</span>
<span class="p-products-cat__small">(ナチュレドッグ)</span>
</a>
</li>
{% set group1 = repository("Plugin\\CustomerGroup42\\Entity\\Group").find(1) %}
{% set group2 = repository("Plugin\\CustomerGroup42\\Entity\\Group").find(2) %}
{% set group3 = repository("Plugin\\CustomerGroup42\\Entity\\Group").find(3) %}
{% set group4 = repository("Plugin\\CustomerGroup42\\Entity\\Group").find(4) %}
{% if group1 is not null and is_granted('view', group1) or group2 is not null and is_granted('view', group2) or group3 is not null and is_granted('view', group3) or group4 is not null and is_granted('view', group4) %}
<li class="p-products-cat__item{% if Category is not null %}{% if Category.id == '10' %} current{% endif %}{% endif %}">
<a href="{{ url('product_list') }}?category_id=10" class="p-products-cat__link">
<span class="p-products-cat__large">Heat therapy Member</span>
<span class="p-products-cat__small">(ヒートセラピー会員専⽤)</span>
</a>
</li>
{% endif %}
</ul>
{% if Category is not null and Category.id == '9' or Category is not null and Category.id == '13' or Category is not null and Category.id == '14' or Category is not null and Category.id == '15' %}
<ul class="p-products-cat p-products-cat--child">
<li class="p-products-cat__item{% if Category is not null and Category.id == '13' %} current{% endif %}">
<a href="{{ url('product_list') }}?category_id=13" class="p-products-cat__link">
<span class="p-products-cat__small">ワンコケア用品</span>
</a>
</li>
<li class="p-products-cat__item{% if Category is not null and Category.id == '14' %} current{% endif %}">
<a href="{{ url('product_list') }}?category_id=14" class="p-products-cat__link">
<span class="p-products-cat__small">ワンコのおやつとご飯</span>
</a>
</li>
<li class="p-products-cat__item{% if Category is not null and Category.id == '15' %} current{% endif %}">
<a href="{{ url('product_list') }}?category_id=15" class="p-products-cat__link">
<span class="p-products-cat__small">ワンコのグッズ</span>
</a>
</li>
</ul>
{% endif %}
{% endif %}
<div class="ec-searchnavRole__infos p-products-infos">
{% if pagination.totalItemCount > 0 %}
<div class="ec-searchnavRole__actions p-products-infos__actions">
{{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number p-products-infos__select'}}) }}
{{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'order-by p-products-infos__select'}}) }}
</div>
{% else %}
<p class="p-products-infos__none">{{ 'お探しの商品は見つかりませんでした'|trans }}</p>
{% endif %}
</div>
</div>
{% if pagination.totalItemCount > 0 %}
<div class="ec-shelfRole">
<ul class="ec-shelfGrid p-products-list">
{% for Product in pagination %}
<li class="ec-shelfGrid__item p-products-list__item">
{# お気に入り #}
{% if is_granted('ROLE_USER') %}{# ログインしている場合 #}
{{ include('Block/product_list_favorite_block.twig') }}
{% endif %}
<a href="{{ url('product_detail', {'id': Product.id}) }}" class=" p-products-list__link">
{# タグと「定期便対応」カテゴリを出力 ここから #}
{% if Product.ProductCategories is not empty %}
{% if Product.Tags is not empty %}
<ul class="c-tags p-products-list__tags">
{% for Tag in Product.Tags %}
<li class="c-tags__tag p-products-list__tags-tag tag_{{ Tag.id }}">{{ Tag }}</li>
{% endfor %}
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.path[0].id == '11' %}
{% for Category in ProductCategory.Category.path %}
<li class="c-tags__tag p-products-list__tags-tag tag_cat{{ Category.id }}">{{ Category.name }}</li>
{% endfor %}
{% endif %}
{% endfor %}
</ul>
{% elseif Product.Tags is empty %}
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.path[0].id == '11' %}
<ul class="c-tags p-products-list__tags">
{% for Category in ProductCategory.Category.path %}
<li class="c-tags__tag p-products-list__tags-tag tag_cat{{ Category.id }}">{{ Category.name }}</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
{% endif %}
{% elseif Product.ProductCategories is empty and Product.Tags is not empty %}
<ul class="c-tags p-products-list__tags">
{% for Tag in Product.Tags %}
<li class="c-tags__tag p-products-list__tags-tag tag_{{ Tag.id }}">{{ Tag }}</li>
{% endfor %}
</ul>
{% endif %}
{# タグと「定期便対応」カテゴリを出力 ここまで #}
{# 「定期便対応」以外のカテゴリを出力 ここから #}
{% if Product.ProductCategories is not empty %}
{% for ProductCategory in Product.ProductCategories %}
{% if ProductCategory.Category.path[0].id != '11' %}
<ul class="c-cats p-products-list__cats">
<li class="c-cats__cat p-products-list__cats-cat">
{% for Category in ProductCategory.Category.path %}
<span class="c-cats__cat-txt">{{ Category.name }}</span>{%- if loop.last == false %}
<span class="c-cats__cat-arrow">></span>{% endif -%}
{% endfor %}
</li>
</ul>
{% endif %}
{% endfor %}
{% endif %}
{# 「定期便対応」以外のカテゴリを出力 ここまで #}
<p class="ec-shelfGrid__item-image p-products-list__img-wrap">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
</p>
<p class=" p-products-list__name">{{ Product.name }}</p>
<div class="p-products-list__info">
{% if Product.production_capacity is not empty %}
<p class=" p-products-list__capacity">{{ Product.production_capacity }}</p>
{% endif %}
<p class="price02-default p-products-list__price">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{{ Product.getPrice02IncTaxMin|number_format }}
{% else %}
{{ Product.getPrice02IncTaxMin|number_format }} ~ {{ Product.getPrice02IncTaxMax|number_format }}
{% endif %}
{% else %}
{{ Product.getPrice02IncTaxMin|number_format }}
{% endif %}円(税込)
</p>
</div>
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="ec-pagerRole l-pagination">
{% include "pager.twig" with {'pages': pagination.paginationData} %}
</div>
{% endif %}
{% endif %}
{% endblock %}