{#
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.
#}
{% set Categories = repository('Eccube\\Entity\\Category').getList() %}
{% extends 'default_frame.twig' %}
{% set body_class = 'product_page' %}
{% 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) {
$('.add-cart').prop('disabled', true);
}
}).done(function(data) {
$.each(data.messages, function() {
$('#ec-modal-header').text(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) {
$('.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 stylesheet %}
<link rel="stylesheet" href="/test-ec-05/html/user_data/assets/css/recommend.min.css">
<style>
.ec-layoutRole .ec-layoutRole__contents {
max-width: unset;
}
.p-top__merchandise .p-top__items__box .p-top__item {
padding: 20px 16px;
}
.ec-topicpath .ec-topicpath__item a {
color: #333;
}
.p-top__merchandise {
padding: 10% 0 20%;
}
.p-top__merchandise .p-top__items__box {
margin-top: 0;
}
.p-top__item__title,
.p-top__item__price {
text-align: center;
}
.p-top__merchandise .absolute1 {
width: 22%;
}
.p-top__merchandise .absolute2 {
width: 30%;
}
.ec-pager .ec-pager__item--active,
.ec-pager .ec-pager__item:hover, {
background-color: inherit;
}
.ec-pager__item a {
background-color: #333;
color: #fefefe !important;
padding: 10px 20px !important;
border-radius: 50%;
}
.ec-pager__item .small{
padding: 10px 16px !important;
}
.ec-pager__item--active a {
background-color: #b72c11;
padding: 10px 20px !important;
border-radius: 50%;
color: #fefefe !important;
}
.ec-pager .ec-pager__item--active,
.ec-pager .ec-pager__item:hover{
background: unset;
}
.sale {
display: none;
}
.p-top__merchandise .p-top__items__box .p-top__item {
overflow: hidden;
position: relative;
}
.cart.absolute {
position: absolute;
z-index: 1;
transform: rotate(40deg);
right: -70px;
overflow: hidden;
top: 20px;
}
@media (max-width:768px) {
.p-top__items__box .p-top__item {
width: auto;
min-width: 220px;
margin-left: 5%;
}
}
@media only screen and (min-width: 768px) {
.ec-searchnavRole .ec-searchnavRole__infos {
border-top-color: #333;
}
}
@media screen and (max-width:1024px) {
.p-top__items__box .p-top__item__meet {
width: 200px !important;
}
.p-top__items__box .p-top__item {
min-width: 230px;
}
.cart.absolute {
right: -55px;
top: 12px;
}
}
</style>
{% endblock %}
{% block main %}
<section class="p-ranking__fv">
<div class="p-ranking__fv__inner">
<div class="section__title top__fix">
<h2 >商品一覧</h2>
</div>
</div>
<!-- banner -->
{{include('Block/banner.twig')}}
<!-- banner -->
</section>
<section class="p-top__merchandise">
<img class="absolute1" src="{{asset ('/test-ec-05/html/user_data/assets/img/common/cloud__gl2.webp')}}" alt="雲">
<img class="absolute2" src="{{asset ('/test-ec-05/html/user_data/assets/img/common/cloud_gl1.webp')}}" alt="雲">
<img class="absolute3" src="{{asset ('/test-ec-05/html/user_data/assets/img/common/meetbox.webp')}}" alt="お肉BOX">
<img class="absolute4" src="{{asset ('/test-ec-05/html/user_data/assets/img/common/nabe.webp')}}" alt="鍋">
<div class="section__title">
<img src="{{asset ('/test-ec-04/html/user_data/assets/img/common/cow.webp')}}" alt="牛のイラスト">
<h2>商品一覧</h2>
</div>
{% macro tree(Category) %}
{% from _self import tree %}
<a class="more__page" href="{{ url('product_list') }}?category_id={{ Category.id }}#page_anchor">
{{ Category.name }}
</a>
{#{% if Category.children|length > 0 %}#}
{# <ul>#}
{# {% for ChildCategory in Category.children %}#}
{# <li>#}
{# {{ tree(ChildCategory) }}#}
{# </li>#}
{# {% endfor %}#}
{# </ul>#}
{#{% endif %}#}
{% endmacro %}
{# @see https://github.com/bolt/bolt/pull/2388 #}
{% from _self import tree %}
<div class="p-top__merchandise__category" id="page_anchor">
<p>カテゴリー選択<span>|</span></p>
<div class="p-top__merchandise__category__items">
{% for Category in Categories %}
{{ tree(Category) }}
{% endfor %}
</div>
</div>
<p style="text-align: center; margin-top:20px;">※当店の商品は全て税込となっております。</p>
{% 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>
<div class="ec-searchnavRole__topicpath">
<ol class="ec-topicpath">
<li class="ec-topicpath__item"><a href="{{ url('product_list') }}">{{ '全て'|trans }}</a>
</li>
{% if Category is not null %}
{% for Path in Category.path %}
<li class="ec-topicpath__divider">|</li>
<li class="ec-topicpath__item{% if loop.last %}--active{% endif %}"><a
href="{{ url('product_list') }}?category_id={{ Path.id }}">{{ Path.name }}</a>
</li>
{% endfor %}
{% endif %}
{% if search_form.vars.value and search_form.vars.value.name %}
<li class="ec-topicpath__divider">|</li>
<li class="ec-topicpath__item">{{ '「%name%」の検索結果'|trans({ '%name%': search_form.vars.value.name }) }}</li>
{% endif %}
</ol>
</div>
<div class="ec-searchnavRole__infos">
<div class="ec-searchnavRole__counter">
{% if pagination.totalItemCount > 0 %}
{{ '<span class="ec-font-bold">%count%件</span><span>の商品が見つかりました</span>'|trans({ '%count%': pagination.totalItemCount })|raw }}
{% else %}
<span>{{ 'お探しの商品は見つかりませんでした'|trans }}</span>
{% endif %}
</div>
{% if pagination.totalItemCount > 0 %}
<div class="ec-searchnavRole__actions">
<div class="ec-select">
{{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number'}}) }}
{{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'order-by'}}) }}
</div>
</div>
{% endif %}
</div>
</div>
{% if pagination.totalItemCount > 0 %}
<div class="ec-shelfRole">
<ul class="ec-shelfGrid p-top__items__box">
{% for Product in pagination %}
<li class="ec-shelfGrid__item p-top__item">
<a href="{{ url('product_detail', {'id': Product.id}) }}">
{% for Tag in Product.Tags %}
<p class="cart absolute">{{ Tag }}</p>
{% endfor %}
<p class="ec-shelfGrid__item-image">
<img class="p-top__item__meet" 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-top__item__title">{{ include(template_from_string(Product.freearea)) }}</p>
{% if Product.description_list %}
<p>{{ Product.description_list|raw|nl2br }}</p>
{% endif %}
<p class="price02-default p-top__item__price">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{{ Product.getPrice02IncTaxMin|price }}
{% else %}
{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
{% endif %}
{% else %}
{{ Product.getPrice02IncTaxMin|price }}
{% endif %}
{#{% if Product.hasProductClass %}#}
{# {% if Product.getPrice02Min == Product.getPrice02Max %}#}
{# {{ Product.getPrice02IMin|price }}#}
{# {% else %}#}
{# {{ Product.getPrice02Min|price }} ~ {{ Product.getPrice02Max|price }}#}
{# {% endif %}#}
{#{% else %}#}
{# {{ Product.getPrice02Min|price }}#}
{#{% endif %}#}
</p>
</a>
{% if Product.stock_find %}
{#{% set form = forms[Product.id] %}#}
{#<form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_add_cart', {id:Product.id}) }}" method="post">#}
{# <div class="ec-productRole__actions">#}
{# {% if form.classcategory_id1 is defined %}#}
{# <div class="ec-select">#}
{# {{ form_widget(form.classcategory_id1) }}#}
{# {{ form_errors(form.classcategory_id1) }}#}
{# </div>#}
{# {% if form.classcategory_id2 is defined %}#}
{# <div class="ec-select">#}
{# {{ form_widget(form.classcategory_id2) }}#}
{# {{ form_errors(form.classcategory_id2) }}#}
{# </div>#}
{# {% endif %}#}
{# {% endif %}#}
{#<div class="ec-numberInput"><span>{{ '数量'|trans }}</span>#}
{# {{ form_widget(form.quantity, {'attr': {'class': 'quantity'}}) }}#}
{# {{ form_errors(form.quantity) }}#}
{#</div>#}
{# </div>#}
{# {{ form_rest(form) }}#}
</form>
<div class="ec-productRole__btn">
<a class="detail-buttons cart" href="{{ url('product_detail', {'id': Product.id}) }}">詳細を見る</a>
{#<button type="submit" class="ec-blockBtn--action add-cart" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}">#}
{# {{ '詳細を見る'|trans }}#}
{#</button>#}
</div>
{% else %}
<div class="ec-productRole__btn">
<button type="button" class="ec-blockBtn--action" disabled="disabled">
{{ 'ただいま品切れ中です。'|trans }}
</button>
</div>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
<div class="ec-modal">
<div class="ec-modal-overlay">
<div class="ec-modal-wrap">
<span class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></span>
<div id="ec-modal-header" class="text-center">{{ 'カートに追加しました。'|trans }}</div>
<div class="ec-modal-box">
<div class="ec-role">
<span class="ec-inlineBtn--cancel">{{ 'お買い物を続ける'|trans }}</span>
<a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
</div>
</div>
</div>
</div>
</div>
<div class="ec-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData} %}
</div>
{% endif %}
{% endif %}
</section>
{% endblock %}