app/Plugin/RelatedProduct42/Resource/template/front/related_product.twig line 1

Open in your IDE?
  1. {% block stylesheet %}
  2.     <style>
  3.         .slick-slider {
  4.             margin-bottom: 30px;
  5.         }
  6.         .slick-dots {
  7.             position: absolute;
  8.             bottom: -25px;
  9.             display: block;
  10.             width: 100%;
  11.             padding: 0;
  12.             list-style: none;
  13.             text-align: center;
  14.         }
  15.         .slick-dots li {
  16.             position: relative;
  17.             display: inline-block;
  18.             width: 20px;
  19.             height: 20px;
  20.             margin: 0 5px;
  21.             padding: 0;
  22.             cursor: pointer;
  23.         }
  24.         .slick-dots li button {
  25.             font-size: 0;
  26.             line-height: 0;
  27.             display: block;
  28.             width: 20px;
  29.             height: 20px;
  30.             padding: 5px;
  31.             cursor: pointer;
  32.             color: transparent;
  33.             border: 0;
  34.             outline: none;
  35.             background: transparent;
  36.         }
  37.         .slick-dots li button:hover,
  38.         .slick-dots li button:focus {
  39.             outline: none;
  40.         }
  41.         .slick-dots li button:hover:before,
  42.         .slick-dots li button:focus:before {
  43.             opacity: 1;
  44.         }
  45.         .slick-dots li button:before {
  46.             content: " ";
  47.             line-height: 20px;
  48.             position: absolute;
  49.             top: 0;
  50.             left: 0;
  51.             width: 12px;
  52.             height: 12px;
  53.             text-align: center;
  54.             opacity: .25;
  55.             background-color: black;
  56.             border-radius: 50%;
  57.         }
  58.         .slick-dots li.slick-active button:before {
  59.             opacity: .75;
  60.             background-color: black;
  61.         }
  62.         .slick-dots li button.thumbnail img {
  63.             width: 0;
  64.             height: 0;
  65.         }
  66.         
  67.         .slick-prev, .slick-next {
  68.             font-size: 0;
  69.             line-height: 0;
  70.             position: absolute;
  71.             top: 50%;
  72.             display: block;
  73.             width: 60px;
  74.             height: 60px;
  75.             padding: 0;
  76.             -webkit-transform: translate(0, -50%);
  77.             -ms-transform: translate(0, -50%);
  78.             transform: translate(0, -50%);
  79.             cursor: pointer;
  80.             color: transparent;
  81.             border: none;
  82.             outline: none;
  83.             background: transparent;
  84.         }
  85.             
  86.         .slick-prev {
  87.             left: 0;
  88.             z-index: 1;
  89.             height: 30px;
  90.         }
  91.             
  92.         .slick-next {
  93.             right: 0;
  94.             z-index: 1;
  95.             height: 30px;
  96.         }
  97.             
  98.         .slick-prev:before, .slick-next:before {
  99.             font-family: 'slick';
  100.             font-size: 40px;
  101.             line-height: 1;
  102.             opacity: 1;
  103.             color: white;
  104.             -webkit-font-smoothing: antialiased;
  105.             -moz-osx-font-smoothing: grayscale;
  106.         }
  107.     
  108.         .slick-prev:before {
  109.             content: url({{ asset('assets/img/common/btn_carousel_l.webp', 'user_data') }});
  110.         }
  111.             
  112.         .slick-next:before {
  113.             content: url({{ asset('assets/img/common/btn_carousel_r.webp', 'user_data') }});
  114.         }
  115.     
  116.         .slick-prev:hover,
  117.         .slick-prev:focus,
  118.         .slick-next:hover,
  119.         .slick-next:focus {
  120.             color: transparent;
  121.             outline: none;
  122.             background: transparent;
  123.         }
  124.             
  125.         .slick-prev:hover:before,
  126.         .slick-prev:focus:before,
  127.         .slick-next:hover:before,
  128.         .slick-next:focus:before {
  129.             opacity: 1;
  130.         }
  131.             
  132.         .slick-prev.slick-disabled:before,
  133.         .slick-next.slick-disabled:before {
  134.             opacity: .25;
  135.         }
  136.         .slick-track{
  137.             position: relative;
  138.             top: 0;
  139.             left: 0;
  140.             display: flex;
  141.             margin-left: auto;
  142.             margin-right: auto;
  143.         }
  144.         .freeze_related {
  145.             position: unset;
  146.             width: 60px;
  147.             display: inline-block;
  148.             line-height: 1em;
  149.             padding: 5px 0;
  150.             background-color: #00B0EC;
  151.             color: white;
  152.             text-align: center;
  153.             font-size: 11px;
  154.             font-weight: 700;
  155.             border-radius: 5px;
  156.             margin-bottom: 5px;
  157.             margin-top: 0px;
  158.         }
  159.         .original_related {
  160.             position: unset;
  161.             width: 85px;
  162.             display: inline-block;
  163.             line-height: 1em;
  164.             padding: 5px 0;
  165.             background-color: #fff100;
  166.             color: black;
  167.             text-align: center;
  168.             font-size: 11px;
  169.             font-weight: 700;
  170.             border-radius: 5px;
  171.             margin-bottom: 5px;
  172.             margin-top: 0px;
  173.         }
  174.             
  175.     </style>
  176. {% endblock %}
  177.     {% block javascript %}
  178.         <script>
  179.             
  180.             $(function() {
  181.                 let width = $(window).width();
  182.                 var photo_count = 2;
  183.                 if (width <= 768) {
  184.                 } else if (width <= 1024) {
  185.                     // タブレット
  186.                     photo_count = 4;
  187.                 } else {
  188.                     // PC
  189.                     photo_count = 4;
  190.                 }
  191.                 $('.main_visual_2').slick({
  192.                     dots: false,
  193.                     autoplay: true,
  194.                     speed: 300,
  195.                     centerMode: true,
  196.                     centerPadding: '5%',
  197.                     arrows: true,
  198.                     infinite: true,
  199.                     slidesToShow: photo_count
  200.                 });
  201.             }); 
  202.         </script>
  203.         <script>
  204.             $(function () {
  205.                 $('#RelatedProduct-product_area').appendTo($('.ec-layoutRole__main, .ec-layoutRole__mainWithColumn, .ec-layoutRole__mainBetweenColumn'));
  206.             });
  207.         </script>
  208.     {% endblock javascript %}
  209. {% block main %}
  210. {% if Product.RelatedProducts|length %}
  211. <div id="RelatedProduct-product_area" class="ec-shelfRole" style="padding: 0px;">
  212.     <div class="block_content" style="padding-left: 10px; padding-right: 10px; margin-bottom: 0px;">
  213.         <h2 style="">よく一緒に購入されている商品</h2>
  214.     </div>
  215.     <ul class="ec-shelfGrid" style="padding-left: 10px; padding-right: 10px;">
  216.         {% for RelatedProduct in Product.RelatedProducts %}
  217.             {% set ChildProduct = RelatedProduct.ChildProduct %}
  218.             {% if ChildProduct.Status.id == constant("Eccube\\Entity\\Master\\ProductStatus::DISPLAY_SHOW") %}
  219.                 <li class="ec-shelfGrid__item">
  220.                     <a href="{{ url('product_detail', {'id': ChildProduct.id}) }}">
  221.                         <img src="{{ asset(ChildProduct.mainFileName|no_image_product, "save_image") }}" style="width: 320px; height: 150px; object-fit: cover;">
  222.                             {% if ChildProduct.is_original == '1' %}
  223.                             <span class="original_related">オリジナル</span>
  224.                             {% endif %}
  225.                             {% if ChildProduct.is_freeze == "1" %}
  226.                             <span class="freeze_related">冷凍</span>
  227.                             {% endif %}
  228.                         <dl>
  229.                             {# 商品名 #}
  230.                             <p style="font-weight: bold; font-size: 14px; height: 40px; overflow: hidden; display: -webkit-box; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: black;">{{ ChildProduct.name }}</p>
  231.                             {# gあたり単価 #}
  232.                             <p style=" color: #B12704; font-size: 16px; font-weight: bold; padding-top: 10px; padding-bottom: 10px;">{{ ChildProduct.cost_per_unit }}</p>
  233.                             <dd class="item_price" style="color: black; font-size: 16px;">
  234.                                 {{ ChildProduct.getPrice02IncTaxMin|price }}(<span style="font-size: 14px;">{{ ChildProduct.getStandardText }}</span>)
  235.                             </dd>
  236.                         </dl>
  237.                     </a>
  238.                 </li>
  239.             {% endif %}
  240.         {% endfor %}
  241.     </ul>
  242. </div>
  243. {% endif %}
  244. {% endblock %}