custom/plugins/DanMuehldorferPlugin/src/Resources/views/storefront/layout/meta.html.twig line 233

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/layout/meta.html.twig' %}
  2. {% block layout_head_inner %}
  3.     {% set metaInformation = page.metaInformation %}
  4.     {% set basicConfig = config('core.basicInformation') %}
  5.     {% set maxLength = config('seo.descriptionMaxLength') %}
  6.     {% set metaDescription = metaInformation.metaDescription|striptags|trim|u.truncate(maxLength ?? 255, '…') %}
  7.     {% set metaTitle = metaInformation.metaTitle|striptags|trim %}
  8.     {% set metaKeywords = metaInformation.metaKeywords|striptags|trim %}
  9.     {# Plugin: CampitRobots START #}
  10.     {% set campitRobotsConfig = config('CampitRobots.config') %}
  11.     {% set enable = campitRobotsConfig.enable %}
  12.     {% set metaTag = campitRobotsConfig.metaTag %}
  13.     {% if(metaTag !== 'shopware_default') %}
  14.         {% set activeRouteStatus = metaTag %}
  15.     {% else %}
  16.         {% set routeMap = {
  17.             'frontend.detail.page': page.product.translated.customFields.campit_robots_meta_tag,
  18.             'frontend.navigation.page': page.header.navigation.active.translated.customFields.campit_robots_meta_tag,
  19.         } %}
  20.         {% set activeRouteStatus = routeMap[activeRoute] ?: 'default' %}
  21.     {% endif %}
  22.     {% set metaRobotsMap = {
  23.         'index_nofollow': 'index, nofollow',
  24.         'noindex_follow': 'noindex, follow',
  25.         'noindex_nofollow': 'noindex, nofollow',
  26.         'shopware_default': page.metaInformation.robots,
  27.         'default': page.metaInformation.robots,
  28.     } %}
  29.     {% set metaRobots = metaRobotsMap[activeRouteStatus] %}
  30.     {# Plugin: CampitRobots END #}
  31.     <head>
  32.         {% block layout_head_meta_tags %}
  33.             {% block layout_head_meta_tags_charset %}
  34.                 <meta charset="utf-8">
  35.             {% endblock %}
  36.             {% block layout_head_title %}
  37.                 <title itemprop="name">{% apply spaceless %}
  38.                         {% block layout_head_title_inner %}
  39.                             {{ metaTitle }}
  40.                         {% endblock %}
  41.                     {% endapply %}</title>
  42.             {% endblock %}
  43.             {% block layout_head_meta_tags_general %}
  44.                 <meta name="description"
  45.                       content="{% block layout_head_meta_tags_description %}{{ metaDescription }}{% endblock %}"/>
  46.                 {#                <meta name="author" #}
  47.                 {#                      content="{% block layout_head_meta_tags_general_author %}{{ metaInformation.author|striptags }}{% endblock %}"/> #}
  48.                 {#                <meta name="robots" #}
  49.                 {#                      content="{% block layout_head_meta_tags_robots %}{{ metaInformation.robots }}{% endblock %}"/> #}
  50.                 {#                <meta name="revisit-after" #}
  51.                 {#                      content="{% block layout_head_meta_tags_general_revisit %}{{ metaInformation.revisit|striptags }}{% endblock %}"/> #}
  52.                 {% if metaKeywords %}
  53.                     <meta name="keywords"
  54.                           content="{% block layout_head_meta_tags_keywords %}{{ metaKeywords }}{% endblock %}"/>
  55.                 {% endif %}
  56.             {% endblock %}
  57.             {% block layout_head_meta_tags_opengraph %}
  58.                 <meta property="og:url"
  59.                       content="{% block layout_head_meta_tags_url_og %}{{ (page.metaInformation.canonical is defined) ? page.metaInformation.canonical : app.request.uri }}{% endblock %}"/>
  60.                 <meta property="og:title"
  61.                       content="{% block layout_head_meta_tags_title_og %}{{ metaTitle }}{% endblock %}"/>
  62.                 <meta property="og:description"
  63.                       content="{% block layout_head_meta_tags_description_og %}{{ metaDescription }}{% endblock %}"/>
  64.                 <meta property="og:image"
  65.                       content="{% block layout_head_meta_tags_image_og %}{{ theme_config('sw-logo-desktop') }}{% endblock %}"/>
  66.                 <meta property="og:type"
  67.                       content="{% block layout_head_meta_tags_type_og %}website{% endblock %}"/>
  68.                 <meta property="og:site_name"
  69.                       content="{% block layout_head_meta_tags_sitename_og %}{{ basicConfig.shopName }}{% endblock %}"/>
  70.                 <meta name="twitter:site"
  71.                       content="{% block layout_head_meta_tags_sitename_twitter %}{{ basicConfig.shopName }}{% endblock %}"/>
  72.                 <meta name="twitter:card"
  73.                       content="{% block layout_head_meta_tags_card_twitter %}summary{% endblock %}"/>
  74.                 <meta name="twitter:title"
  75.                       content="{% block layout_head_meta_tags_title_twitter %}{{ metaTitle }}{% endblock %}"/>
  76.                 <meta name="twitter:description"
  77.                       content="{% block layout_head_meta_tags_description_twitter %}{{ metaDescription }}{% endblock %}"/>
  78.                 <meta name="twitter:image"
  79.                       content="{% block layout_head_meta_tags_image_twitter %}{{ theme_config('sw-logo-desktop') }}{% endblock %}"/>
  80.             {% endblock %}
  81.             {# Product meta is missing #}
  82.             {#            <meta property="product:product_link" content="https://mueldorf.i0378.danubius.de/Premium-Spezial-Daunen-Kopfkissen/PSKK5080"> #}
  83.             {#            <meta property="product:price:amount" content="179"> #}
  84.             {#            <meta property="product:price:currency" content="EUR"> #}
  85.             {% block layout_head_meta_tags_schema_webpage %}
  86.                 <meta itemprop="isFamilyFriendly"
  87.                       content="{% block layout_head_meta_tags_family_friendly %}{% if basicConfig.familyFriendly %}true{% else %}false{% endif %}{% endblock %}"/>
  88.                 <meta itemprop="image"
  89.                       content="{% block layout_head_meta_tags_image_meta %}{{ theme_config('sw-logo-desktop') }}{% endblock %}"/>
  90.                 {#                <meta itemprop="copyrightHolder" #}
  91.                 {#                      content="{% block layout_head_meta_tags_copyright_holder %}{{ basicConfig.shopName }}{% endblock %}"/> #}
  92.                 {#                <meta itemprop="copyrightYear" #}
  93.                 {#                      content="{% block layout_head_meta_tags_copyright_year %}{{ metaInformation.copyrightYear|striptags }}{% endblock %}"/> #}
  94.                 {#                <meta name="robots" content="noindex, nofollow"> #}
  95.             {% endblock %}
  96.             {% block layout_head_meta_tags_viewport %}
  97.                 <meta name="viewport"
  98.                       content="width=device-width, initial-scale=1, shrink-to-fit=no">
  99.             {% endblock %}
  100.             {% if page.product.customFields.dan_product_settings_noindex_nofollow or activeRoute == "frontend.search.page" or app.request.requestUri == "/search" %}
  101.                 <meta name="robots" content="nofollow, noindex" />
  102.             {% else %}
  103.                 <meta name="robots" content="{% block layout_head_meta_tags_robots %}nofollow, noindex{% endblock %}"/>
  104. {#                    <meta name="robots" content="{% block layout_head_meta_tags_robots %}{{ metaInformation.robots }}{% endblock %}"/>#}
  105. {#                <meta name="robots" content="{% block layout_head_meta_tags_robots %}{{ metaRobots }}{% endblock %}"/> #}{# Plugin: CampitRobots #}
  106.             {% endif %}
  107.             {#            {% block layout_head_canonical %} #}
  108.             {#                {% if page.metaInformation.canonical %} #}
  109.             {#                    <link rel="canonical" href="{{ page.metaInformation.canonical }}" /> #}
  110.             {#                {% endif %} #}
  111.             {#            {% endblock %} #}
  112.             {#            {% block layout_head_meta_tags_hreflangs %} #}
  113.             {#                {% for link in hrefLang %} #}
  114.             {#                    <link rel="alternate" hreflang="{{ link.locale }}" href="{{ link.url }}" /> #}
  115.             {#                {% endfor %} #}
  116.             {#            {% endblock %} #}
  117.             {% block layout_head_meta_tags_hreflangs %}
  118.                 {#    {% for link in hrefLang %} #}
  119.                 {#        {% set isoCode = link.locale|lower|split('-') %} #}
  120.                 {#        #}{# @deprecated tag:v6.5.0 - Remove else cases, to maintain correct split of isoCode #}
  121.                 {#        {% set flagLanguage = feature('v6.5.0.0') ? isoCode[0] : isoCode[1] %} #}
  122.                 {#        {% set flagCountry = feature('v6.5.0.0') ? isoCode[1] : isoCode[0] %} #}
  123.                 {#        {% set domain = app.request.get('sw-sales-channel-absolute-base-url') %} #}
  124.                 {#        {% set lang_url = link.url|replace({(domain): ''}) %} #}
  125.                 {#        {% if lang_url starts with "/de" %} #}
  126.                 {#            {% set lang_url = lang_url[3:] %} #}
  127.                 {#            {% if lang_url is empty %} #}
  128.                 {#                {% set lang_url = "/" %} #}
  129.                 {#            {% endif %} #}
  130.                 {#        {% endif %} #}
  131.                 {#        <link rel="alternate" hreflang="{{ flagLanguage }}" href="{{ lang_url }}"/> #}
  132.                 {#    {% endfor %} #}
  133.                 {% for dan_language in page.header.extensions.dan_languages.getVars() %}
  134.                     {% if dan_language.language_id is same as(page.header.activeLanguage.id) %}
  135.                         <link rel="canonical" href="{{ dan_language.url }}"/>
  136.                     {% endif %}
  137.                 {% endfor %}
  138.                 {% for dan_language in page.header.extensions.dan_languages.getVars() %}
  139.                     {% set isoCode = dan_language.language_code|lower|split('-') %}
  140.                     {# @deprecated tag:v6.5.0 - Remove else cases, to maintain correct split of isoCode #}
  141.                     {% set flagLanguage = feature('v6.5.0.0') ? isoCode[0] : isoCode[1] %}
  142.                     {% set flagCountry = feature('v6.5.0.0') ? isoCode[1] : isoCode[0] %}
  143.                     <link rel="alternate" hreflang="{{ flagCountry }}" href="{{ dan_language.url }}"/>
  144.                 {% endfor %}
  145.             {% endblock %}
  146.         {% endblock %}
  147.         {% block layout_head_android %}
  148.             {# @deprecated tag:v6.5.0 - Use the block above, "layout_head_apple", instead #}
  149.         {% endblock %}
  150.         {#        <link rel="preload" as="style" href="/theme/95435b5a8e98befe2c222480c1de3fee/css/all.css?1728371804445627"> #}
  151.         <link href="/bundles/emzplatformrubytheme/font/Inter-Regular.woff2" rel="preload" as="font" type="font/woff">
  152.         <link href="/bundles/emzplatformrubytheme/font/Inter-SemiBold.woff2" rel="preload" as="font" type="font/woff2">
  153.         <link href="/bundles/emzplatformrubytheme/font/Inter-Bold.woff2" rel="preload" as="font" type="font/woff">
  154.         {% block layout_head_stylesheet %}
  155.             {% if isHMRMode %}
  156.                 {# CSS will be loaded from the JS automatically #}
  157.             {% else %}
  158.                 {% set assets = theme_config('assets.css') %}
  159.                 {% for file in assets %}
  160.                     <link rel="preload" as="style" href="{{ asset(file, 'theme') }}">
  161.                     <link rel="stylesheet" href="{{ asset(file, 'theme') }}">
  162.                 {% endfor %}
  163.             {% endif %}
  164.         {% endblock %}
  165.         {% block layout_head_apple %}
  166.             {#            {% if theme_config('sw-logo-share') %} #}
  167.             {#                <link rel="apple-touch-icon" #}
  168.             {#                      sizes="180x180" #}
  169.             {#                      href="{{ theme_config('sw-logo-share') }}"> #}
  170.             {#            {% endif %} #}
  171.         {% endblock %}
  172.         {#        {% block layout_head_favicon %} #}
  173.         {#            <link rel="shortcut icon" #}
  174.         {#                  href="{{ theme_config('sw-logo-favicon') }}"> #}
  175.         {#        {% endblock %} #}
  176.         {% block layout_head_favicon %}
  177.             {#            <link rel="icon" href="{{ theme_config('sw-logo-favicon') }}"> #}
  178.             <link rel="icon" sizes="16x16" href="/favicon-16x16.png" type="image/png">
  179.             <link rel="icon" sizes="32x32" href="/favicon.ico" type="image/x-icon">
  180.             <link rel="icon" sizes="32x32" href="/favicon-32x32.png" type="image/png">
  181.             <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png" type="image/png">
  182.             <link rel="apple-touch-icon" sizes="152x152" href="/ipad-152x152.png" type="image/png">
  183.             <link rel="apple-touch-icon" sizes="167x167" href="/ipad-retina-167x167.png" type="image/png">
  184.             <link rel="apple-touch-icon" sizes="180x180" href="/iphone-retina-180x180.png" type="image/png">
  185.             <link rel="icon" sizes="192x192" href="/favicon-192x192.png" type="image/png">
  186.             <link rel="icon" href="/favicon.svg" type="image/svg+xml">
  187.         {% endblock %}
  188.         {% block layout_head_javascript_feature %}
  189.             {% sw_include "@Storefront/storefront/component/feature.html.twig" %}
  190.         {% endblock %}
  191.         {# Block for tracking scripts which are required to include in the `head` section of the document #}
  192.         {% block layout_head_javascript_tracking %}
  193.             {% sw_include "@Storefront/storefront/component/analytics.html.twig" %}
  194.             {% block campit_matomo_layout_head_javascript_tracking %}
  195. {#                {% sw_include '@Storefront/storefront/component/campit-matomo-data.html.twig' %}#}
  196.             {% endblock %}
  197.         {% endblock %}
  198.         {% block layout_head_javascript_recaptcha %}
  199.             {% sw_include "@Storefront/storefront/component/recaptcha.html.twig" %}
  200.         {% endblock %}
  201.         {% block layout_head_javascript_token %}
  202.         {% endblock %}
  203.         {% if config('core.basicInformation.useDefaultCookieConsent') %}
  204.             {% block layout_head_javascript_cookie_state %}
  205.                 <script>
  206.                     window.useDefaultCookieConsent = true;
  207.                 </script>
  208.             {% endblock %}
  209.         {% endif %}
  210.         {% if feature('FEATURE_NEXT_15917') %}
  211.             {% block layout_head_javascript_router %}
  212.             {# Register all routes that will be needed in JavaScript to the window.router object #}
  213.             <script>
  214.                 window.activeNavigationId = '{{ page.header.navigation.active.id }}';
  215.                 window.router = {
  216.                     'frontend.cart.offcanvas': '{{ path('frontend.cart.offcanvas') }}',
  217.                     'frontend.cookie.offcanvas': '{{ path('frontend.cookie.offcanvas') }}',
  218.                     'frontend.checkout.finish.page': '{{ path('frontend.checkout.finish.page') }}',
  219.                     'frontend.checkout.info': '{{ path('frontend.checkout.info') }}',
  220.                     'frontend.menu.offcanvas': '{{ path('frontend.menu.offcanvas') }}',
  221.                     'frontend.cms.page': '{{ path('frontend.cms.page') }}',
  222.                     'frontend.cms.navigation.page': '{{ path('frontend.cms.navigation.page') }}',
  223.                     'frontend.account.addressbook': '{{ path('frontend.account.addressbook') }}',
  224.                     {# @deprecated tag:v6.5.0 - Route frontend.csrf.generateToken will be removed. #}
  225.                     'frontend.csrf.generateToken': '{{ path('frontend.csrf.generateToken') }}',
  226.                     'frontend.country.country-data': '{{ path('frontend.country.country.data') }}',
  227.                     'frontend.store-api.proxy': '{{ path('frontend.store-api.proxy') }}',
  228.                 };
  229.                 {# @deprecated tag:v6.5.0 - storeApiProxyToken will be removed. #}
  230.                 window.storeApiProxyToken = '{{ sw_csrf("frontend.store-api.proxy", {"mode": "token"}) }}';
  231.                 window.salesChannelId = '{{ app.request.attributes.get('sw-sales-channel-id') }}';
  232.             </script>
  233.             {% endblock %}
  234.             {% block layout_head_javascript_breakpoints %}
  235.             {# Register the available viewport breakpoints the window.breakpoints object #}
  236.             <script>
  237.                 {% set breakpoint = {
  238.                     'xs': theme_config('breakpoint.xs'),
  239.                     'sm': theme_config('breakpoint.sm'),
  240.                     'md': theme_config('breakpoint.md'),
  241.                     'lg': theme_config('breakpoint.lg'),
  242.                     'xl': theme_config('breakpoint.xl')
  243.                 } %}
  244.                 window.breakpoints = {{ breakpoint|json_encode()|raw }};
  245.             </script>
  246.             {% endblock %}
  247.             {# @deprecated tag:v6.5.0 - Block layout_head_javascript_csrf will be removed. #}
  248.             {% block layout_head_javascript_csrf %}
  249.             <script>
  250.                 window.csrf = {
  251.                     'enabled': '{{ shopware.csrfEnabled }}',
  252.                     'mode': '{{ shopware.csrfMode }}'
  253.                 }
  254.             </script>
  255.             {% endblock %}
  256.             {% if config('core.cart.wishlistEnabled') %}
  257.             {% block layout_head_javascript_wishlist_state %}
  258.             <script>
  259.                 window.customerLoggedInState = {{ context.customer is not null and not context.customer.guest ? 1 : 0 }};
  260.                 window.wishlistEnabled = {{ config('core.cart.wishlistEnabled') }};
  261.             </script>
  262.             {% endblock %}
  263.             {% endif %}
  264.             {# @internal tag:v6.5.0 - jQuery will be removed from the core. This block can be used to add jQuery as a `<script>`. #}
  265.             {% block layout_head_javascript_jquery %}
  266.             {% endblock %}
  267.             {% block layout_head_javascript_hmr_mode %}
  268.                 {% if isHMRMode %}
  269.                     <script type="text/javascript" src="/_webpack_hot_proxy_/js/vendor-node.js" defer></script>
  270.                     <script type="text/javascript" src="/_webpack_hot_proxy_/js/runtime.js" defer></script>
  271.                     <script type="text/javascript" src="/_webpack_hot_proxy_/js/vendor-shared.js" defer></script>
  272.                     <script type="text/javascript" src="/_webpack_hot_proxy_/js/app.js" defer></script>
  273.                 {# The storefront entry is a combined entry point which contains all plugins & themes #}
  274.                 <script type="text/javascript" src="/_webpack_hot_proxy_/js/storefront.js" defer></script>
  275.                 {% else %}
  276.                     {% for file in theme_config('assets.js') %}
  277.                         <link rel="preload" href="{{ asset(file, 'theme') }}" as="script">
  278.                         <script type="text/javascript" src="{{ asset(file, 'theme') }}" defer></script>
  279.                     {% endfor %}
  280.                 {% endif %}
  281.             {% endblock %}
  282.         {% endif %}
  283.         <link rel="preload" href="{{ asset("/js/all.js", 'theme') }}" as="script" >
  284.         <script type="text/javascript">
  285.             document.addEventListener('DOMContentLoaded', function () {
  286.                 console.log("DanMuehldorferPlugin loaded")
  287.                 const customUserGroup = document.querySelector('select[name="CustomUserGroup"]');
  288.                 const billingAddress = document.querySelector('select[name="billingAddress[countryId]"]');
  289.                 const shippingAddress = document.querySelector('select[name="shippingAddress[countryId]"]');
  290.                 const webseiteLabel = document.querySelector('label[for="Webseite_0e809d5f2c5c49e9a1431a97dfc04749"]');
  291.                 const webseiteInput = document.getElementById('Webseite_0e809d5f2c5c49e9a1431a97dfc04749');
  292.                 const vatLabel = document.querySelector('label[for="Umsatzsteuer-ID_4d44617639334e46b943e3424ce9a1d1"]');
  293.                 const vatInput = document.getElementById('Umsatzsteuer-ID_4d44617639334e46b943e3424ce9a1d1');
  294.                 const allowedValues = ["69ba8ffad7094019a360d5e90f7705fe", "5d1a4b2db37e483fb6180b0fc44b8dcb"];
  295.                 function updateFields() {
  296.                     const selectedOption = customUserGroup.value;
  297.                     const containsHotel = selectedOption.includes("Hotel");
  298.                     if (containsHotel) {
  299.                         // Disable/hide options except allowedValues
  300.                         [billingAddress, shippingAddress].forEach(select => {
  301.                             Array.from(select.options).forEach(option => {
  302.                                 if (!allowedValues.includes(option.value)) {
  303.                                     option.disabled = true;
  304.                                     option.style.display = 'none';
  305.                                 } else {
  306.                                     option.disabled = false;
  307.                                     option.style.display = '';
  308.                                 }
  309.                             });
  310.                             // Select the first enabled option
  311.                             select.value = Array.from(select.options).find(option => !option.disabled)?.value || '';
  312.                         });
  313.                         // Show the label and input for Webseite
  314.                         if (webseiteLabel) webseiteLabel.style.display = '';
  315.                         if (webseiteInput) webseiteInput.style.display = '';
  316.                         if (vatLabel) vatLabel.style.display = '';
  317.                         if (vatInput) vatInput.style.display = '';
  318.                     } else {
  319.                         // Enable/show all options
  320.                         [billingAddress, shippingAddress].forEach(select => {
  321.                             Array.from(select.options).forEach(option => {
  322.                                 option.disabled = false;
  323.                                 option.style.display = '';
  324.                             });
  325.                             // Select the first enabled option
  326.                             select.value = Array.from(select.options).find(option => !option.disabled)?.value || '';
  327.                         });
  328.                         // Hide the label and input for Webseite and set input value to "n.a."
  329.                         if (webseiteLabel) webseiteLabel.style.display = 'none';
  330.                         if (webseiteInput) {
  331.                             webseiteInput.style.display = 'none';
  332.                             webseiteInput.value = 'n.a.';
  333.                         }
  334.                         // Hide the label and input for Webseite and set input value to "n.a."
  335.                         if (vatLabel) vatLabel.style.display = 'none';
  336.                         if (vatInput) {
  337.                             vatInput.style.display = 'none';
  338.                             vatInput.value = 'n.a.';
  339.                         }
  340.                     }
  341.                 }
  342.                 // Attach change event to CustomUserGroup
  343.                 if (customUserGroup) {
  344.                     customUserGroup.addEventListener('change', updateFields);
  345.                 }
  346.             });
  347.         </script>
  348.     </head>
  349. {% endblock %}