{% sw_extends '@Storefront/storefront/layout/navigation/flyout.html.twig' %}
{# Mega-Menu #}
{% block layout_navigation_flyout_categories %}
<div class="{% if category.media %}col-8 col-xl-8{% else %}col{% endif %}">
<div class="navigation-flyout-categories">
{% block layout_navigation_flyout_categories_recoursion %}
{% sw_include '@Storefront/storefront/layout/navigation/categories.html.twig' with {
navigationTree: navigationTree.children,
navigationMedia: category.media,
page: page
} only %}
{% endblock %}
</div>
</div>
{% endblock %}
{# Topseller/Teaser-Image #}
{% block layout_navigation_flyout_teaser %}
{% set customFields = category.translated.customFields %}
{% set topSeller = getProductByID(customFields.custom_category_mega_menu_top_seller|trans|sw_sanitize, context.context) %}
{% set colors = topSeller.getProperties().groupByPropertyGroups().filterByProperty('name', 'color').first().getOptions().jsonSerialize() %}
{% if topSeller %}
<div class="col-4 col-xl-4">
<p class="nav-item nav-link navigation-flyout-link is-level-0">{{ 'sanetta.header.navigation.topseller.headline' | trans | sw_sanitize }}</p>
<div class="dm_main-navigation-topseller">
<div class="dm_main-navigation-topseller__image">
<img src="{{ topSeller.media.elements[topSeller.coverId].media.url }}">
</div>
<div class="dm_main-navigation-topseller__text">
<p>{{ topSeller.translated.name }}</p>
<ul class="list-unstyled">
{% for color in colors %}
<li>{{ color.name }}</li>
{% endfor %}
</ul>
<p>{{ topSeller.price.elements|first.gross }} €</p>
{% if topSeller.children.count() > 0 %}
{% set linkableProductId = topSeller.children.first().id %}
{% else %}
{% set linkableProductId = topSeller.id %}
{% endif %}
<a class="btn btn-primary btn-sm" href="{{ seoUrl('frontend.detail.page', {'productId': linkableProductId}) }}" title="{{ topSeller.translated.name }}">
{{ 'sanetta.header.navigation.topseller.button' | trans | sw_sanitize }}
</a>
</div>
</div>
</div>
{% else %}
{% if category.media %}
<div class="col-4 col-xl-3">
<div class="navigation-flyout-teaser">
{% block layout_navigation_flyout_teaser_image %}
<a class="navigation-flyout-teaser-image-container"
href="{{ category_url(category) }}"
{% if category_linknewtab(category) %}target="_blank"{% endif %}
title="{{ name }}">
{% sw_thumbnails 'navigation-flyout-teaser-image-thumbnails' with {
media: category.media,
sizes: {
'default': '310px'
},
attributes: {
'class': 'navigation-flyout-teaser-image',
'alt': (category.media.translated.alt ?: ''),
'title': (category.media.translated.title ?: ''),
'data-object-fit': 'cover'
}
} %}
</a>
{% endblock %}
</div>
</div>
{% endif %}
{% endif %}
{% endblock %}