app/template/default/Block/pickup_product.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. {% block javascript %}
  9.     <script>
  10.         $(function () {
  11.             var slidesToshow_val = 3;
  12.             var slidesToshow_leng = $('.card-pickup').length;
  13.             if(slidesToshow_leng < slidesToshow_val){
  14.                 slidesToshow_val = slidesToshow_leng;
  15.                 }
  16.             $('.slider-pickup').slick({
  17.                 arrows: true,
  18.                 slidesToShow: slidesToshow_val,
  19.                 centerMode: true,
  20.                 responsive: [
  21.                     {
  22.                         breakpoint: 768,
  23.                         settings: {
  24.                             arrows: true,
  25.                             centerMode: true,
  26.                             centerPadding: '40px',
  27.                             slidesToShow: 1
  28.                         }
  29.                     }
  30.                 ],
  31.             });
  32.         });
  33.     </script>
  34.     
  35.     
  36.     
  37.     {#<script>#}
  38.     {#    $(function () {#}
  39.     {#        $('.slider-pickup').slick({#}
  40.     {#            arrows: true,#}
  41.     {#            slidesToShow: 3,#}
  42.     {#            centerMode: true,#}
  43.     {#            responsive: [#}
  44.     {#                {#}
  45.     {#                    breakpoint: 768,#}
  46.     {#                    settings: {#}
  47.     {#                        arrows: true,#}
  48.     {#                        centerMode: true,#}
  49.     {#                        centerPadding: '40px',#}
  50.     {#                        slidesToShow: 1#}
  51.     {#                    },#}
  52.     {#                },#}
  53.     {#            ],#}
  54.     {#        });#}
  55.     {#    });#}
  56.     {#</script>#}
  57.     <script>
  58.         window.addEventListener('load', function () {
  59.             var maxHeight = 0;
  60.             $('.slider-pickup .slider_item').each(function (idx, elem) {
  61.                 var height = $(elem).height();
  62.                 if (maxHeight < height) {
  63.                     maxHeight = height;
  64.                 }
  65.             });
  66.             $('.slider-pickup .slider_item').height(maxHeight);
  67.         });
  68.     </script>
  69. {% endblock javascript %}
  70. {% set ProductList = PickupProductList %}
  71. {% if ProductList|length > 0 %}
  72. <section class="pickup bg-gray">
  73.     <div class="container">
  74.         <h2 class="section-title">
  75.             <span class="_sub">
  76.                 PICK UP
  77.             </span>
  78.             <span class="_main">
  79.                 オススメ書籍
  80.             </span>
  81.         </h2>
  82.         <div class="pickup__content">
  83.             <div class="slider-pickup">
  84.                 {% for Product in ProductList %}
  85.                 <a class="slider_item card-pickup" href="{{ url('product_detail', {'id': Product.id}) }}">
  86.                     <div class="card-pickup__content">
  87.                         {# 新刊ラベル #}
  88.                         {% if Product.new_book_flag %}
  89.                             <div class="card-pickup__new">
  90.                                 <img src="{{ asset('assets/img/top/pickup_new.png','user_data') }}" alt="">
  91.                             </div>
  92.                         {% endif %}
  93.                         {# 画像 #}
  94.                         <div class="card-pickup__img">
  95.                             <img src="{{ asset(Product.main_list_image|no_image_product, 'save_image') }}">
  96.                         </div>
  97.                         <p class="card-pickup__title">{{ Product.name }}</p>
  98.                         <p class="card-pickup__text">
  99.                             {{ Product.description_detail|length > 50 ? Product.description_detail|slice(0, 50) ~ '…' : Product.description_detail }}
  100.                         </p>
  101.                     </div>
  102.                     <p class="card-pickup__btn">
  103.                         詳しく見る
  104.                     </p>
  105.                 </a>
  106.                 
  107.                 {% endfor %}
  108.             </div>
  109.             
  110.         </div>
  111.     </div>
  112. </section>
  113. {% endif %}