{% sw_extends '@Storefront/storefront/component/product/card/box-standard.html.twig' %}
{% set config = context.extensions.WodkaHoverOnListingSW6 %}
{% block component_product_box %}
{% if context.extensions.WodkaHoverOnListingSW6 is not defined %}
{{ parent() }}
{% else %}
{% set config = context.extensions.WodkaHoverOnListingSW6 %}
{% if config.active and config.activeFlipDescription %}
{% if product %}
{% set name = product.translated.name %}
{% set id = product.id %}
{% set cover = product.cover.media %}
{% set variation = product.variation %}
<div class="card product-box box-{{ layout }} flip-box">
<div class="card-body flip-box-inner">
<div class="flip-box-front">
{# Clickable all product block #}
{% block component_product_box_badges %}
{% if config.active and config.clickableProductBlock %}
<a class="" href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}">
{{ parent() }}
</a>
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block component_product_box_rich_snippets %}
{{ parent() }}
{% endblock %}
{% block component_product_box_image %}
{% if config.active and product.cover %}
{% set hover = null %}
{% if product.extensions.hover is defined %}
{% set hover = product.extensions.hover %}
{% elseif product.media and product.media|length > 1 %}
{% set break = false %}
{% set hoverPosition = 0 %}
{% if product.cover.position == 0 %}
{% set hoverPosition = 1 %}
{% endif %}
{% for productMedia in product.media %}
{% if not break %}
{% if productMedia.position == hoverPosition %}
{% set hover = productMedia.media %}
{% set break = true %}
{% endif %}
{% endif %}
{% endfor %}
{# Product media position is sometimes broken and its value is 1 for all product media #}
{% if not hover %}
{% set break = false %}
{% for productMedia in product.media %}
{% if not break %}
{% if productMedia.media and product.cover.mediaId != productMedia.mediaId %}
{% set hover = productMedia.media %}
{% set break = true %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% if hover.url %}
<div class="wd--hover-on-listing-container">
{% if config.imageSliderActive and product.cover and product.media %}
{% set autoplay = false %}
{% set useJsFunction = false %}
{% if not config.navigationDotsPosition and not config.navigationArrowsPosition %}
{% set autoplay = true %}
{% else %}
{% if config.autoplay %}
{% set autoplay = false %}
{% set useJsFunction = true %}
{% else %}
{% set autoplay = false %}
{% endif %}
{% endif %}
{% sw_include '@WodkaHoverOnListingSW6/storefront/element/listing-image-slider.html.twig' with {
'productImages': product.media.media,
'navigationDotsPosition': config.navigationDotsPosition,
'navigationArrowsPosition': config.navigationArrowsPosition,
'cover': product.cover.media,
'autoplay': autoplay
} %}
{% else %}
<div class="image--default">
<div class="product-image-wrapper wd--hover-on-listing-product-image">
{# fallback if display mode is not set #}
{% set displayMode = displayMode ?: 'standard' %}
{# set display mode 'cover' for box-image with standard display mode #}
{% if layout == 'image' and displayMode == 'standard' %}
{% set displayMode = 'cover' %}
{% endif %}
<a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
title="{{ name }}"
class="product-image-link is-{{ displayMode }}">
{% if cover.url %}
{% set attributes = {
'class': 'product-image is-'~displayMode,
'alt': (cover.translated.alt ?: name),
'title': (cover.translated.title ?: name)
} %}
{% if displayMode == 'cover' or displayMode == 'contain' %}
{% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %}
{% endif %}
{% sw_thumbnails 'product-image-thumbnails' with {
media: cover,
sizes: sizes
} %}
{% else %}
<div class="product-image-placeholder">
{% sw_icon 'placeholder' style {
'size': 'fluid'
} %}
</div>
{% endif %}
</a>
</div>
</div>
{# fallback if display mode is not set #}
{% set displayMode = displayMode ?: 'standard' %}
{# set display mode 'cover' for box-image with standard display mode #}
{% if layout == 'image' and displayMode == 'standard' %}
{% set displayMode = 'cover' %}
{% endif %}
<div class="image--hover">
<div class="product-image-wrapper wd--hover-on-listing-product-image">
<a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
title="{{ name }}"
class="product-image-link is-{{ displayMode }}">
{% set attributes = {
'class': 'product-image is-'~displayMode,
'alt': (hover.translated.alt ?: name),
'title': (hover.translated.title ?: name)
} %}
{% sw_thumbnails 'product-image-thumbnails' with {
media: hover,
sizes: {
'xs': '501px',
'sm': '315px',
'md': '427px',
'lg': '333px',
'xl': '284px'
}
} %}
</a>
</div>
</div>
{% endif %}
</div>
{% else %}
{{ parent() }}
{% endif %}
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block component_product_box_info %}
<div class="product-info">
{% block component_product_box_name %}
<a href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"
class="product-name"
title="{{ name }}">
{{ name }}
</a>
{% endblock %}
{% block component_product_box_price %}
{% sw_include '@Storefront/storefront/component/product/card/price-unit.html.twig' %}
{% endblock %}
{% sw_include '@Storefront/storefront/component/product/card/action.html.twig' %}
</div>
{% endblock %}
</div>
</div>
</div>
{% endif %}
{% else %}
{{ parent() }}
{% endif %}
{% endif %}
{% endblock %}
{# Clickable all product block #}
{% block component_product_box_content %}
{% if config.active and config.clickableProductBlock %}
<a class="linkClickableProductBlock" href="{{ seoUrl('frontend.detail.page', {'productId': id}) }}"></a>
{{ parent() }}
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}