{% sw_extends '@Storefront/storefront/component/product/listing.html.twig' %}
{% block element_product_listing_col %}
{% set productBanners = slot.data.listing.extensions.crehlerBanner ?? searchResult.extensions.crehlerBanner %}
{% for product in searchResult %}
{% if productBanners and productBanners is not empty %}
{% set desktopBanner = productBanners.desktopMedia|filter(media => media.position == loop.index-1) %}
{% set mobileBanner = productBanners.mobileMedia|filter(media => media.position == loop.index-1) %}
{% for banner in desktopBanner %}
<div class="cms-listing-col {{ listingColumns }} d-none d-md-block">
<div class="card product-box crehler-product-banner">
<div class="card-body">
<div class="product-image-wrapper">
{% if banner.link == null %}
{% sw_thumbnails 'product-banner-thumbnails' with {
media: banner.media,
sizes: sizes
} %}
{% else %}
<a href="{{ banner.link }}"
title="{{ banner.media.title }}"
class="">
{% sw_thumbnails 'product-banner-thumbnails' with {
media: banner.media,
sizes: sizes
} %}
</a>
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
{% for banner in mobileBanner %}
<div class="cms-listing-col {{ listingColumns }} d-md-none">
<div class="card product-box crehler-product-banner">
<div class="card-body">
<div class="product-image-wrapper">
<a href="{{ banner.link }}"
title="{{ banner.media.title }}"
class="product-image-link">
{% sw_thumbnails 'product-banner-thumbnails' with {
media: banner.media,
sizes: sizes
} %}
</a>
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
<div class="cms-listing-col {{ listingColumns }}">
{% block element_product_listing_box %}
{{ parent() }}
{% endblock %}
</div>
{% endfor %}
{% endblock %}