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

Open in your IDE?
  1. {% extends 'default_frame.twig' %}
  2. {% block stylesheet %}
  3.     <style>
  4.         .cart-wrapper {
  5.             margin: 10px;
  6.         }
  7.         .cart-item {
  8.             display: flex;
  9.             margin-bottom: 20px;
  10.             border: 1px solid #ccc;
  11.             padding: 10px;
  12.             border-radius: 8px;
  13.             background: #fff;
  14.         }
  15.         .cart-item-image img {
  16.             width: 100px;
  17.             height: auto;
  18.             object-fit: cover;
  19.             border-radius: 8px;
  20.         }
  21.         .cart-item-info {
  22.             flex: 1;
  23.             margin-left: 10px;
  24.             display: flex;
  25.             flex-direction: column;
  26.             justify-content: space-between;
  27.         }
  28.         .cart-item-title a {
  29.             font-weight: bold;
  30.             color: #333;
  31.         }
  32.         .cart-item-price,
  33.         .cart-item-subtotal,
  34.         .cart-item-quantity,
  35.         .cart-item-delete {
  36.             margin: 5px 0;
  37.         }
  38.         .quantity-control {
  39.             display: flex;
  40.             align-items: center;
  41.             gap: 10px;
  42.         }
  43.         .quantity-control a img {
  44.             width: 20px;
  45.             height: 20px;
  46.         }
  47.         .cart-total {
  48.             text-align: right;
  49.             font-weight: bold;
  50.             margin: 10px 0;
  51.             font-size: 18px;
  52.         }
  53.         .cart-buttons {
  54.             display: flex;
  55.             justify-content: center;
  56.             gap: 20px;
  57.             margin: 20px 0;
  58.         }
  59.         .cart-buttons a img {
  60.             width: 150px;
  61.         }
  62.         .quantity-label-and-control {
  63.             display: flex;
  64.             align-items: center;
  65.             gap: 10px; /* ラベルとボタンの間 */
  66.         }
  67.         .quantity-label-and-control .label {
  68.             white-space: nowrap; /* ラベル改行防止 */
  69.             font-weight: bold;
  70.         }
  71.         .quantity-control {
  72.             display: flex;
  73.             align-items: center;
  74.             gap: 10px; /* ボタンと数量の間 */
  75.         }
  76.         .quantity-control a img {
  77.             width: 20px;
  78.             height: 20px;
  79.         }
  80.     </style>
  81. {% endblock %}
  82. {% block main %}
  83. <!DOCTYPE html>
  84. <html>
  85. <head>
  86. <meta charset="UTF-8">
  87. {# ▼ ブロック:DispHtag ▼ #}
  88. {{ include('Block/DispHtag.twig') }}
  89. {# ▲ ブロック:DispHtag ▲ #}
  90. <title>ベースボール・マガジン社 BBM@BOOK CART</title>
  91. <meta name="description" content="ベースボール・マガジン社が運営する総合スポーツサイト。ベースボール・マガジン社発行の書籍・雑誌・スポーツカードなどの新着情報、各競技の技術情報や専門家によるコラムなど、スポーツファンを応援する情報が満載です。">
  92. <meta name="keywords" content="ベースボールマガジン社,BBM">
  93. {# ▼ ブロック:DispHead ▼ #}
  94. {{ include('Block/DispHead.twig') }}
  95. {# ▲ ブロック:DispHead ▲ #}
  96. </head>
  97. <body id="general">
  98. {# ▼ ブロック:DispBtag ▼ #}
  99. {{ include('Block/DispBtag.twig') }}
  100. {# ▲ ブロック:DispBtag ▲ #}
  101. {# ▼ ブロック:DispHeader ▼ #}
  102. {{ include('Block/DispHeader.twig') }}
  103. {# ▲ ブロック:DispHeader ▲ #}
  104. <div id="container" style="background-image: linear-gradient(#f9f9f9, #eee);">
  105.     <div id="contentbox">
  106.         <h2 class="title">現在のカゴの中</h2>
  107.         {% if totalQuantity > 0 %}
  108.             <div>
  109.                 <p>カゴの中の商品の合計金額は{{ totalPrice|number_format }}円です。</p>
  110. {% for CartIndex, Cart in Carts %}
  111.     {% set cartKey = Cart.cart_key %}
  112.     <div class="cart-wrapper">
  113.         {% for CartItem in Cart.CartItems %}
  114.             {% set ProductClass = CartItem.ProductClass %}
  115.             {% set Product = ProductClass.Product %}
  116.             <div class="cart-item">
  117.                 <div class="cart-item-image">
  118.                     <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">
  119.                         <img src="{{ asset(Product.MainListImage|no_image_product, 'save_image') }}" alt="{{ Product.name }}">
  120.                     </a>
  121.                 </div>
  122.                 <div class="cart-item-info">
  123.                     <div class="cart-item-title">
  124.                         <a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">{{ Product.name }}</a>
  125.                         {% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
  126.                             <div>{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}</div>
  127.                         {% endif %}
  128.                         {% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
  129.                             <div>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}</div>
  130.                         {% endif %}
  131.                     </div>
  132.                     <div class="cart-item-price">
  133.                         単価:{{ CartItem.price|number_format }}円
  134.                     </div>
  135.                     <div class="cart-item-quantity">
  136.                         <div class="quantity-label-and-control">
  137.                             <span class="label">数量:</span>
  138.                             <div class="quantity-control">
  139.                                 <a href="{{ url('cart_handle_item', {'operation': 'down', 'productClassId': ProductClass.id}) }}" {{ csrf_token_for_anchor() }} class="load-overlay" data-method="put" data-confirm="false">
  140.                                     <img src="{{ asset('common_img/button/btn_minus.jpg', 'user_data') }}" alt="減らす" />
  141.                                 </a>
  142.                                 <span>{{ CartItem.quantity|number_format }}</span>
  143.                                 <a href="{{ url('cart_handle_item', {'operation': 'up', 'productClassId': ProductClass.id}) }}" {{ csrf_token_for_anchor() }} class="load-overlay" data-method="put" data-confirm="false">
  144.                                     <img src="{{ asset('common_img/button/btn_plus.jpg', 'user_data') }}" alt="増やす" />
  145.                                 </a>
  146.                             </div>
  147.                         </div>
  148.                     </div>
  149.                     <div class="cart-item-subtotal">
  150.                         小計:{{ CartItem.total_price|number_format }}円
  151.                     </div>
  152.                     <div class="cart-item-delete">
  153.                         <a href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}" {{ csrf_token_for_anchor() }} data-method="put" data-message="カートから商品を削除してもよろしいですか?">削除</a>
  154.                     </div>
  155.                 </div>
  156.             </div>
  157.         {% endfor %}
  158.         <div class="cart-total">
  159.             合計:<span>{{ Cart.totalPrice|number_format }}円</span>
  160.         </div>
  161.         <div class="cart-buttons">
  162.             <a href="{{ url('bookcart') }}">
  163.                 <img src="{{ asset('common_img/button/btn_back.jpg', 'user_data') }}" alt="戻る" />
  164.             </a>
  165.             <a href="{{ path('cart_buystep', {'cart_key':cartKey}) }}">
  166.                 <img src="{{ asset('common_img/button/btn_buystep.jpg', 'user_data') }}" alt="購入手続きへ" />
  167.             </a>
  168.         </div>
  169.     </div>
  170. {% endfor %}
  171.             </div>
  172.        {% else %}
  173.             <p class="empty"><span class="attention">※ 現在カート内に商品はございません。</span></p>
  174.         {% endif %}
  175.     </div>
  176. {# ▼ ブロック:DispFooter ▼ #}
  177. {{ include('Block/DispFooter.twig') }}
  178. {# ▲ ブロック:DispFooter ▲ #}
  179. {# ▼ ブロック:DispFtag ▼ #}
  180. {{ include('Block/DispFtag.twig') }}
  181. {# ▲ ブロック:DispFtag ▲ #}
  182. </div>
  183. </body>
  184. </html>
  185. {% endblock %}
  186. {# ▲ main ▲ #}