app/template/user_data/photo-product_list.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% extends 'default_frame.twig' %}
  9. {% block stylesheet %}
  10.     <link rel="stylesheet" href="{{ asset('assets/css/stock-photo/contents-list.css', 'user_data') }}">
  11.     <link rel="stylesheet" href="{{ asset('assets/css/stock-photo/main_module.css', 'user_data') }}">
  12.     <style>
  13.     .ec-topicpath{
  14.         display: flex;
  15.         flex-wrap: wrap;
  16.         margin: 30px 10% 0;
  17.     }
  18.     .ec-topicpath a{
  19.         color: #109F98;
  20.     }
  21.     .ec-topicpath__divider{
  22.         margin: 0 5px;
  23.     }
  24.     
  25.         .category-btn img{
  26.             margin-right: 15px;
  27.         }
  28.         .tab {
  29.             margin: 30px 15% 0;
  30.         }
  31.         
  32.         @media screen and (max-width:768px){
  33.             .tab {
  34.                 margin: 10px 3% 20px 3%;
  35.             }
  36.         }
  37.         
  38.         .lead-sentence {
  39.             display: flex;
  40.             flex-wrap: wrap;
  41.         }
  42.         
  43.         @media screen and (max-width:768px){
  44.             .tab img{
  45.                 width: 15%;
  46.             }
  47.             .category-btn{
  48.                 margin-bottom: 15px;
  49.             }
  50.         }
  51.         .tab-list {
  52.             display: flex;
  53.             gap: 1px;
  54.         }
  55.         @media screen and (max-width:768px){
  56.             .tab-list{
  57.                 flex-direction: row;
  58.             }
  59.         }
  60.         .tab-item {
  61.             border-radius: 5px 5px 0 0;
  62.             background-color: #109F98;
  63.             border-top: solid 1px #109F98;
  64.             border-right: solid 1px #109F98;
  65.             border-left: solid 1px #109F98;
  66.         }
  67.         .tab-item a{
  68.             color: #FFF;
  69.             padding: 0.5em 1.2em;
  70.             display: block;
  71.         }
  72.         @media screen and (max-width:768px){
  73.             .tab-item{
  74.                 flex: 1 1 auto;
  75.                 min-width: 0;
  76.             }
  77.             
  78.             .tab-item a{
  79.                 margin: 8px 0;
  80.                 text-align: center;
  81.                 white-space: nowrap;
  82.                 padding: 0.4em 0.6em;
  83.             }
  84.         }
  85.         
  86.         @media screen and (max-width:570px){
  87.             .tab-item{
  88.                 font-size: 12px;
  89.                 line-height: 2.5;
  90.             }
  91.         }
  92.         
  93.         @media screen and (max-width:450px){
  94.             .tab-item{
  95.                 font-size: 10px;
  96.             }
  97.         }
  98.         .tab-content:has(.tab-panel.active){
  99.             display: flex;
  100.             justify-content: space-between;
  101.             border-top:solid 1px #109F98;
  102.             border-right:solid 1px #109F98;
  103.             border-left:solid 1px #109F98;
  104.             border-radius: 0 8px 0 0;
  105.         }
  106.         
  107.         .tab-content:not(:has(.tab-panel.active)){
  108.             display: none;
  109.         }
  110.         
  111.         @media screen and (max-width:768px){
  112.             .tab-content{
  113.                 flex-direction: column;
  114.                 border-radius: 0;
  115.             }
  116.         }
  117.         .tab-panel {
  118.             display: none;
  119.         }
  120.         .tab-item.active {
  121.             background-color: #fff;
  122.             font-weight: bold;
  123.             position: relative;
  124.         }
  125.         
  126.         .tab-item.active a{
  127.             color: #109F98;
  128.         }
  129.         
  130.         .tab-item.active::before{
  131.             content: "";
  132.             width: 100%;
  133.             border-bottom: 4px solid  #FFF;
  134.             position: absolute;
  135.             bottom: -3px;
  136.             left: 0;
  137.         }
  138.         .tab-panel.active {
  139.             display: flex;
  140.             padding: 3%;
  141.             flex-wrap: wrap;
  142.             gap:20px 20px;
  143.             flex: 10;
  144.         }
  145.         @media screen and (max-width:768px){
  146.             .tab-panel.active{
  147.                 justify-content: center;
  148.                 
  149.             }
  150.         }
  151.         .tab-panel.active h2 {
  152.             font-size: 20px;
  153.             font-weight: bold;
  154.         }
  155.         
  156.         .search-form-box{
  157.             border: solid 1px #109F98;
  158.             border-radius: 0 0 8px 8px;
  159.         }
  160.         
  161.         .tab-content:not(:has(.active)) + .search-form-box{
  162.             border-radius: 0 8px 8px 8px;
  163.         }
  164.         @media screen and (max-width:768px){
  165.             .search-form-box .search-form-content{
  166.                 display: flex;
  167.                 justify-content: space-between;
  168.                 flex-direction: column;
  169.                 
  170.             }
  171.         }
  172.         .search-form-box .search-form-item{
  173.             margin-left: 3%;
  174.             margin-right: calc(3% + 20px);
  175.         }
  176.         @media screen and (max-width:768px){
  177.             .search-form-box .search-form-item{
  178.                 margin: 0 auto;
  179.                 
  180.             }
  181.         }
  182.         
  183.         .search-form-box .search-form-input{
  184.             -webkit-appearance: none;
  185.             -moz-appearance:none;
  186.             appearance: none;
  187.             border:1px solid #109F98;
  188.             border-radius:25px;
  189.             width: 100%;
  190.             padding-left: 20px;
  191.             height: 36px;
  192.             background-color: #f5f5f5;
  193.         }
  194.         @media screen and (max-width:768px){
  195.             .search-form-box .search-form-input{
  196.                 width: 88vw;
  197.                 box-sizing: border-box;
  198.             }
  199.             .search-form-box .search-form-input::placeholder{
  200.                 font-size: 2vw;
  201.             }
  202.         }
  203.         
  204.         select{
  205.             background:none;
  206.             appearance: none;
  207.             font:inherit;
  208.             padding:9.5px 10px;
  209.             border:1px solid #109F98;
  210.             box-sizing: border-box;
  211.             width: 250px;
  212.             border-radius:2px;
  213.             color: #111111;
  214.         }
  215.         
  216.         .select {
  217.           display: inline-block;
  218.           position: relative;
  219.           vertical-align: middle;
  220.           width: 100%;
  221.         }
  222.         
  223.         .select::before {
  224.           position: absolute;
  225.           top: 18px;
  226.           right: 16px;
  227.           width: 0;
  228.           height: 0;
  229.           border-width: 10px 5px 0 5px;
  230.           border-style: solid;
  231.           border-color: #109F98 transparent transparent transparent;
  232.           content: "";
  233.           pointer-events: none;
  234.         }
  235.         
  236.         /*検索セクション内にあるアイコン(svg)カラー指定*/
  237.         .search-form-box .ic {
  238.             filter: brightness(0) saturate(100%) invert(68%) sepia(68%) saturate(6159%) hue-rotate(145deg) brightness(90%) contrast(87%);
  239.         }
  240.         
  241.         /* 各条件見出し位置調整 */
  242.         .search-form-box .search-title {
  243.             padding: 15px 0 12px 0;
  244.             margin: 0 3%;
  245.             display: flex;
  246.             align-items: center;
  247.             gap: 6px;
  248.             color: #111111;
  249.         }
  250.         
  251.         /*セクション分け用のボーダー*/
  252.         .search-form-box .search-title {
  253.             border-top: 1px solid #D5DAED;
  254.         }
  255.         /*1番目(フリーワード検索)には不要なので非表示*/
  256.         .search-form-box .search-title:first-child {
  257.             border-top: none;
  258.         }
  259.         
  260.         .search-subtitle {
  261.             margin: 16px 0;
  262.         }
  263.         
  264.         /*各条件の副題にh2のトーン寄せ*/
  265.         .search-subtitle label,
  266.         .search-subtitle legend {
  267.             border: solid 2px #109F98;
  268.             border-right: none;
  269.             border-top: none;
  270.             border-bottom: none;
  271.             text-align: left;
  272.             padding: 0 0 0 8px;
  273.             color: #111111;
  274.         }
  275.         
  276.         .search-base-content,
  277.         .search-filter-content {
  278.             margin: 0 3% 3% 3%;
  279.             
  280.         }
  281.         
  282.         /*基本条件*/
  283.         .search-base-content {
  284.             display: flex;
  285.             flex-direction: row;
  286.             gap: 16px;
  287.         }
  288.         
  289.         /* 上記でselectに指定しているスタイルを基本条件用に上書き */
  290.         .search-base-item select {
  291.             border: 1px solid #D5DAED;
  292.         }
  293.         
  294.         @media (max-width: 768px) {
  295.             .search-base-item select {
  296.                 display: flex;
  297.                 flex-wrap: wrap;
  298.             }
  299.             
  300.             .search-base-item {
  301.                 flex: 1 1 200px;
  302.                 max-width: 100%;
  303.             }
  304.             
  305.             .search-base-item select {
  306.                 width: 100%;
  307.             }
  308.         }
  309.         
  310.         .search-filter-list {
  311.           display: flex;
  312.           flex-wrap: wrap;
  313.           gap: 10px;
  314.         }
  315.         
  316.         /*詳細フィルターのチェックボックス並べる数*/
  317.         /*PC表示:10個のチェックボックスが横に5個 × 2行*/
  318.         /*スマホ表示:10個のチェックボックスが横に3個 × 約4行(1個余りになるため)*/
  319.         .filter-checkbox-item {
  320.           display: flex;
  321.           align-items: center;
  322.           gap: 6px;
  323.           align-items: baseline;
  324.           width: calc(100% / 5 - 10px); /* PC: 5列 */
  325.           color: #111111;
  326.         }
  327.         
  328.         @media (max-width: 768px) {
  329.             .filter-checkbox-item {
  330.                 width: calc(100% / 3 - 10px); /* SP: 3列 */
  331.             }
  332.         }
  333.         
  334.         @media (max-width: 450px) {
  335.             .filter-checkbox-item {
  336.                 font-size: max(3.6vw, 12px);
  337.             }
  338.         }
  339.         
  340.         .image-wrapper {
  341.             position: relative;
  342.         }
  343.         .label-free {
  344.             position: absolute;
  345.             top: 0;
  346.             right: 0;
  347.             background-color: #e60012;
  348.             color: #fff;
  349.             font-weight: bold;
  350.             font-size: 14px;
  351.             padding: 3px 10px;
  352.             border-radius: 0 0 0 4px;
  353.             z-index: 1;
  354.         }
  355.         .ec-topicpath__item{
  356.         font-size: 17px;
  357.         }
  358.         
  359.         /* ▼ アコーディオン用 追加CSS ▼ */
  360.         :root{
  361.           --acc-green: #109F98;
  362.           --acc-line:  #0f8a80;
  363.         }
  364.         
  365.         .search-section + .search-section{
  366.           border-top: 1px solid var(--acc-line);
  367.         }
  368.         
  369.         .search-section__header{
  370.           display: flex;
  371.           align-items: center;
  372.           justify-content: space-between;
  373.           padding: 8px 12px;
  374.         }
  375.         
  376.         .accordion-toggle{
  377.           inline-size: 28px;
  378.           block-size: 28px;
  379.           display: grid;
  380.           place-items: center;
  381.           position: relative;
  382.           cursor: pointer;
  383.           border: 1px solid var(--acc-green);
  384.           border-radius: 4px;
  385.           background: var(--acc-green);
  386.         }
  387.         
  388.         .accordion-toggle::before{
  389.           content: "";
  390.           display: block;
  391.           inline-size: 8px;
  392.           block-size: 8px;
  393.           border-right: 2px solid #fff;
  394.           border-bottom: 2px solid #fff;
  395.           transform: rotate(45deg); /* ▼ */
  396.           transition: transform .2s ease;
  397.         }
  398.         
  399.         .is-open .accordion-toggle{
  400.           background: #fff;
  401.           border-color: var(--acc-green);
  402.         }
  403.         
  404.         .is-open .accordion-toggle::before{
  405.           border-right-color: var(--acc-green);
  406.           border-bottom-color: var(--acc-green);
  407.           transform: rotate(-135deg); /* ▲ */
  408.         }
  409.         
  410.         .search-section__panel{
  411.           padding: 12px;
  412.         }
  413.         
  414.         .visually-hidden{
  415.           position: absolute !important;
  416.           inline-size: 1px;
  417.           block-size: 1px;
  418.           margin: -1px;
  419.           padding: 0;
  420.           border: 0;
  421.           clip: rect(0 0 0 0);
  422.           overflow: hidden;
  423.         }
  424.         
  425.         .accordion-toggle:hover{ filter: brightness(0.98); }
  426.         .accordion-toggle:focus-visible{
  427.           outline: 2px solid var(--acc-line);
  428.           outline-offset: 2px;
  429.         }
  430.         
  431.         /* SPだけボタンを中央寄せ */
  432.         @media (max-width: 840px){
  433.           .sp-center{
  434.             display: flex;
  435.             justify-content: center;
  436.           }
  437.         }
  438.     </style>
  439. {% endblock %}
  440. {% set body_class = 'product_page' %}
  441. {% block javascript %}
  442.     <script>
  443.         eccube.productsClassCategories = {
  444.             {% for Product in pagination %}
  445.             "{{ Product.id|escape('js') }}": {{ class_categories_as_json(Product)|raw }}{% if loop.last == false %}, {% endif %}
  446.             {% endfor %}
  447.         };
  448.         $(function() {
  449.             // 表示件数を変更
  450.             $('.disp-number').change(function() {
  451.                 var dispNumber = $(this).val();
  452.                 $('#disp_number').val(dispNumber);
  453.                 $('#pageno').val(1);
  454.                 $("#form1").submit();
  455.             });
  456.             // // 並び順を変更
  457.             $('.order-by').change(function() {
  458.                 var orderBy = $(this).val();
  459.                 $('#orderby').val(orderBy);
  460.                 $('#pageno').val(1);
  461.                 $("#form1").submit();
  462.             });
  463.             $('.add-cart').on('click', function(e) {
  464.                 var $form = $(this).parents('li').find('form');
  465.                 // 個数フォームのチェック
  466.                 var $quantity = $form.parent().find('.quantity');
  467.                 if ($quantity.val() < 1) {
  468.                     $quantity[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
  469.                     setTimeout(function() {
  470.                         loadingOverlay('hide');
  471.                     }, 100);
  472.                     return true;
  473.                 } else {
  474.                     $quantity[0].setCustomValidity('');
  475.                 }
  476.                 e.preventDefault();
  477.                 $.ajax({
  478.                     url: $form.attr('action'),
  479.                     type: $form.attr('method'),
  480.                     data: $form.serialize(),
  481.                     dataType: 'json',
  482.                     beforeSend: function(xhr, settings) {
  483.                         // Buttonを無効にする
  484.                         $('.add-cart').prop('disabled', true);
  485.                     }
  486.                 }).done(function(data) {
  487.                     // レスポンス内のメッセージをalertで表示
  488.                     $.each(data.messages, function() {
  489.                         $('#ec-modal-header').html(this);
  490.                     });
  491.                     $('.ec-modal').show()
  492.                     // カートブロックを更新する
  493.                     $.ajax({
  494.                         url: '{{ url('block_cart') }}',
  495.                         type: 'GET',
  496.                         dataType: 'html'
  497.                     }).done(function(html) {
  498.                         $('.ec-headerRole__cart').html(html);
  499.                     });
  500.                 }).fail(function(data) {
  501.                     alert('{{ 'カートへの追加に失敗しました。'|trans }}');
  502.                 }).always(function(data) {
  503.                     // Buttonを有効にする
  504.                     $('.add-cart').prop('disabled', false);
  505.                 });
  506.             });
  507.         });
  508.         $('.ec-modal-wrap').on('click', function(e) {
  509.             // モーダル内の処理は外側にバブリングさせない
  510.             e.stopPropagation();
  511.         });
  512.         $('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function() {
  513.             $('.ec-modal').hide()
  514.         });
  515.         
  516.     </script>
  517.     <script>
  518.     //  絞り込み検索は、絞り込み検索ボタンが押されたとき、もしくは入力欄にフォーカスされたときに、
  519.     //  enterを押したときのみ発動する。カテゴリ検索を押したときは発火させない
  520.         document.addEventListener('DOMContentLoaded', function () {
  521.             const form = document.querySelector('.tab');
  522.             const categoryBtn = form.querySelector('button[name="search_parent_id"]:not(.word-search)');
  523.             const wordBtn = form.querySelector('.category-btn.word-search');
  524.             const wordInput = form.querySelector('input.search-form-input');
  525.         
  526.             // カテゴリ検索 → name を送らせない
  527.             categoryBtn.addEventListener('click', function () {
  528.                 if (wordInput) {
  529.                     wordInput.disabled = true;
  530.                 }
  531.             });
  532.         
  533.             // 絞り込み検索 → name を有効化
  534.             wordBtn?.addEventListener('click', function () {
  535.                 if (wordInput) {
  536.                     wordInput.disabled = false;
  537.                 }
  538.             });
  539.         
  540.             // Enterキーで submit 時に絞り込み検索の値を送信するための hidden input 挿入
  541.             form.addEventListener('submit', function (e) {
  542.                 if (document.activeElement === wordInput) {
  543.                     e.preventDefault();
  544.         
  545.                     // 既に存在していたら除去(2重防止)
  546.                     const existingHidden = form.querySelector('input[name="search_parent_id"].auto-injected');
  547.                     if (existingHidden) {
  548.                         existingHidden.remove();
  549.                     }
  550.         
  551.                     // ボタンのvalue属性をそのまま使う
  552.                     const valueFromButton = wordBtn?.getAttribute('value') || '';
  553.         
  554.                     const hidden = document.createElement('input');
  555.                     hidden.type = 'hidden';
  556.                     hidden.name = 'search_parent_id';
  557.                     hidden.value = valueFromButton;
  558.                     hidden.classList.add('auto-injected');
  559.                     form.appendChild(hidden);
  560.                     if (wordInput) {
  561.                         wordInput.disabled = false;
  562.                     }
  563.                     form.submit();
  564.                 }
  565.             });
  566.         });
  567.         
  568.         // カテゴリの詳細検索に値が入っていない場合、buttonのnameの値をcategory_idに変更する
  569.         // document.addEventListener('DOMContentLoaded', function () {
  570.         //     const form = document.querySelector('.tab');
  571.         //     const submitBtn = form.querySelector('button.category-btn');
  572.         //     const categorySelects = form.querySelectorAll('select[name="category_ids[]"]');
  573.         
  574.         //     form.addEventListener('submit', function (e) {
  575.         //         // category_ids[] に選択されている値が1つもない場合、ボタンのnameを変更
  576.         //         const hasValue = Array.from(categorySelects).some(select => select.value && select.value !== '');
  577.         
  578.         //         if (!hasValue) {
  579.         //             submitBtn.setAttribute('name', 'category_id');
  580.         //         } else {
  581.         //             submitBtn.setAttribute('name', 'search_parent_id');
  582.         //         }
  583.         //     });
  584.         // });
  585.     </script>
  586.     
  587.     <script>
  588.         (function () {
  589.           function setState(section, open) {
  590.             const btn   = section.querySelector('.js-accordion-toggle');
  591.             const panel = section.querySelector('.js-accordion-panel');
  592.             section.classList.toggle('is-open', open);
  593.             btn.setAttribute('aria-expanded', open ? 'true' : 'false');
  594.             panel.toggleAttribute('hidden', !open);
  595.             panel.setAttribute('aria-hidden', open ? 'false' : 'true');
  596.           }
  597.         
  598.           document.querySelectorAll('.search-form-box').forEach(function (box) {
  599.             // このフォーム(タブ)に属する2つのアコーディオン
  600.             const sections = box.querySelectorAll('.js-accordion');
  601.             if (!sections.length) return;
  602.         
  603.             const key = location.pathname + '#panel=' + (box.dataset.panel || 'default') + ':openId';
  604.         
  605.             // 初期オープン対象:保存 > data-open="1" > 先頭(=フリーワードを想定)
  606.             const savedId = sessionStorage.getItem(key);
  607.             let initial = Array.from(sections).find(s => s.id === savedId)
  608.                        || Array.from(sections).find(s => s.dataset.open === '1')
  609.                        || sections[0];
  610.         
  611.             // 初期反映
  612.             sections.forEach(s => setState(s, s === initial));
  613.             sessionStorage.setItem(key, initial.id);
  614.         
  615.             sections.forEach(function (sec) {
  616.               const btn = sec.querySelector('.js-accordion-toggle');
  617.               btn.addEventListener('click', function () {
  618.                 if (sec.classList.contains('is-open')) return;
  619.         
  620.                 sections.forEach(s => setState(s, s === sec));
  621.                 sessionStorage.setItem(key, sec.id);
  622.               });
  623.             });
  624.           });
  625.         })();
  626.     </script>
  627. {% endblock %}
  628. {% block main %}
  629.     {% set AllCategories = repository('Eccube\\Entity\\Category').getList() %}
  630.     {% set Categories = AllCategories|filter(c => c.id is not null and c.id == 18) %}
  631.     {% set selected_categories = app.request.query.get('category_ids', []) %}
  632.     {% set parent_category = app.request.query.get('search_parent_id') %}
  633.     {#パンくず#}
  634.         <div class="ec-searchnavRole__topicpath pc">
  635.             <ol class="ec-topicpath">
  636.                 <li class="ec-topicpath__item"><a href="{{ url('photo-product_list') }}">{{ 'front.product.all_category'|trans }}</a>
  637.                 </li>
  638.                 {% if Category is not null %}
  639.                     {% for Path in Category.path %}
  640.                         {% if not loop.first %} 
  641.                             <li class="ec-topicpath__divider">></li>
  642.                             <li class="ec-topicpath__item{% if loop.last %}--active{% endif %}">
  643.                                 <a href="{{ url('photo-product_list') }}?category_id={{ Path.id }}#contents-list">{{ Path.name }}</a>
  644.                             </li>
  645.                         {% endif %}
  646.                     {% endfor %}
  647.                 {% endif %}
  648.               {#  {% if selected_categories is not empty %}#}
  649.               {#  {% set first_matched = true %}#}
  650.                     {#{% for Category in Categories %}#}
  651.                     {#    {% for children in Category.Children %}#}
  652.                     {#        {% if children.id == parent_category %}#}
  653.                     {#            <li class="ec-topicpath__divider">></li>#}
  654.                     {#            <li><a href="{{ url('photo-product_list') }}?category_id={{ children.id }}">{{ children.name }}</a></li>#}
  655.                     {#        {% endif %}#}
  656.                     {#            {% for grandChildren in children.Children %}#}
  657.               {#                      {% for grandgrandChild in grandChildren.Children %}#}
  658.               {#                          {% if grandgrandChild.id in selected_categories %}#}
  659.               {#                              {% if first_matched %}#}
  660.               {#                                  <li class="ec-topicpath__divider">></li>#}
  661.               {#                                  <li><a href="{{ url('photo-product_list') }}?category_ids[]={{ grandgrandChild.id }}&search_parent_id={{parent_category}}">{{ grandgrandChild.name }}</a></li>#}
  662.               {#                                  {% set first_matched = false %}#}
  663.               {#                              {% else %}#}
  664.               {#                                  <li><a href="{{ url('photo-product_list') }}?category_ids[]={{ grandgrandChild.id }}&search_parent_id={{parent_category}}">・{{ grandgrandChild.name }}</a></li>#}
  665.               {#                              {% endif %}#}
  666.               {#                          {% endif %}#}
  667.               {#                      {% endfor %}#}
  668.               {#                  {% endfor %}#}
  669.               {#              {% endfor %}#}
  670.               {#      {% endfor %}#}
  671.               {#  {% endif %}#}
  672.               
  673.                 {#検索ワード#}
  674.                 {% if search_form.vars.value.name %}
  675.                     <li class="ec-topicpath__divider">></li>
  676.                     <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>
  677.                 {% endif %}
  678.                 
  679.                 {#撮影地(都道府県)#}
  680.                 {% if app.request.query.get('prefectures') %}
  681.                     <li class="ec-topicpath__divider">></li>
  682.                     <li class="ec-topicpath__item">
  683.                         <a href="{{ url('photo-product_list', {
  684.                             'category_id': app.request.query.get('category_id'),
  685.                             'prefectures': app.request.query.get('prefectures')
  686.                         }) }}#contents-list">
  687.                             {{app.request.query.get('prefectures')}}
  688.                         </a>
  689.                     </li>
  690.                 {% endif %}
  691.                 
  692.                 {#運行会社#}
  693.                 {% if app.request.query.get('operator') %}
  694.                     <li class="ec-topicpath__divider">></li>
  695.                     <li class="ec-topicpath__item">
  696.                             <a href="{{ url('photo-product_list', {
  697.                                 'category_id': app.request.query.get('category_id'),
  698.                                 'operator': app.request.query.get('operator')
  699.                             }) }}#contents-list">
  700.                                 {{app.request.query.get('operator')}}
  701.                             </a>
  702.                     </li>
  703.                 {% endif %}
  704.                 
  705.                 {#撮影年代#}
  706.                 {% if app.request.query.get('photographing_period') %}
  707.                     <li class="ec-topicpath__divider">></li>
  708.                     <li class="ec-topicpath__item">
  709.                             <a href="{{ url('photo-product_list', {
  710.                                 'category_id': app.request.query.get('category_id'),
  711.                                 'operator': app.request.query.get('photographing_period')
  712.                             }) }}#contents-list">
  713.                                 {{app.request.query.get('photographing_period')}}
  714.                             </a>
  715.                     </li>
  716.                 {% endif %}
  717.                 {#撮影地#}
  718.                 {% if app.request.query.get('locations') %}
  719.                     {% for location in app.request.query.get('locations') %}
  720.                             {% if loop.first %}
  721.                                 <li class="ec-topicpath__divider">></li>
  722.                             {% else %}
  723.                                 <li class="ec-topicpath__divider">・</li>
  724.                             {% endif %}
  725.                                 <li>
  726.                                     <a href="{{ url('photo-product_list', {
  727.                                         'category_id': app.request.query.get('category_id'),
  728.                                         'locations[]': location
  729.                                     }) }}#contents-list">
  730.                                         {{ location }}
  731.                                     </a>
  732.                                 </li>
  733.                     {% endfor %}
  734.                 {% endif %}
  735.                 
  736.                 {#撮影天候#}
  737.                 {% if app.request.query.get('weathers') %}
  738.                     {% for weather in app.request.query.get('weathers') %}
  739.                             {% if loop.first %}
  740.                                 <li class="ec-topicpath__divider">></li>
  741.                             {% else %}
  742.                                 <li class="ec-topicpath__divider">・</li>
  743.                             {% endif %}
  744.                                 <li>
  745.                                     <a href="{{ url('photo-product_list', {
  746.                                         'category_id': app.request.query.get('category_id'),
  747.                                         'weathers[]': weather
  748.                                     }) }}#contents-list">
  749.                                         {{ weather }}
  750.                                     </a>
  751.                                 </li>
  752.                     {% endfor %}
  753.                 {% endif %}
  754.                 {#撮影アングル#}
  755.                 {% if app.request.query.get('camera_angles') %}
  756.                     {% for camera_angle in app.request.query.get('camera_angles') %}
  757.                             {% if loop.first %}
  758.                                 <li class="ec-topicpath__divider">></li>
  759.                             {% else %}
  760.                                 <li class="ec-topicpath__divider">・</li>
  761.                             {% endif %}
  762.                                 <li>
  763.                                     <a href="{{ url('photo-product_list', {
  764.                                         'category_id': app.request.query.get('category_id'),
  765.                                         'camera_angles[]': camera_angle
  766.                                     }) }}#contents-list">
  767.                                         {{ camera_angle }}
  768.                                     </a>
  769.                                 </li>
  770.                     {% endfor %}
  771.                 {% endif %}
  772.                 {#撮影方式#}
  773.                 {% if app.request.query.get('color_types') %}
  774.                     {% for color_type in app.request.query.get('color_types') %}
  775.                             {% if loop.first %}
  776.                                 <li class="ec-topicpath__divider">></li>
  777.                             {% else %}
  778.                                 <li class="ec-topicpath__divider">・</li>
  779.                             {% endif %}
  780.                                 <li>
  781.                                     <a href="{{ url('photo-product_list', {
  782.                                         'category_id': app.request.query.get('category_id'),
  783.                                         'color_types[]': color_type
  784.                                     }) }}#contents-list">
  785.                                         {{ color_type }}撮影
  786.                                     </a>
  787.                                 </li>
  788.                     {% endfor %}
  789.                 {% endif %}
  790.                 {#一押し#}
  791.                 {% if app.request.query.get('features') %}
  792.                     {% for feature in app.request.query.get('features') %}
  793.                             {% if loop.first %}
  794.                                 <li class="ec-topicpath__divider">></li>
  795.                             {% else %}
  796.                                 <li class="ec-topicpath__divider">・</li>
  797.                             {% endif %}
  798.                                 <li>
  799.                                     <a href="{{ url('photo-product_list', {
  800.                                         'category_id': app.request.query.get('category_id'),
  801.                                         'features[]': feature
  802.                                     }) }}#contents-list">
  803.                                         {{ feature }}
  804.                                     </a>
  805.                                 </li>
  806.                     {% endfor %}
  807.                 {% endif %}
  808.             </ol>
  809.         </div>
  810.     <!-- カテゴリ検索 -->
  811.     {% if app.request.query.get('category_id') or app.request.query.get('search_parent_id') %}
  812.         <form action="{{ path('photo-product_list') }}#contents-list" method="get" class="tab" >
  813.             <ul class="tab-list">
  814.                 {% for tab in Categories%}
  815.                     {% for children in tab.Children %}
  816.                         {% set children_ids = [] %}
  817.                         {% for grandChild in children.Children %}
  818.                             {% set children_ids = children_ids|merge([grandChild.id]) %}
  819.                         {% endfor %}
  820.                             {% if children.id == app.request.query.get('category_id')
  821.                             or children.id == app.request.query.get('search_parent_id')
  822.                             or app.request.query.get('category_id') in children_ids
  823.                             %}
  824.                                 <li class="tab-item active" tabindex="0" id="{{children.id}}">
  825.                                     <a href="{{ url('photo-product_list', {'category_id': children.id}) }}">{{children.name}}</a>
  826.                                 </li>
  827.                             {% else %}
  828.                                 <li class="tab-item" tabindex="0" id="{{children.id}}">
  829.                                     <a href="{{ url('photo-product_list', {'category_id': children.id}) }}">{{children.name}}</a>
  830.                                 </li>
  831.                             {% endif %}
  832.                     {% endfor %}
  833.                 {% endfor %}
  834.             </ul>
  835.             <div class="search-form-box">
  836.                 <section id="freeword" class="search-section js-accordion" data-open="1">
  837.                     <header class="search-section__header">
  838.                         <div class="search-title">
  839.                             <img src="{{ asset('/html/user_data/assets/icon/btn_ic_search.svg ', 'user_data') }}" class="ic" style="width: auto"><h3>フリーワード検索</h3>
  840.                         </div>
  841.                         <button type="button"
  842.                             class="accordion-toggle js-accordion-toggle"
  843.                             aria-controls="freeword-panel"
  844.                             aria-expanded="true"
  845.                             title="閉じる">
  846.                             <span class="visually-hidden">フリーワード検索を開閉</span>
  847.                         </button>
  848.                     </header>
  849.                     <div id="freeword-panel"
  850.                         class="search-section__panel js-accordion-panel"
  851.                         aria-hidden="false">
  852.                         <div class="search-form-content">
  853.                             <div class="search-form-item">
  854.                                 <input type="text" name="name" class="search-form-input"
  855.                                  placeholder="駅名・線路名・形式・撮影者名など自由に検索できます"
  856.                                 {% if search_form.vars.value.name
  857.                                 and (app.request.query.get('search_parent_id') is not empty or app.request.query.get('category_id') is not empty) %}
  858.                                 value="{{ search_form.vars.value.name }}"
  859.                                 {% endif %}
  860.                                 >
  861.                             </div>
  862.                         </div>
  863.                         <div class="sp-center">
  864.                             <button type="submit" class="category-btn word-search">
  865.                                 <img src="{{ asset('/html/user_data/assets/icon/btn_ic_search.svg ', 'user_data') }}" alt="お気に入り">
  866.                                 検索
  867.                             </button>
  868.                         </div>
  869.                     </div>
  870.                 </section>
  871.                 <section id="details" class="search-section js-accordion" data-open="0">
  872.                     <header class="search-section__header">
  873.                         <div class="search-title">
  874.                             <img src="{{ asset('/html/user_data/assets/icon/title_ic_filter.svg ', 'user_data') }}" class="ic" style="width: auto"><h3>詳細フィルター</h3>
  875.                         </div>
  876.                         <button type="button"
  877.                                 class="accordion-toggle js-accordion-toggle"
  878.                                 aria-controls="details-panel"
  879.                                 aria-expanded="false"
  880.                                 title="開く">
  881.                           <span class="visually-hidden">詳細フィルターを開閉</span>
  882.                         </button>
  883.                     </header>
  884.                     <div id="details-panel"
  885.                         class="search-section__panel js-accordion-panel"
  886.                         hidden aria-hidden="true">
  887.                         <div class="search-base-content">
  888.                             <div class="search-base-item">
  889.                                 <h4 class="search-subtitle"><label for="pref-select">撮影地(都道府県)</label></h4>
  890.                                 <div class="select">
  891.                                     <select name="prefectures" id="pref-select">
  892.                                         <option value="">選択</option>
  893.                                         {% if prefectures is not empty %}
  894.                                             {% for prefecture in prefectures %}
  895.                                                 <option value="{{prefecture}}"
  896.                                                 {% if app.request.query.get('prefectures') and prefecture == app.request.query.get('prefectures') %}
  897.                                                     selected
  898.                                                 {% endif %}                                        
  899.                                                 >{{prefecture}}</option>
  900.                                             {% endfor %}
  901.                                         {% else %}
  902.                                             <option value="">該当なし</option>
  903.                                         {% endif %}
  904.                                     </select>
  905.                                 </div>
  906.                             </div>
  907.                             
  908.                             <div class="search-base-item">
  909.                                 <h4 class="search-subtitle"><label for="period-select">年代</label></h4>
  910.                                 <div class="select">
  911.                                     <select name="photographing_period" id="period-select" >
  912.                                         <option value="">選択</option>
  913.                                         {% if photographing_periods is not empty %}
  914.                                             {% for photographing_period in photographing_periods |sort %}
  915.                                                 <option value="{{photographing_period}}"
  916.                                                 {% if app.request.query.get('photographing_period') and photographing_period == app.request.query.get('photographing_period') %}
  917.                                                     selected
  918.                                                 {% endif %}  
  919.                                                 >{{photographing_period}}</option>
  920.                                             {% endfor %}
  921.                                         {% else %}
  922.                                             <option value="">該当なし</option>
  923.                                         {% endif %}
  924.                                     </select>
  925.                                 </div>
  926.                             </div>
  927.                         </div>
  928.                         
  929.                         <div class="search-filter-content">
  930.                             <h4 class="search-subtitle"><legend>撮影アングル</legend></h4> 
  931.                             <div class="search-filter-list">
  932.                                 {% if camera_angles is not empty %}
  933.                                     {% for camera_angle in camera_angles %}
  934.                                         <label class="filter-checkbox-item">
  935.                                             <input type="checkbox" name="camera_angles[]" value="{{camera_angle}}"
  936.                                                 {% if app.request.query.get('camera_angles') and camera_angle in app.request.query.get('camera_angles') %}
  937.                                                     checked
  938.                                                 {% endif %}    
  939.                                             >{{camera_angle}}
  940.                                         </label>
  941.                                     {% endfor %}
  942.                                 {% else %}
  943.                                     <p>該当する検索候補がありません。</p>
  944.                                 {% endif %}
  945.                             </div>
  946.         
  947.                             <h4 class="search-subtitle"><legend>カラー種別</legend></h4> {# id属性名・サブタイトル仮置き #}
  948.                             <div class="search-filter-list">
  949.                                 {% if color_types is not empty %}
  950.                                     {% for color_type in color_types %}
  951.                                         <label class="filter-checkbox-item">
  952.                                             <input type="checkbox" name="color_types[]" value="{{color_type}}"
  953.                                                 {% if app.request.query.get('color_types') and color_type in app.request.query.get('color_types') %}
  954.                                                     checked
  955.                                                 {% endif %}
  956.                                             >{{color_type}}
  957.                                         </label>
  958.                                     {% endfor %}
  959.                                 {% else %}
  960.                                     <p>該当する検索候補がありません。</p>
  961.                                 {% endif %}
  962.                             </div>
  963.                         </div>
  964.                         <div class="sp-center">
  965.                             <button type="submit" class="category-btn word-search">
  966.                                 <img src="{{ asset('/html/user_data/assets/icon/btn_ic_search.svg ', 'user_data') }}" alt="お気に入り">
  967.                                 検索
  968.                             </button>
  969.                         </div>
  970.                     </div>
  971.                 </section>
  972.             </div>
  973.             {% if app.request.query.get('category_id') or app.request.query.get('search_parent_id') %}
  974.                 <input type="hidden" name="category_id" value="{{ app.request.query.get('category_id') ?: app.request.query.get('search_parent_id') }}">
  975.             {% endif%}
  976.         </form>
  977.     {% endif %}
  978. <section class="contents-list" id="contents-list">
  979.     <!-- 商品リスト -->
  980.     <div class="list-view">
  981.         <div class="list-title">
  982.             <div class="list-title-left">
  983.                 {#カテゴリが存在する場合(通常の検索)#}
  984.                 {% if app.request.query.get('category_id') %}
  985.                         <h2 class="ec-topicpath__title">{{ Category.name }}<span>の写真</span></h2>
  986.                         {% if search_form.vars.value.name %}
  987.                             <p class="ec-topicpath__item"> > {{ search_form.vars.value.name }}</p>
  988.                         {% endif %}
  989.                         {% if app.request.query.get('prefectures') %}
  990.                             <p class="ec-topicpath__item"> > {{app.request.query.get('prefectures')}}</p>
  991.                         {% endif %}
  992.                         {% if app.request.query.get('operator') %}
  993.                             <p class="ec-topicpath__item"> > {{app.request.query.get('operator')}}</p>
  994.                         {% endif %}
  995.                         {% if app.request.query.get('photographing_period') %}
  996.                             <p class="ec-topicpath__item"> > {{app.request.query.get('photographing_period')}}</p>
  997.                         {% endif %}
  998.                         {% if app.request.query.get('locations') %}
  999.                             <p class="ec-topicpath__item">
  1000.                             {% for location in app.request.query.get('locations') %}
  1001.                                 {% if loop.first %}
  1002.                                      > {{ location }}
  1003.                                 {% else %}
  1004.                                     <span class="ec-topicpath__item">・{{ location }}</span>
  1005.                                 {% endif %}
  1006.                             {% endfor %}
  1007.                             </p>
  1008.                         {% endif %}
  1009.                         {% if app.request.query.get('weathers') %}
  1010.                             <p class="ec-topicpath__item">
  1011.                             {% for weather in app.request.query.get('weathers') %}
  1012.                                 {% if loop.first %}
  1013.                                      > {{ weather }}
  1014.                                 {% else %}
  1015.                                     <span class="ec-topicpath__item">・{{ weather }}</span>
  1016.                                 {% endif %}
  1017.                             {% endfor %}
  1018.                             </p>
  1019.                         {% endif %}
  1020.                         {% if app.request.query.get('camera_angles') %}
  1021.                             <p class="ec-topicpath__item">
  1022.                             {% for camera_angle in app.request.query.get('camera_angles') %}
  1023.                                 {% if loop.first %}
  1024.                                      > {{ camera_angle }}
  1025.                                 {% else %}
  1026.                                     <span class="ec-topicpath__item">・{{ camera_angle }}</span>
  1027.                                 {% endif %}
  1028.                             {% endfor %}
  1029.                             </p>
  1030.                         {% endif %}
  1031.                         {% if app.request.query.get('color_types') %}
  1032.                             <p class="ec-topicpath__item">
  1033.                             {% for color_type in app.request.query.get('color_types') %}
  1034.                                 {% if loop.first %}
  1035.                                      > {{ color_type }}
  1036.                                 {% else %}
  1037.                                     <span class="ec-topicpath__item">・{{ color_type }}</span>
  1038.                                 {% endif %}
  1039.                             {% endfor %}
  1040.                             </p>
  1041.                         {% endif %}
  1042.                         {% if app.request.query.get('features') %}
  1043.                             <p class="ec-topicpath__item">
  1044.                             {% for feature in app.request.query.get('features') %}
  1045.                                 {% if loop.first %}
  1046.                                      > {{ feature }}
  1047.                                 {% else %}
  1048.                                     <span class="ec-topicpath__item">・{{ feature }}</span>
  1049.                                 {% endif %}
  1050.                             {% endfor %}
  1051.                             </p>
  1052.                         {% endif %}
  1053.                 {% else %}
  1054.                     {#通常の全体検索#}
  1055.                     {% if search_form.vars.value.name %}
  1056.                         <div>
  1057.                             <h2 class="ec-topicpath__title">「{{ search_form.vars.value.name }}」<span style="padding: 0;">で検索</span></h2>
  1058.                         </div>
  1059.                     {% else %}
  1060.                     {#全体を表示#}
  1061.                         <h2 class="ec-topicpath__title">すべての写真</h2>
  1062.                     {% endif %}
  1063.                 {% endif %}
  1064.             </div>
  1065.             <div class="list-title-right">
  1066.                 {% if pagination.totalItemCount > 0 %}
  1067.                     {% set start = ((pagination.currentPageNumber - 1) * pagination.getItemNumberPerPage) + 1 %}
  1068.                 {% else %}
  1069.                     {% set start = 0 %}
  1070.                 {% endif %}
  1071.                 {% set end = min(pagination.currentPageNumber * pagination.getItemNumberPerPage, pagination.totalItemCount) %}
  1072.                 <p>({{ pagination.totalItemCount }}件中{{ start }}件-{{ end }}件を表示)</p>
  1073.             </div>
  1074.         </div>
  1075.         <!-- カテゴリ説明 -->
  1076.         {#デザインにないため、いったんコメントアウト#}
  1077.         {#<p class="lead-sentence">#}
  1078.         {#    <button type="submit" class="category-btn-list word-search" name="search_parent_id" value="1">#}
  1079.   {#              JR埼京線#}
  1080.   {#          </button>#}
  1081.   {#          <button type="submit" class="category-btn-list word-search" name="search_parent_id" value="2">#}
  1082.   {#              SL#}
  1083.   {#          </button>#}
  1084.         {#</p>#}
  1085.         <!-- リストエリア -->
  1086.         {% if pagination.totalItemCount > 0 %}
  1087.             <div>
  1088.                 <div class="list-area">
  1089.                 {% for Product in pagination %}
  1090.                     <div class="card-1">
  1091.                         <a href="{{ url('photo-product_detail', {'id': Product.id}) }}">
  1092.                             <div class="image-wrapper">
  1093.                                 <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
  1094.                                     {% if Product.getPrice02IncTaxMin == 0 %}
  1095.                                         <div class="label-free">無料</div>
  1096.                                     {% endif %}
  1097.                             </div>
  1098.                             {#デザインにないため、いったんコメントアウト#}
  1099.                             {#<h3>{{ Product.name }}</h3>#}
  1100.                             {#<p class="price02-default">#}
  1101.                             {#    {{ Product.getPrice02IncTaxMin|price }}<span class="tax">(税込)</span>#}
  1102.                             {#</p>#}
  1103.                         </a>
  1104.                     </div>
  1105.                 {% endfor %}
  1106.                 </div>
  1107.                 <!-- ページネーション -->
  1108.                 {% set pages = pagination.paginationData %}
  1109.                 {% if pages.pageCount > 1 %}
  1110.                     <div class="ec-pager pagination">
  1111.                         {# 前へ #}
  1112.                         {% if pages.previous is defined %}
  1113.                             <a class="page-return" href="{{ path(
  1114.                             app.request.attributes.get('_route'),
  1115.                             app.request.query.all|merge({'pageno': pages.previous})) }}#contents-list">←</a>
  1116.                         {% endif %}
  1117.                         <div class="page-num">
  1118.                             {% for page in pages.pagesInRange %}
  1119.                                 {% if page == pages.current %}
  1120.                                     <a class="active" href="{{ path(
  1121.                                         app.request.attributes.get('_route'),
  1122.                                         app.request.query.all|merge({'pageno': page})) }}#contents-list"> {{ page }} </a>
  1123.                                 {% else %}
  1124.                                     <a href="{{ path(
  1125.                                         app.request.attributes.get('_route'),
  1126.                                         app.request.query.all|merge({'pageno': page})) }}#contents-list"> {{ page }} </a>
  1127.                                 {% endif %}
  1128.                             {% endfor %}
  1129.                         </div>
  1130.                         {# 次へ #}
  1131.                         {% if pages.next is defined %}
  1132.                             <a class="page-advance" href="{{ path(
  1133.                             app.request.attributes.get('_route'),
  1134.                             app.request.query.all|merge({'pageno': pages.next})) }}#contents-list">→</a>
  1135.                         {% endif %}
  1136.                     </div>
  1137.                 {% endif %}
  1138.             </div>
  1139.         {% else %}
  1140.             <p class="no_item">{{ 'お探しの商品は見つかりませんでした'|trans }}</p>
  1141.         {% endif %}
  1142.         
  1143.         <!-- カテゴリ説明 -->
  1144.         {#デザインにないため、いったんコメントアウト#}
  1145.         {#<p class="lead-sentence">#}
  1146.         {#    <button type="submit" class="category-btn-list word-search" name="search_parent_id" value="1">#}
  1147.   {#              JR埼京線#}
  1148.   {#          </button>#}
  1149.   {#          <button type="submit" class="category-btn-list word-search" name="search_parent_id" value="2">#}
  1150.   {#              SL#}
  1151.   {#          </button>#}
  1152.         {#</p>#}
  1153.     </div>
  1154.             
  1155. </section>
  1156. {% endblock %}