{% extends 'default_frame.twig' %}
{% set body_id = 'cart_page' %}
{% block main %}
<section>
<div class="main_ttl_wrap">
<h2 class="main_ttl">ショッピングカート</h2>
</div>
</section>
<div class="ec-cartRole__progress">
<ul class="ec-progress">
{% set step = 1 %}
<li class="ec-progress__item is-complete">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ 'カートの商品'|trans }}
</div>
</li>
{% if is_granted('ROLE_USER') == false %}
<li class="ec-progress__item">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ 'お客様情報'|trans }}
</div>
</li>
{% endif %}
<li class="ec-progress__item">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ 'ご注文手続き'|trans }}
</div>
</li>
<li class="ec-progress__item">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ 'ご注文内容確認'|trans }}
</div>
</li>
<li class="ec-progress__item">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ '完了'|trans }}
</div>
</li>
</ul>
</div>
{% set productStr = app.session.flashbag.get('eccube.front.request.product') %}
{% for error in app.session.flashbag.get('eccube.front.request.error') %}
{% set idx = loop.index0 %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">
{% if productStr[idx] is defined %}
{{ error|trans({'%product%':productStr[idx]})|nl2br }}
{% else %}
{{ error|trans|nl2br }}
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% for error in app.session.flashbag.get('eccube.front.cart.error') %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">
{{ error|trans|nl2br }}
</div>
</div>
</div>
{% endfor %}
{% if totalQuantity > 0 %}
<div class="totalText center mb30">
<p>
{{ '商品の合計金額は「<strong>%price%</strong>」です。'|trans({ '%price%': totalPrice|price })|raw }}
</p>
</div>
{% if Carts|length > 1 %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__text">
{{ '同時購入できない商品がカートに含まれています。'|trans|nl2br }}
</div>
</div>
</div>
{% endif %}
<form name="form" id="form_cart" class="ec-cartRole" method="post" action="{{ url('cart') }}">
{% for CartIndex,Cart in Carts %}
{% set cartKey = Cart.cart_key %}
{% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">
{{ error|trans|nl2br }}
</div>
</div>
</div>
{% endfor %}
<div class="form_area cart_area sp_ml5 sp_mr5">
<table class="cart_table">
<tr>
<th>商品情報</th>
<th>数量</th>
<th>価格</th>
<th>削除</th>
</tr>
{% for CartItem in Cart.CartItems %}
{% set ProductClass = CartItem.ProductClass %}
{% set Product = ProductClass.Product %}
<tr>
<td>
<div class="cartform_img">
<a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">
<img src="{{ asset(Product.MainListImage|no_image_product, 'save_image') }}"
alt="{{ Product.name }}" />
</a>
</div>
<div class="cartform_name">
<a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">{{ Product.name }}</a>
{% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
<br>{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}
{% endif %}
{% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
<br>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}
{% endif %}
{% if CartItem.CustomCartItemPrice is not empty %}
<div class="">
ヨコ幅:{{CartItem.CustomCartItemPrice.width}}mm
</div>
<div class="">
タテ長:{{CartItem.CustomCartItemPrice.height}}mm
</div>
<div class="">
本体価格:{{CartItem.CustomCartItemPrice.price|price}}
</div>
<div class="">
面取り加工:{{getChamfer(CartItem.CustomCartItemPrice.chamfer)}} {{CartItem.CustomCartItemPrice.chamfer_price|price}}
</div>
<div class="">
取付金具:{{getMounting(CartItem.CustomCartItemPrice.mounting)}} {{CartItem.CustomCartItemPrice.mounting_price|price}}
</div>
{# <div class="">
吊り金具・ヒモ(無料):{{getHanging(CartItem.CustomCartItemPrice.hanging)}}
</div>
<div class="">
ゴム足(無料):{{getRubber(CartItem.CustomCartItemPrice.rubber)}}
</div> #}
{% endif %}
</div>
</td>
<td>
<div class="cart_amount_updown">
{% if CartItem.quantity > 1 %}
<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">
<img src="{{ asset('assets/img/icon/cart_minus.svg') }}" alt="マイナス">
</a>
{% else %}
<a href="javascript:;" style="opacity: 0.5;">
<img src="{{ asset('assets/img/icon/cart_minus.svg') }}" alt="マイナス">
</a>
{% endif %}
<p class="cart_amount">{{ CartItem.quantity|number_format }}</p>
<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">
<img src="{{ asset('assets/img/icon/cart_plus.svg') }}" alt="プラス">
</a>
</div>
</td>
<td>
<div class="cart_price">{{ CartItem.price|price }}</div>
</td>
<td>
<div class="cart_delate">
<a href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}"
{{ csrf_token_for_anchor() }} class="ec-icon" data-method="put"
data-message="カートから商品を削除してもよろしいですか?">
<img src="{{ asset('assets/img/icon/cart_delate.svg') }}" alt="delete" class="pc">
<span class="sp">削除</span>
</a>
</div>
</td>
</tr>
{% endfor %}
</table>
<div class="cart_total">
<p class="txt_total">合計金額<strong>{{ Cart.totalPrice|price }}</strong><span>円(税込)</span></p>
{% if BaseInfo.isOptionPoint and is_granted('ROLE_USER') %}
<p class="txt_point">{{Cart.add_point}}ポイント獲得できます</p>
{% endif %}
<div class="">
<p>送料:全国一律 1,320円(税込)</p>
{% if BaseInfo.delivery_free_amount and BaseInfo.delivery_free_quantity %}
{% if is_delivery_free[cartKey] %}
{{ '送料:無料'|trans }}
{% else %}
{{ 'あと「<strong>%price%</strong>」または「<strong>%quantity%個</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%price%': least[cartKey]|price, '%quantity%': quantity[cartKey]|number_format })|raw }}
{% endif %}
{% elseif BaseInfo.delivery_free_amount %}
{% if is_delivery_free[cartKey] %}
{{ '送料:無料'|trans }}
{% else %}
{{ 'あと「<strong>%price%</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%price%': least[cartKey]|price })|raw }}
{% endif %}
{% elseif BaseInfo.delivery_free_quantity %}
{% if is_delivery_free[cartKey] %}
{{ '送料:無料'|trans }}
{% else %}
{{ 'あと「<strong>%quantity%個</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%quantity%': quantity[cartKey]|number_format })|raw }}
{% endif %}
{% endif %}
</div>
</div>
<div class="flex_btn between">
{% if loop.last %}
<a class="cart_back_btn btn" href="{{ path('homepage') }}">買い物を続ける</a>
{% endif %}
<a href="{{ path('cart_buystep', {'cart_key':cartKey}) }}"
class="cart_btn btn no_arrow"><span>ご購入手続きへ進む</span></a>
</div>
</div>
{% endfor %}
</form>
{% else %}
{% for CartIndex,Cart in Carts %}
{% set cartKey = Cart.cart_key %}
{% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">
{{ error|trans|nl2br }}
</div>
</div>
</div>
{% endfor %}
{% endfor %}
<div class="ec-role">
<div class="ec-off3Grid">
<div class="ec-off3Grid__cell">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">{{ '現在カート内に商品はございません。'|trans }}</div>
</div>
</div>
</div>
</div>
{% endif %}
<style>
.ec-cartRole {
display: block;
padding: 0;
}
</style>
{% endblock %}