{#
This file is part of EC-CUBE
カスタマイズTwig
#}
{% block javascript %}
<script>
$(function() {
{% if favorites_product_id is not empty %}
alert("お気に入りに追加しました。");
{% endif %}
{% set current_domain = app.request.getHost() %}
{% set is_prod = 'web-order.shikomel.com' in current_domain %}
{% set is_stg = 'web-order-stg.shikomel.com' in current_domain %}
{% set custom_customer_id = is_granted('ROLE_USER') ? app.user.id:'' %}
// カート表示イベントの送付
{% if is_prod %}
let cartData = [];
let totalPrice = 0;
{% for Cart in Carts %}
{% for CartItem in Cart.CartItems %}
{% set ProductClass = CartItem.ProductClass %}
{% set Product = ProductClass.Product %}
cartData.push({
id: "{{ Product.id }}",
name: "{{ Product.name }}",
price: "{{ CartItem.total_price }}",
quantity: {{ CartItem.quantity|number_format }},
});
{% endfor %}
totalPrice = {{ Cart.totalPrice }};
{% endfor %}
if (cartData.length > 0) {
fbq('track', 'InitiateCheckout', {
content_type: "CartInfo",
content_ids: cartData.map(item => item.id),
content_name: cartData.map(item => item.name).join(", "),
contents: cartData.map(item => ({
id: item.id,
name: item.name,
quantity: item.quantity,
price: item.price
})),
currency: "JPY",
num_items: cartData.reduce((total, item) => total + item.quantity, 0),
value: 55
});
// Metaへイベント送付
fbq('trackCustom', 'ce_show_cart', {
content_type: "CartInfo",
content_ids: cartData.map(item => item.id),
content_name: cartData.map(item => item.name).join(", "),
contents: cartData.map(item => ({
id: item.id,
name: item.name,
quantity: item.quantity,
price: item.price
})),
currency: "JPY",
num_items: cartData.reduce((total, item) => total + item.quantity, 0),
value: 55
});
// GAへイベント送付
window.dataLayer.push({
event: 'ce_show_cart',
custom_event_name: 'ce_show_cart',
custom_contents: cartData.map(item => ({
id: item.id,
name: item.name,
quantity: item.quantity,
price: item.price
})),
custom_content_ids: cartData.map(item => item.id),
custom_content_names: cartData.map(item => item.name).join(", "),
custom_num_item: cartData.reduce((total, item) => total + item.quantity, 0),
custom_total_price: totalPrice,
custom_customer_id: '{{ custom_customer_id }}',
custom_user_agent: $("#user_agent").val(),
custom_is_ig: $("#is_ig").val(),
custom_is_line: $("#is_line").val(),
custom_referer: $("#referer").val(),
custom_real_ip: $("#real_ip").val(),
});
// Lineへイベント送付
_lt('send', 'cv', {
type: 'ce_show_cart'
},['d6fb195c-aa19-4109-8ea0-7b1d883fb349']);
}
{% endif %}
});
</script>
{% endblock %}
{% extends 'default_frame.twig' %}
{% set body_class = 'cart_page' %}
{% block stylesheet %}
<style>
.non_product {
margin-top: 24px;
text-align: center;
font-size: 14px;
margin-bottom: 24px;
}
.non_product_continue {
margin-bottom: 0px;
border-radius: 6px;
border: solid 1px #CCCCCC;
background-color: unset;
color: #525263;
font-weight: 600;
text-align: center;
cursor: pointer;
font-size: 14px;
padding: 10px 16px;
text-decoration: none;
display: block;
height: 56px;
line-height: 56px;
padding-top: 0;
padding-bottom: 0;
}
.ec-cartRole img.minus_btn_img {
width: 32px;
height: 32px;
}
.ec-cartRole img.plus_btn_img {
width: 32px;
height: 32px;
}
.ec-cartRole .quantity {
font-size: 18px;
border-bottom: solid 2px;
width: 58px;
text-align: center;
font-weight: bold;
margin-left: 8px;
margin-right: 8px;
}
.ec-cartRow__container {
display: flex;
align-items: flex-start;
}
.ec-cart-img {
margin-right: 10px;
height: 60px;
}
.ec-cartRow__unitPrice {
font-size: 14px;
}
.ec-cart-pro-info a {
font-size: 14px;
color: #1F9FCB;
font-weight: bold;
}
.separater {
background-color: #F5F5F5;
width: 100%;
}
.ec-alert-warning .ec-alert-warning__icon img {
display: inline-block;
width: 16px;
height: 16px;
}
.ec-cartRole .ec-cartRole__error .ec-alert-warning {
max-width: 100%;
display: flex;
}
.ec-alert-warning .ec-alert-warning__text {
color: #DE5D50;
font-size: 13px;
text-align: left;
font-weight: normal;
margin-top: 4px;
width: 100%;
}
.ec-alert-warning {
margin-bottom: 24px;
background: #FFF;
border-radius: 6px;
border: solid 1px #DE5D50;
text-align: left;
display: flex;
margin-right: 20px;
margin-left: 20px;
width: auto;
}
{# PC用スタイル #}
@media screen and (min-width: 1025px) {
.ec-cartRole__error {
margin: 0 auto;
padding-left: 20px;
padding-right: 20px;
max-width: 1130px;
}
hr:not([size]) {
height: 1px;
background-color: #ddd;
opacity: 1;
}
.separater {
background-color: #DDDDDD;
}
.ec-cartRow__amountUpDown {
padding-left: 145px;
}
.ec-cart-pro-info a {
font-size: 16px;
color: #1F9FCB;
}
.ec-cart-img img {
width: 130px;
height: 105px;
max-width: 130px;
margin-right: 15px;
border-radius: 4px;
}
#form_cart_frame {
display: flex;
justify-content: space-around;
}
.ec-cartRole .ec-cartRole__cart {
padding: 0px; width: 50%; margin-left: 0px; margin-right: 100px;
}
.is_pc {
display: block;
}
.is_sp {
display: none;
}
}
{# スマホ&タブレット用スタイル #}
@media screen and (max-width: 1024px) {
hr:not([size]) {
height: 8px;
background-color: #f5f5f5;
opacity: 1;
}
.separater {
background-color: #DDDDDD;
}
.ec-cart-img {
margin-right: 10px; min-width: 74px;
}
.ec-cart-img img {
width: 74px;
height: 60px;
border-radius: 4px;
}
.is_pc {
display: none;
}
.is_sp {
display: block;
}
}
</style>
{% endblock %}
{% block main %}
<div class="ec-role">
<div class="ec-pageHeader">
<h1 style="border-top: none; padding: 12px 0 12px; margin-bottom: 8px;">{{ 'カート'|trans }}</h1>
</div>
</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/img/common/alert_icon.png', 'user_data') }}"></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/img/common/alert_icon.png', 'user_data') }}"></div>
<div class="ec-alert-warning__text">
{{ error|trans|nl2br }}
</div>
</div>
</div>
{% endfor %}
<div class="ec-cartRole" style="padding: 0px; display: block;">
{% if totalQuantity > 0 %}
{% 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" 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/img/common/alert_icon.png', 'user_data') }}"></div>
<div class="ec-alert-warning__text">
{{ error|trans|nl2br }}
</div>
</div>
</div>
{% endfor %}
<div id="form_cart_frame">
<div class="ec-cartRole__cart" style="">
<div class="">
{% for CartItem in Cart.CartItems %}
{% set ProductClass = CartItem.ProductClass %}
{% set Product = ProductClass.Product %}
<div style="padding-right: 16px; padding-left: 16px;">
<div style="margin-top: 20px;">
<div class="ec-cartRow__container" style="display: flex; align-items: flex-start;">
<div class="ec-cart-img" style="">
<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="ec-cart-pro-info">
<div class="ec-cartRow__name" style="line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;">
<a target="_blank" style="" href="{{ url('product_detail', {id : Product.id} ) }}">
{{ Product.name }}
</a>
</div>
<div class="ec-cartRow__unitPrice" style="margin-top: 5px;">{{ CartItem.price|number_format }}円
{% if Product.standard_text %}({{ Product.standard_text }}){% endif %}
</div>
</div>
</div>
</div>
<div style="display: flex; margin-top: 8px;
{% if not CartItem.ProductClass.Product.is_recipe_book %}
justify-content: space-between;
{% else %}
justify-content: end;
{% endif %}
align-items: flex-end;">
{# レシピ帖の場合には数量のアップダウンは非表示 #}
{% if not CartItem.ProductClass.Product.is_recipe_book %}
<div class="ec-cartRow__amountUpDown" style="display: flex;">
{% if CartItem.quantity > 1 %}
<a class="plus_btn" 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">
<span class="ec-cartRow__amountDownButton__icon">
<img src="{{ asset('assets/img/common/minus_btn.png', 'user_data') }}" alt="reduce" class="minus_btn_img">
</span>
</a>
{% else %}
<div class="ec-cartRow__amountDownButtonDisabled">
<span class="ec-cartRow__amountDownButton__icon">
<img src="{{ asset('assets/img/common/minus_btn_disabled.png', 'user_data') }}" alt="reduce" class="minus_btn_img">
</span>
</div>
{% endif %}
<div class="quantity">{{ CartItem.quantity|number_format }}</div>
<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">
<span class="ec-cartRow__amountUpButton__icon">
<img src="{{ asset('assets/img/common/plus_btn.png', 'user_data') }}" alt="increase" class="plus_btn_img">
</span>
</a>
</div>
{% endif %}
<div class="ec-cartRow__sutbtotalSP">
<span style="font-size: 14px;">小計</span>
<span style="font-size: 20px; font-weight: bold;">{{ CartItem.total_price|number_format }}</span>
<span style="font-size: 14px;">円</span>
<span style="font-size: 14px;">(税込)</span>
</div>
</div>
<div style="text-align: right; margin-top: 14px;">
{% if is_granted('ROLE_USER') %}
<a href="{{ url('product_add_favorite', {id:Product.id}) }}" class="ec-icon" data-method="post">
<span style="font-size: 14px; text-decoration: underline; color: #525263; margin-right: 20px;">お気に入りに追加</span>
</a>
{% endif %}
<a href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}" {{ csrf_token_for_anchor() }} class="ec-icon" data-method="put" data-message="カートから商品を削除してもよろしいですか?">
<span style="font-size: 14px; text-decoration: underline; color: #525263;">削除</span>
</a>
</div>
</div>
<hr class="separater" style="">
{% endfor %}
</div>
</div>
<div class="ec-cartRole__actions" style="padding-right: 16px; padding-left: 16px; margin-right: 0px; width: 375px;">
<div style="position: sticky; top: 50px;">
<div class="ec-cartRole__total" style="display: flex; justify-content: space-between; align-items: center; height: 36px; margin: 16px 0px; padding: 0px;">
<span style="font-size: 18px; font-weight: bold;">
合計金額<span style="font-size: 14px; font-weight: normal;">({{ Cart.CartItems|length }}商品)</span>
</span>
<span class="ec-cartRole__totalAmount" style="font-size: 24px; font-weight: bold;">
{{ Cart.totalPrice|number_format }}
<span style="font-size: 14px; font-weight: bold;">円(税込)</span>
</span>
</div>
{# PCもSPもクーポンあればバナー表示するように修正 #}
{% if isShowCouponCode is defined and isShowCouponCode %}
<div class="" style="margin: auto;">
<img src="{{ asset('assets/img/common/has_3000_coupon_cart.png', 'user_data') }}" style="padding: 0px 10px;">
</div>
{% endif %}
<a class="ec-blockBtn--action" style="max-width: 343px; margin: auto; background-color: #DE5D50; border-color: #DE5D50;" href="{{ url('shopping_nonmember') }}">{{ 'ご注文手続きへ'|trans }}</a>
{% if loop.last %}
<div style="text-align: center; margin-bottom: 16px; margin-top: 16px; line-height: 39px;">
<a style="color: #1F9FCB;" href="{{ path('homepage') }}">{{ 'お買い物を続ける'|trans }}</a>
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</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="non_product">{{ 'カートに商品がありません。'|trans }}</div>
<div style="margin-bottom: 24px;">
<a class="non_product_continue" href="{{ path('homepage') }}">{{ 'お買い物を続ける'|trans }}</a>
</div>
</div>
</div>
</div>
{% endif %}
</div>
{% endblock %}