app/template/kaorime/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('{{ '1以上で入力してください。'|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('{{ 'カートへの追加に失敗しました。'|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 main %}
  87.     <!-- PAGE CONTENTS -->
  88.     <div class="products productsIndex">
  89.         <section class="sub-container">
  90.             <!-- H1 商品カテゴリーの見出し -->
  91.             <div class="sub-h1--products">
  92.                 <h1 class="itemTitle" style="color: #221613;">
  93.                     {% if subtitle is defined and subtitle is not empty %}
  94.                         {# 「全商品」を除外 #}
  95.                         {% if Category is not null %}
  96.                             {# 親カテゴリ(「個人印鑑」など)を除外 #}
  97.                             {% if Category.Parent is not null %}
  98.                                 {# 子カテゴリ(「実印」など)にのみ適用 #}
  99.                                 {{ Category.Parent.name }}
  100.                             {% endif %}
  101.                         {% endif %}
  102.                         {% if(subtitle == "全商品") %}
  103.                                 商品一覧
  104.                             {% else %}
  105.                                 {{ subtitle }}
  106.                         {% endif %}
  107.                     {% elseif title is defined and title is not empty %}
  108.                         {{ title }}
  109.                     {% endif %}
  110.                 </h1>
  111.                 <div class="itemImg">
  112.                     <div class="itemImgInner">
  113.                         <img src="{{ asset('assets/img/products/sub_h1_02.jpg') }}" alt="香り芽本舗の商品一覧" class="imgObjectFitCover">
  114.                     </div>
  115.                 </div>
  116.             </div>
  117.             <!-- /H1 -->
  118.             <!-- CONTENTS -->
  119.             <div class="l-container l-2ColumnContainer">
  120.                 <!-- MAIN-CONTENTS -->
  121.                 <div class="l-main">
  122.                     <!-- BREAD CRUMBS -->
  123.                     <div class="sub-breadcrumbsWrap">
  124.                         <ul class="sub-breadcrumbs">
  125.                             <li><a href="#">TOP</a></li>
  126.                             <li>商品一覧</li>
  127.                         </ul>
  128.                     </div>
  129.                     <!-- /BREAD CRUMBS -->
  130.                     <!-- MAIN CONTENTS -->
  131.                     <section>
  132.                         {% if search_form.category_id.vars.errors|length > 0 %}
  133.                         <div class="ec-searchnavRole">
  134.                             <p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
  135.                         </div>
  136.                         {% else %}
  137.                             <div class="ec-searchnavRole">
  138.                                 <form name="form1" id="form1" method="get" action="?">
  139.                                     {% for item in search_form %}
  140.                                         <input type="hidden" id="{{ item.vars.id }}"
  141.                                                name="{{ item.vars.full_name }}"
  142.                                                {% if item.vars.value is not empty %}value="{{ item.vars.value }}" {% endif %}/>
  143.                                     {% endfor %}
  144.                                 </form>
  145.                             </div>
  146.                         <!-- HED -->
  147.                         <div class="products-listHed">
  148.                             <h2 class="mod-hl-01">商品一覧</h2>
  149.                             <div class="boxSortBtnWrap">
  150.                                 {% if pagination.totalItemCount > 0 %}
  151.                                     <div class="boxSortBtn boxSortBtn-number">
  152.                                         {{ form_widget(search_form.disp_number, {'id': '', 'attr': {'class': 'disp-number mod-form-select form-control'}}) }}
  153.                                     </div>
  154.                                     <div class="boxSortBtn boxSortBtn-orderBy">
  155.                                         {{ form_widget(search_form.orderby, {'id': '', 'attr': {'class': 'order-by mod-form-select form-control'}}) }}
  156.                                     </div>
  157.                                 {% endif %}
  158.                             </div>
  159.                         </div>
  160.                         <!-- /HED -->
  161.                             <div class="ec-searchnavRole__infos marginBottom40">
  162.                                 <div class="ec-searchnavRole__counter">
  163.                                     {% if pagination.totalItemCount > 0 %}
  164.                                         {{ '<span class="ec-font-bold">%count%件</span><span>の商品が見つかりました</span>'|trans({ '%count%': pagination.totalItemCount })|raw }}
  165.                                     {% else %}
  166.                                         <span>{{ 'お探しの商品は見つかりませんでした'|trans }}</span>
  167.                                     {% endif %}
  168.                                 </div>
  169.                             </div>
  170.                         <!-- LIST -->
  171.                         <div class="products-listList mod-productsBoxContainer">
  172.                             {% if pagination.totalItemCount > 0 %}
  173.                                         {% for Product in pagination %}
  174.                                             <!-- BOX -->
  175.                                             <article class="mod-productsBox">
  176.                                                 <a href="{{ url('product_detail', {'id': Product.id}) }}" class="mod-productsBoxInner">
  177.                                                     <span class="boxImg">
  178.                                                         <span class="boxImgInner">
  179.                                                             <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" class="imgObjectFitCover" loading="lazy">
  180.                                                         </span>
  181.                                                     </span>
  182.                                                     <div class="boxData">
  183.                                                         <h3 class="name">{{ Product.name }}</h3>
  184.                                                         {# 販売価格 #}
  185.                                                         <p class="price">
  186.                                                             {% if Product.getPrice01Min is not null %}
  187.                                                                 {% set priceClass = "color: #f00;font-weight: bold;font-size: 17px;text-align:right;" %}
  188.                                                             {% else %}
  189.                                                                 {% set priceClass = "" %}
  190.                                                             {% endif %}
  191.                                                             <div style="{{ priceClass }}">
  192.                                                                 {% if Product.hasProductClass %}
  193.                                                                     {% if Product.getPrice02Min == Product.getPrice02Max %}
  194.                                                                         {{ Product.getPrice02IncTaxMin|number_format }}
  195.                                                                     {% else %}
  196.                                                                         {{ Product.getPrice02IncTaxMin|number_format }}
  197.                                                                         ~
  198.                                                                         {{ Product.getPrice02IncTaxMax|number_format }}
  199.                                                                     {% endif %}
  200.                                                                     円
  201.                                                                     <small class="isSmall" style="font-size: 15px;">(税込)</small>
  202.                                                                 {% else %}
  203.                                                                     {{ Product.getPrice02IncTaxMin|number_format }}
  204.                                                                     円
  205.                                                                     <small class="isSmall" style="font-size: 15px;">(税込)</small>
  206.                                                                 {% endif %}
  207.                                                             </div>
  208.                                                             <div class="font13 textRight" style="margin-top:10px;text-decoration: line-through;">
  209.                                                             {% if Product.hasProductClass %}
  210.                                                                 <div>
  211.                                                                     {% if Product.getPrice01Min is not null and Product.getPrice01IncTaxMin == Product.getPrice01IncTaxMax %}
  212.                                                                         {{ Product.getPrice01IncTaxMin|number_format }}円
  213.                                                                         <span class="tax">(税込)</span>
  214.                                                                     {% elseif Product.getPrice01Min is not null and Product.getPrice01Max is not null %}
  215.                                                                         {{ Product.getPrice01IncTaxMin|number_format }}~ {{ Product.getPrice01IncTaxMax|number_format }}円
  216.                                                                         <span class="tax">(税込)</span>
  217.                                                                     {% endif %}
  218.                                                                 </div>
  219.                                                             {% else %}
  220.                                                                 {% if Product.getPrice01Max is not null %}
  221.                                                                     {{ Product.getPrice01IncTaxMin|number_format }}円
  222.                                                                     <span class="tax">(税込)</span>
  223.                                                                 {% endif %}
  224.                                                             {% endif %}
  225.                                                             </div>
  226.                                                         </p>
  227.                                                         {% if Product.stock_find %}
  228.                                                         {% else %}
  229.                                                             <div class="ec-productRole__btn">
  230.                                                                 <button type="button" class="ec-blockBtn--action" disabled="disabled">
  231.                                                                     {{ 'ただいま品切れ中です。'|trans }}
  232.                                                                 </button>
  233.                                                             </div>
  234.                                                         {% endif %}
  235.                                                     </div>
  236.                                                 </a>
  237.                                             </article>
  238.                                             <!-- /BOX -->
  239.                                         {% endfor %}
  240.                             {% endif %}
  241.                         </div>
  242.                         <!-- /LIST -->
  243.                         <div class="ec-modal">
  244.                             <div class="ec-modal-overlay">
  245.                                 <div class="ec-modal-wrap">
  246.                                     <span class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></span>
  247.                                     <div id="ec-modal-header" class="text-center">{{ 'カートに追加しました。'|trans }}</div>
  248.                                     <div class="ec-modal-box">
  249.                                         <div class="ec-role">
  250.                                             <span class="ec-inlineBtn--cancel">{{ 'お買い物を続ける'|trans }}</span>
  251.                                             <a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
  252.                                         </div>
  253.                                     </div>
  254.                                 </div>
  255.                             </div>
  256.                         </div>
  257.                         {% endif %}
  258.                     </section>
  259.                     <!-- /MAIN CONTENTS -->
  260.                     <!-- PAGINATION -->
  261.                     {% include "pager.twig" with {'pages': pagination.paginationData} %}
  262.                     <!-- /PAGINATION -->
  263.                     {% if Layout.MainBottom %}
  264.                             {{ include('block.twig', {'Blocks': Layout.MainBottom}) }}
  265.                     {% endif %}
  266.                 </div>
  267.                 <!-- /MAIN-CONTENTS -->
  268.                 <!-- SIDE-CONTENTS -->
  269.                 {{ include('Block/side_menu.twig') }}
  270.                 <!-- /SIDE-CONTENTS -->
  271.             </div>
  272.             <!-- /CONTENTS -->
  273.         </section>
  274.     </div>
  275.     <!-- /PAGE CONTENTS -->
  276.     <style>
  277.         .ec-blockBtn--action {
  278.             height: 30px;
  279.             line-height: 100%;
  280.             margin-top: 15px;
  281.             font-size: 12px;
  282.         }
  283.     </style>
  284. {% endblock %}