{% sw_extends '@Storefront/storefront/component/product/card/box-standard.html.twig' %}
{% block component_product_box %}
{% if product %}
{% set name = product.translated.name %}
{# Custom switch, as we want product cards to link to the Parent product (so no variation is selected), instead of the product variation itself. #}
{% if product.parentId is not null %}
{% set id = product.parentId %}
{% else %}
{% set id = product.id %}
{% endif %}
{% set cover = product.cover.media %}
{% set variation = product.variation %}
{% set displayParent = product.variantListingConfig.displayParent and product.parentId === null %}
{% set productUrl = seoUrl('frontend.detail.page', { 'productId': id }) %}
<div class="product-box box-{{ layout }} h-full group">
{% block component_product_box_content %}
{{ parent() }}
{% endblock %}
</div>
{% endif %}
{% endblock %}
{% block component_product_box_image_link_inner %}
{% if cover.url %}
{% set attributes = {
class: 'product-image cover',
alt: cover.translated.alt ? : name,
title: cover.translated.title ? : name
} %}
{% sw_thumbnails 'product-image-thumbnails'
with
{
media: cover,
sizes: {
'xs': '308px',
'md': '420px',
'xl': '868px'
}
} %}
{% if 'secondMediaExtension' in product.extensions|keys %}
{% set secondMedia = product.extensions.secondMediaExtension.secondMedia.media %}
{% set attributes = {
class: 'product-image product-image-hover hidden opacity-0 hover:opacity-100 md:block transition cover',
alt: secondMedia.translated.alt ? : name,
title: secondMedia.translated.title ? : name
} %}
{% sw_thumbnails 'product-image-thumbnails'
with
{
media: secondMedia,
sizes: {
'xs': '308px',
'md': '420px',
'xl': '868px'
}
} %}
{% endif %}
{% else %}
{% block component_product_box_image_placeholder %}
{% sw_icon 'placeholder' style {
'size': 'fluid'
} %}
{% endblock %}
{% endif %}
{% endblock %}
{% block component_product_box_variant_characteristics %}
{% endblock %}
{% block component_product_box_image_link %}
{{ parent() }}
<div class="variant-selector justify-center text-sm transition absolute bottom-0 flex w-full flex-wrap grid-gap-2 p-2 bg-white/25 opacity-0 group-hover:opacity-100">
{% for product in product.extensions.allChildren.elements %}
{% set size = product.options.elements|first.name %}
{% if product.availableStock %}
<a href="{{ productUrl }}?size={{ size }}"
title="Selecteer maat {{ size }}"
class="flex items-center justify-center w-8 h-8 bg-grey-50 border border-transparent rounded-sm hover:border-grey-900">{{ size }}</a>
{% endif %}
{% endfor %}
</div>
{% endblock %}
{% block component_product_box_brand_name %}
<div class="product-brand-name font-accent font-bold text-xs mb-2">
{{ product.manufacturer.translated.name }}
</div>
{% endblock %}
{% block component_product_box_name %}
<a href="{{ productUrl }}"
class="product-name block text-xs font-normal lg:text-sm"
title="{{ name }}">
{{ name }}
</a>
{% endblock %}