{#
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 start_date = '2021-09-06'|date('Y-m-d') %}
{% set end_date = '2021-09-27'|date('Y-m-d') %}
{% set campaign_category_id = "174" %}
{% set coupon_code = "eio100anniv" %}
{% if start_date <= date()|date('Y-m-d') and date()|date('Y-m-d') <= end_date %}
{% set campaign_valid = true %}
{% else %}
{% set campaign_valid = false %}
{% endif %}
{% extends 'default_frame.twig' %}
{% set body_class = 'product_page' %}
{#
↑↑↑ここまで↑↑↑
固定バナー対応
↓↓↓ここから↓↓↓
#}
{% set jytp_id = "75" %}
{% set jytp_url = '/html/user_data/top/top-slider_20210603_2_PC.jpg' %}
{#
↑↑↑ここまで↑↑↑
#}
{% block javascript %}
<script>
eccube.productsClassCategories = {
{% for Product in pagination %}
"{{ Product.id|escape('js') }}": {{ class_categories_as_json(Product)|raw }}{% if loop.last == false %}, {% endif %}
{% endfor %}
};
$(function() {
// 表示件数を変更
$('.disp-number').change(function() {
var dispNumber = $(this).val();
$('#disp_number').val(dispNumber);
$('#pageno').val(1);
$("#form1").submit();
});
// 並び順を変更
$('.order-by').change(function() {
var orderBy = $(this).val();
$('#orderby').val(orderBy);
$('#pageno').val(1);
$("#form1").submit();
});
$('.add-cart').on('click', function(e) {
var $form = $(this).parents('li').find('form');
// 個数フォームのチェック
var $quantity = $form.parent().find('.quantity');
if ($quantity.val() < 1) {
$quantity[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
setTimeout(function() {
loadingOverlay('hide');
}, 100);
return true;
} else {
$quantity[0].setCustomValidity('');
}
e.preventDefault();
$.ajax({
url: $form.attr('action'),
type: $form.attr('method'),
data: $form.serialize(),
dataType: 'json',
beforeSend: function(xhr, settings) {
// Buttonを無効にする
$('.add-cart').prop('disabled', true);
}
}).done(function(data) {
// レスポンス内のメッセージをalertで表示
$.each(data.messages, function() {
$('#ec-modal-header').html(this);
});
$('#ec-modal-checkbox').prop('checked', true);
// カートブロックを更新する
$.ajax({
url: '{{ url('block_cart') }}',
type: 'GET',
dataType: 'html'
}).done(function(html) {
$('.ec-headerRole__cart').html(html);
});
}).fail(function(data) {
alert('{{ 'カートへの追加に失敗しました。'|trans }}');
}).always(function(data) {
// Buttonを有効にする
$('.add-cart').prop('disabled', false);
});
});
});
</script>
{% endblock %}
{% block main %}
<style>
.list_title {
font-size: 1.2em!important;
line-height: 1.5em;
}
.ec-layoutRole__mainBottom{
margin-top: 20px!important;
}
.campaign_img {
margin-bottom: 1em;
}
@media only screen and (min-width: 768px){
.campaign_img{
width: 80%;
margin: 0 auto 1em;
}
}
@media only screen and (max-width: 767px){
.campaign_img{
width: 100%;
}
}
</style>
{%if campaign_valid == false and search_form.category_id.vars.value == "90" %}
<script type="text/javascript" id="list_script">
document.title = "全商品 / コスモピア・オンラインショップ";
document.getElementById("list_script").remove();
</script>
{% endif %}
{% if search_form.category_id.vars.errors|length > 0 or (campaign_valid == false and search_form.category_id.vars.value == campaign_category_id) %}
<div class="ec-searchnavRole">
<p class="errormsg text-danger">{{ 'ご指定のカテゴリは存在しません'|trans }}</p>
</div>
{% else %}
<div class="ec-searchnavRole">
<form name="form1" id="form1" method="get" action="?">
{% for item in search_form %}
<input type="hidden" id="{{ item.vars.id }}"
name="{{ item.vars.full_name }}"
{% if item.vars.value is not empty %}value="{{ item.vars.value }}" {% endif %}/>
{% endfor %}
</form>
<div class="ec-searchnavRole__topicpath">
<ol class="ec-topicpath">
{% if Category is not null %}
{% for Path in Category.path %}
{% if loop.last %}
<li class="ec-topicpath__item{% if loop.last %}--active{% endif %}">
<h1 class="list_title">
{% if campaign_valid == true and search_form.category_id.vars.value == campaign_category_id %}
<a href="{{ url('product_list') }}?category_id={{ Path.id }}">通巻100号記念 マガジン電子版バックナンバー半額セール</a>
{% else %}
<a href="{{ url('product_list') }}?category_id={{ Path.id }}">{{ Path.name }}</a>
{% endif %}
</h1>
</li>
{% endif %}
{% endfor %}
{% else %}
<li class="ec-topicpath__item"><a href="{{ url('product_list') }}">{{ '全て'|trans }}</a></li>
{% endif %}
{% if search_form.vars.value and search_form.vars.value.name %}
<li class="ec-topicpath__item">{{ '「%name%」の検索結果'|trans({ '%name%': search_form.vars.value.name }) }}</li>
{% endif %}
</ol>
{#
キャンペーン用ヘッダー
#}
{% if campaign_valid == true and search_form.category_id.vars.value == campaign_category_id %}
<div class="ec-topicpath__item" style="line-height:1.5em;font-size:1.4em;">
<div class="campaign_img"><img src="/html/user_data/assets/img/sale_20210906/os_sale_no_detail.jpg" style="width:100%"></div>
<p style="text-align: left;font-size: 0.8em;color: black;margin:0 1em;font-weight: normal;">
多聴多読マガジン通巻100号を記念して、一部のバックナンバー電子版の半額セールを実施しております。<br>
購入する商品に悩んだら、<a href="https://www.cosmopier.com/shopping-guide/?utm_source=cp_shop&utm_medium=magazine_sale&utm_content=sale_list" style="color:#337ab7!important;font-weight:bold;" target="_blank">お買い物ガイド</a>もご覧ください。<br>
<span class="campaign_alert" style="font-weight: bold;color: red;">購入時、クーポンコード「{{coupon_code}}」を必ずご使用ください。<br/>
また、本クーポンをご利用いただけるのは【お一人様1回のみ】です。
</span><br/>
<span class="copy_button" onclick="copyToClipboard()">★クーポンコードをコピー</span><br/>
※商品購入時のクーポンコード画面でペーストしてください。<br/>
</p>
<p style="text-align: left;font-size: 0.8em;margin: 1em 1em 0;font-weight: bold;">
<span style="color: white;background-color: #000 !important;font-weight: normal;border-radius: 5px;padding:5px 10px;">セール実施期間:2021/9/6 ~ 2021/9/27</span>
</p>
</div>
{% endif %}
{#
ページごとの固定バナー
#}
{% if search_form.category_id.vars.value == jytp_id %}
<div class="ec-topicpath__item" style="line-height:1.5em;font-size:1.4em;">
<div class="campaign_img"><img src="{{jytp_url}}" style="width:100%"></div>
<p style="text-align: left;font-size: 0.8em;color: black;margin:0 1em;font-weight: normal;">
★表紙をクリックすると、立ち読み・CD試聴ができます!
</p>
</div>
{% endif %}
</div>
{{ include('Block/category_nav.twig') }}
<div class="ec-searchnavRole__infos">
<div class="ec-searchnavRole__counter">
{% if pagination.totalItemCount > 0 %}
{{ '<span>対象商品:</span><span class="ec-font-bold">%count%</span><span class="mini">件</span>'|trans({ '%count%': pagination.totalItemCount })|raw }}
{% else %}
<span>{{ 'お探しの商品は見つかりませんでした'|trans }}</span>
{% endif %}
</div>
{% if pagination.totalItemCount > 0 %}
<div class="ec-searchnavRole__actions">
<div class="ec-select">
{{ form_widget(disp_number_form, {'id': '', 'attr': {'class': 'disp-number'}}) }}
{{ form_widget(order_by_form, {'id': '', 'attr': {'class': 'order-by'}}) }}
</div>
</div>
{% endif %}
</div>
</div>
{% if pagination.totalItemCount > 0 %}
<div class="ec-shelfRole">
<ul class="ec-shelfGrid">
{% for Product in pagination %}
<li class="ec-shelfGrid__item">
<a href="{{ url('product_detail', {'id': Product.id}) }}">
<p class="ec-shelfGrid__item-image">
<img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}">
</p>
{# タグ #}
<ul class="ec-productRole__tags">
{% for Tag in Product.Tags %}
<li class="ec-productRole__tag tag_{{ Tag.id }}">{{ Tag }}</li>
{% endfor %}
</ul>
<p class="ttl">{{ Product.name }}</p>
{% if Product.description_list %}
<p class="subtext">{{ Product.description_list|raw|nl2br }}</p>
{% endif %}
<p class="price02-default">
{% if Product.hasProductClass %}
{% if Product.getPrice02Min == Product.getPrice02Max %}
{{ Product.getPrice02IncTaxMin|price }}
{% else %}
{{ Product.getPrice02IncTaxMin|price }} ~ {{ Product.getPrice02IncTaxMax|price }}
{% endif %}
{% else %}
{{ Product.getPrice02IncTaxMin|price }}
{% endif %}<span>(税込)</span>
</p>
</a>
{% if Product.stock_find %}
{% set form = forms[Product.id] %}
<form name="form{{ Product.id }}" id="productForm{{ Product.id }}" action="{{ url('product_add_cart', {id:Product.id}) }}" method="post">
<div class="ec-productRole__actions">
{% if form.classcategory_id1 is defined %}
<div class="ec-select">
{{ form_widget(form.classcategory_id1) }}
{{ form_errors(form.classcategory_id1) }}
</div>
{% if form.classcategory_id2 is defined %}
<div class="ec-select">
{{ form_widget(form.classcategory_id2) }}
{{ form_errors(form.classcategory_id2) }}
</div>
{% endif %}
{% endif %}
<div class="ec-numberInput">
{{ form_widget(form.quantity, {'attr': {'class': 'quantity'}}) }}
{{ form_errors(form.quantity) }}
</div>
</div>
{{ form_rest(form) }}
</form>
<div class="ec-productRole__btn">
<button type="submit" class="ec-blockBtn--cancel add-cart" data-cartid="{{ Product.id }}" form="productForm{{ Product.id }}">
{{ 'カートに入れる'|trans }}
</button>
</div>
{% else %}
<div class="ec-productRole__btn">
<button type="button" class="ec-blockBtn--action zero" disabled="disabled">
{{ '品切れ中です'|trans }}
</button>
</div>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
<div class="ec-modal">
<input type="checkbox" id="ec-modal-checkbox" class="checkbox">
<div class="ec-modal-overlay">
<label for="ec-modal-checkbox" class="ec-modal-overlay-close"></label>
<div class="ec-modal-wrap">
<label for="ec-modal-checkbox" class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></label>
<div id="ec-modal-header" class="text-center">{{ 'カートに追加しました。'|trans }}</div>
<div class="ec-modal-box">
<div class="ec-role">
<label for="ec-modal-checkbox" class="ec-inlineBtn--cancel">{{ 'お買い物を続ける'|trans }}</label>
<a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
</div>
</div>
</div>
</div>
</div>
<div class="ec-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData} %}
</div>
{% endif %}
{% endif %}
{% endblock %}