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>{{ 'ショッピングカート'|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">{{ 'カートの商品'|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">{{ 'お客様情報'|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">{{ 'ご注文手続き'|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">{{ 'ご注文内容確認'|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">{{ '完了'|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 app.request.get('no_product') %}
  81.             <div class="ec-cartRole__error">
  82.                 <div class="ec-alert-warning">
  83.                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  84.                     <div class="ec-alert-warning__text">
  85.                         ※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。
  86.                     </div>
  87.                 </div>
  88.             </div>
  89.         {% endif %}
  90.         {% if totalQuantity > 0 %}
  91.             <div class="ec-cartRole__totalText">
  92.                 <p>
  93.                     {{ '商品の合計金額は「<strong>%price%</strong>」です。'|trans({ '%price%': totalPrice|price })|raw }}
  94.                 </p>
  95.             </div>
  96.             {% if Carts|length > 1 %}
  97.                 <div class="ec-cartRole__error">
  98.                     <div class="ec-alert-warning">
  99.                         <div class="ec-alert-warning__text">
  100.                             {{ '同時購入できない商品がカートに含まれています。'|trans|nl2br }}
  101.                         </div>
  102.                     </div>
  103.                 </div>
  104.             {% endif %}
  105.             {% set totalAllProductPrice = 0 %}
  106.             {% set totalProductPrice = 0 %}
  107.             {% set userFee = userRate/100 %}
  108.             {% set taxRate = taxRate %}
  109.             <form name="form" id="form_cart" class="ec-cartRole" method="post" action="{{ url('cart') }}">
  110.                 {% set colors = {"_1_": "金","_2_": "銀","_3_": "黒","_4_": "白","_5_": "赤","_6_": "紺","_7_": "黄","_8_": "緑"} %}
  111.                 {% for CartIndex,Cart in Carts %}
  112.                     {% set cartKey = Cart.cart_key %}
  113.                     {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  114.                         <div class="ec-cartRole__error">
  115.                             <div class="ec-alert-warning">
  116.                                 <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  117.                                 <div class="ec-alert-warning__text">
  118.                                     {{ error|trans|nl2br }}
  119.                                 </div>
  120.                             </div>
  121.                         </div>
  122.                     {% endfor %}
  123.                     <div class="ec-cartRole__cart">
  124.                         <div class="ec-cartTable">
  125.                             <ol class="ec-cartHeader">
  126.                                 <li class="ec-cartHeader__label">{{ '削除'|trans }}</li>
  127.                                 <li class="ec-cartHeader__label">{{ '商品内容'|trans }}</li>
  128.                                 <li class="ec-cartHeader__label">{{ '単価'|trans }}</li>
  129.                                 <li class="ec-cartHeader__label">{{ '数量'|trans }}</li>
  130.                                 <li class="ec-cartHeader__label">{{ '小計'|trans }}</li>
  131.                             </ol>
  132.                             {% set newTotalPrice = 0 %}
  133.                             {% for CartItem in Cart.CartItems %}
  134.                                 {% set pricePrint = 0 %}
  135.                                 {% set ProductClass = CartItem.ProductClass %}
  136.                                 {% set Product = ProductClass.Product %}
  137.                                 {% set totalProductPrice = totalProductPrice + (CartItem.price*CartItem.quantity) %}
  138.                                 {% set totalAllProductPrice = totalAllProductPrice + (CartItem.price*CartItem.quantity) %}
  139.                                 <ul class="ec-cartRow">
  140.                                     <li class="ec-cartRow__delColumn">
  141.                                         <a href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id,'cartItemId': CartItem.id }) }}" {{ csrf_token_for_anchor() }} class="ec-icon" data-method="put" data-message="カートから商品を削除してもよろしいですか?">
  142.                                             <img src="{{ asset('assets/icon/cross.svg') }}" alt="delete">
  143.                                         </a>
  144.                                     </li>
  145.                                     <li class="ec-cartRow__contentColumn">
  146.                                         <div class="ec-cartRow__img">
  147.                                             <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">
  148.                                                 <img src="{{ asset(Product.MainListImage|no_image_product, 'save_image') }}" alt="{{ Product.name }}"/>
  149.                                             </a>
  150.                                         </div>
  151.                                         <div class="ec-cartRow__summary">
  152.                                             <div class="ec-cartRow__name">
  153.                                                 <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">{{ Product.name }}</a>
  154.                                                 {% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
  155.                                                     <br>{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}
  156.                                                 {% endif %}
  157.                                                 {% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
  158.                                                     <br>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}
  159.                                                 {% endif %}
  160.                                                 {% if CartItem.is_print == 1 %}
  161.                                                     <br>ネームプリントする: {% if CartItem.is_repurchase == 1 %} 前回と同じ版 {% else %} 新規版 {% endif %}
  162.                                                     {% if colors[CartItem.product_print_color] is defined %}
  163.                                                         <br>プリント色: {{ colors[CartItem.product_print_color] }}
  164.                                                     {% endif %}
  165.                                                     {% set pricePrint = CartItem.product_print_fee_price * CartItem.quantity %}
  166.                                                     {% set totalAllProductPrice = totalAllProductPrice + pricePrint %}
  167.                                                 {% else %}
  168.                                                     {% if ProductClass.Product.id != 1912 %}
  169.                                                     <br>ネームプリント しない
  170.                                                     {% endif %}
  171.                                                 {% endif %}
  172.                                             </div>
  173.                                         </div>
  174.                                     </li>
  175.                                     <li class="ec-cartRow__amountColumn">
  176.                                         <div class="ec-cartRow__unitPrice">
  177.                                             {{ CartItem.price|price }}
  178.                                         </div>
  179.                                         {% if CartItem.is_print == 1 %}
  180.                                         <div class="ec-cartRow__unitPrice">
  181.                                             (ネームプリント代){{ CartItem.product_print_fee_price|price }}
  182.                                         </div>
  183.                                         {% endif %}
  184.                                     </li>
  185.                                     <li class="ec-cartRow__amountColumn">
  186.                                         <div class="ec-cartRow__amount">{{ CartItem.quantity|number_format }}</div>
  187.                                         <div class="ec-cartRow__amountSP">{{ '数量:'|trans }}{{ CartItem.quantity|number_format }}</div>
  188.                                         <div class="ec-cartRow__amountUpDown">
  189.                                             {% if CartItem.quantity > 1 %}
  190.                                                 <a href="{{ url('cart_handle_item', {'operation': 'down', 'productClassId': ProductClass.id, 'cartItemId': CartItem.id}) }}" {{ csrf_token_for_anchor() }} class="ec-cartRow__amountDownButton load-overlay" data-method="put" data-confirm="false">
  191.                                                     <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus-dark.svg') }}" alt="reduce"></span>
  192.                                                 </a>
  193.                                             {% else %}
  194.                                                 <div class="ec-cartRow__amountDownButtonDisabled">
  195.                                                     <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus.svg') }}" alt="reduce"></span>
  196.                                                 </div>
  197.                                             {% endif %}
  198.                                             <a href="{{ url('cart_handle_item', {'operation': 'up', 'productClassId': ProductClass.id, 'cartItemId': CartItem.id}) }}" {{ csrf_token_for_anchor() }} class="ec-cartRow__amountUpButton load-overlay" data-method="put" data-confirm="false">
  199.                                                 <span class="ec-cartRow__amountUpButton__icon"><img src="{{ asset('assets/icon/plus-dark.svg') }}" alt="increase"></span>
  200.                                             </a>
  201.                                         </div>
  202.                                     </li>
  203.                                     <li class="ec-cartRow__subtotalColumn">
  204.                                         {% if CartItem.is_print %}
  205.                                             <div class="ec-cartRow__sutbtotal">{{ (CartItem.total_price+pricePrint)|price }}</div>
  206.                                             {% set newTotalPrice = newTotalPrice + (CartItem.total_price+pricePrint) %}
  207.                                         {% else %}
  208.                                             <div class="ec-cartRow__sutbtotal">{{ CartItem.total_price|price }}</div>
  209.                                             {% set newTotalPrice = newTotalPrice + CartItem.total_price %}
  210.                                         {% endif %}
  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.                     {% set totalPrice = 0 %}
  241.                     {% set totalPriceProductAndPrint = 0 %}
  242.                     {% set totalPriceProductFee10 = 0 %}
  243.                     {% set totalPriceTaxRate = 0 %}
  244.                     <div class="ec-cartRole__actions">
  245.                         <div class="ec-cartRole__total" style="padding-bottom: 0;">
  246.                             {{ '商品合計:'|trans }}
  247.                             <span class="ec-cartRole__totalAmount">{{ totalAllProductPrice|price }}</span>
  248.                         </div>
  249.                         {% set totalPrice = totalPrice + totalAllProductPrice %}
  250.                         {% set totalPriceProductAndPrint = totalPriceProductAndPrint + totalAllProductPrice %}
  251.                         <div class="ec-cartRole__total" style="padding-bottom: 0;">
  252.                             {{ '会員割引:'|trans }}
  253.                             <span class="ec-cartRole__totalAmount">-{{ (totalProductPrice*userFee)|price }}</span>
  254.                         </div>
  255.                         {% set totalPriceProductAndPrint = totalPriceProductAndPrint - (totalProductPrice*userFee) %}
  256.                         {% set totalPrice = totalPrice - (totalProductPrice*userFee) %}
  257.                         <div class="ec-cartRole__total" style="padding-bottom: 0;">
  258.                             {{ '版代:'|trans }}
  259.                             <span class="ec-cartRole__totalAmount">{{ fee_print_all_price|price }}</span>
  260.                         </div>
  261.                         {% set totalPrice = totalPrice + fee_print_all_price %}
  262.                         {% set totalPriceProductAndPrint = totalPriceProductAndPrint + fee_print_all_price %}
  263.                         {% set totalPriceProductFee10 = (totalAllProductPrice - (totalProductPrice*userFee)) + fee_print_all_price %}
  264.                         <div class="ec-cartRole__total" style="padding-bottom: 0;">
  265.                             {{ '消費税:'|trans }}
  266.                             {% set totalPriceTaxRate = (totalPriceProductFee10 * (taxRate/100))|round(0, roundType) %}
  267.                             <span class="ec-cartRole__totalAmount">{{ totalPriceTaxRate|price }}</span>
  268.                         </div>
  269.                         <div class="ec-cartRole__total">{{ '合計:'|trans }}<span class="ec-cartRole__totalAmount">{{ (totalPrice+totalPriceTaxRate)|price }}</span>
  270.                         </div>
  271.                         <a class="ec-blockBtn--action" href="{{ path('cart_buystep', {'cart_key':cartKey}) }}">{{ 'レジに進む'|trans }}</a>
  272.                         {% if loop.last %}
  273.                             <a class="ec-blockBtn--cancel" href="{{ path('homepage') }}">{{ 'お買い物を続ける'|trans }}</a>
  274.                         {% endif %}
  275.                     </div>
  276.                 {% endfor %}
  277.             </form>
  278.         {% else %}
  279.             {% for CartIndex,Cart in Carts %}
  280.                 {% set cartKey = Cart.cart_key %}
  281.                 {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  282.                     <div class="ec-cartRole__error">
  283.                         <div class="ec-alert-warning">
  284.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  285.                             <div class="ec-alert-warning__text">
  286.                                 {{ error|trans|nl2br }}
  287.                             </div>
  288.                         </div>
  289.                     </div>
  290.                 {% endfor %}
  291.             {% endfor %}
  292.             <div class="ec-role">
  293.                 <div class="ec-off3Grid">
  294.                     <div class="ec-off3Grid__cell">
  295.                         <div class="ec-alert-warning">
  296.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  297.                             <div class="ec-alert-warning__text">{{ '現在カート内に商品はございません。'|trans }}</div>
  298.                         </div>
  299.                     </div>
  300.                 </div>
  301.             </div>
  302.         {% endif %}
  303.     </div>
  304. {% endblock %}