{% extends 'default_frame.twig' %}
{% block stylesheet %}
<style>
.cart-wrapper {
margin: 10px;
}
.cart-item {
display: flex;
margin-bottom: 20px;
border: 1px solid #ccc;
padding: 10px;
border-radius: 8px;
background: #fff;
}
.cart-item-image img {
width: 100px;
height: auto;
object-fit: cover;
border-radius: 8px;
}
.cart-item-info {
flex: 1;
margin-left: 10px;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.cart-item-title a {
font-weight: bold;
color: #333;
}
.cart-item-price,
.cart-item-subtotal,
.cart-item-quantity,
.cart-item-delete {
margin: 5px 0;
}
.quantity-control {
display: flex;
align-items: center;
gap: 10px;
}
.quantity-control a img {
width: 20px;
height: 20px;
}
.cart-total {
text-align: right;
font-weight: bold;
margin: 10px 0;
font-size: 18px;
}
.cart-buttons {
display: flex;
justify-content: center;
gap: 20px;
margin: 20px 0;
}
.cart-buttons a img {
width: 150px;
}
.quantity-label-and-control {
display: flex;
align-items: center;
gap: 10px; /* ラベルとボタンの間 */
}
.quantity-label-and-control .label {
white-space: nowrap; /* ラベル改行防止 */
font-weight: bold;
}
.quantity-control {
display: flex;
align-items: center;
gap: 10px; /* ボタンと数量の間 */
}
.quantity-control a img {
width: 20px;
height: 20px;
}
</style>
{% endblock %}
{% block main %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
{# ▼ ブロック:DispHtag ▼ #}
{{ include('Block/DispHtag.twig') }}
{# ▲ ブロック:DispHtag ▲ #}
<title>ベースボール・マガジン社 BBM@BOOK CART</title>
<meta name="description" content="ベースボール・マガジン社が運営する総合スポーツサイト。ベースボール・マガジン社発行の書籍・雑誌・スポーツカードなどの新着情報、各競技の技術情報や専門家によるコラムなど、スポーツファンを応援する情報が満載です。">
<meta name="keywords" content="ベースボールマガジン社,BBM">
{# ▼ ブロック:DispHead ▼ #}
{{ include('Block/DispHead.twig') }}
{# ▲ ブロック:DispHead ▲ #}
</head>
<body id="general">
{# ▼ ブロック:DispBtag ▼ #}
{{ include('Block/DispBtag.twig') }}
{# ▲ ブロック:DispBtag ▲ #}
{# ▼ ブロック:DispHeader ▼ #}
{{ include('Block/DispHeader.twig') }}
{# ▲ ブロック:DispHeader ▲ #}
<div id="container" style="background-image: linear-gradient(#f9f9f9, #eee);">
<div id="contentbox">
<h2 class="title">現在のカゴの中</h2>
{% if totalQuantity > 0 %}
<div>
<p>カゴの中の商品の合計金額は{{ totalPrice|number_format }}円です。</p>
{% for CartIndex, Cart in Carts %}
{% set cartKey = Cart.cart_key %}
<div class="cart-wrapper">
{% for CartItem in Cart.CartItems %}
{% set ProductClass = CartItem.ProductClass %}
{% set Product = ProductClass.Product %}
<div class="cart-item">
<div class="cart-item-image">
<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="cart-item-info">
<div class="cart-item-title">
<a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">{{ Product.name }}</a>
{% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
<div>{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}</div>
{% endif %}
{% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
<div>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}</div>
{% endif %}
</div>
<div class="cart-item-price">
単価:{{ CartItem.price|number_format }}円
</div>
<div class="cart-item-quantity">
<div class="quantity-label-and-control">
<span class="label">数量:</span>
<div class="quantity-control">
<a href="{{ url('cart_handle_item', {'operation': 'down', 'productClassId': ProductClass.id}) }}" {{ csrf_token_for_anchor() }} class="load-overlay" data-method="put" data-confirm="false">
<img src="{{ asset('common_img/button/btn_minus.jpg', 'user_data') }}" alt="減らす" />
</a>
<span>{{ CartItem.quantity|number_format }}</span>
<a href="{{ url('cart_handle_item', {'operation': 'up', 'productClassId': ProductClass.id}) }}" {{ csrf_token_for_anchor() }} class="load-overlay" data-method="put" data-confirm="false">
<img src="{{ asset('common_img/button/btn_plus.jpg', 'user_data') }}" alt="増やす" />
</a>
</div>
</div>
</div>
<div class="cart-item-subtotal">
小計:{{ CartItem.total_price|number_format }}円
</div>
<div class="cart-item-delete">
<a href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}" {{ csrf_token_for_anchor() }} data-method="put" data-message="カートから商品を削除してもよろしいですか?">削除</a>
</div>
</div>
</div>
{% endfor %}
<div class="cart-total">
合計:<span>{{ Cart.totalPrice|number_format }}円</span>
</div>
<div class="cart-buttons">
<a href="{{ url('bookcart') }}">
<img src="{{ asset('common_img/button/btn_back.jpg', 'user_data') }}" alt="戻る" />
</a>
<a href="{{ path('cart_buystep', {'cart_key':cartKey}) }}">
<img src="{{ asset('common_img/button/btn_buystep.jpg', 'user_data') }}" alt="購入手続きへ" />
</a>
</div>
</div>
{% endfor %}
</div>
{% else %}
<p class="empty"><span class="attention">※ 現在カート内に商品はございません。</span></p>
{% endif %}
</div>
{# ▼ ブロック:DispFooter ▼ #}
{{ include('Block/DispFooter.twig') }}
{# ▲ ブロック:DispFooter ▲ #}
{# ▼ ブロック:DispFtag ▼ #}
{{ include('Block/DispFtag.twig') }}
{# ▲ ブロック:DispFtag ▲ #}
</div>
</body>
</html>
{% endblock %}
{# ▲ main ▲ #}