app/template/default/Product/detail.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% extends 'default_frame.twig' %}
  9. {% block stylesheet %}
  10.     {#<link rel="stylesheet" href="{{ asset('assets/css/contents.css', 'user_data') }}">#}
  11.     {#<link rel="stylesheet" href="{{ asset('assets/css/main_module.css', 'user_data') }}">#}
  12.     <link rel="stylesheet" href="{{ asset('assets/css/page/_product_detail.css', 'user_data') }}">
  13.     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick-theme.min.css">
  14.     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.css">
  15.     <style>
  16.     .reservation4-add-cart{
  17.         justify-content: center;
  18.     }
  19.         .new {
  20.           position: absolute;
  21.           top: -1%;
  22.           left: -2%;
  23.           width: 41%;
  24.           background: linear-gradient(to top left, transparent 50%, #df0b75 50%);
  25.           z-index: 10;
  26.           display: flex;
  27.           align-items: center;
  28.           justify-content: center;
  29.           transform-origin: top left;
  30.           container-type: inline-size;
  31.           color: white;
  32.           clip-path: polygon(0 60%, 60% 0, 100% 0, 0 100%);
  33.           aspect-ratio: 1 / 1;
  34.         }
  35.             
  36.         .new-text {
  37.           position: absolute;
  38.           color: #ffffff;
  39.           font-weight: bold;
  40.           font-size: 20cqw;
  41.           text-align: center;
  42.           line-height: 3em;
  43.           transform: rotate(-45.5deg) translate(0%,-25%);
  44.         }
  45.     
  46.     .list-btn {
  47.         width:100%;
  48.     }
  49.     @media screen and (max-width: 820px) {
  50.     .list-btn {
  51.         width:50%;
  52.     }
  53.     }
  54.     .ec-modal {
  55.       display: none;
  56.       position: fixed;
  57.       top: 0;
  58.       left: 0;
  59.       z-index: 9999;
  60.       width: 100%;
  61.       height: 100%;
  62.     }
  63.     .ec-modal.small {
  64.       width: 30%;
  65.     }
  66.     .ec-modal.full {
  67.       width: 100%;
  68.       height: 100%;
  69.     }
  70.     .ec-modal .ec-modal-overlay {
  71.       display: flex;
  72.       justify-content: center;
  73.       align-items: center;
  74.       background-color: rgba(0, 0, 0, 0.3);
  75.       width: 100%;
  76.       height: 100%;
  77.     }
  78.     .ec-modal .ec-modal-wrap {
  79.       position: relative;
  80.       border-radius: 10px;
  81.       border: 1px solid #333;
  82.       background-color: #fff;
  83.       width: 40%;
  84.       margin: 20px;
  85.       padding: 40px 5px;
  86.       color: #555555;
  87.       text-decoration: none;
  88.     }
  89.     .ec-modal .ec-modal-close {
  90.       cursor: pointer;
  91.       position: absolute;
  92.       right: 20px;
  93.       top: 10px;
  94.       font-size: 20px;
  95.       height: 30px;
  96.       width: 20px;
  97.     }
  98.     .ec-modal .ec-modal-close:hover {
  99.       color: #4b5361;
  100.     }
  101.     .ec-modal .ec-modal-box {
  102.       text-align: center;
  103.       font-weight: 600;
  104.     }
  105.     .ec-modal .ec-role {
  106.       margin-top: 20px;
  107.     }
  108.     #ec-modal-header {
  109.         text-align: center;
  110.     }
  111.     .ec-role {
  112.         display: flex;
  113.         justify-content: space-around;
  114.     }
  115.     .ec-inlineBtn--cancel {
  116.         color: #09860d;
  117.         border: solid 1px #09860d;
  118.         border-radius: 50px;
  119.         padding: 10px;
  120.     }
  121.     .ec-inlineBtn--cancel:hover {
  122.         color: #ffffff;
  123.         background-color:#09860d;
  124.     }
  125.     .ec-inlineBtn--action {
  126.         color: #e8353e;
  127.         border: solid 1px #e8353e;
  128.         border-radius: 50px;
  129.         padding: 10px;
  130.     }
  131.     .ec-inlineBtn--action:hover {
  132.         color: #ffffff;
  133.         background-color:#e8353e ;
  134.     }
  135.     
  136.     .img-list img{
  137.         height: auto;
  138.         object-fit: cover;
  139.     }
  140.     
  141.     .img-list,.img-main {
  142.       opacity: 0;
  143.     }
  144. .img-list.slick-initialized,.img-main.slick-initialized{
  145.   opacity: 1;
  146. }
  147. .img-list .slick-list {
  148.   margin: 0 -5px;
  149. }
  150. .img-list .slick-slide {
  151.   margin: 0 5px;
  152.     
  153.     </style>
  154. {% endblock %}
  155. {% set body_class = 'product_page' %}
  156. {% block javascript %}
  157.     <script src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>
  158.     <script>
  159.         eccube.classCategories = {{ class_categories_as_json(Product)|raw }};
  160.         // 規格2に選択肢を割り当てる。
  161.         function fnSetClassCategories(form, classcat_id2_selected) {
  162.             var $form = $(form);
  163.             var product_id = $form.find('input[name=product_id]').val();
  164.             var $sele1 = $form.find('select[name=classcategory_id1]');
  165.             var $sele2 = $form.find('select[name=classcategory_id2]');
  166.             eccube.setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
  167.         }
  168.         {% if form.classcategory_id2 is defined %}
  169.         fnSetClassCategories(
  170.             $('#form1'), {{ form.classcategory_id2.vars.value|json_encode|raw }}
  171.         );
  172.         {% elseif form.classcategory_id1 is defined %}
  173.         eccube.checkStock($('#form1'), {{ Product.id }}, {{ form.classcategory_id1.vars.value|json_encode|raw }}, null);
  174.         {% endif %}
  175.     </script>
  176.     <script>
  177.     //画像をクリックするたびにslickが初期化されることへの対応
  178.         function initSlick() {
  179.             if ($(".img-main").hasClass('slick-initialized')) {
  180.                 $(".img-main").slick('unslick');
  181.             }
  182.             $(".img-main").slick({
  183.                 slidesToShow: 1,
  184.                 slidesToScroll: 1,
  185.                 arrows: false,
  186.                 fade: true,
  187.                 asNavFor: ".img-list"
  188.             });
  189.         
  190.             if ($(".img-list").hasClass('slick-initialized')) {
  191.                 $(".img-list").slick('unslick');
  192.             }
  193.             $(".img-list").slick({
  194.                 slidesToShow: 3,
  195.                 slidesToScroll: 1,
  196.                 asNavFor: ".img-main",
  197.                 focusOnSelect: true
  198.             });
  199.         }
  200.         
  201.         $(window).on('load', function() {
  202.             initSlick();
  203.         });
  204.     </script>
  205.     <script>
  206.     //もっと読むボタン
  207.     document.querySelector(".more").addEventListener("click",function(){
  208.         document.querySelector(".content-text").classList.add("show");
  209.         document.querySelector(".more").classList.add("hide");
  210.     });
  211.     
  212.     
  213.     </script>
  214.     <script>
  215.         $(function() {
  216.             $('.add-cart').on('click', function(event) {
  217.                 {% if form.classcategory_id1 is defined %}
  218.                 // 規格1フォームの必須チェック
  219.                 if ($('#classcategory_id1').val() == '__unselected' || $('#classcategory_id1').val() == '') {
  220.                     $('#classcategory_id1')[0].setCustomValidity('{{ '項目が選択されていません'|trans }}');
  221.                     return true;
  222.                 } else {
  223.                     $('#classcategory_id1')[0].setCustomValidity('');
  224.                 }
  225.                 {% endif %}
  226.                 {% if form.classcategory_id2 is defined %}
  227.                 // 規格2フォームの必須チェック
  228.                 if ($('#classcategory_id2').val() == '__unselected' || $('#classcategory_id2').val() == '') {
  229.                     $('#classcategory_id2')[0].setCustomValidity('{{ '項目が選択されていません'|trans }}');
  230.                     return true;
  231.                 } else {
  232.                     $('#classcategory_id2')[0].setCustomValidity('');
  233.                 }
  234.                 {% endif %}
  235.                 // 個数フォームのチェック
  236.                 if ($('#quantity').val() < 1) {
  237.                     $('#quantity')[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
  238.                     return true;
  239.                 } else {
  240.                     $('#quantity')[0].setCustomValidity('');
  241.                 }
  242.                 event.preventDefault();
  243.                 $form = $('#form1');
  244.                 $.ajax({
  245.                     url: $form.attr('action'),
  246.                     type: $form.attr('method'),
  247.                     data: $form.serialize(),
  248.                     dataType: 'json',
  249.                     beforeSend: function(xhr, settings) {
  250.                         // Buttonを無効にする
  251.                         $('.add-cart').prop('disabled', true);
  252.                     }
  253.                 }).done(function(data) {
  254.                     // レスポンス内のメッセージをalertで表示
  255.                     $.each(data.messages, function() {
  256.                         $('#ec-modal-header').html(this);
  257.                     });
  258.                     $('.ec-modal').show()
  259.                     // カートブロックを更新する
  260.                     $.ajax({
  261.                         url: "{{ url('block_cart') }}",
  262.                         type: 'GET',
  263.                         dataType: 'html'
  264.                     }).done(function(html) {
  265.                         $('.ec-headerRole__cart').html(html);
  266.                     });
  267.                 }).fail(function(data) {
  268.                     alert('{{ 'カートへの追加に失敗しました。'|trans }}');
  269.                 }).always(function(data) {
  270.                     // Buttonを有効にする
  271.                     $('.add-cart').prop('disabled', false);
  272.                 });
  273.             });
  274.         });
  275.         $('.ec-modal-wrap').on('click', function(e) {
  276.             // モーダル内の処理は外側にバブリングさせない
  277.             e.stopPropagation();
  278.         });
  279.         $('.ec-modal-overlay, .ec-modal, .ec-modal-close, .ec-inlineBtn--cancel').on('click', function() {
  280.             $('.ec-modal').hide()
  281.         });
  282.     </script>
  283.     <script type="application/ld+json">
  284.     {
  285.         "@context": "https://schema.org/",
  286.         "@type": "Product",
  287.         "name": "{{ Product.name }}",
  288.         "image": [
  289.             {% for img in Product.ProductImage %}
  290.                 "{{ app.request.schemeAndHttpHost }}{{ asset(img, 'save_image') }}"{% if not loop.last %},{% endif %}
  291.             {% else %}
  292.                 "{{ app.request.schemeAndHttpHost }}{{ asset(''|no_image_product, 'save_image') }}"
  293.             {% endfor %}
  294.         ],
  295.         "description": "{{ Product.description_list | default(Product.description_detail) | replace({'\n': '', '\r': ''}) | slice(0,300) }}",
  296.         {% if Product.code_min %}
  297.         "sku": "{{ Product.code_min }}",
  298.         {% endif %}
  299.         "offers": {
  300.             "@type": "Offer",
  301.             "url": "{{ url('product_detail', {'id': Product.id}) }}",
  302.             "priceCurrency": "{{ eccube_config.currency }}",
  303.             "price": {{ Product.getPrice02IncTaxMin ? Product.getPrice02IncTaxMin : 0}},
  304.             "availability": "{{ Product.stock_find ? "InStock" : "OutOfStock" }}"
  305.         }
  306.     }
  307.     </script>
  308.     <script>
  309.         document.addEventListener('DOMContentLoaded', function() {
  310.             function adjustItems(selector,amount) {
  311.                 const items = document.querySelectorAll(selector);
  312.                 items.forEach((item, index) => {
  313.                     if (window.innerWidth <= 768) {
  314.                         item.style.display = index < amount ? 'block' : 'none';
  315.                     } else {
  316.                         item.style.display = 'block';
  317.                     }
  318.                 });
  319.             }
  320.         
  321.             adjustItems(".relation .card-2",3);
  322.             adjustItems(".recommended .card-2",3);
  323.             window.addEventListener('resize', adjustItems);
  324.         });
  325.     </script>
  326. {% endblock %}
  327. {% block main %}
  328.         <!-- 商品詳細 -->
  329.         <section class="detail">
  330.             <div class="content-area">
  331.                 <!-- SP用タイトル -->
  332.                 <div class="content-status sp-on">
  333.                     <h2>{{ Product.name }}</h2>
  334.                         <p><span class="status-author-name">{{ Product.author }}</span></p>
  335.                         <p><span class="status-price">{{ Product.ProductClasses|first.price02IncTax|price}}</span>(税込)</p>
  336.                         <div class="status-detail">
  337.                             <p class="sp-space">発売日:<span class="status-release">{{ Product.release_date }}</span></p>
  338.                             <p>版型:<span class="status-size">{{ Product.plate_type }}</span></p>
  339.                         </div>
  340.                         <p>ページ数:<span class="status-pages">{{ Product.page_amount }}ページ</span></p>
  341.                 </div>
  342.                 <div class="content-image">
  343.                     <div class="img-main">
  344.                         {% for ProductImage in Product.ProductImage %}
  345.                             <div class="slideThumb" data-index="{{ loop.index0 }}">
  346.                                 <img src="{{ asset(ProductImage, 'save_image') }}" alt=""loading="lazy">
  347.                             </div>
  348.                         {% endfor %}
  349.                     </div>
  350.                     {% if Product.ProductImage|length > 1 %}
  351.                     <div class="img-list">
  352.                         {% for ProductImage in Product.ProductImage %}
  353.                             <div class="slideThumb" data-index="{{ loop.index0 }}">
  354.                                 <img src="{{ asset(ProductImage, 'save_image') }}" alt=""loading="lazy">
  355.                             </div>
  356.                         {% endfor %}
  357.                     </div>
  358.                     {% endif %}
  359.                     {% if Product.meclib_url %}
  360.                     <a href="{{ Product.meclib_url }}" class="list-link" target="_blank">
  361.                         <span class="btn-l"><img src="{{ asset('assets/img/btn_circle_read-sample.svg', 'user_data') }}" alt="book-icon"></span>
  362.                         <span class="list-btn">試し読みをする</span>
  363.                     </a>
  364.                     <p>※外部サイトへ</p>
  365.                     {% endif %}
  366.                 </div>
  367.                 
  368.                 <div class="content-data">
  369.                     <!-- PC用タイトル -->
  370.                     <div class="content-status pc">
  371.                         <h2>{{ Product.name }}</h2>
  372.                         <p><span class="status-author-name">{{ Product.author }}</span></p>
  373.                             <p><span class="status-price">{{ Product.ProductClasses|first.price02IncTax|price }}</span>(税込)</p>
  374.                         <div class="status-detail">
  375.                             <p>発売日:<span class="status-release">{{ Product.release_date }}</span></p>
  376.                             <p>版型:<span class="status-size">{{Product.plate_type}}</span></p>
  377.                             <p>ページ数:<span class="status-pages">{{Product.page_amount}}ページ</span></p>
  378.                         </div>
  379.                     </div>
  380.                     <div class="content-text">
  381.                         <p>{{Product.description_detail|nl2br|raw}}</p>
  382.                     </div>
  383.                     <button class="list-link more sp" type="button">
  384.                         <span class="btn-l"><img src="{{ asset('assets/img/btn_ic_arrow_btm.svg ', 'user_data') }}" alt="book-icon"></span>
  385.                         <span class="list-btn">もっと見る</span>
  386.                     </button>
  387.                 </div>
  388.             </div>
  389.             <!-- 購入エリア -->
  390.             <div class="buy-area">
  391.                 <p class="price-line"><span class="price">{{Product.ProductClasses|first.price02IncTax|price}}</span>(税込)</p>
  392.                 <div class="ec-productRole__tags"></div>
  393.                 <div class="postage">
  394.                     <p>合計3500円以上で送料無料</p>
  395.                 </div>
  396.                 <form action="{{ url('product_add_cart', {id:Product.id}) }}" method="post" id="form1" name="form1">
  397.                         {% if Product.stock_find %}
  398.                             <div class="ec-productRole__actions">
  399.                                 {% if form.classcategory_id1 is defined %}
  400.                                     <div class="ec-select">
  401.                                         {{ form_row(form.classcategory_id1) }}
  402.                                         {{ form_errors(form.classcategory_id1) }}
  403.                                     </div>
  404.                                     {% if form.classcategory_id2 is defined %}
  405.                                         <div class="ec-select">
  406.                                             {{ form_row(form.classcategory_id2) }}
  407.                                             {{ form_errors(form.classcategory_id2) }}
  408.                                         </div>
  409.                                     {% endif %}
  410.                                 {% endif %}
  411.                                 <div class="quantities">
  412.                                     <p>数量:</p> 
  413.                                     {{ form_widget(form.quantity) }}
  414.                                     {{ form_errors(form.quantity) }}
  415.                                 </div>
  416.                             </div>
  417.                             <div class="ec-productRole__btn">
  418.                                 <button type="submit" class="buy-btn add-cart">
  419.                                     <div class="cart-in"><img src="{{ asset('assets/img/btn_ic_cart.svg', 'user_data') }}" alt="カート">
  420.                                         カートに入れる
  421.                                     </div>
  422.                                 </button>
  423.                             </div>
  424.                         {% else %}
  425.                             <div class="ec-productRole__btn">
  426.                                 <button type="button" class="ec-blockBtn--action" disabled="disabled">
  427.                                     {{ 'ただいま品切れ中です。'|trans }}
  428.                                 </button>
  429.                             </div>
  430.                         {% endif %}
  431.                     {{ form_rest(form) }}
  432.                 </form>
  433.                 
  434.                 {% if BaseInfo.option_favorite_product and is_granted('ROLE_USER')%}
  435.                     {% if is_favorite == false %}
  436.                         <form action="{{ url('product_add_favorite', {id:Product.id}) }}" method="post">
  437.                             <div class="ec-productRole__btn">
  438.                                 <button type="submit" class="favorite-btn">
  439.                                         <div class="cart-in">
  440.                                             <img src="{{ asset('/html/user_data/assets/icon/btn_ster.svg', 'user_data') }}" alt="お気に入り">
  441.                                             <span class="ec-closeBtn--circle">{{ 'お気に入りに追加'|trans }}</span>
  442.                                         </div>
  443.                                 </button>
  444.                             </div>
  445.                         </form>
  446.                     {% else %}
  447.                     <a href="{{ url('mypage_favorite_delete', { id : Product.id }) }}" {{ csrf_token_for_anchor() }}  data-method="delete">
  448.                         <div class="ec-productRole__btn">
  449.                             <button type="button" class="favorite-btn-after">
  450.                                     <div class="cart-in">
  451.                                         <img src="{{ asset('/html/user_data/assets/icon/btn_ster2.svg', 'user_data') }}" alt="お気に入り">
  452.                                         <span class="ec-closeBtn--circle"></span>{{ 'お気に入りから削除'|trans }}</span>
  453.                                     </div>
  454.                             </button>
  455.                         </div>
  456.                     </a>
  457.                     {% endif %}
  458.                 {% endif %}
  459.                 {% if Product.amazon_url %}
  460.                     <div class="amazon">
  461.                         <p>※外部サイトへ</p>
  462.                         <a href="{{Product.amazon_url}}" target="_blank"><img src="{{ asset('/html/user_data/assets/img/amazon.png', 'user_data') }}" alt="アマゾン購入"></a>
  463.                     </div>
  464.                 {% endif %}
  465.             </div>
  466.         </section>
  467.         
  468.         <div class="ec-modal">
  469.                     <div class="ec-modal-overlay">
  470.                         <div class="ec-modal-wrap">
  471.                             <span class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></span>
  472.                             <div id="ec-modal-header" class="text-center">{{ 'カートに追加しました。'|trans }}</div>
  473.                             <div class="ec-modal-box">
  474.                                 <div class="ec-role">
  475.                                     <span class="ec-inlineBtn--cancel">{{ 'お買い物を続ける'|trans }}</span>
  476.                                     <a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
  477.                                 </div>
  478.                             </div>
  479.                         </div>
  480.                     </div>
  481.                 </div>
  482.         {# 関連コンテンツ #}
  483.         <section class="special-2">
  484.             <h2><img src="/html/user_data/assets/img/title_ic_newbook.svg" alt="関連icon"> この商品に関連する商品</h2>
  485.             <div class="pipe-line">
  486.                 <div class="pipe">
  487.                     <div class="line"></div>
  488.                 </div>
  489.                 <div class="green"></div>
  490.             </div>
  491.             <div class="content-2 relation">
  492.                 {# Step 1: 現在の商品が持つカテゴリIDを先に抽出 #}
  493.                 {% set CurrentCategoryIds = [] %}
  494.                 {% for ProductCategory in Product.ProductCategories %}
  495.                     {% set CurrentCategoryIds = CurrentCategoryIds | merge([ProductCategory.Category.id]) %}
  496.                 {% endfor %}
  497.                 
  498.                 {# Step 2: 同じカテゴリを持つ他の商品を抽出 #}
  499.                 {% set CategoryProducts = [] %}
  500.                 {% for otherProduct in allProducts %}
  501.                     {% if otherProduct.id != Product.id %}
  502.                         {% set match = false %}
  503.                         {% for otherCategory in otherProduct.ProductCategories %}
  504.                             {% if otherCategory.Category.id in CurrentCategoryIds %}
  505.                                 {% set match = true %}
  506.                             {% endif %}
  507.                         {% endfor %}
  508.                 
  509.                         {% if match %}
  510.                             {% set CategoryProducts = CategoryProducts | merge([otherProduct]) %}
  511.                         {% endif %}
  512.                     {% endif %}
  513.                 {% endfor %}
  514.                 {#その上でランダムシャッフルして7件だけ抜く #}
  515.                 {% set randomProducts = [] %}
  516.                 {% set workingProducts = CategoryProducts %}
  517.                     {% for i in 0..6 %}
  518.                         {% if workingProducts|length > 0 %}
  519.                             {% set randomIndex = random(workingProducts|keys) %}
  520.                             {% set randomProduct = workingProducts[randomIndex] %}
  521.                             {% set randomProducts = randomProducts|merge([randomProduct]) %}
  522.                              {#選んだやつをworkingProductsから除外する #}
  523.                             {% set workingProducts = workingProducts|filter(p => p != randomProduct) %}
  524.                         {% endif %}
  525.                     {% endfor %}
  526.                     {% for RecommendProduct in randomProducts %}
  527.                           <div class="card-2">
  528.                             {% for ProductTags in RecommendProduct.ProductTag %}
  529.                                 {% if ProductTags.Tag.id == 1 %}
  530.                                     <div class="new">
  531.                                         <div class="new-text">New</div>
  532.                                     </div>
  533.                                 {% endif %}
  534.                             {% endfor %}
  535.                             <a href="{{ url('product_detail', {'id': RecommendProduct.id}) }}">
  536.                                 <img src="{{asset(RecommendProduct.main_list_image|no_image_product, 'save_image') }}" class="" alt="コンテンツ1"/>
  537.                             </a>
  538.                             <h3>{{RecommendProduct.name}}</h3>
  539.                             <p>{{RecommendProduct.author}}</p>
  540.                             {% set firstClass = RecommendProduct.ProductClasses|first %}
  541.                             <p>{{ firstClass.price02_inc_tax | price}}税込</p>
  542.                         </div>
  543.                     {% endfor %}
  544.             </div>
  545.         
  546.         </section>
  547.         <!-- 商品詳細 -->
  548.         <section class="detail-data">
  549.             <h2><img src="{{ asset('assets/img/title_ic_infomation.svg', 'user_data') }}" alt=""> 登録情報</h2>
  550.             
  551.             <div class="pipe-line">
  552.                 <div class="pipe">
  553.                     <div class="line"></div>
  554.                 </div>
  555.                 <div class="white"></div>
  556.             </div>
  557.             
  558.             <div class="data-list">
  559.                 <table>
  560.                     <tr>
  561.                         <td>商品名 : <span>{{Product.name}}</span></td>
  562.                     </tr>
  563.                     <tr>
  564.                         <td>著者名 : <span>{{Product.author}}</span></td>
  565.                     </tr>
  566.                     <tr>
  567.                         <td>発売日 : <span>{{Product.release_date}}</span></td>
  568.                     </tr>
  569.                     <tr>
  570.                         <td>定価 : <span>{{Product.ProductClasses|first.price02IncTax|price}}(税込)</span></td>
  571.                     </tr>
  572.                     <tr>
  573.                         <td>ページ数 : <span>{{Product.page_amount}}ページ</span></td>
  574.                     </tr>
  575.                     <tr>
  576.                         <td>ISBN-13 : <span>{{Product.ISBN_13}}</span></td>
  577.                     </tr>
  578.                     <tr>
  579.                         <td>版型 : <span>{{Product.plate_type}}</span></td>
  580.                     </tr>
  581.                     <tr>
  582.                         <td>寸法 : <span>{{Product.book_size}}</span></td>
  583.                     </tr>
  584.                 </table>
  585.             </div>
  586.             
  587.         </section>
  588.         <!-- 閲覧履歴 -->
  589.         {% if app.user %}
  590.         <section class="special-2 recommended">
  591.             <h2><img src="/html/user_data/assets/img/title_ic_recommend.svg" alt="閲覧icon"> 閲覧履歴に基づくおすすめ</h2>
  592.             <div class="pipe-line">
  593.                 <div class="pipe">
  594.                     <div class="line"></div>
  595.                 </div>
  596.                 <div class="green"></div>
  597.             </div>
  598.             <div class="content-2">
  599.                 {# ランダムシャッフルして7件だけ抜く #}
  600.                 {% set randomProducts = [] %}
  601.                 {% set workingProducts = recommendProducts %}
  602.                     {% for i in 0..6 %}
  603.                         {#{% set randomProducts = randomProducts|merge([random(taggedProducts)]) %}#}
  604.                         {% if workingProducts|length > 0 %}
  605.                             {% set randomIndex = random(workingProducts|keys) %}
  606.                             {% set randomProduct = workingProducts[randomIndex] %}
  607.                             {% set randomProducts = randomProducts|merge([randomProduct]) %}
  608.                             {# 選んだやつをworkingProductsから除外する #}
  609.                             {% set workingProducts = workingProducts|filter(p => p != randomProduct) %}
  610.                         {% endif %}
  611.                     {% endfor %}
  612.                 {% for recommendedProduct in randomProducts %}
  613.                     <div class="card-2">
  614.                             {% for ProductTags in recommendedProduct.ProductTag %}
  615.                                 {% if ProductTags.Tag.id == 1 %}
  616.                                     <div class="new">
  617.                                         <div class="new-text">New</div>
  618.                                     </div>
  619.                                 {% endif %}
  620.                             {% endfor %}
  621.                         <a href="{{ url('product_detail', {'id': recommendedProduct.id}) }}">
  622.                             <img src="{{asset(recommendedProduct.main_list_image|no_image_product, 'save_image') }}" class="" alt="コンテンツ1"/>
  623.                         </a>
  624.                         <h3>{{recommendedProduct.name}}</h3>
  625.                         <p><span>{{recommendedProduct.author}}</span></p>
  626.                         <p>¥<span>{{ recommendedProduct.getPrice02IncTaxMax|number_format(0, '.', ',') }}</span>(税込)</p>
  627.                     </div>
  628.                 {% endfor %}
  629.             </div>
  630.         </section>
  631.         {% endif %}
  632.     </section>
  633. {% endblock %}