{#
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' %}
{% block stylesheet %}
<link rel="stylesheet" href="{{ asset('assets/css/stock-photo/contents-list.css', 'user_data') }}">
<link rel="stylesheet" href="{{ asset('assets/css/stock-photo/main_module.css', 'user_data') }}">
<style>
.ec-topicpath{
display: flex;
flex-wrap: wrap;
margin: 30px 10% 0;
}
.ec-topicpath a{
color: #109F98;
}
.ec-topicpath__divider{
margin: 0 5px;
}
.category-btn img{
margin-right: 15px;
}
.tab {
margin: 30px 15% 0;
}
@media screen and (max-width:768px){
.tab {
margin: 10px 3% 20px 3%;
}
}
.lead-sentence {
display: flex;
flex-wrap: wrap;
}
@media screen and (max-width:768px){
.tab img{
width: 15%;
}
.category-btn{
margin-bottom: 15px;
}
}
.tab-list {
display: flex;
gap: 1px;
}
@media screen and (max-width:768px){
.tab-list{
flex-direction: row;
}
}
.tab-item {
border-radius: 5px 5px 0 0;
background-color: #109F98;
border-top: solid 1px #109F98;
border-right: solid 1px #109F98;
border-left: solid 1px #109F98;
}
.tab-item a{
color: #FFF;
padding: 0.5em 1.2em;
display: block;
}
@media screen and (max-width:768px){
.tab-item{
flex: 1 1 auto;
min-width: 0;
}
.tab-item a{
margin: 8px 0;
text-align: center;
white-space: nowrap;
padding: 0.4em 0.6em;
}
}
@media screen and (max-width:570px){
.tab-item{
font-size: 12px;
line-height: 2.5;
}
}
@media screen and (max-width:450px){
.tab-item{
font-size: 10px;
}
}
.tab-content:has(.tab-panel.active){
display: flex;
justify-content: space-between;
border-top:solid 1px #109F98;
border-right:solid 1px #109F98;
border-left:solid 1px #109F98;
border-radius: 0 8px 0 0;
}
.tab-content:not(:has(.tab-panel.active)){
display: none;
}
@media screen and (max-width:768px){
.tab-content{
flex-direction: column;
border-radius: 0;
}
}
.tab-panel {
display: none;
}
.tab-item.active {
background-color: #fff;
font-weight: bold;
position: relative;
}
.tab-item.active a{
color: #109F98;
}
.tab-item.active::before{
content: "";
width: 100%;
border-bottom: 4px solid #FFF;
position: absolute;
bottom: -3px;
left: 0;
}
.tab-panel.active {
display: flex;
padding: 3%;
flex-wrap: wrap;
gap:20px 20px;
flex: 10;
}
@media screen and (max-width:768px){
.tab-panel.active{
justify-content: center;
}
}
.tab-panel.active h2 {
font-size: 20px;
font-weight: bold;
}
.search-form-box{
border: solid 1px #109F98;
border-radius: 0 0 8px 8px;
}
.tab-content:not(:has(.active)) + .search-form-box{
border-radius: 0 8px 8px 8px;
}
@media screen and (max-width:768px){
.search-form-box .search-form-content{
display: flex;
justify-content: space-between;
flex-direction: column;
}
}
.search-form-box .search-form-item{
margin-left: 3%;
margin-right: calc(3% + 20px);
}
@media screen and (max-width:768px){
.search-form-box .search-form-item{
margin: 0 auto;
}
}
.search-form-box .search-form-input{
-webkit-appearance: none;
-moz-appearance:none;
appearance: none;
border:1px solid #109F98;
border-radius:25px;
width: 100%;
padding-left: 20px;
height: 36px;
background-color: #f5f5f5;
}
@media screen and (max-width:768px){
.search-form-box .search-form-input{
width: 88vw;
box-sizing: border-box;
}
.search-form-box .search-form-input::placeholder{
font-size: 2vw;
}
}
select{
background:none;
appearance: none;
font:inherit;
padding:9.5px 10px;
border:1px solid #109F98;
box-sizing: border-box;
width: 250px;
border-radius:2px;
color: #111111;
}
.select {
display: inline-block;
position: relative;
vertical-align: middle;
width: 100%;
}
.select::before {
position: absolute;
top: 18px;
right: 16px;
width: 0;
height: 0;
border-width: 10px 5px 0 5px;
border-style: solid;
border-color: #109F98 transparent transparent transparent;
content: "";
pointer-events: none;
}
/*検索セクション内にあるアイコン(svg)カラー指定*/
.search-form-box .ic {
filter: brightness(0) saturate(100%) invert(68%) sepia(68%) saturate(6159%) hue-rotate(145deg) brightness(90%) contrast(87%);
}
/* 各条件見出し位置調整 */
.search-form-box .search-title {
padding: 15px 0 12px 0;
margin: 0 3%;
display: flex;
align-items: center;
gap: 6px;
color: #111111;
}
/*セクション分け用のボーダー*/
.search-form-box .search-title {
border-top: 1px solid #D5DAED;
}
/*1番目(フリーワード検索)には不要なので非表示*/
.search-form-box .search-title:first-child {
border-top: none;
}
.search-subtitle {
margin: 16px 0;
}
/*各条件の副題にh2のトーン寄せ*/
.search-subtitle label,
.search-subtitle legend {
border: solid 2px #109F98;
border-right: none;
border-top: none;
border-bottom: none;
text-align: left;
padding: 0 0 0 8px;
color: #111111;
}
.search-base-content,
.search-filter-content {
margin: 0 3% 3% 3%;
}
/*基本条件*/
.search-base-content {
display: flex;
flex-direction: row;
gap: 16px;
}
/* 上記でselectに指定しているスタイルを基本条件用に上書き */
.search-base-item select {
border: 1px solid #D5DAED;
}
@media (max-width: 768px) {
.search-base-item select {
display: flex;
flex-wrap: wrap;
}
.search-base-item {
flex: 1 1 200px;
max-width: 100%;
}
.search-base-item select {
width: 100%;
}
}
.search-filter-list {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
/*詳細フィルターのチェックボックス並べる数*/
/*PC表示:10個のチェックボックスが横に5個 × 2行*/
/*スマホ表示:10個のチェックボックスが横に3個 × 約4行(1個余りになるため)*/
.filter-checkbox-item {
display: flex;
align-items: center;
gap: 6px;
align-items: baseline;
width: calc(100% / 5 - 10px); /* PC: 5列 */
color: #111111;
}
@media (max-width: 768px) {
.filter-checkbox-item {
width: calc(100% / 3 - 10px); /* SP: 3列 */
}
}
@media (max-width: 450px) {
.filter-checkbox-item {
font-size: max(3.6vw, 12px);
}
}
.image-wrapper {
position: relative;
}
.label-free {
position: absolute;
top: 0;
right: 0;
background-color: #e60012;
color: #fff;
font-weight: bold;
font-size: 14px;
padding: 3px 10px;
border-radius: 0 0 0 4px;
z-index: 1;
}
.ec-topicpath__item{
font-size: 17px;
}
/* ▼ アコーディオン用 追加CSS ▼ */
:root{
--acc-green: #109F98;
--acc-line: #0f8a80;
}
.search-section + .search-section{
border-top: 1px solid var(--acc-line);
}
.search-section__header{
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
}
.accordion-toggle{
inline-size: 28px;
block-size: 28px;
display: grid;
place-items: center;
position: relative;
cursor: pointer;
border: 1px solid var(--acc-green);
border-radius: 4px;
background: var(--acc-green);
}
.accordion-toggle::before{
content: "";
display: block;
inline-size: 8px;
block-size: 8px;
border-right: 2px solid #fff;
border-bottom: 2px solid #fff;
transform: rotate(45deg); /* ▼ */
transition: transform .2s ease;
}
.is-open .accordion-toggle{
background: #fff;
border-color: var(--acc-green);
}
.is-open .accordion-toggle::before{
border-right-color: var(--acc-green);
border-bottom-color: var(--acc-green);
transform: rotate(-135deg); /* ▲ */
}
.search-section__panel{
padding: 12px;
}
.visually-hidden{
position: absolute !important;
inline-size: 1px;
block-size: 1px;
margin: -1px;
padding: 0;
border: 0;
clip: rect(0 0 0 0);
overflow: hidden;
}
.accordion-toggle:hover{ filter: brightness(0.98); }
.accordion-toggle:focus-visible{
outline: 2px solid var(--acc-line);
outline-offset: 2px;
}
/* SPだけボタンを中央寄せ */
@media (max-width: 840px){
.sp-center{
display: flex;
justify-content: center;
}
}
</style>
{% endblock %}
{% 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()
});
</script>
<script>
// 絞り込み検索は、絞り込み検索ボタンが押されたとき、もしくは入力欄にフォーカスされたときに、
// enterを押したときのみ発動する。カテゴリ検索を押したときは発火させない
document.addEventListener('DOMContentLoaded', function () {
const form = document.querySelector('.tab');
const categoryBtn = form.querySelector('button[name="search_parent_id"]:not(.word-search)');
const wordBtn = form.querySelector('.category-btn.word-search');
const wordInput = form.querySelector('input.search-form-input');
// カテゴリ検索 → name を送らせない
categoryBtn.addEventListener('click', function () {
if (wordInput) {
wordInput.disabled = true;
}
});
// 絞り込み検索 → name を有効化
wordBtn?.addEventListener('click', function () {
if (wordInput) {
wordInput.disabled = false;
}
});
// Enterキーで submit 時に絞り込み検索の値を送信するための hidden input 挿入
form.addEventListener('submit', function (e) {
if (document.activeElement === wordInput) {
e.preventDefault();
// 既に存在していたら除去(2重防止)
const existingHidden = form.querySelector('input[name="search_parent_id"].auto-injected');
if (existingHidden) {
existingHidden.remove();
}
// ボタンのvalue属性をそのまま使う
const valueFromButton = wordBtn?.getAttribute('value') || '';
const hidden = document.createElement('input');
hidden.type = 'hidden';
hidden.name = 'search_parent_id';
hidden.value = valueFromButton;
hidden.classList.add('auto-injected');
form.appendChild(hidden);
if (wordInput) {
wordInput.disabled = false;
}
form.submit();
}
});
});
// カテゴリの詳細検索に値が入っていない場合、buttonのnameの値をcategory_idに変更する
// document.addEventListener('DOMContentLoaded', function () {
// const form = document.querySelector('.tab');
// const submitBtn = form.querySelector('button.category-btn');
// const categorySelects = form.querySelectorAll('select[name="category_ids[]"]');
// form.addEventListener('submit', function (e) {
// // category_ids[] に選択されている値が1つもない場合、ボタンのnameを変更
// const hasValue = Array.from(categorySelects).some(select => select.value && select.value !== '');
// if (!hasValue) {
// submitBtn.setAttribute('name', 'category_id');
// } else {
// submitBtn.setAttribute('name', 'search_parent_id');
// }
// });
// });
</script>
<script>
(function () {
function setState(section, open) {
const btn = section.querySelector('.js-accordion-toggle');
const panel = section.querySelector('.js-accordion-panel');
section.classList.toggle('is-open', open);
btn.setAttribute('aria-expanded', open ? 'true' : 'false');
panel.toggleAttribute('hidden', !open);
panel.setAttribute('aria-hidden', open ? 'false' : 'true');
}
document.querySelectorAll('.search-form-box').forEach(function (box) {
// このフォーム(タブ)に属する2つのアコーディオン
const sections = box.querySelectorAll('.js-accordion');
if (!sections.length) return;
const key = location.pathname + '#panel=' + (box.dataset.panel || 'default') + ':openId';
// 初期オープン対象:保存 > data-open="1" > 先頭(=フリーワードを想定)
const savedId = sessionStorage.getItem(key);
let initial = Array.from(sections).find(s => s.id === savedId)
|| Array.from(sections).find(s => s.dataset.open === '1')
|| sections[0];
// 初期反映
sections.forEach(s => setState(s, s === initial));
sessionStorage.setItem(key, initial.id);
sections.forEach(function (sec) {
const btn = sec.querySelector('.js-accordion-toggle');
btn.addEventListener('click', function () {
if (sec.classList.contains('is-open')) return;
sections.forEach(s => setState(s, s === sec));
sessionStorage.setItem(key, sec.id);
});
});
});
})();
</script>
{% endblock %}
{% block main %}
{% set AllCategories = repository('Eccube\\Entity\\Category').getList() %}
{% set Categories = AllCategories|filter(c => c.id is not null and c.id == 18) %}
{% set selected_categories = app.request.query.get('category_ids', []) %}
{% set parent_category = app.request.query.get('search_parent_id') %}
{#パンくず#}
<div class="ec-searchnavRole__topicpath pc">
<ol class="ec-topicpath">
<li class="ec-topicpath__item"><a href="{{ url('photo-product_list') }}">{{ 'front.product.all_category'|trans }}</a>
</li>
{% if Category is not null %}
{% for Path in Category.path %}
{% if not loop.first %}
<li class="ec-topicpath__divider">></li>
<li class="ec-topicpath__item{% if loop.last %}--active{% endif %}">
<a href="{{ url('photo-product_list') }}?category_id={{ Path.id }}#contents-list">{{ Path.name }}</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
{# {% if selected_categories is not empty %}#}
{# {% set first_matched = true %}#}
{#{% for Category in Categories %}#}
{# {% for children in Category.Children %}#}
{# {% if children.id == parent_category %}#}
{# <li class="ec-topicpath__divider">></li>#}
{# <li><a href="{{ url('photo-product_list') }}?category_id={{ children.id }}">{{ children.name }}</a></li>#}
{# {% endif %}#}
{# {% for grandChildren in children.Children %}#}
{# {% for grandgrandChild in grandChildren.Children %}#}
{# {% if grandgrandChild.id in selected_categories %}#}
{# {% if first_matched %}#}
{# <li class="ec-topicpath__divider">></li>#}
{# <li><a href="{{ url('photo-product_list') }}?category_ids[]={{ grandgrandChild.id }}&search_parent_id={{parent_category}}">{{ grandgrandChild.name }}</a></li>#}
{# {% set first_matched = false %}#}
{# {% else %}#}
{# <li><a href="{{ url('photo-product_list') }}?category_ids[]={{ grandgrandChild.id }}&search_parent_id={{parent_category}}">・{{ grandgrandChild.name }}</a></li>#}
{# {% endif %}#}
{# {% endif %}#}
{# {% endfor %}#}
{# {% endfor %}#}
{# {% endfor %}#}
{# {% endfor %}#}
{# {% endif %}#}
{#検索ワード#}
{% if search_form.vars.value.name %}
<li class="ec-topicpath__divider">></li>
<li class="ec-topicpath__item"><a href="{{ url('photo-product_list') }}?name={{ search_form.vars.value.name }}#contents-list">{{ search_form.vars.value.name }}</a></li>
{% endif %}
{#撮影地(都道府県)#}
{% if app.request.query.get('prefectures') %}
<li class="ec-topicpath__divider">></li>
<li class="ec-topicpath__item">
<a href="{{ url('photo-product_list', {
'category_id': app.request.query.get('category_id'),
'prefectures': app.request.query.get('prefectures')
}) }}#contents-list">
{{app.request.query.get('prefectures')}}
</a>
</li>
{% endif %}
{#運行会社#}
{% if app.request.query.get('operator') %}
<li class="ec-topicpath__divider">></li>
<li class="ec-topicpath__item">
<a href="{{ url('photo-product_list', {
'category_id': app.request.query.get('category_id'),
'operator': app.request.query.get('operator')
}) }}#contents-list">
{{app.request.query.get('operator')}}
</a>
</li>
{% endif %}
{#撮影年代#}
{% if app.request.query.get('photographing_period') %}
<li class="ec-topicpath__divider">></li>
<li class="ec-topicpath__item">
<a href="{{ url('photo-product_list', {
'category_id': app.request.query.get('category_id'),
'operator': app.request.query.get('photographing_period')
}) }}#contents-list">
{{app.request.query.get('photographing_period')}}
</a>
</li>
{% endif %}
{#撮影地#}
{% if app.request.query.get('locations') %}
{% for location in app.request.query.get('locations') %}
{% if loop.first %}
<li class="ec-topicpath__divider">></li>
{% else %}
<li class="ec-topicpath__divider">・</li>
{% endif %}
<li>
<a href="{{ url('photo-product_list', {
'category_id': app.request.query.get('category_id'),
'locations[]': location
}) }}#contents-list">
{{ location }}
</a>
</li>
{% endfor %}
{% endif %}
{#撮影天候#}
{% if app.request.query.get('weathers') %}
{% for weather in app.request.query.get('weathers') %}
{% if loop.first %}
<li class="ec-topicpath__divider">></li>
{% else %}
<li class="ec-topicpath__divider">・</li>
{% endif %}
<li>
<a href="{{ url('photo-product_list', {
'category_id': app.request.query.get('category_id'),
'weathers[]': weather
}) }}#contents-list">
{{ weather }}
</a>
</li>
{% endfor %}
{% endif %}
{#撮影アングル#}
{% if app.request.query.get('camera_angles') %}
{% for camera_angle in app.request.query.get('camera_angles') %}
{% if loop.first %}
<li class="ec-topicpath__divider">></li>
{% else %}
<li class="ec-topicpath__divider">・</li>
{% endif %}
<li>
<a href="{{ url('photo-product_list', {
'category_id': app.request.query.get('category_id'),
'camera_angles[]': camera_angle
}) }}#contents-list">
{{ camera_angle }}
</a>
</li>
{% endfor %}
{% endif %}
{#撮影方式#}
{% if app.request.query.get('color_types') %}
{% for color_type in app.request.query.get('color_types') %}
{% if loop.first %}
<li class="ec-topicpath__divider">></li>
{% else %}
<li class="ec-topicpath__divider">・</li>
{% endif %}
<li>
<a href="{{ url('photo-product_list', {
'category_id': app.request.query.get('category_id'),
'color_types[]': color_type
}) }}#contents-list">
{{ color_type }}撮影
</a>
</li>
{% endfor %}
{% endif %}
{#一押し#}
{% if app.request.query.get('features') %}
{% for feature in app.request.query.get('features') %}
{% if loop.first %}
<li class="ec-topicpath__divider">></li>
{% else %}
<li class="ec-topicpath__divider">・</li>
{% endif %}
<li>
<a href="{{ url('photo-product_list', {
'category_id': app.request.query.get('category_id'),
'features[]': feature
}) }}#contents-list">
{{ feature }}
</a>
</li>
{% endfor %}
{% endif %}
</ol>
</div>
<!-- カテゴリ検索 -->
{% if app.request.query.get('category_id') or app.request.query.get('search_parent_id') %}
<form action="{{ path('photo-product_list') }}#contents-list" method="get" class="tab" >
<ul class="tab-list">
{% for tab in Categories%}
{% for children in tab.Children %}
{% set children_ids = [] %}
{% for grandChild in children.Children %}
{% set children_ids = children_ids|merge([grandChild.id]) %}
{% endfor %}
{% if children.id == app.request.query.get('category_id')
or children.id == app.request.query.get('search_parent_id')
or app.request.query.get('category_id') in children_ids
%}
<li class="tab-item active" tabindex="0" id="{{children.id}}">
<a href="{{ url('photo-product_list', {'category_id': children.id}) }}">{{children.name}}</a>
</li>
{% else %}
<li class="tab-item" tabindex="0" id="{{children.id}}">
<a href="{{ url('photo-product_list', {'category_id': children.id}) }}">{{children.name}}</a>
</li>
{% endif %}
{% endfor %}
{% endfor %}
</ul>
<div class="search-form-box">
<section id="freeword" class="search-section js-accordion" data-open="1">
<header class="search-section__header">
<div class="search-title">
<img src="{{ asset('/html/user_data/assets/icon/btn_ic_search.svg ', 'user_data') }}" class="ic" style="width: auto"><h3>フリーワード検索</h3>
</div>
<button type="button"
class="accordion-toggle js-accordion-toggle"
aria-controls="freeword-panel"
aria-expanded="true"
title="閉じる">
<span class="visually-hidden">フリーワード検索を開閉</span>
</button>
</header>
<div id="freeword-panel"
class="search-section__panel js-accordion-panel"
aria-hidden="false">
<div class="search-form-content">
<div class="search-form-item">
<input type="text" name="name" class="search-form-input"
placeholder="駅名・線路名・形式・撮影者名など自由に検索できます"
{% if search_form.vars.value.name
and (app.request.query.get('search_parent_id') is not empty or app.request.query.get('category_id') is not empty) %}
value="{{ search_form.vars.value.name }}"
{% endif %}
>
</div>
</div>
<div class="sp-center">
<button type="submit" class="category-btn word-search">
<img src="{{ asset('/html/user_data/assets/icon/btn_ic_search.svg ', 'user_data') }}" alt="お気に入り">
検索
</button>
</div>
</div>
</section>
<section id="details" class="search-section js-accordion" data-open="0">
<header class="search-section__header">
<div class="search-title">
<img src="{{ asset('/html/user_data/assets/icon/title_ic_filter.svg ', 'user_data') }}" class="ic" style="width: auto"><h3>詳細フィルター</h3>
</div>
<button type="button"
class="accordion-toggle js-accordion-toggle"
aria-controls="details-panel"
aria-expanded="false"
title="開く">
<span class="visually-hidden">詳細フィルターを開閉</span>
</button>
</header>
<div id="details-panel"
class="search-section__panel js-accordion-panel"
hidden aria-hidden="true">
<div class="search-base-content">
<div class="search-base-item">
<h4 class="search-subtitle"><label for="pref-select">撮影地(都道府県)</label></h4>
<div class="select">
<select name="prefectures" id="pref-select">
<option value="">選択</option>
{% if prefectures is not empty %}
{% for prefecture in prefectures %}
<option value="{{prefecture}}"
{% if app.request.query.get('prefectures') and prefecture == app.request.query.get('prefectures') %}
selected
{% endif %}
>{{prefecture}}</option>
{% endfor %}
{% else %}
<option value="">該当なし</option>
{% endif %}
</select>
</div>
</div>
<div class="search-base-item">
<h4 class="search-subtitle"><label for="period-select">年代</label></h4>
<div class="select">
<select name="photographing_period" id="period-select" >
<option value="">選択</option>
{% if photographing_periods is not empty %}
{% for photographing_period in photographing_periods |sort %}
<option value="{{photographing_period}}"
{% if app.request.query.get('photographing_period') and photographing_period == app.request.query.get('photographing_period') %}
selected
{% endif %}
>{{photographing_period}}</option>
{% endfor %}
{% else %}
<option value="">該当なし</option>
{% endif %}
</select>
</div>
</div>
</div>
<div class="search-filter-content">
<h4 class="search-subtitle"><legend>撮影アングル</legend></h4>
<div class="search-filter-list">
{% if camera_angles is not empty %}
{% for camera_angle in camera_angles %}
<label class="filter-checkbox-item">
<input type="checkbox" name="camera_angles[]" value="{{camera_angle}}"
{% if app.request.query.get('camera_angles') and camera_angle in app.request.query.get('camera_angles') %}
checked
{% endif %}
>{{camera_angle}}
</label>
{% endfor %}
{% else %}
<p>該当する検索候補がありません。</p>
{% endif %}
</div>
<h4 class="search-subtitle"><legend>カラー種別</legend></h4> {# id属性名・サブタイトル仮置き #}
<div class="search-filter-list">
{% if color_types is not empty %}
{% for color_type in color_types %}
<label class="filter-checkbox-item">
<input type="checkbox" name="color_types[]" value="{{color_type}}"
{% if app.request.query.get('color_types') and color_type in app.request.query.get('color_types') %}
checked
{% endif %}
>{{color_type}}
</label>
{% endfor %}
{% else %}
<p>該当する検索候補がありません。</p>
{% endif %}
</div>
</div>
<div class="sp-center">
<button type="submit" class="category-btn word-search">
<img src="{{ asset('/html/user_data/assets/icon/btn_ic_search.svg ', 'user_data') }}" alt="お気に入り">
検索
</button>
</div>
</div>
</section>
</div>
{% if app.request.query.get('category_id') or app.request.query.get('search_parent_id') %}
<input type="hidden" name="category_id" value="{{ app.request.query.get('category_id') ?: app.request.query.get('search_parent_id') }}">
{% endif%}
</form>
{% endif %}
<section class="contents-list" id="contents-list">
<!-- 商品リスト -->
<div class="list-view">
<div class="list-title">
<div class="list-title-left">
{#カテゴリが存在する場合(通常の検索)#}
{% if app.request.query.get('category_id') %}
<h2 class="ec-topicpath__title">{{ Category.name }}<span>の写真</span></h2>
{% if search_form.vars.value.name %}
<p class="ec-topicpath__item"> > {{ search_form.vars.value.name }}</p>
{% endif %}
{% if app.request.query.get('prefectures') %}
<p class="ec-topicpath__item"> > {{app.request.query.get('prefectures')}}</p>
{% endif %}
{% if app.request.query.get('operator') %}
<p class="ec-topicpath__item"> > {{app.request.query.get('operator')}}</p>
{% endif %}
{% if app.request.query.get('photographing_period') %}
<p class="ec-topicpath__item"> > {{app.request.query.get('photographing_period')}}</p>
{% endif %}
{% if app.request.query.get('locations') %}
<p class="ec-topicpath__item">
{% for location in app.request.query.get('locations') %}
{% if loop.first %}
> {{ location }}
{% else %}
<span class="ec-topicpath__item">・{{ location }}</span>
{% endif %}
{% endfor %}
</p>
{% endif %}
{% if app.request.query.get('weathers') %}
<p class="ec-topicpath__item">
{% for weather in app.request.query.get('weathers') %}
{% if loop.first %}
> {{ weather }}
{% else %}
<span class="ec-topicpath__item">・{{ weather }}</span>
{% endif %}
{% endfor %}
</p>
{% endif %}
{% if app.request.query.get('camera_angles') %}
<p class="ec-topicpath__item">
{% for camera_angle in app.request.query.get('camera_angles') %}
{% if loop.first %}
> {{ camera_angle }}
{% else %}
<span class="ec-topicpath__item">・{{ camera_angle }}</span>
{% endif %}
{% endfor %}
</p>
{% endif %}
{% if app.request.query.get('color_types') %}
<p class="ec-topicpath__item">
{% for color_type in app.request.query.get('color_types') %}
{% if loop.first %}
> {{ color_type }}
{% else %}
<span class="ec-topicpath__item">・{{ color_type }}</span>
{% endif %}
{% endfor %}
</p>
{% endif %}
{% if app.request.query.get('features') %}
<p class="ec-topicpath__item">
{% for feature in app.request.query.get('features') %}
{% if loop.first %}
> {{ feature }}
{% else %}
<span class="ec-topicpath__item">・{{ feature }}</span>
{% endif %}
{% endfor %}
</p>
{% endif %}
{% else %}
{#通常の全体検索#}
{% if search_form.vars.value.name %}
<div>
<h2 class="ec-topicpath__title">「{{ search_form.vars.value.name }}」<span style="padding: 0;">で検索</span></h2>
</div>
{% else %}
{#全体を表示#}
<h2 class="ec-topicpath__title">すべての写真</h2>
{% endif %}
{% endif %}
</div>
<div class="list-title-right">
{% if pagination.totalItemCount > 0 %}
{% set start = ((pagination.currentPageNumber - 1) * pagination.getItemNumberPerPage) + 1 %}
{% else %}
{% set start = 0 %}
{% endif %}
{% set end = min(pagination.currentPageNumber * pagination.getItemNumberPerPage, pagination.totalItemCount) %}
<p>({{ pagination.totalItemCount }}件中{{ start }}件-{{ end }}件を表示)</p>
</div>
</div>
<!-- カテゴリ説明 -->
{#デザインにないため、いったんコメントアウト#}
{#<p class="lead-sentence">#}
{# <button type="submit" class="category-btn-list word-search" name="search_parent_id" value="1">#}
{# JR埼京線#}
{# </button>#}
{# <button type="submit" class="category-btn-list word-search" name="search_parent_id" value="2">#}
{# SL#}
{# </button>#}
{#</p>#}
<!-- リストエリア -->
{% if pagination.totalItemCount > 0 %}
<div>
<div class="list-area">
{% for Product in pagination %}
<div class="card-1">
<a href="{{ url('photo-product_detail', {'id': Product.id}) }}">
<div class="image-wrapper">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
{% if Product.getPrice02IncTaxMin == 0 %}
<div class="label-free">無料</div>
{% endif %}
</div>
{#デザインにないため、いったんコメントアウト#}
{#<h3>{{ Product.name }}</h3>#}
{#<p class="price02-default">#}
{# {{ Product.getPrice02IncTaxMin|price }}<span class="tax">(税込)</span>#}
{#</p>#}
</a>
</div>
{% endfor %}
</div>
<!-- ページネーション -->
{% set pages = pagination.paginationData %}
{% if pages.pageCount > 1 %}
<div class="ec-pager pagination">
{# 前へ #}
{% if pages.previous is defined %}
<a class="page-return" href="{{ path(
app.request.attributes.get('_route'),
app.request.query.all|merge({'pageno': pages.previous})) }}#contents-list">←</a>
{% endif %}
<div class="page-num">
{% for page in pages.pagesInRange %}
{% if page == pages.current %}
<a class="active" href="{{ path(
app.request.attributes.get('_route'),
app.request.query.all|merge({'pageno': page})) }}#contents-list"> {{ page }} </a>
{% else %}
<a href="{{ path(
app.request.attributes.get('_route'),
app.request.query.all|merge({'pageno': page})) }}#contents-list"> {{ page }} </a>
{% endif %}
{% endfor %}
</div>
{# 次へ #}
{% if pages.next is defined %}
<a class="page-advance" href="{{ path(
app.request.attributes.get('_route'),
app.request.query.all|merge({'pageno': pages.next})) }}#contents-list">→</a>
{% endif %}
</div>
{% endif %}
</div>
{% else %}
<p class="no_item">{{ 'お探しの商品は見つかりませんでした'|trans }}</p>
{% endif %}
<!-- カテゴリ説明 -->
{#デザインにないため、いったんコメントアウト#}
{#<p class="lead-sentence">#}
{# <button type="submit" class="category-btn-list word-search" name="search_parent_id" value="1">#}
{# JR埼京線#}
{# </button>#}
{# <button type="submit" class="category-btn-list word-search" name="search_parent_id" value="2">#}
{# SL#}
{# </button>#}
{#</p>#}
</div>
</section>
{% endblock %}