{% sw_extends '@Storefront/storefront/component/product/card/box.html.twig' %}
{# add lazy load and hover img to generic box template #}
{% block component_product_box_image_link_inner %}
{% if cover.url %}
{% set hoverImg = false %}
{% set hoverImgSrc = '' %}
{% if product.customFields.doncarne_product_custom_fields_listing_hover_img %}
{% set hoverImgId = product.customFields.doncarne_product_custom_fields_listing_hover_img %}
{% if context.context is defined %}
{% set mediaCollection = searchMedia([hoverImgId], context.context) %}
{% set media = mediaCollection.get(hoverImgId) %}
{% elseif context is defined %}
{% set mediaCollection = searchMedia([hoverImgId], context) %}
{% set media = mediaCollection.get(hoverImgId) %}
{% else %}
{% for mediaItem in product.media %}
{% if mediaItem.media.id == hoverImgId %}
{% set media = mediaItem.media %}
{% endif %}
{% endfor %}
{% endif %}
{% if media and media.url %}
{% set hoverImgSrc = media.url %}
{% set hoverImg = true %}
{% endif %}
{% endif %}
{% set attributes = {
'class': 'product-image is-'~displayMode,
'alt': (cover.translated.alt ?: name),
'title': (cover.translated.title ?: name),
'loading': 'lazy',
'data-hover-img': hoverImg ? '1' : '0',
'data-hover-img-source': hoverImgSrc
} %}
{% if displayMode == 'cover' or displayMode == 'contain' %}
{% set attributes = attributes|merge({ 'data-object-fit': displayMode }) %}
{% endif %}
{% block component_product_box_image_thumbnail %}
{{ parent() }}
{% endblock %}
{% else %}
{% block component_product_box_image_placeholder %}
<div class="product-image-placeholder product-image is-standard">
{% sw_icon 'placeholder' style {
'size': 'fluid'
} %}
</div>
{% endblock %}
{% endif %}
{% endblock %}
{% block component_product_box_wishlist_action %}
{# default shopware only if plugin not active #}
{% if not config('CoeWishlistSw6.config.wishlistButtonOnListing') %}
{% if controllerName !== "Wishlist" %}
{{ parent() }}
{# on wishlist page: show remove button #}
{% else %}
<div class="product-wishlist product-wishlist-remove">
{% block component_product_wishlist_remove_form %}
{% set size = size ?? 'md' %}
<form action="{{ path('frontend.wishlist.product.delete', {'id': id}) }}"
method="post"
class="product-wishlist-form"
data-form-csrf-handler="true">
{% block component_product_box_wishlist_remove_csrf %}
{{ sw_csrf('frontend.wishlist.product.delete') }}
{% endblock %}
{% block component_product_wishlist_remove_redirect %}
<input type="hidden"
name="redirectTo"
value="frontend.wishlist.page"/>
{% endblock %}
{% block component_product_wishlist_remove_submit %}
<button type="submit" class="btn product-wishlist-btn product-wishlist-btn-remove">
{% sw_icon 'x' style { 'class': 'icon-wishlist icon-wishlist-remove', 'size': size, 'pack': 'solid' } %}
</button>
{% endblock %}
</form>
{% endblock %}
</div>
{% endif %}
{% endif %}
{% endblock %}
{% block component_product_box_info %}
{# Add product number reference -- used in app/storefront/src/js/product-listing-rating.plugin.js && controller url #}
<div class="product-info">
{% block component_product_box_name %}
{{ parent() }}
<a
data-rating-url="{{ path('frontend.product.rating', {'productNumber': product.productNumber }) }}"
href="{{ seoUrl('frontend.detail.page', {'productId': product.id}) }}#review-tab-pane"
></a>
{% if product.getExtension("doncarneCutProperties").all()|first %}
{% sw_include '@Storefront/solution360/cut-product-property-image.html.twig' with {media: product.getExtension("doncarneCutProperties").all()|first.media} only %}
{% endif %}
<span class="product-unit-label">
{% if product.purchaseUnit %}
{{ "listing.boxUnitLabel"|trans|sw_sanitize }} {{product.purchaseUnit}} {{product.unit.translated.name}}
{% endif %}
{% if product.translated.packUnit %}
{% if product.purchaseUnit %}, {% endif %}{{product.translated.packUnit}}
{% endif %}
</span>
{% endblock %}
{% block component_product_box_rating %}
{% if config('core.listing.showReview') %}
<div class="product-rating">
{% if true or product.ratingAverage %}
{% sw_include '@Storefront/storefront/component/review/rating.html.twig' with {
points: product.ratingAverage,
style: 'text-primary'
} %}
<span class="point-rating__details">{{product.ratingAverage}}/5.00</span>
{% endif %}
</div>
{% endif %}
{% endblock %}
{% block component_product_box_variant_characteristics %}
{% sw_include '@Storefront/solution360/product-usps-listing.html.twig' with { product: product }%}
{% endblock %}
{% block component_product_box_description %}
{% endblock %}
{% block component_product_box_price %}
{{ parent() }}
{% endblock %}
{# % sw_include '@Storefront/solution360/special-product-properties.html.twig' with {specialProperties: product.getExtension("doncarneSpecialProperties").all()} % #}
{% block component_product_box_action %}
{% endblock %}
{# this block depends on whether or not third party plugin installed #}
{% if config('CoeWishlistSw6.config.wishlistButtonOnListing') %}
{# CoeWishlistSw6 is active and adjusted #}
{% sw_include '@Storefront/storefront/component/wishlist/button/add-note.html.twig'
with {
additionalClass: 'product-card__wishlist-btn'
}
%}
{% endif %}
</div>
{% endblock %}