custom/plugins/DmSanettaTheme/src/Resources/views/storefront/layout/navigation/flyout.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/layout/navigation/flyout.html.twig' %}
  2. {# Mega-Menu #}
  3. {% block layout_navigation_flyout_categories %}
  4.     <div class="{% if category.media %}col-8 col-xl-8{% else %}col{% endif %}">
  5.         <div class="navigation-flyout-categories">
  6.             {% block layout_navigation_flyout_categories_recoursion %}
  7.                 {% sw_include '@Storefront/storefront/layout/navigation/categories.html.twig' with {
  8.                     navigationTree: navigationTree.children,
  9.                     navigationMedia: category.media,
  10.                     page: page
  11.                 } only %}
  12.             {% endblock %}
  13.         </div>
  14.     </div>
  15. {% endblock %}
  16. {# Topseller/Teaser-Image #}
  17. {% block layout_navigation_flyout_teaser %}
  18.     {% set customFields = category.translated.customFields %}
  19.     {% set topSeller = getProductByID(customFields.custom_category_mega_menu_top_seller|trans|sw_sanitize, context.context) %}
  20.     {% set colors = topSeller.getProperties().groupByPropertyGroups().filterByProperty('name', 'color').first().getOptions().jsonSerialize() %}
  21.     {% if topSeller %}
  22.         <div class="col-4 col-xl-4">
  23.             <p class="nav-item nav-link navigation-flyout-link is-level-0">{{ 'sanetta.header.navigation.topseller.headline' | trans | sw_sanitize }}</p>
  24.             <div class="dm_main-navigation-topseller">
  25.                 <div class="dm_main-navigation-topseller__image">
  26.                     <img src="{{ topSeller.media.elements[topSeller.coverId].media.url }}">
  27.                 </div>
  28.                 <div class="dm_main-navigation-topseller__text">
  29.                     <p>{{ topSeller.translated.name }}</p>
  30.                     <ul class="list-unstyled">
  31.                         {% for color in colors %}
  32.                             <li>{{ color.name }}</li>
  33.                         {% endfor %}
  34.                     </ul>
  35.                     <p>{{ topSeller.price.elements|first.gross }} €</p>
  36.                     {% if topSeller.children.count() > 0 %}
  37.                         {% set linkableProductId = topSeller.children.first().id %}
  38.                     {% else %}
  39.                         {% set linkableProductId = topSeller.id %}
  40.                     {% endif %}
  41.                     <a class="btn btn-primary btn-sm" href="{{ seoUrl('frontend.detail.page', {'productId': linkableProductId}) }}" title="{{ topSeller.translated.name }}">
  42.                         {{ 'sanetta.header.navigation.topseller.button' | trans | sw_sanitize }}
  43.                     </a>
  44.                 </div>
  45.             </div>
  46.         </div>
  47.     {% else %}
  48.         {% if category.media %}
  49.             <div class="col-4 col-xl-3">
  50.                 <div class="navigation-flyout-teaser">
  51.                     {% block layout_navigation_flyout_teaser_image %}
  52.                         <a class="navigation-flyout-teaser-image-container"
  53.                            href="{{ category_url(category) }}"
  54.                            {% if category_linknewtab(category) %}target="_blank"{% endif %}
  55.                            title="{{ name }}">
  56.                             {% sw_thumbnails 'navigation-flyout-teaser-image-thumbnails' with {
  57.                                 media: category.media,
  58.                                 sizes: {
  59.                                     'default': '310px'
  60.                                 },
  61.                                 attributes: {
  62.                                     'class': 'navigation-flyout-teaser-image',
  63.                                     'alt': (category.media.translated.alt ?: ''),
  64.                                     'title': (category.media.translated.title ?: ''),
  65.                                     'data-object-fit': 'cover'
  66.                                 }
  67.                             } %}
  68.                         </a>
  69.                     {% endblock %}
  70.                 </div>
  71.             </div>
  72.         {% endif %}
  73.     {% endif %}
  74. {% endblock %}