{% sw_extends '@Storefront/storefront/component/product/card/box-standard.html.twig' %}
{% block component_product_box %}
{% set sizes = {
'xs': '500px',
'sm': '315px',
'md': '390px',
'lg': '350px',
'xl': '280px'
} %}
{{ parent() }}
{% endblock %}
{% block component_product_box_content %}
{# SET TYPE FREE OR GOLD #}
{% set type = 'free' %}
{% if product.extensions.dvdwParticipations and product.extensions.dvdwParticipations.elements | length > 0 %}
{% set participation = product.extensions.dvdwParticipations | first %}
{% if participation and participation.orderLineItem and participation.orderLineItem.extensions.dvdwTicket %}
{% set type = participation.orderLineItem.extensions.dvdwTicket.type %}
{% endif %}
{% endif %}
{% if product.tagIds is defined and ('f78e8311466f4d31aa91e6b39e489b81' in product.tagIds) %}
{% set type = 'gold' %}
{% endif %}
{# SET PROMO PHASE #}
{# {% set showPromoPhase = context.extensions.currentDvdwEvent.phase === 'phase-promo-show' %} #}
{% set usePromoPhase = context.extensions.currentDvdwEvent.phase === 'phase-promo-use' %}
{# {% set showPromoPhase = context.extensions.currentDvdwEvent.phase === 'phase-promo-show' %} #}
{# {% set usePromoPhase = true %} #}
{# TARGET URL #}
{% set targetUrl = seoUrl('frontend.detail.page', {'productId': id}) %}
{% if usePromoPhase == true && participation && participation.dvdwPromotion && participation.dvdwPromotion && participation.dvdwPromotion.promoUrl %}
{% set targetUrl = participation.dvdwPromotion.promoUrl %}
{% endif %}
{# MEDIA URL #}
{% set usedMedia = cover %}
{% if usePromoPhase == true and participation and participation.dvdwPromotion and participation.dvdwPromotion.media %}
{% set usedMedia = participation.dvdwPromotion.media %}
{% endif %}
<div
class="card-body {% if type === 'gold' %}gold-webshop{% endif %}"> {# GOLDEN WEBSHOP BADGE #}
{% block component_product_box_badges %}
{{ parent() }}
{% if type === 'gold' %}
<div class="badge badge-gold">
<img src="/bundles/dvdwdirectory/images/product/badge-gold.svg" alt="golden badge"/>
</div>
{% endif %}
{% endblock %}
{% block component_product_box_rich_snippets %}
{{ parent() }}
{% endblock %}
{% block component_product_box_image %}
{# WEBSHOP NAME #}
{% if participation && participation.dvdwPromotion && usePromoPhase == true %}
{% block component_product_box_name_top %}
<a href="{{ targetUrl }}" class="product-name" title="{{ name }}" target="_blank" rel="noopener noreferrer">
{{ name }}
</a>
{% endblock %}
{% endif %}
<div
class="product-image-wrapper">
{# 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="{{ targetUrl }}" title="{{ name }}" class="product-image-link is-{{ displayMode }}" target="_blank" rel="noopener noreferrer">
{% if usedMedia.url %}
{% set attributes = {
'class': 'product-image is-'~displayMode,
'alt': (usedMedia.translated.alt ?: name),
'title': (usedMedia.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: usedMedia,
sizes: sizes
} %}
{% else %}
<div class="product-image-placeholder">
{% sw_icon 'placeholder-icon' style {
pack: 'custom-icons',
size: 'fluid'
} %}
</div>
{% endif %}
</a>
{% if config('core.cart.wishlistEnabled') %}
{% block component_product_box_wishlist_action %}
{% sw_include '@Storefront/storefront/component/product/card/wishlist.html.twig' with {
appearance: 'circle',
productId: id
} %}
{% endblock %}
{% endif %}
</div>
{% endblock %}
{% block component_product_box_info %}
{# <hr class="image-info-line"> #}
<div class="product-info">
{% block component_product_box_rating %}{% endblock %}
{% block component_product_box_name %}
<div>
{% if participation and participation.dvdwPromotion and usePromoPhase == true %}
<a href="{{ targetUrl }}" class="product-name promo" title="{{ participation.dvdwPromotion.translated.title }}" target="_blank" rel="noopener noreferrer">
{{ participation.dvdwPromotion.translated.title }}
</a>
{% if participation.dvdwPromotion.freeShipping == true %}
<div class="free-shipping">
<span>
{{ "listingItem.freeShipping"|trans|sw_sanitize }}
</span>
{% if participation.dvdwPromotion.freeShippingMinimumAmount != null and participation.dvdwPromotion.freeShippingMinimumAmount > 0 %}
<span>
{{ "listingItem.freeShippingFrom"|trans|replace({'{price}': participation.dvdwPromotion.freeShippingMinimumAmount|number_format(2, ',', '.')})|sw_sanitize }}
</span>
{% endif %}
</div>
{% else %}
<div class="free-shipping"></div>
{% endif %}
{% else %}
<a href="{{ targetUrl }}" class="product-name" title="{{ name }}">
{{ name }}
</a>
{% endif %}
</div>
{% endblock %}
{% block component_product_box_promocode %}
{% if usePromoPhase == true %}
<div
class="promocode-wrapper">
{# PROMO CODE #}
{% if participation && participation.dvdwPromotion && participation.dvdwPromotion.promoCode && usePromoPhase == true %}
<div class="promocode-label">Promo code</div>
<div class="promocode {% if type === 'gold' %}gold-webshop{% endif %}">
{{ participation.dvdwPromotion.promoCode }}
</div>
{% endif %}
</div>
{% endif %}
{% endblock %}
{% block component_product_box_variant_characteristics %}{% endblock %}
{% block component_product_box_description %}
<div class="product-description {% if product.translated.description|length > 75 %} tooltip-target {% endif %}">
{% if participation && participation.dvdwPromotion && usePromoPhase == true && participation.dvdwPromotion.translated.description %}
{{ participation.dvdwPromotion.translated.description }}
{% else %}
{{ product.translated.description|striptags|raw }}
{# {% if product.translated.description|length > 75 %}#}
{# <span class="tooltip-text">#}
{# {{ product.translated.description|striptags|raw }}#}
{# </span>#}
{# {% endif %}#}
{% endif %}
</div>
{% endblock %}
{% block component_product_box_price %}{% endblock %}
{% block component_product_box_action %}
{% sw_include '@DvdwDirectory/storefront/component/shops/card-actions.html.twig' %}
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock %}