{#
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' %}
{% 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()
});
{# word検索 #}
const word = document.querySelector('#name');
word.addEventListener('input', (evt) => {
word.textContent = evt.target.value;
$('#search-product').submit();
})
//価格のslider
const range1 = document.querySelector('#range-1');
const range2 = document.querySelector('#range-2');
const startValue1 = document.querySelector('#start-value1');
const endValue2 = document.querySelector('#end-value2');
range1.addEventListener('input', (evt) => {
startValue1.textContent = evt.target.value;
$('#search-product').submit();
})
range2.addEventListener('input', (evt) => {
endValue2.textContent = evt.target.value;
$('#search-product').submit();
})
startValue1.textContent = range1.value;
endValue2.textContent = range2.value;
//高さのslider
const range3 = document.querySelector('#range-3');
const range4 = document.querySelector('#range-4');
const startValue3 = document.querySelector('#start-value3');
const endValue4 = document.querySelector('#end-value4');
range3.addEventListener('input', (evt) => {
startValue3.textContent = evt.target.value;
$('#search-product').submit();
})
range4.addEventListener('input', (evt) => {
endValue4.textContent = evt.target.value;
$('#search-product').submit();
})
startValue3.textContent = range3.value;
endValue4.textContent = range4.value;
//幅のslider
const range5 = document.querySelector('#range-5');
const range6 = document.querySelector('#range-6');
const startValue5 = document.querySelector('#start-value5');
const endValue6 = document.querySelector('#end-value6');
range5.addEventListener('input', (evt) => {
startValue5.textContent = evt.target.value;
$('#search-product').submit();
})
range6.addEventListener('input', (evt) => {
endValue6.textContent = evt.target.value;
$('#search-product').submit();
})
startValue5.textContent = range5.value;
endValue6.textContent = range6.value;
//初期表示は非表示
document.getElementById("searchBox").style.display ="none";
//絞り込みボタンの背景色を制御
const search = location.search;
if (search !== "") {
isSelected.style.background = "#F2F2F2";
}
function clickBtn2(){ //検索ボックスの表示・非表示を制御
const searchBox = document.getElementById("searchBox");
const isSelected = document.getElementById("isSelected");
if (searchBox.style.display==""){
searchBox.style.display ="none";
} else{
searchBox.style.display ="";
}
}
</script>
{% endblock %}
{% block stylesheet %}
<style>
.ec-modal {
display: none;
position: fixed;
top: 0;
left: 0;
z-index: 99999;
width: 100%;
height: 100%;
}
.ec-modal.small {
width: 30%;
}
.ec-modal.full {
width: 100%;
height: 100%;
}
.ec-modal .ec-modal-overlay {
display: flex;
justify-content: center;
align-items: center;
background-color: rgba(0, 0, 0, 0.3);
width: 100%;
height: 100%;
}
.ec-modal .ec-modal-wrap {
position: relative;
border-radius: 6px;
border: 0px;
background-color: #fff;
width: 50%;
margin: 20px;
padding: 40px 5px;
}
.ec-modal .ec-modal-close {
cursor: pointer;
position: absolute;
right: 20px;
top: 10px;
font-size: 20px;
height: 30px;
width: 20px;
}
.ec-modal .ec-modal-close:hover {
color: #4b5361;
}
.ec-modal .ec-modal-box {
text-align: center;
}
.ec-modal .ec-role {
margin-top: 20px;
}
.margin {
margin: 3px;
}
.artcategory-flex {
background-color: #f4f1ee;
padding: 5px;
margin-bottom: 30px;
display: flex;
flex-wrap: wrap;
border-radius: 6px;
}
.category-title {
padding: 3px;
margin-left: 2%;
}
.category-title h5 {
color: black;
}
.ec-headerSearch__keywordBtn {
border-radius: 6px;
}
a {
color: black;
text-decoration: none;
}
a:hover {
color: #d5a770;
text-decoration: none;
}
.mb {
margin-bottom: 5px;
}
.img-wrap {
width: auto;
height: 300px;
}
.img-wrap img {
min-width: 250px;
width: auto;
height: 300px;
border-radius: 6px;
}
.img {
width: auto;
height: 300px;
max-width: auto;
max-height: 300px;
object-fit: cover;
}
.ec-blockBtn--action {
display: inline-block;
margin-bottom: 0;
font-weight: bold;
text-align: center;
vertical-align: middle;
touch-action: manipulation;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 12px;
font-size: 0.875rem;
border-radius: 1.42857142;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
padding: 10px 16px;
text-decoration: none;
color: #fff;
background-color: #d5a770;
border-color: #d5a770;
display: block;
width: 100%;
height: 56px;
line-height: 56px;
padding-top: 0;
padding-bottom: 0;
}
{# これしないとmaker_idのフォームが表示されてしまう #}
.form-control {
display: none;
}
.form-label {
display: none;
}
.ml-20 {
margin-left: 20%;
}
.deleteIcon {
color: red;
}
.deleteIcon:hover {
color: red;
}
.product-list-flex {
display: flex;
justify-content: center;
padding: 40px;
margin: 0 auto 30px auto;
border-radius: 6px;
background-color: #F2F2F2;
max-width: 750px;
}
.pr-16 {
padding-right: 16px;
}
.skelton_btn {
width: 130px;
padding: 6px 12px;
text-align: center;
text-decoration: none;
background: #fff;
}
.skelton_btn:hover {
background: #F2F2F2;
cursor: pointer;
text-decoration: none;
border-radius: 3px;
}
@media screen and ( max-width:1035px) {
.product-list-flex {
display: flex;
}
.slidebar-multithumb {
width: 100%;
}
.line {
display: none;
}
.searchWord {
display: none;
}
.img-wrap img {
min-width: 180px;
width: auto;
height: 300px;
}
}
@media screen and ( max-width:768px) {
.product-list-flex {
display: none;
}
.skelton_btn {
display: none;
}
}
.ec-numberInput {
display: none;
}
.product-list-description:hover {
color: black;
}
</style>
{% endblock %}
{% block main %}
{% 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">
{% if Category is null %}
{# <li class="ec-topicpath__item"><a href="{{ url('product_list') }}">{{ '全て'|trans }}</a>
</li> #}
<div class="artcategory-flex">
<div class="category-title"><h2 class="fontweight-bold gold"><a href="{{ url('product_list') }}">{{ 'アート作品'|trans }}</a></h2></div>
</div>
{% endif %}
{% if Category is not null %}
{% for Path in Category.path %}
{# <li class="ec-topicpath__item{% if loop.last %}--active{% endif %}"><a
href="{{ url('product_list') }}?category_id={{ Path.id }}">{{ Path.name }}</a>
</li> #}
<div class="artcategory-flex">
<div class="category-title"><h2 class="fontweight-bold gold"><a href="{{ url('product_list') }}?category_id={{ Path.id }}">{{ Path.name }}</a></h2></div>
</div>
{% 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">
<a href="#" class="skelton_btn" id="isSelected" onclick="clickBtn2()">絞り込み</a>
{{ 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>
<form method="get" class="searchform" id='search-product' action="{{ path('product_list') }}">
<div class="product-list-flex" id="searchBox">
<div class="product-list-size pr-16">
<div class="ec-headerSearch__category">
<div class="fontweight-bold"><label for="range-label">ワード</label><a class='deleteIcon' href='/products/list?name=&price_min={{price_min}}&price_max={{price_max}}&size_vertical_min={{size_vertical_min}}&size_vertical_max={{size_vertical_max}}&size_width_min={{size_width_min}}&size_width_max={{size_width_max}}'><i class="fa-regular fa-trash-can ml-20"></i></a></div>
<div class="ec-select ec-select_search margin-top ">
{% if name %}
<input type="text" name="name" id="name" placeholder={{name}}>
{% else %}
<input type="text" name="name" id="name">
{% endif %}
</div>
</div>
</div>
<div class="product-list-size">
<div class="slidebar-multithumb">
<div class="fontweight-bold mb"><label for="range-label">価格</label><a class='deleteIcon' href='/products/list?name={{name}}&price_min=0&price_max=1000000&size_vertical_min={{size_vertical_min}}&size_vertical_max={{size_vertical_max}}&size_width_min={{size_width_min}}&size_width_max={{size_width_max}}'><i class="fa-regular fa-trash-can ml-20"></i></a></div>
<div class="flex">
<div><span id="start-value1"></span>~</div>
<div><span id="end-value2"></span>円</div>
</div>
<div class="slidebar-multithumb-title"></div>
{% if price_min %}
<input class="thumb-1" type="range" name="price_min" id="range-1" value={{price_min}} min="0" max="1000000" step="100">
{% else %}
<input class="thumb-1" type="range" name="price_min" id="range-1" value="0" min="0" max="1000000" step="100">
{% endif %}
{% if price_max %}
<input class="thumb-2" type="range" name="price_max" id="range-2" value={{price_max}} min="0" max="1000000" step="100">
{% else %}
<input class="thumb-2" type="range" name="price_max" id="range-2" value="1000000" min="0" max="1000000" step="100">
{% endif %}
</div>
</div>
<div class="product-list-size">
<div class="slidebar-multithumb">
<div class="fontweight-bold mb"><label for="range-label">高さ</label><a class='deleteIcon' href='/products/list?name={{name}}&price_min={{price_min}}&price_max={{price_max}}&size_vertical_min=0&size_vertical_max=300&size_width_min={{size_width_min}}&size_width_max={{size_width_max}}'><i class="fa-regular fa-trash-can ml-20"></i></a></div>
<div class="flex">
<div><span id="start-value3"></span>~</div>
<div><span id="end-value4"></span>cm</div>
</div>
<div class="slidebar-multithumb-title"></div>
{% if size_vertical_min %}
<input class="thumb-1" type="range" name="size_vertical_min" id="range-3" value={{size_vertical_min}} min="0" max="500" step="10">
{% else %}
<input class="thumb-1" type="range" name="size_vertical_min" id="range-3" value="0" min="0" max="300" step="10">
{% endif %}
{% if size_vertical_max %}
<input class="thumb-2" type="range" name="size_vertical_max" id="range-4" value={{size_vertical_max}} min="0" max="300" step="10">
{% else %}
<input class="thumb-2" type="range" name="size_vertical_max" id="range-4" value="300" min="0" max="300" step="10">
{% endif %}
</div>
</div>
<div class="product-list-size">
<div class="slidebar-multithumb">
<div class="fontweight-bold mb"><label for="range-label">幅</label><a class='deleteIcon' href='/products/list?name={{name}}&price_min={{price_min}}&price_max={{price_max}}&size_vertical_min={{size_vertical_min}}&size_vertical_max={{size_vertical_max}}&size_width_min=0&size_width_max=300'><i class="fa-regular fa-trash-can ml-20"></i></a></div>
<div class="flex">
<div><span id="start-value5"></span>~</div>
<div><span id="end-value6"></span>cm</div>
</div>
<div class="slidebar-multithumb-title"></div>
{% if size_width_min %}
<input class="thumb-1" type="range" name="size_width_min" id="range-5" value={{size_width_min}} min="0" max="300" step="10">
{% else %}
<input class="thumb-1" type="range" name="size_width_min" id="range-5" value="0" min="0" max="300" step="10">
{% endif %}
{% if size_width_max %}
<input class="thumb-2" type="range" name="size_width_max" id="range-6" value={{size_width_max}} min="0" max="300" step="10">
{% else %}
<input class="thumb-2" type="range" name="size_width_max" id="range-6" value="300" min="0" max="300" step="10">
{% endif %}
</div>
</div>
</div>
</form>
{% 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}) }}" class="product-list-description">
{# <p class="ec-shelfGrid__item-image"> #}
<div class="img-wrap">
<img class="img" src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
</div>
{# </p> #}
<p class="price02-default margin">{{ Product.name }}</p>
{# アーティスト名 #}
{# {% for artist in artists %}
{% if Product.getArtistId == artist.id %}
<p class="margin">{{ artist.name }}</P>
{% endif %}
{% endfor %} #}
{# 絵の技法 #}
{% if Product.getProductionTechnique is not null %}
<p class="margin">{{ Product.getProductionTechnique }}</p>
{% endif %}
{# 絵のサイズ #}
{% if Product.getProductionSizeVertical and Product.getProductionSizeWidth %}
<p class="margin">{{ Product.getProductionSizeVertical }} x {{ Product.getProductionSizeWidth }} cm</p>
{% endif %}
{% if Product.description_list %}
<p class="margin">{{ Product.description_list|raw|nl2br }}</p>
{% endif %}
<p class="price02-default margin">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{{ Product.getPrice02IncTaxMin|price }}
{% else %}
{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
{% endif %}
{% else %}
{{ Product.getPrice02IncTaxMin|price }}
{% endif %}
</p>
</a>
{% if Product.stock_find %}
{% set form = forms[Product.id] %}
{# Todo ここの下のform,hiddenで残しているが無くす? #}
<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">
<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 mt-5per">{{ 'カートへ進む'|trans }}</a>
</div>
</div>
</div>
</div>
</div>
<div class="ec-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData} %}
</div>
{% endif %}
{% endif %}
{% endblock %}