custom/plugins/AlexMax/src/Resources/views/storefront/component/product/card/box-standard.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/product/card/box-standard.html.twig' %}
  2. {% set config = context.extensions.WodkaHoverOnListingSW6 %}
  3. {% block component_product_box %}
  4.   {% if context.extensions.WodkaHoverOnListingSW6 is not defined %}
  5.     {{ parent() }}
  6.   {% else %}
  7.     {% set config = context.extensions.WodkaHoverOnListingSW6 %}
  8.     {% if config.active and config.activeFlipDescription %}
  9.       {% if product %}
  10.         {% set name = product.translated.name %}
  11.         {% set id = product.id %}
  12.         {% set cover = product.cover.media %}
  13.         {% set variation = product.variation %}
  14.         <div class="card product-box box-{{ layout }} flip-box">
  15.           <div class="card-body flip-box-inner">
  16.             <div class="flip-box-front">
  17.               {# Clickable all product block #}
  18.               {% block component_product_box_badges %}
  19.                 {% if config.active and config.clickableProductBlock %}
  20.                   <a class="" href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}">
  21.                     {{ parent() }}
  22.                   </a>
  23.                 {% else %}
  24.                   {{ parent() }}
  25.                 {% endif %}
  26.               {% endblock %}
  27.               {% block component_product_box_rich_snippets %}
  28.                 {{ parent() }}
  29.               {% endblock %}
  30.               {% block component_product_box_image %}
  31.                 {% if config.active and product.cover %}
  32.                   {% set hover = null %}
  33.                   {% if product.extensions.hover is defined %}
  34.                     {% set hover = product.extensions.hover %}
  35.                   {% elseif product.media and product.media|length > 1 %}
  36.                     {% set break = false %}
  37.                     {% set hoverPosition = 0 %}
  38.                     {% if product.cover.position == 0 %}
  39.                       {% set hoverPosition = 1 %}
  40.                     {% endif %}
  41.                     {% for productMedia in product.media %}
  42.                       {% if not break %}
  43.                         {% if productMedia.position == hoverPosition %}
  44.                           {% set hover = productMedia.media %}
  45.                           {% set break = true %}
  46.                         {% endif %}
  47.                       {% endif %}
  48.                     {% endfor %}
  49.                     {# Product media position is sometimes broken and its value is 1 for all product media #}
  50.                     {% if not hover %}
  51.                       {% set break = false %}
  52.                       {% for productMedia in product.media %}
  53.                         {% if not break %}
  54.                           {% if productMedia.media and product.cover.mediaId != productMedia.mediaId %}
  55.                             {% set hover = productMedia.media %}
  56.                             {% set break = true %}
  57.                           {% endif %}
  58.                         {% endif %}
  59.                       {% endfor %}
  60.                     {% endif %}
  61.                   {% endif %}
  62.                   {% if hover.url %}
  63.                     <div class="wd--hover-on-listing-container">
  64.                       {% if config.imageSliderActive and product.cover and product.media %}
  65.                         {% set autoplay = false %}
  66.                         {% set useJsFunction = false %}
  67.                         {% if not config.navigationDotsPosition and not config.navigationArrowsPosition %}
  68.                           {% set autoplay = true %}
  69.                         {% else %}
  70.                           {% if config.autoplay %}
  71.                             {% set autoplay = false %}
  72.                             {% set useJsFunction = true %}
  73.                           {% else %}
  74.                             {% set autoplay = false %}
  75.                           {% endif %}
  76.                         {% endif %}
  77.                         {% sw_include '@WodkaHoverOnListingSW6/storefront/element/listing-image-slider.html.twig' with {
  78.                           'productImages': product.media.media,
  79.                           'navigationDotsPosition': config.navigationDotsPosition,
  80.                           'navigationArrowsPosition': config.navigationArrowsPosition,
  81.                           'cover': product.cover.media,
  82.                           'autoplay': autoplay
  83.                         } %}
  84.                       {% else %}
  85.                         <div class="image--default">
  86.                           <div class="product-image-wrapper wd--hover-on-listing-product-image">
  87.                             {# fallback if display mode is not set #}
  88.                             {% set displayMode = displayMode ?: 'standard' %}
  89.                             {# set display mode 'cover' for box-image with standard display mode #}
  90.                             {% if layout == 'image' and displayMode == 'standard' %}
  91.                               {% set displayMode = 'cover' %}
  92.                             {% endif %}
  93.                             <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  94.                                title="{{ name }}"
  95.                                class="product-image-link is-{{ displayMode }}">
  96.                               {% if cover.url %}
  97.                                 {% set attributes = {
  98.                                   'class': 'product-image is-'~displayMode,
  99.                                   'alt': (cover.translated.alt ?: name),
  100.                                   'title': (cover.translated.title ?: name)
  101.                                 } %}
  102.                                 {% if displayMode == 'cover' or displayMode == 'contain' %}
  103.                                   {% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %}
  104.                                 {% endif %}
  105.                                 {% sw_thumbnails 'product-image-thumbnails' with {
  106.                                   media: cover,
  107.                                   sizes: sizes
  108.                                 } %}
  109.                               {% else %}
  110.                                 <div class="product-image-placeholder">
  111.                                   {% sw_icon 'placeholder' style {
  112.                                     'size': 'fluid'
  113.                                   } %}
  114.                                 </div>
  115.                               {% endif %}
  116.                             </a>
  117.                           
  118.                           </div>
  119.                         </div>
  120.                         {# fallback if display mode is not set #}
  121.                         {% set displayMode = displayMode ?: 'standard' %}
  122.                         {# set display mode 'cover' for box-image with standard display mode #}
  123.                         {% if layout == 'image' and displayMode == 'standard' %}
  124.                           {% set displayMode = 'cover' %}
  125.                         {% endif %}
  126.                         <div class="image--hover">
  127.                           <div class="product-image-wrapper wd--hover-on-listing-product-image">
  128.                             <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  129.                                title="{{ name }}"
  130.                                class="product-image-link is-{{ displayMode }}">
  131.                               {% set attributes = {
  132.                                 'class': 'product-image is-'~displayMode,
  133.                                 'alt': (hover.translated.alt ?: name),
  134.                                 'title': (hover.translated.title ?: name)
  135.                               } %}
  136.                               {% sw_thumbnails 'product-image-thumbnails' with {
  137.                                 media: hover,
  138.                                 sizes: {
  139.                                   'xs': '501px',
  140.                                   'sm': '315px',
  141.                                   'md': '427px',
  142.                                   'lg': '333px',
  143.                                   'xl': '284px'
  144.                                 }
  145.                               } %}
  146.                             </a>
  147.                           </div>
  148.                         </div>
  149.                       {% endif %}
  150.                     </div>
  151.                   {% else %}
  152.                     {{ parent() }}
  153.                   {% endif %}
  154.                 {% else %}
  155.                   {{ parent() }}
  156.                 {% endif %}
  157.               {% endblock %}
  158.               {% block component_product_box_info %}
  159.                 <div class="product-info">
  160.                   {% block component_product_box_name %}
  161.                     <a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
  162.                        class="product-name"
  163.                        title="{{ name }}">
  164.                       {{ name }}
  165.                     </a>
  166.                   {% endblock %}
  167.                   {% block component_product_box_price %}
  168.                     {% sw_include '@Storefront/storefront/component/product/card/price-unit.html.twig' %}
  169.                   {% endblock %}
  170.                 {% sw_include '@Storefront/storefront/component/product/card/action.html.twig' %}
  171.                 </div>
  172.               {% endblock %}
  173.               
  174.             </div>
  175.           </div>
  176.           
  177.         </div>
  178.       {% endif %}
  179.     {% else %}
  180.       {{ parent() }}
  181.     {% endif %}
  182.   {% endif %}
  183. {% endblock %}
  184. {# Clickable all product block #}
  185. {% block component_product_box_content %}
  186.   {% if config.active and config.clickableProductBlock %}
  187.     <a class="linkClickableProductBlock" href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"></a>
  188.     {{ parent() }}
  189.   {% else %}
  190.     {{ parent() }}
  191.   {% endif %}
  192. {% endblock %}