app/template/kaiino/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 product_list' %}
  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.             
  33.             // 複数カテゴリ検索用のパラメータ
  34.             $('#search1').on('submit', function(){
  35.               var category = [];
  36.               $('.category_ids:checked').each(function(){
  37.                 category.push($(this).val());
  38.               });
  39.               
  40.               var brand = [];
  41.               $('.brand_ids:checked').each(function(){
  42.                 brand.push($(this).val());
  43.               });
  44.               
  45.               var taste = [];
  46.               $('.taste_ids:checked').each(function(){
  47.                 taste.push($(this).val());
  48.               });
  49.               $('[name=category_ids]').val(category.join('-'));
  50.               $('[name=brand_ids]').val(brand.join('-'));
  51.               $('[name=taste_ids]').val(taste.join('-'));
  52.               
  53.             });
  54.             
  55.             //
  56.             $('.search_modal_open').on('click', function(){
  57.               $('.search_modal_wrap').addClass('on');
  58.             });
  59.             $('.search_modal_close').on('click', function(){
  60.               $('.search_modal_wrap').removeClass('on');
  61.             });
  62.             
  63.             // 
  64.             $('.search_modal .accordion dt').on('click', function(){
  65.               
  66.               $(this).toggleClass('on');
  67.               
  68.             });
  69.             
  70.             
  71.             $('.add-cart').on('click', function(e) {
  72.                 var $form = $(this).parents('li').find('form');
  73.                 // 個数フォームのチェック
  74.                 var $quantity = $form.parent().find('.quantity');
  75.                 if ($quantity.val() < 1) {
  76.                     $quantity[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
  77.                     setTimeout(function() {
  78.                         loadingOverlay('hide');
  79.                     }, 100);
  80.                     return true;
  81.                 } else {
  82.                     $quantity[0].setCustomValidity('');
  83.                 }
  84.                 e.preventDefault();
  85.                 $.ajax({
  86.                     url: $form.attr('action'),
  87.                     type: $form.attr('method'),
  88.                     data: $form.serialize(),
  89.                     dataType: 'json',
  90.                     beforeSend: function(xhr, settings) {
  91.                         // Buttonを無効にする
  92.                         $('.add-cart').prop('disabled', true);
  93.                     }
  94.                 }).done(function(data) {
  95.                     // レスポンス内のメッセージをalertで表示
  96.                     $.each(data.messages, function() {
  97.                         $('#ec-modal-header').html(this);
  98.                     });
  99.                     $('.ec-modal').show()
  100.                     // カートブロックを更新する
  101.                     $.ajax({
  102.                         url: '{{ url('block_cart') }}',
  103.                         type: 'GET',
  104.                         dataType: 'html'
  105.                     }).done(function(html) {
  106.                         $('.ec-headerRole__cart').html(html);
  107.                     });
  108.                 }).fail(function(data) {
  109.                     alert('{{ 'カートへの追加に失敗しました。'|trans }}');
  110.                 }).always(function(data) {
  111.                     // Buttonを有効にする
  112.                     $('.add-cart').prop('disabled', false);
  113.                 });
  114.             });
  115.         });
  116.         $('.ec-modal-wrap').on('click', function(e) {
  117.             // モーダル内の処理は外側にバブリングさせない
  118.             e.stopPropagation();
  119.         });
  120.         $('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function() {
  121.             $('.ec-modal').hide()
  122.         });
  123.     </script>
  124. {% endblock %}
  125. {% block main %}
  126.     {% if search_form.vars.value.category_id.id is defined %}
  127.     {{ include('Block/category'~search_form.vars.value.category_id.id~'.twig', ignore_missing = true) }}
  128.     {% endif %}
  129.     {% if search_form.category_id.vars.errors|length > 0 %}
  130.         <div class="ec-searchnavRole">
  131.             <p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
  132.         </div>
  133.     {% else %}
  134.         <div class="ec-searchnavRole">
  135.             <form name="form1" id="form1" method="get" action="?">
  136.                 {% for item in search_form %}
  137.                     <input type="hidden" id="{{ item.vars.id }}"
  138.                            name="{{ item.vars.full_name }}"
  139.                            {% if item.vars.value is not empty %}value="{{ item.vars.value }}" {% endif %}/>
  140.                 {% endfor %}
  141.             </form>
  142.             
  143.             <div class="search_params_wrap">
  144.               <div class="box1">
  145.                 <div class="title">現在の検索条件</div>
  146.                 <ul class="params">
  147.                   {% for dat in s_search %}
  148.                     <li><a href="{{ dat.link }}"><i class="fa-solid fa-xmark"></i>{{ dat.name }}</a></li>
  149.                   {% endfor %}
  150.                 </ul>  
  151.               </div>
  152.               <div class="box2">
  153.                 <div class="search_btn">
  154.                   <a href="javascript:void(0);" class="search_modal_open">商品を絞り込む</a>
  155.                 </div>
  156.               </div>
  157.             </div>
  158.               
  159.             <div class="">
  160.             </div>
  161.                 
  162.             {#
  163.             <div class="ec-searchnavRole__topicpath">
  164.                 <ol class="ec-topicpath">
  165.                     <li class="ec-topicpath__item"><a href="{{ url('product_list') }}">{{ '全て'|trans }}</a>
  166.                     </li>
  167.                     {% if Category is not null %}
  168.                         {% for Path in Category.path %}
  169.                             <li class="ec-topicpath__divider">|</li>
  170.                             <li class="ec-topicpath__item{% if loop.last %}--active{% endif %}"><a
  171.                                         href="{{ url('product_list') }}?category_id={{ Path.id }}">{{ Path.name }}</a>
  172.                             </li>
  173.                         {% endfor %}
  174.                     {% endif %}
  175.                     {% if search_form.vars.value and search_form.vars.value.name %}
  176.                         <li class="ec-topicpath__divider">|</li>
  177.                         <li class="ec-topicpath__item">{{ '「%name%」の検索結果'|trans({ '%name%': search_form.vars.value.name }) }}</li>
  178.                     {% endif %}
  179.                 </ol>
  180.             </div>
  181.             #}
  182.                 
  183.                 
  184.             <div class="ec-searchnavRole__infos">
  185.                 <div class="ec-searchnavRole__counter">
  186.                     {% if pagination.totalItemCount > 0 %}
  187.                         {{ '<span class="ec-font-bold">%count%件</span><span>の商品が見つかりました</span>'|trans({ '%count%': pagination.totalItemCount })|raw }}
  188.                     {% else %}
  189.                         <span>{{ 'お探しの商品は見つかりませんでした'|trans }}</span>
  190.                     {% endif %}
  191.                 </div>
  192.                 {% if pagination.totalItemCount > 0 %}
  193.                     <div class="ec-searchnavRole__actions">
  194.                         <div class="ec-select">
  195.                             {{ form_widget(disp_number_form, {'id': '', 'attr': {'class': 'disp-number'}}) }}
  196.                             {{ form_widget(order_by_form, {'id': '', 'attr': {'class': 'order-by'}}) }}
  197.                         </div>
  198.                     </div>
  199.                 {% endif %}
  200.             </div>
  201.         </div>
  202.         {% if pagination.totalItemCount > 0 %}
  203.             <div class="ec-shelfRole">
  204.                 <ul class="ec-shelfGrid">
  205.                     {% for Product in pagination %}
  206.                         <li class="ec-shelfGrid__item">
  207.                             <a href="{{ url('product_detail', {'id': Product.id}) }}">
  208.                                 <div class="ec-shelfGrid__item-image">
  209.                                     <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" loading="lazy">
  210.                                     <ul class="color-list">
  211.                                       {{ Product.getColorsHTML|raw }}
  212.                                     </ul>
  213.                                     {% if Product.stock_find == false %}
  214.                                       <p class="list_soldout">sold out</p>
  215.                                     {% endif %}
  216.                                     {{ Product.getSaleIcon|raw }}
  217.                                 </div>
  218.                                 {#<ul class="ec-shelfRole__tags">
  219.                                     {% for Tag in Product.ProductTag %}
  220.                                         {% if Tag %}
  221.                                             <li class="ec-shelfRole__tag">{{ Tag.Tag }}</li>
  222.                                         {% endif %}
  223.                                     {% endfor %}
  224.                                 </ul>#}
  225.                                 {{ include('@DesignTag4/tag_list.twig', ignore_missing = true) }}
  226.                                 <p class="ec-shelfGrid__item-name">{{ Product.name }}</p>
  227.                                 {% if Product.description_list %}
  228.                                     <p>{{ Product.description_list|raw|nl2br }}</p>
  229.                                 {% endif %}
  230.                                 <p class="price02-default">
  231.                                     {% if Product.hasProductClass %}
  232.                                         {% if Product.getPrice02Min == Product.getPrice02Max %}
  233.                                             {{ Product.getPrice02IncTaxMin|price }}
  234.                                         {% else %}
  235.                                             {{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
  236.                                         {% endif %}
  237.                                     {% else %}
  238.                                         {#{{ Product.getPrice02IncTaxMin|price }}#}
  239.                                         {{ Product.getSalePrice|raw }}
  240.                                     {% endif %}
  241.                                 </p>
  242.                             </a>
  243.                         </li>
  244.                     {% endfor %}
  245.                 </ul>
  246.             </div>
  247.             <div class="ec-modal">
  248.                 <div class="ec-modal-overlay">
  249.                     <div class="ec-modal-wrap">
  250.                         <span class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></span>
  251.                         <div id="ec-modal-header" class="text-center">{{ 'カートに追加しました。'|trans }}</div>
  252.                         <div class="ec-modal-box">
  253.                             <div class="ec-role">
  254.                                 <span class="ec-inlineBtn--cancel">{{ 'お買い物を続ける'|trans }}</span>
  255.                                 <a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
  256.                             </div>
  257.                         </div>
  258.                     </div>
  259.                 </div>
  260.             </div>
  261.             <div class="ec-pagerRole">
  262.                 {% include "pager.twig" with {'pages': pagination.paginationData} %}
  263.             </div>
  264.         {% endif %}
  265.     {% endif %}
  266.     
  267.     
  268.     <!------**** modal search ****------>
  269.       <div class="search_modal_wrap">
  270.       <div class="search_modal">
  271.           <div class="close_btn"><a href="javascript:void(0);" class="search_modal_close"><i class="fas fa-times"></i></a></div>
  272.           <form action="?" method="get" id="search1">
  273.             
  274.             <div class="search_box">
  275.               <h2>カテゴリ</h2>
  276.               <input type="hidden" name="category_ids" value="">
  277.               <input type="hidden" name="brand_ids" value="">
  278.               <input type="hidden" name="taste_ids" value="">
  279.               {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  280.               {% for Category in Categories %}
  281.               <dl class="accordion">
  282.                 <dt><img src="{{ asset('img/icons/') }}category{{ Category.id }}.png" alt="" width="30"><span>{{ Category.name }}</span></dt>
  283.                 {#{% if Category.children|length > 0 %}#}
  284.                 <dd>
  285.                   <ul class="checkbox">
  286.                     {% set checked = (Category.id in s_category_ids)? 'checked':'' %}
  287.                     <li><label><input type="checkbox" class="category_ids" value="{{ Category.id }}" {{ checked }}><span>{{ Category.name }}すべて</span></label></li><!--すべてを選択-->
  288.                     {% for ChildCategory in Category.children %}
  289.                       {% set checked = (ChildCategory.id in s_category_ids)? 'checked':'' %}
  290.                       <li><label><input type="checkbox" class="category_ids" value="{{ ChildCategory.id }}" {{ checked }}><span>{{ ChildCategory.name }}</span></label></li>
  291.                     {% endfor %}
  292.                   </ul>
  293.                 </dd>
  294.                 {#{% endif %}#}
  295.               </dl>
  296.               {% endfor %}
  297.             </div>
  298.             <div class="search_box">
  299.               <h2>ブランド</h2>
  300.               {% set Brands = repository('Plugin\\BrandManager\\Entity\\Brand').getList() %}
  301.               <dl class="accordion">
  302.                 <ul class="checkbox">
  303.                   {% for Brand in Brands %}
  304.                     {% set checked = (Brand.id in s_brand_ids)? 'checked':'' %}
  305.                     <li><label><input type="checkbox" class="brand_ids" value="{{ Brand.id }}" {{ checked }}><span>{{ Brand.name }}</span></label></li>
  306.                   {% endfor %}
  307.                 </ul>
  308.               </dl>
  309.             </div>
  310.             <div class="search_box">
  311.               <h2>テイスト</h2>
  312.               {% set Tastes = repository('Plugin\\TasteManager\\Entity\\Taste').getList() %}
  313.               <dl class="accordion">
  314.                 <ul class="checkbox">
  315.                   {% for Taste in Tastes %}
  316.                     {% set checked = (Taste.id in s_taste_ids)? 'checked':'' %}
  317.                     <li><label><input type="checkbox" class="taste_ids" value="{{ Taste.id }}" {{ checked }}><span>{{ Taste.name }}</span></label></li>
  318.                   {% endfor %}
  319.                 </ul>
  320.               </dl>
  321.             </div>
  322.             <div class="search_box">
  323.               <h2>キーワード</h2>
  324.               <dl class="keyword">
  325.                 {#<dt>キーワード検索</dt>#}
  326.                 <dd>
  327.                   <input type="text" name="name" value="{{ s_name }}" placeholder="キーワード …">
  328.                   {#<button class="keyword-btn"><i class="fa-solid fa-magnifying-glass"></i></button>#}
  329.                 </dd>
  330.               </dl>
  331.             </div>
  332.               
  333.             <div class="search_btns">
  334.               <input type="submit" value="この条件で検索" class="btn btn-black">
  335.               <input type="reset" value="条件をクリア" name="reset" class="btn btn-mono">
  336.               {#<a href="javascript:void(0);" class="btn btn-black">この条件で検索</a>
  337.               <a href="javascript:void(0)" class="btn btn-mono">条件をクリア</a>#}
  338.             </div>
  339.           </form>
  340.       </div>
  341.       </div>
  342.       
  343.       
  344.       <!-- -->
  345.     
  346. {% endblock %}