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 main %}
  11.     <div class="ec-role">
  12.         <div class="ec-pageHeader">
  13.             <h1>
  14.                 <span class="jp">ショッピングカート</span>
  15.                 <span class="en">In Your Cart</span>
  16.             </h1>
  17.         </div>
  18.     </div>
  19.     <div class="ec-cartRole">
  20.         <div class="ec-cartRole__progress">
  21.             <ul class="ec-progress">
  22.                 {% set step = 1 %}
  23.                 <li class="ec-progress__item is-complete">
  24.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  25.                     </div>
  26.                     <div class="ec-progress__label">
  27.                         <span class="jp">カートの商品</span>
  28.                         <span class="en">Items In Your Cart</span>
  29.                     </div>
  30.                 </li>
  31.                 {% if is_granted('ROLE_USER') == false %}
  32.                     <li class="ec-progress__item">
  33.                         <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  34.                         </div>
  35.                         <div class="ec-progress__label">
  36.                             <span class="jp">お客様情報</span>
  37.                             <span class="en">Your Info</span>
  38.                         </div>
  39.                     </li>
  40.                 {% endif %}
  41.                 <li class="ec-progress__item">
  42.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  43.                     </div>
  44.                     <div class="ec-progress__label">
  45.                         <span class="jp">ご注文手続き</span>
  46.                         <span class="en">Ordering</span>
  47.                     </div>
  48.                 </li>
  49.                 <li class="ec-progress__item">
  50.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  51.                     </div>
  52.                     <div class="ec-progress__label">
  53.                         <span class="jp">ご注文内容確認</span>
  54.                         <span class="en">Confirming</span>
  55.                     </div>
  56.                 </li>
  57.                 <li class="ec-progress__item">
  58.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  59.                     </div>
  60.                     <div class="ec-progress__label">
  61.                         <span class="jp">完了</span>
  62.                         <span class="en">Completed</span>
  63.                     </div>
  64.                 </li>
  65.             </ul>
  66.         </div>
  67.         {% set productStr = app.session.flashbag.get('eccube.front.request.product') %}
  68.         {% for error in app.session.flashbag.get('eccube.front.request.error') %}
  69.             {% set idx = loop.index0 %}
  70.             <div class="ec-cartRole__error">
  71.                 <div class="ec-alert-warning">
  72.                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  73.                     <div class="ec-alert-warning__text">
  74.                         {% if productStr[idx] is defined %}
  75.                             {{ error|trans({'%product%':productStr[idx]})|nl2br }}
  76.                         {% else %}
  77.                             {{ error|trans|nl2br }}
  78.                         {% endif %}
  79.                     </div>
  80.                 </div>
  81.             </div>
  82.         {% endfor %}
  83.         {% for error in app.session.flashbag.get('eccube.front.cart.error') %}
  84.             <div class="ec-cartRole__error">
  85.                 <div class="ec-alert-warning">
  86.                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  87.                     <div class="ec-alert-warning__text">
  88.                         {{ error|trans|nl2br }}
  89.                     </div>
  90.                 </div>
  91.             </div>
  92.         {% endfor %}
  93.         {% if totalQuantity > 0 %}
  94.             <div class="ec-cartRole__totalText">
  95.                 <p>
  96.                     {{ '商品の合計金額は「<strong>%price%</strong>」です。'|trans({ '%price%': totalPrice|price })|raw }}
  97.                 </p>
  98.             </div>
  99.             
  100.             {# ▼▼▼ 追加:カート内のすべての product_id を収集 ▼▼▼ #}
  101.             {% set product_ids = [] %}
  102.             {% for Cart in Carts %}
  103.                 {% for CartItem in Cart.CartItems %}
  104.                     {% set ProductClass = CartItem.ProductClass %}
  105.                     {% set Product = ProductClass.Product %}
  106.                     {% if Product and Product.id is not null %}
  107.                         {% set product_ids = product_ids|merge([Product.id]) %}
  108.                     {% endif %}
  109.                 {% endfor %}
  110.             {% endfor %}
  111.             {# 対象商品の有無を判定 #}
  112.             {% set has_ticket = (36 in product_ids) %}
  113.             {% set has_bucket = (32 in product_ids) or (31 in product_ids) %}
  114.             {% if Carts|length > 1 %}
  115.                 <div class="ec-cartRole__error">
  116.                     <div class="ec-alert-warning">
  117.                         {# 32 or 31 が含まれる #}
  118.                         {% if has_ticket %}
  119.                             <div class="ec-alert-warning__text">
  120.                                 前売りチケットは他商品とは分けて単体でご購入お願いいたします。<br>
  121.                                 Please purchase "Pre-Sales Entry Ticket for 40th Festival" without other items.<br>
  122.                             </div>
  123.         
  124.                         {# 36 が含まれる #}
  125.                         {% elseif has_bucket %}
  126.                             <div class="ec-alert-warning__text">
  127.                                 レーシングバケットは出荷工場が異なるため他商品と分けてお会計お願いいたします。<br>
  128.                                 Please purchase "Full Bucket Seat" without other items. Because of difference of factory.
  129.                             </div>
  130.         
  131.                         {# それ以外(配送方法違いなどでカートが分かれている) #}
  132.                         {% else %}
  133.                             <div class="ec-alert-warning__text">
  134.                                 配送方法が異なるため同時購入できない商品がカートに含まれています。<br>
  135.                                 お手数おかけしますが配送方法ごとに分けてご購入お願い致します。
  136.                             </div>
  137.                         {% endif %}
  138.                     </div>
  139.                 </div>
  140.             {% endif %}
  141.             <form name="form" id="form_cart" class="ec-cartRole" method="post" action="{{ url('cart') }}">
  142.                 {% for CartIndex,Cart in Carts %}
  143.                     {% set cartKey = Cart.cart_key %}
  144.                     {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  145.                         <div class="ec-cartRole__error">
  146.                             <div class="ec-alert-warning">
  147.                                 <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  148.                                 <div class="ec-alert-warning__text">
  149.                                     {{ error|trans|nl2br }}
  150.                                 </div>
  151.                             </div>
  152.                         </div>
  153.                     {% endfor %}
  154.                     <div class="ec-cartRole__cart">
  155.                         <div class="ec-cartTable">
  156.                             <ol class="ec-cartHeader">
  157.                                 <li class="ec-cartHeader__label">{{ '削除'|trans }}</li>
  158.                                 <li class="ec-cartHeader__label">{{ '商品内容'|trans }}</li>
  159.                                 <li class="ec-cartHeader__label">{{ '数量'|trans }}</li>
  160.                                 <li class="ec-cartHeader__label">{{ '小計'|trans }}</li>
  161.                             </ol>
  162.                             {% for CartItem in Cart.CartItems %}
  163.                                 {% set ProductClass = CartItem.ProductClass %}
  164.                                 {% set Product = ProductClass.Product %}
  165.                                 <ul class="ec-cartRow">
  166.                                     <li class="ec-cartRow__delColumn">
  167.                                         <a href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}" {{ csrf_token_for_anchor() }} class="ec-icon" data-method="put" data-message="カートから商品を削除してもよろしいですか?">
  168.                                             <img src="{{ asset('assets/icon/cross.svg') }}" alt="delete">
  169.                                         </a>
  170.                                     </li>
  171.                                     <li class="ec-cartRow__contentColumn">
  172.                                         <div class="ec-cartRow__img">
  173.                                             <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">
  174.                                                 <img src="{{ asset(Product.MainListImage|no_image_product, 'save_image') }}" alt="{{ Product.name }}"/>
  175.                                             </a>
  176.                                         </div>
  177.                                         <div class="ec-cartRow__summary">
  178.                                             <div class="ec-cartRow__name">
  179.                                                 <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">{{ Product.name }}</a>
  180.                                                 {% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
  181.                                                     <br>{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}
  182.                                                 {% endif %}
  183.                                                 {% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
  184.                                                     <br>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}
  185.                                                 {% endif %}
  186.                                             </div>
  187.                                             <div class="ec-cartRow__unitPrice">{{ CartItem.price|price }}</div>
  188.                                             <div class="ec-cartRow__sutbtotalSP">{{ '小計:'|trans }}{{ CartItem.total_price|price }}</div>
  189.                                         </div>
  190.                                     </li>
  191.                                     <li class="ec-cartRow__amountColumn">
  192.                                         <div class="ec-cartRow__amount">{{ CartItem.quantity|number_format }}</div>
  193.                                         <div class="ec-cartRow__amountSP">{{ '数量:'|trans }}{{ CartItem.quantity|number_format }}</div>
  194.                                         <div class="ec-cartRow__amountUpDown">
  195.                                             {% if CartItem.quantity > 1 %}
  196.                                                 <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">
  197.                                                     <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus-dark.svg') }}" alt="reduce"></span>
  198.                                                 </a>
  199.                                             {% else %}
  200.                                                 <div class="ec-cartRow__amountDownButtonDisabled">
  201.                                                     <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus.svg') }}" alt="reduce"></span>
  202.                                                 </div>
  203.                                             {% endif %}
  204.                                             <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">
  205.                                                 <span class="ec-cartRow__amountUpButton__icon"><img src="{{ asset('assets/icon/plus-dark.svg') }}" alt="increase"></span>
  206.                                             </a>
  207.                                         </div>
  208.                                     </li>
  209.                                     <li class="ec-cartRow__subtotalColumn">
  210.                                         <div class="ec-cartRow__sutbtotal">{{ CartItem.total_price|price }}</div>
  211.                                     </li>
  212.                                 </ul>
  213.                             {% endfor %}
  214.                         </div>
  215.                     </div>
  216.                     <div class="ec-cartRole__progress">
  217.                         {% if BaseInfo.delivery_free_amount and BaseInfo.delivery_free_quantity %}
  218.                             <br/>
  219.                             {% if is_delivery_free[cartKey] %}
  220.                                 {{ '現在送料無料です。'|trans }}
  221.                             {% else %}
  222.                                 {{ 'あと「<strong>%price%</strong>」または「<strong>%quantity%個</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%price%': least[cartKey]|price, '%quantity%': quantity[cartKey]|number_format })|raw }}
  223.                             {% endif %}
  224.                         {% elseif BaseInfo.delivery_free_amount %}
  225.                             <br/>
  226.                             {% if is_delivery_free[cartKey] %}
  227.                                 {{ '現在送料無料です。'|trans }}
  228.                             {% else %}
  229.                                 {{ 'あと「<strong>%price%</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%price%': least[cartKey]|price })|raw }}
  230.                             {% endif %}
  231.                         {% elseif BaseInfo.delivery_free_quantity %}
  232.                             <br/>
  233.                             {% if is_delivery_free[cartKey] %}
  234.                                 {{ '現在送料無料です。'|trans }}
  235.                             {% else %}
  236.                                 {{ 'あと「<strong>%quantity%個</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%quantity%': quantity[cartKey]|number_format })|raw }}
  237.                             {% endif %}
  238.                         {% endif %}
  239.                     </div>
  240.                     <div class="ec-cartRole__actions">
  241.                         <div class="ec-cartRole__total">{{ '合計:'|trans }}<span class="ec-cartRole__totalAmount">{{ Cart.totalPrice|price }}</span>
  242.                         </div>
  243.                         <a class="ec-blockBtn--action" href="{{ path('cart_buystep', {'cart_key':cartKey}) }}">{{ 'レジに進む'|trans }}</a>
  244.                         {% if loop.last %}
  245.                             <a class="ec-blockBtn--cancel" href="{{ path('homepage') }}">{{ 'お買い物を続ける'|trans }}</a>
  246.                         {% endif %}
  247.                     </div>
  248.                 {% endfor %}
  249.             </form>
  250.         {% else %}
  251.             {% for CartIndex,Cart in Carts %}
  252.                 {% set cartKey = Cart.cart_key %}
  253.                 {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  254.                     <div class="ec-cartRole__error">
  255.                         <div class="ec-alert-warning">
  256.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  257.                             <div class="ec-alert-warning__text">
  258.                                 {{ error|trans|nl2br }}
  259.                             </div>
  260.                         </div>
  261.                     </div>
  262.                 {% endfor %}
  263.             {% endfor %}
  264.             <div class="ec-role">
  265.                 <div class="ec-off3Grid">
  266.                     <div class="ec-off3Grid__cell">
  267.                         <div class="ec-alert-warning">
  268.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  269.                             <div class="ec-alert-warning__text">{{ '現在カート内に商品はございません。'|trans }}</div>
  270.                         </div>
  271.                     </div>
  272.                 </div>
  273.             </div>
  274.         {% endif %}
  275.     </div>
  276. {% endblock %}