app/template/mieuree/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 stylesheet %}
  11.     <style>
  12.         .float-container{
  13.             border: 3px;
  14.             
  15.         }
  16.         .float-child{
  17.             float: left;
  18.             padding: 10px;
  19.         }
  20.         .btn-basic0{
  21.             background-color:#d09aa9;
  22.             color:#fff;
  23.             font-size:16px;
  24.             text-align:center;
  25.             display:inline-block;
  26.             padding:1.2em 1.2em;
  27.             min-width:200px;
  28.             border-radius:3px;
  29.             text-decoration:none;
  30.             transition:background-color 0.3s ease;
  31.             margin:0 auto;
  32.             border: none;
  33.         }
  34.         .divider{
  35.             border-top: 1px solid #E7CCD4;
  36.         }
  37.     </style>
  38. {% endblock %}
  39. {% block javascript %}
  40.     <script>
  41.         eccube.productsClassCategories = {
  42.             {% for Product in pagination %}
  43.             "{{ Product.id|escape('js') }}": {{ class_categories_as_json(Product)|raw }}{% if loop.last == false %}, {% endif %}
  44.             {% endfor %}
  45.         };
  46.         $(function() {
  47.             // 表示件数を変更
  48.             $('.disp-number').change(function() {
  49.                 var dispNumber = $(this).val();
  50.                 $('#disp_number').val(dispNumber);
  51.                 $('#pageno').val(1);
  52.                 $("#form1").submit();
  53.             });
  54.             // 並び順を変更
  55.             $('.order-by').change(function() {
  56.                 var orderBy = $(this).val();
  57.                 $('#orderby').val(orderBy);
  58.                 $('#pageno').val(1);
  59.                 $("#form1").submit();
  60.             });
  61.             $('.add-cart').on('click', function(e) {
  62.                 var $form = $(this).parents('li').find('form');
  63.                 // 個数フォームのチェック
  64.                 var $quantity = $form.parent().find('.quantity');
  65.                 if ($quantity.val() < 1) {
  66.                     $quantity[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
  67.                     setTimeout(function() {
  68.                         loadingOverlay('hide');
  69.                     }, 100);
  70.                     return true;
  71.                 } else {
  72.                     $quantity[0].setCustomValidity('');
  73.                 }
  74.                 e.preventDefault();
  75.                 $.ajax({
  76.                     url: $form.attr('action'),
  77.                     type: $form.attr('method'),
  78.                     data: $form.serialize(),
  79.                     dataType: 'json',
  80.                     beforeSend: function(xhr, settings) {
  81.                         // Buttonを無効にする
  82.                         $('.add-cart').prop('disabled', true);
  83.                     }
  84.                 }).done(function(data) {
  85.                     // レスポンス内のメッセージをalertで表示
  86.                     $.each(data.messages, function() {
  87.                         $('#ec-modal-header').html(this);
  88.                     });
  89.                     $('.ec-modal').show()
  90.                     // カートブロックを更新する
  91.                     $.ajax({
  92.                         url: '{{ url('block_cart') }}',
  93.                         type: 'GET',
  94.                         dataType: 'html'
  95.                     }).done(function(html) {
  96.                         $('.ec-headerRole__cart').html(html);
  97.                     });
  98.                 }).fail(function(data) {
  99.                     alert('{{ 'カートへの追加に失敗しました。'|trans }}');
  100.                 }).always(function(data) {
  101.                     // Buttonを有効にする
  102.                     $('.add-cart').prop('disabled', false);
  103.                 });
  104.             });
  105.         });
  106.         $('.ec-modal-wrap').on('click', function(e) {
  107.             // モーダル内の処理は外側にバブリングさせない
  108.             e.stopPropagation();
  109.         });
  110.         $('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function() {
  111.             $('.ec-modal').hide()
  112.         });
  113.     </script>
  114. {% endblock %}
  115. {% block main %}
  116.     <div>
  117.         <h2 class="section-title-home" data-title="Original Item">オリジナルアイテム</h2>
  118.     </div>
  119.     {% if search_form.category_id.vars.errors|length > 0 %}
  120.         <div class="ec-searchnavRole">
  121.             <p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
  122.         </div>
  123.     {% else %}
  124.         <div class="ec-searchnavRole">
  125.             <form name="form1" id="form1" method="get" action="?">
  126.                 {% for item in search_form %}
  127.                     <input type="hidden" id="{{ item.vars.id }}"
  128.                            name="{{ item.vars.full_name }}"
  129.                            {% if item.vars.value is not empty %}value="{{ item.vars.value }}" {% endif %}/>
  130.                 {% endfor %}
  131.             </form>
  132.             
  133.             <div class="ec-searchnavRole__topicpath">
  134.             
  135.                 <ol class="ec-topicpath">
  136.                     
  137.                     <li class="ec-topicpath__item"><a href="{{ url('product_list') }}">{{ '全て'|trans }}</a>
  138.                     </li>
  139.                     
  140.                     {% if Category is not null %}
  141.                         {% for Path in Category.path %}
  142.                             <li class="ec-topicpath__divider">|</li>
  143.                             <li class="ec-topicpath__item{% if loop.last %}--active{% endif %}"><a
  144.                                         href="{{ url('product_list') }}?category_id={{ Path.id }}">{{ Path.name }}</a>
  145.                             </li>
  146.                         {% endfor %}
  147.                     {% endif %}
  148.                     {% if search_form.vars.value and search_form.vars.value.name %}
  149.                         <li class="ec-topicpath__divider">|</li>
  150.                         <li class="ec-topicpath__item">{{ '「%name%」の検索結果'|trans({ '%name%': search_form.vars.value.name }) }}</li>
  151.                     {% endif %}
  152.                 </ol>
  153.             </div>
  154.             
  155.             <div class="ec-searchnavRole__infos">
  156.                 <div class="ec-searchnavRole__counter">
  157.                     {% if pagination.totalItemCount > 0 %}
  158.                         {{ '<span class="ec-font-bold">%count%件</span><span>の商品が見つかりました</span>'|trans({ '%count%': pagination.totalItemCount })|raw }}
  159.                     {% else %}
  160.                         <span>{{ 'お探しの商品は見つかりませんでした'|trans }}</span>
  161.                     {% endif %}
  162.                 </div>
  163.                 {% if pagination.totalItemCount > 0 %}
  164.                     <div class="ec-searchnavRole__actions">
  165.                         <div class="ec-select">
  166.                             {{ form_widget(disp_number_form, {'id': '', 'attr': {'class': 'disp-number'}}) }}
  167.                             {{ form_widget(order_by_form, {'id': '', 'attr': {'class': 'order-by'}}) }}
  168.                         </div>
  169.                     </div>
  170.                 {% endif %}
  171.             </div>
  172.         </div>
  173.         {% if pagination.totalItemCount > 0 %}
  174.             <div class="ec-shelfRole">
  175.                 <ul class="ec-shelfGrid">
  176.                     {% for Product in pagination %}
  177.                         <li class="ec-shelfGrid__item">
  178.                             <a href="{{ url('product_detail', {'id': Product.id}) }}">
  179.                                 <p class="ec-shelfGrid__item-image">
  180.                                     <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}" alt="{{ Product.name }}" loading="lazy">
  181.                                 </p>
  182.                                 <div class="float-container">
  183.                                     <div class="float-child">
  184.                                         <p>{{ Product.name }}</p>
  185.                                     </div>
  186.                                     <div class="float-child">
  187.                                         {% if Product.description_list %}
  188.                                             <p>{{ Product.description_list|raw|nl2br }}</p>
  189.                                         {% endif %}
  190.                                         <p class="price02-default">
  191.                                             {% if Product.hasProductClass %}
  192.                                                 {% if Product.getPrice02Min == Product.getPrice02Max %}
  193.                                                     {{ Product.getPrice02IncTaxMin|price }}
  194.                                                 {% else %}
  195.                                                     {{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
  196.                                                 {% endif %}
  197.                                             {% else %}
  198.                                                 {{ Product.getPrice02IncTaxMin|price }}
  199.                                             {% endif %}
  200.                                         </p>
  201.                                     </div>
  202.                                 </div>
  203.                             </a>
  204.                             {% if Product.stock_find %}
  205.                                 {% set form = forms[Product.id] %}
  206.                                 <form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_add_cart', {id:Product.id}) }}" method="post">
  207.                                     <div class="ec-productRole__actions">
  208.                                         {% if form.classcategory_id1 is defined %}
  209.                                             <div class="ec-select">
  210.                                                 {{ form_widget(form.classcategory_id1) }}
  211.                                                 {{ form_errors(form.classcategory_id1) }}
  212.                                             </div>
  213.                                             {% if form.classcategory_id2 is defined %}
  214.                                                 <div class="ec-select">
  215.                                                     {{ form_widget(form.classcategory_id2) }}
  216.                                                     {{ form_errors(form.classcategory_id2) }}
  217.                                                 </div>
  218.                                             {% endif %}
  219.                                         {% endif %}
  220.                                         <div class="float-container">
  221.                                             <div class="ec-productRole__btn float-child">
  222.                                                 <button type="submit" class="btn-basic0 --action add-cart" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}">
  223.                                                     {{ 'カートに入れる'|trans }}
  224.                                                 </button>
  225.                                             </div>
  226.                                             <div class="ec-numberInput float-child"><span>{{ '数量'|trans }}</span>
  227.                                                 {{ form_widget(form.quantity, {'attr': {'class': 'quantity'}}) }}
  228.                                                 {{ form_errors(form.quantity) }}
  229.                                             </div>
  230.                                         </div>
  231.                                         
  232.                                     </div>
  233.                                     {{ form_rest(form) }}
  234.                                 </form>
  235.                                 
  236.                             {% else %}
  237.                                 <div class="ec-productRole__btn">
  238.                                     <button type="button" class="ec-blockBtn--action" disabled="disabled">
  239.                                         {{ 'ただいま品切れ中です。'|trans }}
  240.                                     </button>
  241.                                 </div>
  242.                             {% endif %}
  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. {% endblock %}