app/template/default/Cart/index.twig line 1

Open in your IDE?
  1. {% extends 'default_frame.twig' %}
  2. {% set body_class = 'cart_page' %}
  3. {% block main %}
  4. <div id="undercolumn_cart">
  5.     <div class="ec-role">
  6.         <div class="ec-pageHeader">
  7.             <h2 class="title">{{ '現在のカゴの中'|trans }}</h2>
  8.         </div>
  9.     </div>
  10.     <div class="ec-cartRole">
  11.         {% set productStr = app.session.flashbag.get('eccube.front.request.product') %}
  12.         {% for error in app.session.flashbag.get('eccube.front.request.error') %}
  13.             {% set idx = loop.index0 %}
  14.             <div class="ec-cartRole__error">
  15.                 <div class="ec-alert-warning">
  16.                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  17.                     <div class="ec-alert-warning__text">
  18.                         {% if productStr[idx] is defined %}
  19.                             {{ error|trans({'%product%':productStr[idx]})|nl2br }}
  20.                         {% else %}
  21.                             {{ error|trans|nl2br }}
  22.                         {% endif %}
  23.                     </div>
  24.                 </div>
  25.             </div>
  26.         {% endfor %}
  27.         {% for error in app.session.flashbag.get('eccube.front.cart.error') %}
  28.             <div class="ec-cartRole__error">
  29.                 <div class="ec-alert-warning">
  30.                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  31.                     <div class="ec-alert-warning__text">
  32.                         {{ error|trans|nl2br }}
  33.                     </div>
  34.                 </div>
  35.             </div>
  36.         {% endfor %}
  37.         {% if totalQuantity > 0 %}
  38.             {% if Carts|length > 1 %}
  39.                 <div class="ec-alert-warning">
  40.                     <div class="ec-alert-warning__text">
  41.                         {# 商品のSalecttypeを求める #}
  42.                         {% set SaleTypetext = [] %}
  43.                         {% for CartIndex,Cart in Carts %}
  44.                             {% for CartItem in Cart.CartItems %}
  45.                                 {% if CartItem.ProductClass.SaleType.name not in SaleTypetext %}
  46.                                     {% set SaleTypetext = SaleTypetext|merge([CartItem.ProductClass.SaleType.name]) %}
  47.                                 {% endif %}
  48.                             {% endfor %}
  49.                         {% endfor %}
  50.                         <div class="alert" style="margin-bottom:0;">
  51.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  52.                             {{SaleTypetext|join(',')}}は同時購入できません。<br />お手数ですが、個別に購入手続きをお願い致します。
  53.                         </div>
  54.                     </div>
  55.                 </div>
  56.             {% endif %}
  57.             <form name="form" id="form_cart" class="ec-cartRole" method="post" action="{{ url('cart') }}">
  58.                 {% for CartIndex,Cart in Carts %}
  59.                     <div class="cart-list">
  60.                         {% set cartKey = Cart.cart_key %}
  61.                         {% set errorflug = false %}
  62.                         {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  63.                             <div class="ec-cartRole__error">
  64.                                 <div class="ec-alert-warning">
  65.                                     <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  66.                                     <div class="ec-alert-warning__text">
  67.                                         {{ error|trans|nl2br }}
  68.                                     </div>
  69.                                 </div>
  70.                             </div>
  71.                             {% set errorflug = true %}
  72.                         {% endfor %}
  73.                         {# カートヘッダー(カートが別れる時のみ表示) #}
  74.                         {% set purchasing_goods_name = '' %}
  75.                         {% if Carts|length > 1 %}
  76.                             {% set SaleTypefirst = [] %}
  77.                             {% for CartItem in Cart.CartItems %}
  78.                             {% if loop.first %}
  79.                                 {% set SaleTypefirst = CartItem.ProductClass.SaleType.name %}
  80.                             {% endif %}
  81.                             {% endfor %}
  82.                                 <h3 class="subtitle">{{SaleTypefirst}}</h3>
  83.                             {% set purchasing_goods_name = SaleTypefirst %}
  84.                         {% else %}
  85.                             {% set purchasing_goods_name = "カートの中の商品" %}
  86.                         {% endif %}
  87.                         <div class="ec-cartRole__totalText">
  88.                             <p>
  89.                                 {{purchasing_goods_name}}の合計金額は「<strong>{{ Cart.totalPrice|number_format }}円</strong>」です。
  90.                             </p>
  91.                         </div>
  92.                         {# カート詳細情報 #}
  93.                         <div class="ec-cartRole__cart">
  94.                             <div class="ec-cartTable table-layout__type3">
  95.                                 <div class="tr table-head">
  96.                                     <div class="th w1 ec-cartHeader__label">削除</div>
  97.                                     <div class="th w1 ec-cartHeader__label">画像</div>
  98.                                     <div class="th w4 table-layout__name ec-cartHeader__label">商品名</div>
  99.                                     <div class="th w2 ec-cartHeader__label">単価</div>
  100.                                     <div class="th w2 ec-cartHeader__label">数量</div>
  101.                                     <div class="th w2 ec-cartHeader__label">小計</div>
  102.                                 </div>
  103.                                 {% for CartItem in Cart.CartItems %}
  104.                                     {% set ProductClass = CartItem.ProductClass %}
  105.                                     {% set Product = ProductClass.Product %}
  106.                                     <div class="tr">
  107.                                         <div class="td w1 table-layout__deleate textLC ec-cartRow__delColumn">
  108.                                             <div class="position-center">
  109.                                                 <div class="only-pc">
  110.                                                     <a class="btn-oldinput__short ec-icon" href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}" {{ csrf_token_for_anchor() }} data-method="put" data-message="カートから商品を削除してもよろしいですか?">
  111.                                                         <span>削除</span>
  112.                                                     </a>
  113.                                                 </div>
  114.                                                 <div class="only-sp">
  115.                                                     <a class="ec-icon" href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}" {{ csrf_token_for_anchor() }} data-method="put" data-message="カートから商品を削除してもよろしいですか?">
  116.                                                         <p class="ec-icon close-btn">
  117.                                                         <img src="{{ asset('assets/icon/cross-white.svg') }}" alt="delete">
  118.                                                         </p>
  119.                                                     </a>
  120.                                                 </div>
  121.                                             </div>
  122.                                         </div>
  123.                                         <div class="td w1 table-layout__img textLC ec-cartRow__img">
  124.                                             <div class="position-center">
  125.                                                 <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">
  126.                                                     <img src="{{ asset(Product.MainListImage|no_image_product, 'save_image') }}" alt="{{ Product.name }}"/>
  127.                                                 </a>
  128.                                             </div>
  129.                                         </div>
  130.                                         <div class="td w4 table-layout__right ec-cartRow__name" data-label="商品名 :">
  131.                                             <div class="position-center">
  132.                                                 <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">{{ Product.name }}</a>
  133.                                                 {% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
  134.                                                     <p>{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}</p>
  135.                                                 {% endif %}
  136.                                                 {% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
  137.                                                     <p>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}</p>
  138.                                                 {% endif %}
  139.                                             </div>
  140.                                         </div>
  141.                                         <div  class="td w2 table-layout__right textLR ec-cartRow__unitPrice" data-label="単価 :">
  142.                                             <div class="position-center">
  143.                                                 <span>{{ CartItem.price|number_format }}円</span>
  144.                                             </div>
  145.                                         </div>
  146.                                         <div  class="td w2 table-layout__right textLC ec-cartRow__amountColumn" data-label="数量 :">
  147.                                             <div class="position-center">
  148.                                                 <p class="ec-cartRow__amount">{{ CartItem.quantity|number_format }}</p>
  149.                                                 <div class="ec-cartRow__amountUpDown flex">
  150.                                                     {% if CartItem.quantity > 1 %}
  151.                                                         <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">
  152.                                                             <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus-dark.svg') }}" alt="reduce"></span>
  153.                                                         </a>
  154.                                                     {% else %}
  155.                                                         <div class="ec-cartRow__amountDownButtonDisabled">
  156.                                                             <span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus.svg') }}" alt="reduce"></span>
  157.                                                         </div>
  158.                                                     {% endif %}
  159.                                                     <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">
  160.                                                         <span class="ec-cartRow__amountUpButton__icon"><img src="{{ asset('assets/icon/plus-dark.svg') }}" alt="increase"></span>
  161.                                                     </a>
  162.                                                 </div>
  163.                                             </div>
  164.                                         </div>
  165.                                         <div  class="td w2 table-layout__right textLR ec-cartRow__subtotalColumn" data-label="小計 :">
  166.                                             <div class="ec-cartRow__sutbtotal position-center">
  167.                                                 <span>{{ CartItem.total_price|number_format }}円</span>
  168.                                             </div>
  169.                                         </div>
  170.                                     </div>
  171.                                 {% endfor %}
  172.                             </div>
  173.                         </div>
  174.                         {% if errorflug == false %}
  175.                             <p class="cart-agree">上記内容でよろしければ「購入手続きへ」ボタンをクリックしてください。</p>
  176.                         {% endif %}
  177.                         <div class="btn-area flex">
  178.                             <a class="ec-blockBtn--action orange-btn" href="{{ path('cart_buystep', {'cart_key':cartKey}) }}">購入手続きへ</a>
  179.                             <a class="ec-blockBtn--cancel gray-btn back-btn" href="{{ path('homepage') }}">戻る</a>
  180.                         </div>
  181.                     </div>
  182.                 {% endfor %}
  183.             </form>
  184.         {% else %}
  185.             {% for CartIndex,Cart in Carts %}
  186.                 {% set cartKey = Cart.cart_key %}
  187.                 {% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
  188.                     <div class="ec-cartRole__error">
  189.                         <div class="ec-alert-warning">
  190.                             <div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
  191.                             <div class="ec-alert-warning__text">
  192.                                 {{ error|trans|nl2br }}
  193.                             </div>
  194.                         </div>
  195.                     </div>
  196.                 {% endfor %}
  197.             {% endfor %}
  198.             <div class="ec-role">
  199.                 <div class="ec-alert-warning">
  200.                     <div class="ec-alert-warning__text empty"><span class="attention">※ 現在カート内に商品はございません。</span></div>
  201.                 </div>
  202.             </div>
  203.         {% endif %}
  204.     </div>
  205. </div>
  206. {% endblock %}