app/template/idealinc/Blog/detail.twig line 1

Open in your IDE?
  1. {% extends 'default_frame.twig' %}
  2. {% set body_class = 'blog_page' %}
  3. {% set wrap_class = 'blogDwrap' %}
  4. {% set footerBrandListFlg = true %}
  5. {% block stylesheet %}
  6. <link rel="stylesheet" href="{{ asset('assets/css/contents.css') }}">
  7. {% endblock stylesheet %}
  8. {% block javascript %}
  9.   <script>
  10.     eccube.productsClassCategories = {
  11.         {% for CategoryRecommendProduct in Pickup %}
  12.         {% set Product = CategoryRecommendProduct %}
  13.         "{{ Product.id|escape('js') }}": {{ class_categories_as_json(Product)|raw }}{% if loop.last == false %}, {% endif %}
  14.         {% endfor %}
  15.     };
  16.     $(function() {
  17.       $('.add-cart').on('click', function(event) {
  18.           // 規格1フォームの必須チェック
  19.           var $classcategory = $(this).parents('form').find('select[name="classcategory_id1"]');
  20.           if ($classcategory.length) {
  21.             if ($classcategory.val() == '__unselected' || $classcategory.val() == '') {
  22.                 $classcategory[0].setCustomValidity('{{ '項目が選択されていません'|trans }}');
  23.                 return true;
  24.             } else {
  25.                 $classcategory[0].setCustomValidity('');
  26.             }
  27.           }
  28.           // 規格2フォームの必須チェック
  29.           var $classcategory2 = $(this).parents('form').find('select[name="classcategory_id2"]');
  30.           if ($classcategory2.length) {
  31.             if ($classcategory2.val() == '__unselected' || $classcategory2.val() == '') {
  32.                 $classcategory2[0].setCustomValidity('{{ '項目が選択されていません'|trans }}');
  33.                 return true;
  34.             } else {
  35.                 $classcategory2[0].setCustomValidity('');
  36.             }
  37.           }
  38.           // 個数フォームのチェック
  39.           var $quantity = $(this).parents('form').find('[name="quantity"]');
  40.           if ($quantity.val() < 1) {
  41.               $quantity[0].setCustomValidity('{{ '1以上で入力してください。'|trans }}');
  42.               return true;
  43.           } else {
  44.               $quantity[0].setCustomValidity('');
  45.           }
  46.           event.preventDefault();
  47.           $form = $(this).parents('form');
  48.           $.ajax({
  49.               url: $form.attr('action'),
  50.               type: $form.attr('method'),
  51.               data: $form.serialize(),
  52.               dataType: 'json',
  53.               beforeSend: function(xhr, settings) {
  54.                   // Buttonを無効にする
  55.                   $('.add-cart').prop('disabled', true);
  56.               }
  57.           }).done(function(data) {
  58.               // レスポンス内のメッセージをalertで表示
  59.               $.each(data.messages, function() {
  60.                   $('#ec-modal-header').html(this);
  61.               });
  62.               $('#ec-modal-checkbox').prop('checked', true);
  63.               // カートブロックを更新する
  64.               $.ajax({
  65.                 url: "{{ url('block_cart') }}",
  66.                 type: 'GET',
  67.                 dataType: 'html'
  68.               }).done(function(response) {
  69.                 let res = JSON.parse(response);
  70.                 $('.cart_number').text(res.totalQuantity);
  71.               });
  72.           }).fail(function(data) {
  73.               alert('{{ 'カートへの追加に失敗しました。'|trans }}');
  74.           }).always(function(data) {
  75.               // Buttonを有効にする
  76.               $('.add-cart').prop('disabled', false);
  77.           });
  78.       });
  79.         $('.slider').slick({
  80.             autoplay: true,
  81.             autoplaySpeed: 2000,
  82.             dots: false,
  83.             loop: true,
  84.             slidesToShow: 3,
  85.             prevArrow: false,
  86.             nextArrow: false,
  87.             variableWidth: true,
  88.             responsive: [
  89.             {
  90.               breakpoint: 1179,
  91.               settings: {
  92.                 slidesToShow: 2,
  93.               }
  94.             },
  95.             {
  96.               breakpoint: 768,
  97.               settings: {
  98.                 slidesToShow: 1,
  99.               }
  100.             }]
  101.         });
  102.     });
  103.   </script>
  104. {% endblock %}
  105. {% block main %}
  106. {{ include('Block/header_shop.twig') }}
  107. <div class="conts">
  108.     <h2 class="h2Normal">BLOG</h2>
  109.     <p class="txt14 ls6 tarS mt25P">ブログ</p>
  110. </div>
  111. <!-- MAINVISUAL -->
  112. {% if Blog.thumbnail is not empty %}
  113. <div class="mainVisualBlogD pcShow">
  114.   <div class="c-blog-thumbnail--wrapper">
  115.     <div class="c-blog-thumbnail" style="background-image: url('{{ Blog.thumbnail }}')"></div>
  116.   </div>
  117. </div>
  118. <div class="mainVisual spShow">
  119.     <img src="{{ Blog.thumbnail }}" alt="">
  120. </div>
  121. {% endif %}
  122. <!-- BLOG -->
  123. <section class="blogD">
  124.   <div class="conts2">
  125.     <p class="txt13 ls10">{{ Blog.date }}</p>
  126.     <p class="txtBig mt40P mb40P">{{ Blog.title|raw }}</p>
  127.     <div class="txtWrap mb40P blog-content">
  128.       {{ Blog.content|raw|nl2br }}
  129.     </div>
  130.   </div>
  131. </section>
  132. <div class="bgColor">
  133.   <!-- PICKUP ITEMS -->
  134.   <section class="pickupItems">
  135.       <h2 class="h2Normal mt60P mb40">PICKUP ITEMS</h2>
  136.       <div class="flexWrap slider">
  137.         {% for CategoryRecommendProduct in Pickup if Pickup %}
  138.         {% set Product = CategoryRecommendProduct %}
  139.         <div class="flex">
  140.           {% set pickup_url = asset(Product.mainFileName|no_image_product, "save_image") %}
  141.           <a href="{{ url('product_detail', {'id': Product.id}) }}" class="pickup-image" style="background-image:url('{{ pickup_url }}')"></a>
  142.           {% set brand = '' %}
  143.           {% for ProductCategory in Product.ProductCategories %}
  144.             {% if ProductCategory.Category.Parent and ProductCategory.Category.Parent.id == '3' %}
  145.               {% set brand = ProductCategory.Category.name %}
  146.             {% endif %}
  147.           {% endfor %}
  148.           <div class="flexTxt">
  149.             <p class="txt12 ls6">{{ brand }}</p>
  150.             <p class="txt18 ls6 mt15 mb20">{{ Product.name }}</p>
  151.             <p class="txt14 ls6">Price: {{ Product.getPrice02IncTaxMin|price }}</p>
  152.             <a href="{{ url('product_detail', {'id': Product.id}) }}" class="buttonC mt-20">DETAIL</a>
  153.           </div>
  154.         </div>
  155.         {% endfor %}
  156.       </div>
  157.       <div class="ec-modal">
  158.         <input type="checkbox" id="ec-modal-checkbox" class="checkbox">
  159.         <div class="ec-modal-overlay">
  160.             <label for="ec-modal-checkbox" class="ec-modal-overlay-close"></label>
  161.             <div class="ec-modal-wrap">
  162.                 <label for="ec-modal-checkbox" class="ec-modal-close"><span class="ec-icon"><img src="{{ asset('assets/icon/cross-dark.svg') }}" alt=""/></span></label>
  163.                 <div id="ec-modal-header" class="text-center">{{ 'カートに追加しました。'|trans }}</div>
  164.                 <div class="ec-modal-box">
  165.                     <div class="ec-role">
  166.                         <label for="ec-modal-checkbox" class="ec-inlineBtn--cancel">{{ 'お買い物を続ける'|trans }}</label>
  167.                         <a href="{{ url('cart') }}" class="ec-inlineBtn--action">{{ 'カートへ進む'|trans }}</a>
  168.                     </div>
  169.                 </div>
  170.             </div>
  171.         </div>
  172.       </div>
  173.   </section>
  174. </div>
  175. <!-- NAVIGATION -->
  176. <div class="flex nav blog-navigation">
  177.     {% if Blog.prev_link %}
  178.     <a href="{{ Blog.prev_link }}">
  179.         <div class="flex button2">
  180.             <div>
  181.                 <i class="fas fa-chevron-left"></i>
  182.             </div>
  183.             <div>
  184.                 <p>前へ</p>
  185.             </div>
  186.         </div>
  187.     </a>
  188.     {% endif %}
  189.     <div>
  190.       <a href="{{ url('blog_list', {'shop': shop}) }}" class="button2 buttonCustom">一覧へ戻る</a>
  191.     </div>
  192.     {% if Blog.next_link %}
  193.     <a href="{{ Blog.next_link }}">
  194.         <div class="flex button2">
  195.             <div>
  196.                 <p>次へ</p>
  197.             </div>
  198.             <div>
  199.                 <i class="fas fa-chevron-right"></i>
  200.             </div>
  201.         </div>
  202.     </a>
  203.     {% endif %}
  204. </div>
  205. {% endblock %}