app/template/default/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. {% set body_class = 'product_page' %}
  10. {% block javascript %}
  11.     <script>
  12.         eccube.productsClassCategories = {
  13.             {% for Product in pagination %}
  14.             "{{ Product.id|escape('js') }}": {{ class_categories_as_json(Product)|raw }}{% if loop.last == false %}, {% endif %}
  15.             {% endfor %}
  16.         };
  17.         $(function() {
  18.             // 表示件数を変更
  19.             $('.disp-number').change(function() {
  20.                 var dispNumber = $(this).val();
  21.                 $('#disp_number').val(dispNumber);
  22.                 $('#pageno').val(1);
  23.                 $("#form1").submit();
  24.             });
  25.             // 並び順を変更
  26.             $('.order-by').change(function() {
  27.                 var orderBy = $(this).val();
  28.                 $('#orderby').val(orderBy);
  29.                 $('#pageno').val(1);
  30.                 $("#form1").submit();
  31.             });
  32.             $('.add-cart').on('click', function(e) {
  33.                 var $form = $(this).parents('li').find('form');
  34.                 // 個数フォームのチェック
  35.                 var $quantity = $form.parent().find('.quantity');
  36.                 if ($quantity.val() < 1) {
  37.                     $quantity[0].setCustomValidity('{{ 'front.product.invalid_quantity'|trans }}');
  38.                     setTimeout(function() {
  39.                         loadingOverlay('hide');
  40.                     }, 100);
  41.                     return true;
  42.                 } else {
  43.                     $quantity[0].setCustomValidity('');
  44.                 }
  45.                 e.preventDefault();
  46.                 $.ajax({
  47.                     url: $form.attr('action'),
  48.                     type: $form.attr('method'),
  49.                     data: $form.serialize(),
  50.                     dataType: 'json',
  51.                     beforeSend: function(xhr, settings) {
  52.                         // Buttonを無効にする
  53.                         $('.add-cart').prop('disabled', true);
  54.                     }
  55.                 }).done(function(data) {
  56.                     // レスポンス内のメッセージをalertで表示
  57.                     $.each(data.messages, function() {
  58.                         $('#ec-modal-header').text(this);
  59.                     });
  60.                     $('.ec-modal').show()
  61.                     // カートブロックを更新する
  62.                     $.ajax({
  63.                         url: '{{ url('block_cart') }}',
  64.                         type: 'GET',
  65.                         dataType: 'html'
  66.                     }).done(function(html) {
  67.                         $('.ec-headerRole__cart').html(html);
  68.                     });
  69.                 }).fail(function(data) {
  70.                     alert('{{ 'front.product.add_cart_error'|trans }}');
  71.                 }).always(function(data) {
  72.                     // Buttonを有効にする
  73.                     $('.add-cart').prop('disabled', false);
  74.                 });
  75.             });
  76.         });
  77.         $('.ec-modal-wrap').on('click', function(e) {
  78.             // モーダル内の処理は外側にバブリングさせない
  79.             e.stopPropagation();
  80.         });
  81.         $('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function() {
  82.             $('.ec-modal').hide()
  83.         });
  84.     </script>
  85. {% endblock %}
  86. {% block stylesheet %}
  87.     <style>
  88.     
  89. @media only screen and (min-width: 768px) {
  90.     .ec-topicpath {
  91.         padding: 10px 0 5px;
  92.         font-size: 14px;
  93.     }
  94.     }
  95. @media only screen and (min-width: 768px) {
  96.     .ec-searchnavRole .ec-searchnavRole__infos {
  97.         border-top: 1px solid #ccc;
  98.         padding-top: 10px;
  99.     }
  100.     }
  101. .ec-shelfGrid {
  102.             display: flex;
  103.             flex-wrap: wrap;
  104. }
  105. .ec-shelfGrid li{
  106.             width: 100%;
  107. }
  108. @media (min-width: 768px) {
  109. .ec-shelfGrid li{
  110.             width: 50%;
  111. }
  112. }
  113. .product_name{
  114.     color: #596f00; 
  115.     font-size: 20px;
  116.     font-weight: 600;
  117.     margin-top: 10px;
  118.     margin-bottom: 30px;
  119.     padding-top: 8px;
  120.     border-top: 2px solid #abcd03;
  121. }
  122. @media only screen and (min-width: 768px) {
  123. .product_name{
  124.     font-size: 24px;
  125. }
  126. }
  127. .price02-default{
  128.     margin-bottom: 5px;
  129. }
  130. @media only screen and (min-width: 768px) {
  131. .price02-default{
  132.     font-size: 18px;
  133.     margin-bottom: 10px;
  134. }
  135. }
  136. .ec-shelfGrid__item .elementor-button span {
  137.     text-decoration: inherit;
  138.     display: inline-block;
  139. }
  140. .ec-shelfGrid__item .elementor-button {
  141.     display: flex;
  142.     justify-content: center;
  143.     align-items: center;
  144.     margin: 0 auto;
  145.     display: inline-block;
  146.     line-height: 1;
  147.     font-size: 20px;
  148.     font-weight: bold;
  149.     border-radius: 3px;
  150.     color: #fff;
  151.     fill: #fff;
  152.     text-align: center;
  153.     transition: all .3s;
  154.     background-color: #000000;
  155.     width: 100%;
  156.     max-width: 420px;
  157.     max-height: 60px;
  158.     padding-top: 20px;
  159.     padding-bottom: 20px;
  160. }
  161. @media only screen and (max-width: 768px) {
  162.     .ec-shelfGrid__item .elementor-button {
  163.         font-size: 15px;
  164.         padding: 20px 22px;
  165.         width: 100%;
  166.         max-width: 100%;
  167.         height: 100%;
  168.         display: flex;
  169.         justify-content: center;
  170.         align-items: center;
  171.         text-align: center;
  172.     }
  173. }
  174.     </style>
  175.   
  176. {% endblock %}
  177. {% block main %}
  178.     <div class="ec-role">
  179.         <div class="ec-pageHeader">
  180.             <h1 class="km_pagetitle">販売中の古墳</h1>
  181.         </div>
  182.     </div>
  183.     {% if search_form.category_id.vars.errors|length > 0 %}
  184.         <div class="ec-searchnavRole">
  185.             <p class="errormsg text-danger">{{ 'front.product.search__category_not_found'|trans }}</p>
  186.         </div>
  187.     {% else %}
  188.         <div class="ec-searchnavRole">
  189.             <form name="form1" id="form1" method="get" action="?">
  190.                 {% for item in search_form %}
  191.                     <input type="hidden" id="{{ item.vars.id }}"
  192.                            name="{{ item.vars.full_name }}"
  193.                            {% if item.vars.value is not empty %}value="{{ item.vars.value }}" {% endif %}/>
  194.                 {% endfor %}
  195.             </form>
  196.             <div class="ec-searchnavRole__topicpath">
  197.                 <ol class="ec-topicpath">
  198.                     {% if Category is not null %}
  199.                         {% for Path in Category.path %}
  200.                             <li class="ec-topicpath__item{% if loop.last %}--active{% endif %}"><a
  201.                                         href="{{ url('product_list') }}?category_id={{ Path.id }}">{{ Path.name }}</a>
  202.                             </li>
  203.                         {% endfor %}
  204.                     {% endif %}
  205.                     {% if search_form.vars.value and search_form.vars.value.name %}
  206.                         <li class="ec-topicpath__divider">|</li>
  207.                         <li class="ec-topicpath__item">{{ 'front.product.search_result__keyword'|trans({ '%name%': search_form.vars.value.name }) }}</li>
  208.                     {% endif %}
  209.                 </ol>
  210.             </div>
  211.             <div class="ec-searchnavRole__infos">
  212.                 <div class="ec-searchnavRole__counter">
  213.                     {% if pagination.totalItemCount > 0 %}
  214.                         {{ 'front.product.search_result__detail'|trans({ '%count%': pagination.totalItemCount })|raw }}
  215.                     {% else %}
  216.                         <span>{{ 'front.product.search__product_not_found'|trans }}</span>
  217.                     {% endif %}
  218.                 </div>
  219.                 {% if pagination.totalItemCount > 0 %}
  220.                     <div class="ec-searchnavRole__actions">
  221.                         <div class="ec-select">
  222.                             {{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number'}}) }}
  223.                             {{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'order-by'}}) }}
  224.                         </div>
  225.                     </div>
  226.                 {% endif %}
  227.             </div>
  228.         </div>
  229.         {% if pagination.totalItemCount > 0 %}
  230.             <div class="ec-shelfRole">
  231.                 <ul class="ec-shelfGrid">
  232.                     {% for Product in pagination %}
  233.                         <li class="ec-shelfGrid__item">
  234.                             
  235.                             
  236.                                 <div class="product_name"> 
  237.                                 <p>{{ Product.name }}</p>
  238.                                 </div>
  239.                             
  240.                             
  241.                             <a href="{{ url('product_detail', {'id': Product.id}) }}">
  242.                                 <p class="ec-shelfGrid__item-image">
  243.                                     <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
  244.                                 </p>
  245.                                 {# 住所 #}
  246.                                 {% if Product.kofun_product_type and Product.kofun_product_type.id == 1 %}
  247.                                     <div class="ec-productRole__kofun-address">
  248.                                         {{ Product.Kofun.Pref.name ?? '' }}{{ Product.Kofun.addr01 ?? '' }}{{ Product.Kofun.addr02 ?? '' }}
  249.                                     </div>
  250.                                 {% endif %}
  251.                                 {% if Product.description_list %}
  252.                                     <p>{{ Product.description_list|raw|nl2br }}</p>
  253.                                 {% endif %}
  254.                                 <p class="price02-default">
  255.                                     {% if Product.hasProductClass %}
  256.                                         {% if Product.getPrice02Min == Product.getPrice02Max %}
  257.                                             {{ Product.getPrice02IncTaxMin|price }}
  258.                                         {% else %}
  259.                                             {{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
  260.                                         {% endif %}
  261.                                     {% else %}
  262.                                         {{ Product.getPrice02IncTaxMin|price }}
  263.                                     {% endif %}
  264.                                 </p>
  265.                             </a>
  266.                             <a class="elementor-button" href="{{ url('product_detail', {'id': Product.id}) }}">
  267.                                 <span>この古墳墓の詳細を見る</span>
  268.                             </a>
  269.                         </li>
  270.                     {% endfor %}
  271.                 </ul>
  272.             </div>
  273.             <div class="ec-modal">
  274.                 <div class="ec-modal-overlay">
  275.                     <div class="ec-modal-wrap">
  276.                         <span class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></span>
  277.                         <div id="ec-modal-header" class="text-center">{{ 'front.product.add_cart_complete'|trans }}</div>
  278.                         <div class="ec-modal-box">
  279.                             <div class="ec-role">
  280.                                 <span class="ec-inlineBtn--cancel">{{ 'front.product.continue'|trans }}</span>
  281.                                 <a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'common.go_to_cart'|trans }}</a>
  282.                             </div>
  283.                         </div>
  284.                     </div>
  285.                 </div>
  286.             </div>
  287.             <div class="ec-pagerRole">
  288.                 {% include "pager.twig" with {'pages': pagination.paginationData} %}
  289.             </div>
  290.         {% endif %}
  291.     {% endif %}
  292. {% endblock %}