app/template/default/Cart/index.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 = 'cart_page' %}
  10. {% block stylesheet %}
  11.     <link rel="stylesheet" type="text/css" href="/html/user_data/assets/css/calendar.css">
  12. {% endblock %}
  13. {% block javascript %}
  14.     <script>
  15.         const rental_setting = '{{ rental_setting }}';
  16.     </script>
  17.     <script src="/html/user_data/assets/js/calendar.js"></script>
  18.     <script>
  19.         $(function() {
  20.             $('.ec-cartTable').each(function() {
  21.                 if ($(this).find('.ec-cartRow__periodColumn').length > 0) {
  22.                     $(this).find('ol li').eq(2).text('レンタル期間');
  23.                 }
  24.             });
  25.             let reserved = '{{ reserved }}';
  26.             if (reserved) {
  27.               reserved = reserved.split('|');
  28.               $('.ec-cartRow').each(function(index) {
  29.                 let cal = $(this).find('.cal_root');
  30.                 if (cal.length > 0) {
  31.                   cal.data('period', reserved[index]);
  32.                 }
  33.               });
  34.             }
  35.             let valied = '{{ valied }}';
  36.             valied = valied.split('|');
  37.             $('.period_error_msg').each(function(index) {
  38.               if (!valied[index]) {
  39.                 $(this).show();
  40.                 $('.ec-cartRole__actions').eq(index).find('.ec-blockBtn--action').hide();
  41.               }
  42.               else {
  43.                 $('.ec-cartRole__cart').eq(index).find('.cal_root').removeClass('cal_root');
  44.               }
  45.             });
  46.             $('body').addClass('script_loaded');
  47.         });
  48.     </script>
  49. {% endblock %}
  50. {% block main %}
  51.     <div class="ec-role">
  52.         <div class="ec-pageHeader">
  53.             <h1>{{ 'ショッピングカート'|trans }}</h1>
  54.         </div>
  55.     </div>
  56.     <div class="ec-cartRole">
  57.         <div class="ec-cartRole__progress">
  58.             <ul class="ec-progress">
  59.                 {% set step = 1 %}
  60.                 <li class="ec-progress__item is-complete">
  61.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  62.                     </div>
  63.                     <div class="ec-progress__label">{{ 'カートの商品'|trans }}
  64.                     </div>
  65.                 </li>
  66.                 {% if is_granted('ROLE_USER') == false %}
  67.                     <li class="ec-progress__item">
  68.                         <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  69.                         </div>
  70.                         <div class="ec-progress__label">{{ 'お客様情報'|trans }}
  71.                         </div>
  72.                     </li>
  73.                 {% endif %}
  74.                 <li class="ec-progress__item">
  75.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  76.                     </div>
  77.                     <div class="ec-progress__label">{{ 'ご注文手続き'|trans }}
  78.                     </div>
  79.                 </li>
  80.                 <li class="ec-progress__item">
  81.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  82.                     </div>
  83.                     <div class="ec-progress__label">{{ 'ご注文内容確認'|trans }}
  84.                     </div>
  85.                 </li>
  86.                 <li class="ec-progress__item">
  87.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  88.                     </div>
  89.                     <div class="ec-progress__label">{{ '完了'|trans }}
  90.                     </div>
  91.                 </li>
  92.             </ul>
  93.         </div>
  94.         {% set productStr = app.session.flashbag.get('eccube.front.request.product') %}
  95.         {% for error in app.session.flashbag.get('eccube.front.request.error') %}
  96.             {% set idx = loop.index0 %}
  97.             <div class="ec-cartRole__error">
  98.                 <div class="ec-alert-warning">
  99.                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  100.                     <div class="ec-alert-warning__text">
  101.                         {% if productStr[idx] is defined %}
  102.                             {{ error|trans({'%product%':productStr[idx]})|nl2br }}
  103.                         {% else %}
  104.                             {{ error|trans|nl2br }}
  105.                         {% endif %}
  106.                     </div>
  107.                 </div>
  108.             </div>
  109.         {% endfor %}
  110.         {% for error in app.session.flashbag.get('eccube.front.cart.error') %}
  111.             <div class="ec-cartRole__error">
  112.                 <div class="ec-alert-warning">
  113.                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  114.                     <div class="ec-alert-warning__text">
  115.                         {{ error|trans|nl2br }}
  116.                     </div>
  117.                 </div>
  118.             </div>
  119.         {% endfor %}
  120.         {% if totalQuantity > 0 %}
  121.             <div class="ec-cartRole__totalText">
  122.                 <p>
  123.                     {{ '商品の合計金額は「<strong>%price%</strong>」です。'|trans({ '%price%': totalPrice|price })|raw }}
  124.                 </p>
  125.             </div>
  126.             {% if Carts|length > 1 %}
  127.                 <div class="ec-cartRole__error">
  128.                     <div class="ec-alert-warning">
  129.                         <div class="ec-alert-warning__text">
  130.                             {{ '同時購入できない商品がカートに含まれています。'|trans|nl2br }}
  131.                         </div>
  132.                     </div>
  133.                 </div>
  134.             {% endif %}
  135.             <form name="form" id="form_cart" class="ec-cartRole" method="post" action="{{ url('cart') }}">
  136.                 <div id="valid_check" style="display:none"></div>
  137.                 {% for CartIndex,Cart in Carts %}
  138.                     {% set cartKey = Cart.cart_key %}
  139.                     {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  140.                         <div class="ec-cartRole__error">
  141.                             <div class="ec-alert-warning">
  142.                                 <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  143.                                 <div class="ec-alert-warning__text">
  144.                                     {{ error|trans|nl2br }}
  145.                                 </div>
  146.                             </div>
  147.                         </div>
  148.                     {% endfor %}
  149.                     <div class="ec-cartRole__cart">
  150.                         <p class="period_error_msg" style="color:red;display:none">レンタル期間が揃っていません。</p>
  151.                         <div class="ec-cartTable">
  152.                             <ol class="ec-cartHeader">
  153.                                 <li class="ec-cartHeader__label">{{ '削除'|trans }}</li>
  154.                                 <li class="ec-cartHeader__label">{{ '商品内容'|trans }}</li>
  155.                                 <li class="ec-cartHeader__label">{{ '数量'|trans }}</li>
  156.                                 <li class="ec-cartHeader__label">{{ '小計'|trans }}</li>
  157.                             </ol>
  158.                             {% for CartItem in Cart.CartItems %}
  159.                                 {% set ProductClass = CartItem.ProductClass %}
  160.                                 {% set Product = ProductClass.Product %}
  161.                                 <ul class="ec-cartRow">
  162.                                     <li class="ec-cartRow__delColumn">
  163.                                         <a href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}" {{ csrf_token_for_anchor() }} class="ec-icon" data-method="put" data-message="カートから商品を削除してもよろしいですか?">
  164.                                             <img src="{{ asset('assets/icon/cross.svg') }}" alt="delete">
  165.                                         </a>
  166.                                     </li>
  167.                                     <li class="ec-cartRow__contentColumn">
  168.                                         <div class="ec-cartRow__img">
  169.                                             <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">
  170.                                                 <img src="{{ asset(Product.MainListImage|no_image_product, 'save_image') }}" alt="{{ Product.name }}"/>
  171.                                             </a>
  172.                                         </div>
  173.                                         <div class="ec-cartRow__summary">
  174.                                             <div class="ec-cartRow__name">
  175.                                                 <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">{{ Product.name }}</a>
  176.                                                 {% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
  177.                                                     <br>{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}
  178.                                                 {% endif %}
  179.                                                 {% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
  180.                                                     <br>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}
  181.                                                 {% endif %}
  182.                                             </div>
  183.                                             <div class="ec-cartRow__unitPrice">{{ CartItem.price|price }}</div>
  184.                                             <div class="ec-cartRow__sutbtotalSP">{{ '小計:'|trans }}{{ CartItem.total_price|price }}</div>
  185.                                         </div>
  186.                                     </li>
  187. {% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
  188.                                     <li class="ec-cartRow__amountColumn ec-cartRow__periodColumn">
  189.                                         <div class="cal_root" data-period="">
  190. {% if CartItem.period %}
  191.                                             {% if CartItem.really_period %}<span>{{ CartItem.really_period }}</span>{% endif %}
  192.                                             <p>{{ CartItem.period }}</p>
  193.                                             <div class="cal_wrap"></div>
  194.                                             <a href="{{ url('cart_item_update_period', {'cartItemId': CartItem.id, 'period': 'upldate_period' }) }}" {{ csrf_token_for_anchor() }} class="period_change_link" data-method="put" data-confirm="false"></a>
  195. {% else %}
  196.                                             期間が選択されていません。
  197. {% endif %}
  198.                                         </div>
  199.                                     </li>
  200. {% else %}
  201.                                     <li class="ec-cartRow__amountColumn">
  202.                                         <div class="ec-cartRow__amount">{{ CartItem.quantity|number_format }}</div>
  203.                                         <div class="ec-cartRow__amountSP">{{ '数量:'|trans }}{{ CartItem.quantity|number_format }}</div>
  204.                                         <div class="ec-cartRow__amountUpDown">
  205.                                             {% if CartItem.quantity > 1 %}
  206.                                                 <a href="{{ url('cart_handle_item', {'operation': 'down', 'productClassId': ProductClass.id}) }}" {{ csrf_token_for_anchor() }} class="ec-cartRow__amountDownButton load-overlay" data-method="put" data-confirm="false">
  207.                                                     <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus-dark.svg') }}" alt="reduce"></span>
  208.                                                 </a>
  209.                                             {% else %}
  210.                                                 <div class="ec-cartRow__amountDownButtonDisabled">
  211.                                                     <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus.svg') }}" alt="reduce"></span>
  212.                                                 </div>
  213.                                             {% endif %}
  214.                                             <a href="{{ url('cart_handle_item', {'operation': 'up', 'productClassId': ProductClass.id}) }}" {{ csrf_token_for_anchor() }} class="ec-cartRow__amountUpButton load-overlay" data-method="put" data-confirm="false">
  215.                                                 <span class="ec-cartRow__amountUpButton__icon"><img src="{{ asset('assets/icon/plus-dark.svg') }}" alt="increase"></span>
  216.                                             </a>
  217.                                         </div>
  218.                                     </li>
  219. {% endif %}
  220.                                     <li class="ec-cartRow__subtotalColumn">
  221.                                         <div class="ec-cartRow__sutbtotal">{{ CartItem.total_price|price }}</div>
  222.                                     </li>
  223.                                 </ul>
  224.                             {% endfor %}
  225.                         </div>
  226.                     </div>
  227.                     <div class="ec-cartRole__progress">
  228.                         {% if BaseInfo.delivery_free_amount and BaseInfo.delivery_free_quantity %}
  229.                             <br/>
  230.                             {% if is_delivery_free[cartKey] %}
  231.                                 {{ '現在送料無料です。'|trans }}
  232.                             {% else %}
  233.                                 {{ 'あと「<strong>%price%</strong>」または「<strong>%quantity%個</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%price%': least[cartKey]|price, '%quantity%': quantity[cartKey]|number_format })|raw }}
  234.                             {% endif %}
  235.                         {% elseif BaseInfo.delivery_free_amount %}
  236.                             <br/>
  237.                             {% if is_delivery_free[cartKey] %}
  238.                                 {{ '現在送料無料です。'|trans }}
  239.                             {% else %}
  240.                                 {{ 'あと「<strong>%price%</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%price%': least[cartKey]|price })|raw }}
  241.                             {% endif %}
  242.                         {% elseif BaseInfo.delivery_free_quantity %}
  243.                             <br/>
  244.                             {% if is_delivery_free[cartKey] %}
  245.                                 {{ '現在送料無料です。'|trans }}
  246.                             {% else %}
  247.                                 {{ 'あと「<strong>%quantity%個</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%quantity%': quantity[cartKey]|number_format })|raw }}
  248.                             {% endif %}
  249.                         {% endif %}
  250.                     </div>
  251.                     <div class="ec-cartRole__actions">
  252.                         <div class="ec-cartRole__total">{{ '合計:'|trans }}<span class="ec-cartRole__totalAmount">{{ Cart.totalPrice|price }}</span>
  253.                         </div>
  254.                         <a class="ec-blockBtn--action" href="{{ path('cart_buystep', {'cart_key':cartKey}) }}">{{ 'レジに進む'|trans }}</a>
  255.                         {% if loop.last %}
  256.                             <a class="ec-blockBtn--cancel" href="{{ path('homepage') }}">{{ 'お買い物を続ける'|trans }}</a>
  257.                         {% endif %}
  258.                     </div>
  259.                 {% endfor %}
  260.             </form>
  261.         {% else %}
  262.             {% for CartIndex,Cart in Carts %}
  263.                 {% set cartKey = Cart.cart_key %}
  264.                 {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  265.                     <div class="ec-cartRole__error">
  266.                         <div class="ec-alert-warning">
  267.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  268.                             <div class="ec-alert-warning__text">
  269.                                 {{ error|trans|nl2br }}
  270.                             </div>
  271.                         </div>
  272.                     </div>
  273.                 {% endfor %}
  274.             {% endfor %}
  275.             <div class="ec-role">
  276.                 <div class="ec-off3Grid">
  277.                     <div class="ec-off3Grid__cell">
  278.                         <div class="ec-alert-warning">
  279.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  280.                             <div class="ec-alert-warning__text">{{ '現在カート内に商品はございません。'|trans }}</div>
  281.                         </div>
  282.                     </div>
  283.                 </div>
  284.             </div>
  285.         {% endif %}
  286.     </div>
  287. {% endblock %}