{#
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 product_list' %}
{% 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();
});
// 複数カテゴリ検索用のパラメータ
$('#search1').on('submit', function(){
var category = [];
$('.category_ids:checked').each(function(){
category.push($(this).val());
});
var brand = [];
$('.brand_ids:checked').each(function(){
brand.push($(this).val());
});
var taste = [];
$('.taste_ids:checked').each(function(){
taste.push($(this).val());
});
$('[name=category_ids]').val(category.join('-'));
$('[name=brand_ids]').val(brand.join('-'));
$('[name=taste_ids]').val(taste.join('-'));
});
//
$('.search_modal_open').on('click', function(){
$('.search_modal_wrap').addClass('on');
});
$('.search_modal_close').on('click', function(){
$('.search_modal_wrap').removeClass('on');
});
//
$('.search_modal .accordion dt').on('click', function(){
$(this).toggleClass('on');
});
$('.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 %}
{% if search_form.vars.value.category_id.id is defined %}
{{ include('Block/category'~search_form.vars.value.category_id.id~'.twig', ignore_missing = true) }}
{% endif %}
{% 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="search_params_wrap">
<div class="box1">
<div class="title">現在の検索条件</div>
<ul class="params">
{% for dat in s_search %}
<li><a href="{{ dat.link }}"><i class="fa-solid fa-xmark"></i>{{ dat.name }}</a></li>
{% endfor %}
</ul>
</div>
<div class="box2">
<div class="search_btn">
<a href="javascript:void(0);" class="search_modal_open">商品を絞り込む</a>
</div>
</div>
</div>
<div class="">
</div>
{#
<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(disp_number_form, {'id': '', 'attr': {'class': 'disp-number'}}) }}
{{ form_widget(order_by_form, {'id': '', 'attr': {'class': 'order-by'}}) }}
</div>
</div>
{% endif %}
</div>
</div>
{% if pagination.totalItemCount > 0 %}
<div class="ec-shelfRole">
<ul class="ec-shelfGrid">
{% for Product in pagination %}
<li class="ec-shelfGrid__item">
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<div class="ec-shelfGrid__item-image">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" loading="lazy">
<ul class="color-list">
{{ Product.getColorsHTML|raw }}
</ul>
{% if Product.stock_find == false %}
<p class="list_soldout">sold out</p>
{% endif %}
{{ Product.getSaleIcon|raw }}
</div>
{#<ul class="ec-shelfRole__tags">
{% for Tag in Product.ProductTag %}
{% if Tag %}
<li class="ec-shelfRole__tag">{{ Tag.Tag }}</li>
{% endif %}
{% endfor %}
</ul>#}
{{ include('@DesignTag4/tag_list.twig', ignore_missing = true) }}
<p class="ec-shelfGrid__item-name">{{ Product.name }}</p>
{% if Product.description_list %}
<p>{{ Product.description_list|raw|nl2br }}</p>
{% endif %}
<p class="price02-default">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{{ Product.getPrice02IncTaxMin|price }}
{% else %}
{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
{% endif %}
{% else %}
{#{{ Product.getPrice02IncTaxMin|price }}#}
{{ Product.getSalePrice|raw }}
{% endif %}
</p>
</a>
</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 %}
<!------**** modal search ****------>
<div class="search_modal_wrap">
<div class="search_modal">
<div class="close_btn"><a href="javascript:void(0);" class="search_modal_close"><i class="fas fa-times"></i></a></div>
<form action="?" method="get" id="search1">
<div class="search_box">
<h2>カテゴリ</h2>
<input type="hidden" name="category_ids" value="">
<input type="hidden" name="brand_ids" value="">
<input type="hidden" name="taste_ids" value="">
{% set Categories = repository('Eccube\\Entity\\Category').getList() %}
{% for Category in Categories %}
<dl class="accordion">
<dt><img src="{{ asset('img/icons/') }}category{{ Category.id }}.png" alt="" width="30"><span>{{ Category.name }}</span></dt>
{#{% if Category.children|length > 0 %}#}
<dd>
<ul class="checkbox">
{% set checked = (Category.id in s_category_ids)? 'checked':'' %}
<li><label><input type="checkbox" class="category_ids" value="{{ Category.id }}" {{ checked }}><span>{{ Category.name }}すべて</span></label></li><!--すべてを選択-->
{% for ChildCategory in Category.children %}
{% set checked = (ChildCategory.id in s_category_ids)? 'checked':'' %}
<li><label><input type="checkbox" class="category_ids" value="{{ ChildCategory.id }}" {{ checked }}><span>{{ ChildCategory.name }}</span></label></li>
{% endfor %}
</ul>
</dd>
{#{% endif %}#}
</dl>
{% endfor %}
</div>
<div class="search_box">
<h2>ブランド</h2>
{% set Brands = repository('Plugin\\BrandManager\\Entity\\Brand').getList() %}
<dl class="accordion">
<ul class="checkbox">
{% for Brand in Brands %}
{% set checked = (Brand.id in s_brand_ids)? 'checked':'' %}
<li><label><input type="checkbox" class="brand_ids" value="{{ Brand.id }}" {{ checked }}><span>{{ Brand.name }}</span></label></li>
{% endfor %}
</ul>
</dl>
</div>
<div class="search_box">
<h2>テイスト</h2>
{% set Tastes = repository('Plugin\\TasteManager\\Entity\\Taste').getList() %}
<dl class="accordion">
<ul class="checkbox">
{% for Taste in Tastes %}
{% set checked = (Taste.id in s_taste_ids)? 'checked':'' %}
<li><label><input type="checkbox" class="taste_ids" value="{{ Taste.id }}" {{ checked }}><span>{{ Taste.name }}</span></label></li>
{% endfor %}
</ul>
</dl>
</div>
<div class="search_box">
<h2>キーワード</h2>
<dl class="keyword">
{#<dt>キーワード検索</dt>#}
<dd>
<input type="text" name="name" value="{{ s_name }}" placeholder="キーワード …">
{#<button class="keyword-btn"><i class="fa-solid fa-magnifying-glass"></i></button>#}
</dd>
</dl>
</div>
<div class="search_btns">
<input type="submit" value="この条件で検索" class="btn btn-black">
<input type="reset" value="条件をクリア" name="reset" class="btn btn-mono">
{#<a href="javascript:void(0);" class="btn btn-black">この条件で検索</a>
<a href="javascript:void(0)" class="btn btn-mono">条件をクリア</a>#}
</div>
</form>
</div>
</div>
<!-- -->
{% endblock %}