custom/plugins/theme/src/Resources/views/storefront/layout/header/header.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/layout/header/header.html.twig' %}
  2. {# moved outside of container div because of full width #}
  3. {% block layout_top_bar %}
  4. {% endblock %}
  5. {% block layout_header_logo %}
  6.     <!-- script type="application/javascript" src="https://privacy-proxy.usercentrics.eu/latest/uc-block.bundle.js"></script -->
  7.     <div class="col-6 col-md-4 col-lg-auto header-logo-col order-1">
  8.         {% sw_include '@Storefront/storefront/layout/header/logo.html.twig' %}
  9.     </div>
  10. {% endblock %}
  11. {% block layout_header_search %}
  12.     <div class="col-12 col-md-5 col-lg order-3 order-md-2 order-lg-2 header-search-col">
  13.         <div class="row">
  14.             <div class="col">
  15.                 {% sw_include '@Storefront/storefront/layout/header/search.html.twig' %}
  16.             </div>
  17.         </div>
  18.     </div>
  19. {% endblock %}
  20. {% block layout_header_actions %}
  21.     <div class="col-6 col-md-3 col-lg-auto order-1 order-md-3 header-actions-col">
  22.         <div class="row {{ gridNoGuttersClass }} justify-content-end align-items-center">
  23.             {% block layout_header_navigation_toggle %}
  24.             {% endblock %}
  25.             {% block layout_header_actions_account %}
  26.                 {% if doncarneConfig.beefClubCategory and doncarneConfig.beefClubPortalCategory and doncarneConfig.beefClubImage %}
  27.                     {% set imageId = doncarneConfig.beefClubImage %}
  28.                     {% set mediaCollection = searchMedia([imageId], context.context) %}
  29.                     {% set media = mediaCollection.get(imageId) %}
  30.                     {% set category = doncarneConfig.beefClubCategory  %}
  31.                     {% if context.customer and context.customer.groupId == doncarneConfig.beefClubCustomerGroup %}
  32.                         {% set category = doncarneConfig.beefClubPortalCategory  %}
  33.                     {% endif %}
  34.                     <a class="d-block header-beef-club" href="{{ seoUrl('frontend.navigation.page', { navigationId: category }) }}" title="Don Carne Beef Club">
  35.                         <img class="img-fluid" src="{{media.url}}" alt="Don Carne Beef Club">
  36.                     </a>
  37.                 {% endif %}
  38.                 <div class="col-auto">
  39.                     <div class="account-menu">
  40.                         {% sw_include '@Storefront/storefront/layout/header/actions/account-widget.html.twig' %}
  41.                     </div>
  42.                 </div>
  43.             {% endblock %}
  44.             {% if config('core.cart.wishlistEnabled') %}
  45.                 {% block layout_header_actions_wishlist %}
  46.                     {{ parent() }}
  47.                 {% endblock %}
  48.             {% endif %}
  49.             {% block layout_header_actions_cart %}
  50.                 {{ parent() }}
  51.                 <div class="col-auto d-lg-none">
  52.                     <div class="menu-button">
  53.                         {% block layout_header_navigation_toggle_button %}
  54.                             <button class="btn nav-main-toggle-btn header-actions-btn pb-0"
  55.                                     type="button"
  56.                                     data-offcanvas-menu="true"
  57.                                     aria-label="{{ "general.menuLink"|trans|striptags }}">
  58.                                 {% block layout_header_navigation_toggle_button_icon %}
  59.                                     {% sw_icon 'stack' %}
  60.                                 {% endblock %}
  61.                                 <span class="d-block text-primary font-weight-normal menu-icon-title">{{ "menu.title"|trans|sw_sanitize|upper }}</span>
  62.                             </button>
  63.                         {% endblock %}
  64.                     </div>
  65.                 </div>
  66.             {% endblock %}
  67.         </div>
  68.     </div>
  69.     {# moved to main.js javascript file
  70.     <!-- clerk ratings {literal} -->
  71.     <script>
  72.         async function fetchRating(sku) {
  73.             try {
  74.                 const response = await fetch(`https://doncarne.de/product-rating/${sku}`);
  75.                 const html = await response.text();
  76.                 const parser = new DOMParser();
  77.                 const doc = parser.parseFromString(html, 'text/html');
  78.                 const ratingElement = doc.querySelector('.product-review-rating__details');
  79.                 const rating = ratingElement ? ratingElement.textContent.trim() : '';
  80.                 const starsElement = doc.querySelector('.product-review-rating');
  81.                 const stars = starsElement ? starsElement.innerHTML : '';
  82.                 return { rating, stars };
  83.             } catch (error) {
  84.                 console.error('Error fetching rating for SKU:', sku, error);
  85.                 return { rating: '', stars: '' };
  86.             }
  87.         }
  88.         async function fetchAllRatings() {
  89.             const productRatingsElements = document.querySelectorAll('.product-ratings');
  90.             const fetchPromises = [];
  91.             productRatingsElements.forEach(productRatingElement => {
  92.                 const sku = productRatingElement.getAttribute('data-item-sku');
  93.                 if (sku) {
  94.                     fetchPromises.push(fetchRating(sku));
  95.                 }
  96.             });
  97.             const ratings = await Promise.all(fetchPromises);
  98.             productRatingsElements.forEach((productRatingElement, index) => {
  99.                 const { rating, stars } = ratings[index];
  100.                 productRatingElement.innerHTML = `
  101.             <div>
  102.                 <div class="product-stars">${stars}</div>
  103.                 <p style="color:#000;font-size:13px;margin-bottom:0px">${rating}</p>
  104.             </div>
  105.         `;
  106.             });
  107.         }
  108.         window.onload = fetchAllRatings;
  109.     </script>
  110.     <!-- Brevo Conversations {literal} -->
  111.     <script>
  112.         (function(d, w, c) {
  113.             w.BrevoConversationsID = '66755306756cb768ed6aa8bd';
  114.             w[c] = w[c] || function() {
  115.                 (w[c].q = w[c].q || []).push(arguments);
  116.             };
  117.             var s = d.createElement('script');
  118.             s.async = true;
  119.             s.src = 'https://conversations-widget.brevo.com/brevo-conversations.js';
  120.             if (d.head) d.head.appendChild(s);
  121.         })(document, window, 'BrevoConversations');
  122.     </script>
  123.     <!-- /Brevo Conversations {/literal} -->
  124.     #}
  125. {% endblock %}