{#
This file is part of EC-CUBE
Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
http://www.ec-cube.co.jp/
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% set Carts = get_all_carts() %}
{% set totalPrice = get_carts_total_price() %}
{% set totalQuantity = get_carts_total_quantity() %}
<div class="ec-cartNaviWrap">
<div class="ec-cartNavi">
<i class="ec-cartNavi__icon fas fa-shopping-cart">
<span class="ec-cartNavi__badge">{{ totalQuantity|number_format }}</span>
</i>
<div class="ec-cartNavi__label">
<div class="ec-cartNavi__price">{{ totalPrice|price }}</div>
</div>
</div>
{% if totalQuantity > 0 %}
<div class="ec-cartNaviIsset">
{% for Cart in Carts %}
{% for CartItem in Cart.CartItems %}
{% set ProductClass = CartItem.ProductClass %}
{% set Product = ProductClass.Product %}
<div class="ec-cartNaviIsset__cart">
<div class="ec-cartNaviIsset__cartImage">
{# ─── ① 画像名オプションを探す ─── #}
{% set imageName = '' %}
{% for opt in CartItem.CartItemOptions %}
{% if opt.label == '画像名' %}
{% for cat in opt.CartItemOptionCategories %}
{% set imageName = cat.value %}
{% endfor %}
{% endif %}
{% endfor %}
{# ─── ② オプション画像があればカスタムルート、それ以外は通常画像 ─── #}
{% if imageName %}
<img src="{{ path('upload_image', { filename: imageName }) }}" alt="{{ imageName }}">
{% else %}
<img src="{{ asset(Product.MainListImage|no_image_product, 'save_image') }}" alt="{{ Product.name }}">
{% endif %}
</div>
<div class="ec-cartNaviIsset__cartContent">
<div class="ec-cartNaviIsset__cartContentTitle">{{ Product.name }}
<div class="ec-font-size-1">
{% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}
{% endif %}
{% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
<br>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}
{% endif %}
{{ include('@ProductOption42/default/Cart/cart_option.twig',ignore_missing=true) }}
</div>
</div>
<div class="ec-cartNaviIsset__cartContentPrice">
{{ CartItem.price|price }}
<div class="ec-cartNaviIsset__cartContentTax">{{ '税込'|trans }}</div>
</div>
<div class="ec-cartNaviIsset__cartContentNumber">{{ '数量'|trans }} {{ CartItem.quantity|number_format }}</div>
</div>
</div>
{% endfor %}
{% endfor %}
<div class="ec-cartNaviIsset__action">
<a class="ec-blockBtn--action" href="{{ url('cart') }}">{{ 'カートへ進む'|trans }}</a>
<a class="ec-blockBtn ec-cartNavi--cancel">{{ 'キャンセル'|trans }}</a>
</div>
</div>
{% else %}
<div class="ec-cartNaviNull">
<div class="ec-cartNaviNull__message">
<p>{{ '現在カート内に商品はございません。'|trans }}</p>
</div>
</div>
{% endif %}
</div>