src/Eccube/Resource/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>{{ 'front.cart.title'|trans }}</h1>
  14.         </div>
  15.     </div>
  16.     <div class="ec-cartRole">
  17.         <div class="ec-cartRole__progress">
  18.             <ul class="ec-progress">
  19.                 {% set step = 1 %}
  20.                 <li class="ec-progress__item is-complete">
  21.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  22.                     </div>
  23.                     <div class="ec-progress__label">{{ 'front.cart.nav__cart_items'|trans }}
  24.                     </div>
  25.                 </li>
  26.                 {% if is_granted('ROLE_USER') == false %}
  27.                     <li class="ec-progress__item">
  28.                         <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  29.                         </div>
  30.                         <div class="ec-progress__label">{{ 'front.cart.nav__customer_info'|trans }}
  31.                         </div>
  32.                     </li>
  33.                 {% endif %}
  34.                 <li class="ec-progress__item">
  35.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  36.                     </div>
  37.                     <div class="ec-progress__label">{{ 'front.cart.nav__order'|trans }}
  38.                     </div>
  39.                 </li>
  40.                 <li class="ec-progress__item">
  41.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  42.                     </div>
  43.                     <div class="ec-progress__label">{{ 'front.cart.nav__confirm'|trans }}
  44.                     </div>
  45.                 </li>
  46.                 <li class="ec-progress__item">
  47.                     <div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
  48.                     </div>
  49.                     <div class="ec-progress__label">{{ 'front.cart.nav__complete'|trans }}
  50.                     </div>
  51.                 </li>
  52.             </ul>
  53.         </div>
  54.         {% set productStr = app.session.flashbag.get('eccube.front.request.product') %}
  55.         {% for error in app.session.flashbag.get('eccube.front.request.error') %}
  56.             {% set idx = loop.index0 %}
  57.             <div class="ec-cartRole__error">
  58.                 <div class="ec-alert-warning">
  59.                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  60.                     <div class="ec-alert-warning__text">
  61.                         {% if productStr[idx] is defined %}
  62.                             {{ error|trans({'%product%':productStr[idx]})|nl2br }}
  63.                         {% else %}
  64.                             {{ error|trans|nl2br }}
  65.                         {% endif %}
  66.                     </div>
  67.                 </div>
  68.             </div>
  69.         {% endfor %}
  70.         {% for error in app.session.flashbag.get('eccube.front.cart.error') %}
  71.             <div class="ec-cartRole__error">
  72.                 <div class="ec-alert-warning">
  73.                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  74.                     <div class="ec-alert-warning__text">
  75.                         {{ error|trans|nl2br }}
  76.                     </div>
  77.                 </div>
  78.             </div>
  79.         {% endfor %}
  80.         {% if totalQuantity > 0 %}
  81.             <div class="ec-cartRole__totalText">
  82.                 <p>
  83.                     {{ 'front.cart.total_price'|trans({ '%price%': totalPrice|price })|raw }}
  84.                 </p>
  85.             </div>
  86.             {% if Carts|length > 1 %}
  87.                 <div class="ec-cartRole__error">
  88.                     <div class="ec-alert-warning">
  89.                         <div class="ec-alert-warning__text">
  90.                             {{ 'front.cart.divide_cart'|trans|nl2br }}
  91.                         </div>
  92.                     </div>
  93.                 </div>
  94.             {% endif %}
  95.             <form name="form" id="form_cart" class="ec-cartRole" method="post" action="{{ url('cart') }}">
  96.                 {% for CartIndex,Cart in Carts %}
  97.                     {% set cartKey = Cart.cart_key %}
  98.                     {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  99.                         <div class="ec-cartRole__error">
  100.                             <div class="ec-alert-warning">
  101.                                 <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  102.                                 <div class="ec-alert-warning__text">
  103.                                     {{ error|trans|nl2br }}
  104.                                 </div>
  105.                             </div>
  106.                         </div>
  107.                     {% endfor %}
  108.                     <div class="ec-cartRole__cart">
  109.                         <div class="ec-cartTable">
  110.                             <ol class="ec-cartHeader">
  111.                                 <li class="ec-cartHeader__label">{{ 'front.cart.delete'|trans }}</li>
  112.                                 <li class="ec-cartHeader__label">{{ 'front.cart.product'|trans }}</li>
  113.                                 <li class="ec-cartHeader__label">{{ 'common.quantity'|trans }}</li>
  114.                                 <li class="ec-cartHeader__label">{{ 'common.subtotal'|trans }}</li>
  115.                             </ol>
  116.                             {% for CartItem in Cart.CartItems %}
  117.                                 {% set ProductClass = CartItem.ProductClass %}
  118.                                 {% set Product = ProductClass.Product %}
  119.                                 <ul class="ec-cartRow">
  120.                                     <li class="ec-cartRow__delColumn">
  121.                                         <a href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}" {{ csrf_token_for_anchor() }} class="ec-icon" data-method="put" data-message="カートから商品を削除してもよろしいですか?">
  122.                                             <img src="{{ asset('assets/icon/cross.svg') }}" alt="delete">
  123.                                         </a>
  124.                                     </li>
  125.                                     <li class="ec-cartRow__contentColumn">
  126.                                         <div class="ec-cartRow__img">
  127.                                             <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">
  128.                                                 <img src="{{ asset(Product.MainListImage|no_image_product, 'save_image') }}" alt="{{ Product.name }}"/>
  129.                                             </a>
  130.                                         </div>
  131.                                         <div class="ec-cartRow__summary">
  132.                                             <div class="ec-cartRow__name">
  133.                                                 <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">{{ Product.name }}</a>
  134.                                                 {% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
  135.                                                     <br>{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}
  136.                                                 {% endif %}
  137.                                                 {% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
  138.                                                     <br>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}
  139.                                                 {% endif %}
  140.                                             </div>
  141.                                             <div class="ec-cartRow__unitPrice">{{ CartItem.price|price }}</div>
  142.                                             <div class="ec-cartRow__sutbtotalSP">{{ 'common.subtotal__with_separator'|trans }}{{ CartItem.total_price|price }}</div>
  143.                                         </div>
  144.                                     </li>
  145.                                     <li class="ec-cartRow__amountColumn">
  146.                                         <div class="ec-cartRow__amount">{{ CartItem.quantity|number_format }}</div>
  147.                                         <div class="ec-cartRow__amountSP">{{ 'common.quantity__with_separator'|trans }}{{ CartItem.quantity|number_format }}</div>
  148.                                         <div class="ec-cartRow__amountUpDown">
  149.                                             {% if CartItem.quantity > 1 %}
  150.                                                 <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">
  151.                                                     <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus-dark.svg') }}" alt="reduce"></span>
  152.                                                 </a>
  153.                                             {% else %}
  154.                                                 <div class="ec-cartRow__amountDownButtonDisabled">
  155.                                                     <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus.svg') }}" alt="reduce"></span>
  156.                                                 </div>
  157.                                             {% endif %}
  158.                                             <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">
  159.                                                 <span class="ec-cartRow__amountUpButton__icon"><img src="{{ asset('assets/icon/plus-dark.svg') }}" alt="increase"></span>
  160.                                             </a>
  161.                                         </div>
  162.                                     </li>
  163.                                     <li class="ec-cartRow__subtotalColumn">
  164.                                         <div class="ec-cartRow__sutbtotal">{{ CartItem.total_price|price }}</div>
  165.                                     </li>
  166.                                 </ul>
  167.                             {% endfor %}
  168.                         </div>
  169.                     </div>
  170.                     <div class="ec-cartRole__progress">
  171.                         {% if BaseInfo.delivery_free_amount and BaseInfo.delivery_free_quantity %}
  172.                             <br/>
  173.                             {% if is_delivery_free[cartKey] %}
  174.                                 {{ 'front.cart.delivery_fee_free__now'|trans }}
  175.                             {% else %}
  176.                                 {{ 'front.cart.delivery_fee_free__price_and_quantity'|trans({ '%price%': least[cartKey]|price, '%quantity%': quantity[cartKey]|number_format })|raw }}
  177.                             {% endif %}
  178.                         {% elseif BaseInfo.delivery_free_amount %}
  179.                             <br/>
  180.                             {% if is_delivery_free[cartKey] %}
  181.                                 {{ 'front.cart.delivery_fee_free__now'|trans }}
  182.                             {% else %}
  183.                                 {{ 'front.cart.delivery_fee_free__price'|trans({ '%price%': least[cartKey]|price })|raw }}
  184.                             {% endif %}
  185.                         {% elseif BaseInfo.delivery_free_quantity %}
  186.                             <br/>
  187.                             {% if is_delivery_free[cartKey] %}
  188.                                 {{ 'front.cart.delivery_fee_free__now'|trans }}
  189.                             {% else %}
  190.                                 {{ 'front.cart.delivery_fee_free__quantity'|trans({ '%quantity%': quantity[cartKey]|number_format })|raw }}
  191.                             {% endif %}
  192.                         {% endif %}
  193.                     </div>
  194.                     <div class="ec-cartRole__actions">
  195.                         <div class="ec-cartRole__total">{{ 'common.total__with_separator'|trans }}<span class="ec-cartRole__totalAmount">{{ Cart.totalPrice|price }}</span>
  196.                         </div>
  197.                         <a class="ec-blockBtn--action" href="{{ path('cart_buystep', {'cart_key':cartKey}) }}">{{ 'front.cart.checkout'|trans }}</a>
  198.                         {% if loop.last %}
  199.                             <a class="ec-blockBtn--cancel" href="{{ path('homepage') }}">{{ 'front.cart.continue'|trans }}</a>
  200.                         {% endif %}
  201.                     </div>
  202.                 {% endfor %}
  203.             </form>
  204.         {% else %}
  205.             {% for CartIndex,Cart in Carts %}
  206.                 {% set cartKey = Cart.cart_key %}
  207.                 {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  208.                     <div class="ec-cartRole__error">
  209.                         <div class="ec-alert-warning">
  210.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  211.                             <div class="ec-alert-warning__text">
  212.                                 {{ error|trans|nl2br }}
  213.                             </div>
  214.                         </div>
  215.                     </div>
  216.                 {% endfor %}
  217.             {% endfor %}
  218.             <div class="ec-role">
  219.                 <div class="ec-off3Grid">
  220.                     <div class="ec-off3Grid__cell">
  221.                         <div class="ec-alert-warning">
  222.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  223.                             <div class="ec-alert-warning__text">{{ 'front.cart.no_items'|trans }}</div>
  224.                         </div>
  225.                     </div>
  226.                 </div>
  227.             </div>
  228.         {% endif %}
  229.     </div>
  230. {% endblock %}