app/template/default/Block/refine_check_item.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of Refine
  3. Copyright(c) 2021 Refine Co.,Ltd. All Rights Reserved.
  4. https://www.re-fine.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. <script>
  9.     $(function () {
  10.         $('#refine-check-item').appendTo($('#js-checked-area'));
  11.         if (window.matchMedia( '(min-width: 768px)' ).matches) {
  12.             if($('#js-checked-slider').find('.p-product-checked__slide').length<=4){
  13.                 $('#js-checked-slider').addClass('no-slide');
  14.             } else {
  15.                 $('#js-checked-slider').slick({
  16.                   autoplay: false,
  17.                   arrows: true,
  18.                   dots:false,
  19.                   slidesToShow: 4,
  20.                 });
  21.             }
  22.         } else {
  23.             if($('#js-checked-slider').find('.p-product-checked__slide').length<=1){
  24.                 $('#js-checked-slider').addClass('no-slide');
  25.             } else {
  26.                 $('#js-checked-slider').slick({
  27.                   autoplay: false,
  28.                   arrows: false,
  29.                   dots:false,
  30.                   centerMode: true,
  31.                   centerPadding: '10%',
  32.                 });
  33.             }
  34.         }
  35.     });
  36. </script>
  37. {% if Products %}
  38.     <div class="p-product-checked__container" id="refine-check-item">
  39.         <h2 class="p-product-checked__ttl c-ttl-sec">
  40.             <span class="jp">最近チェックした商品</span>
  41.             <span class="en">CHECKED PRODUCTS</span>
  42.         </h2>
  43.         <div class="p-product-checked__slider" id="js-checked-slider">
  44.             {% for ProductArray in Products  %}
  45.                 {% set Product = ProductArray.Product %}
  46.                 {% set hasStock = ProductArray.hasStock %}
  47.                 {% set group1 = repository("Plugin\\CustomerGroup42\\Entity\\Group").find(1) %}
  48.                 {% set group2 = repository("Plugin\\CustomerGroup42\\Entity\\Group").find(2) %}
  49.                 {% set group3 = repository("Plugin\\CustomerGroup42\\Entity\\Group").find(3) %}
  50.                 {% set group4 = repository("Plugin\\CustomerGroup42\\Entity\\Group").find(4) %}
  51.                 {% if group1 is not null and is_granted('view', group1) or group2 is not null and is_granted('view', group2) or group3 is not null and is_granted('view', group3) or group4 is not null and is_granted('view', group4) %} {# ヒートセラピー会員 ログイン時 #}
  52.                     <div class="p-product-checked__slide">
  53.                         <a href="{{ url('product_detail', {'id': Product.id}) }}" class="p-product-checked__slide-link">
  54.                             <div class="p-product-checked__slide-img-wrap">
  55.                                 <img src="{{ asset(Product.main_list_image|no_image_product, "save_image") }}" alt="{{ Product.name }}">
  56.                             </div>
  57.                             <h3 class="p-product-checked__slide-ttl">{{ Product.name }}</h3>
  58.                         </a>
  59.                     </div>
  60.                 {% else %} {# ヒートセラピー会員 非ログイン時 #}
  61.                     {% if Product.ProductCategories[0] is not defined or Product.ProductCategories[0] is defined and Product.ProductCategories[0].category_id != 10 %}
  62.                         <div class="p-product-checked__slide">
  63.                             <a href="{{ url('product_detail', {'id': Product.id}) }}" class="p-product-checked__slide-link">
  64.                                 <div class="p-product-checked__slide-img-wrap">
  65.                                     <img src="{{ asset(Product.main_list_image|no_image_product, "save_image") }}" alt="{{ Product.name }}">
  66.                                 </div>
  67.                                 <h3 class="p-product-checked__slide-ttl">{{ Product.name }}</h3>
  68.                             </a>
  69.                         </div>
  70.                     {% endif %}
  71.                 {% endif %}
  72.             {% endfor %}
  73.         </div>
  74.     </div>
  75. {% endif %}