app/Plugin/CustomProductSearch/Resource/template/default/Product/search_result.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 product_search_results' %}
  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').html(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. <div class="main_visual" data-imgpc="{{ asset('assets/img/common/main_visual.jpg','user_data') }}" data-imgsmp="{{ asset('assets/img/common/main_visualsmp.jpg','user_data') }}">
  88.     <div class="container">
  89.         <h2 class="main_visual_title"><span class="_big">G-Laboウクレレラインナップ</span><span class="_small">G-Laboは、職人によってテキストテキストテキストテキストなウクレレブランドです。</span></h2>
  90.     </div>
  91. </div>
  92. <div class="product_list container">
  93.     <div class="product_list_category">
  94.         <p class="_list"><a href="#">すべての商品</a></p>
  95.         {{ include('Block/category.twig') }}
  96.     </div>
  97.     <div class="product_list_container">
  98.         <div id="main_side" class="side">
  99.             {{ include('/Block/search_form.twig') }}
  100.         </div>
  101.         <div id="main_content">
  102.             {% if pagination.totalItemCount > 0 %}
  103.                 <div class="product_list_block">
  104.                     {% for Product in pagination %}
  105.                         <div class="product_list_item">
  106.                             <a href="{{ url('product_detail', {'id': Product.id}) }}">
  107.                                 <div class="_img">
  108.                                     <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" {% if loop.index > 5 %} loading="lazy"{% endif %}>
  109.                                 </div>
  110.                                 <div class="_content">
  111.                                     <ul class="_tag">
  112.                                         {% for Tag in Product.Tags %}
  113.                                             <li>{{ Tag }}</li>
  114.                                         {% endfor %}
  115.                                     </ul>
  116.                                     <p class="_title">{{ Product.name }}</p>
  117.                                 </div>
  118.                                 <p class="_price">
  119.                                     {% if Product.hasProductClass %}
  120.                                         {% if Product.getPrice02Min == Product.getPrice02Max %}
  121.                                             {{ Product.getPrice02IncTaxMin|price }}<span class="_included">(税込)</span>
  122.                                         {% else %}
  123.                                             {{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}<span class="_included">(税込)</span>
  124.                                         {% endif %}
  125.                                     {% else %}
  126.                                         {{ Product.getPrice02IncTaxMin|price }}<span class="_included">(税込)</span>
  127.                                     {% endif %}
  128.                                 </p>
  129.                             </a>
  130.                         </div>
  131.                     {% endfor %}
  132.                 </div>
  133.                 <div class="ec-modal">
  134.                     <div class="ec-modal-overlay">
  135.                         <div class="ec-modal-wrap">
  136.                             <span class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></span>
  137.                             <div id="ec-modal-header" class="text-center">{{ 'カートに追加しました。'|trans }}</div>
  138.                             <div class="ec-modal-box">
  139.                                 <div class="ec-role">
  140.                                     <span class="ec-inlineBtn--cancel">{{ 'お買い物を続ける'|trans }}</span>
  141.                                     <a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
  142.                                 </div>
  143.                             </div>
  144.                         </div>
  145.                     </div>
  146.                 </div>
  147.                 <div class="ec-pagerRole">
  148.                     {% include "pager.twig" with {'pages': pagination.paginationData} %}
  149.                 </div>
  150.             {% else %}
  151.                 <p class="search_no_results__text">ご指定の条件に一致する商品が見つかりませんでした。</p>
  152.                 <p class="search_no_results__link"><a href="{{ url('product_list') }}">商品一覧へ戻る</a></p>
  153.             {% endif %}
  154.         </div>
  155.     </div>
  156. </div>
  157. {% endblock %}