custom/plugins/XioniXconfig/src/Resources/views/storefront/page/product-detail/buy-widget.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/page/product-detail/buy-widget.html.twig' %}
  2. {% block page_product_detail_buy_form %}
  3. {% endblock %}
  4. {% block page_product_detail_price %}
  5. {% set has_config = page.extensions.is_xconfig.has_configuration %}
  6. {% sw_include '@XioniXconfig/storefront/page/product-detail/x_breadcrumb.html.twig' with { context: context, category: page.product.seoCategory } only %}
  7.     <div class="x-product-detail-tabs">
  8.         <div class="x-product-detail-tab tab-price">
  9.             <button class="tab-button tab-active" type="button" value="price">Preis</button>
  10.         </div>
  11.         <div class="x-product-detail-tab tab-info">
  12.             <button class="tab-button" type="button" value="info">Kontakt</button>
  13.         </div>
  14.         <div class="x-product-detail-tab tab-manufacturer">
  15.             <button class="tab-button" type="button" value="manufacturer">Mengen %</button>
  16.         </div>
  17.     </div>
  18.     <div class="product-detail-tab-content" id="tab-price">
  19.         <div class="product-detail-price-container">
  20.             {% if page.product.productNumber %}
  21.                 <div class="product-detail-ordernumber-container">
  22.                     {% block page_product_detail_ordernumber_label %}
  23.                         <span class="product-detail-ordernumber-label">
  24.                             {{ "detail.productNumberLabel"|trans|sw_sanitize }}
  25.                         </span>
  26.                     {% endblock %}
  27.                     {% block page_product_detail_ordernumber %}
  28.                         <meta itemprop="productID"
  29.                               content="{{ page.product.id }}"/>
  30.                         <span class="product-detail-ordernumber"
  31.                               itemprop="sku">
  32.                             {{ page.product.productNumber }}
  33.                         </span>
  34.                     {% endblock %}
  35.                 </div>
  36.             {% endif %}    
  37.             <h1 class="x-product-atricle-name">{{ page.product.translated.name }}</h1>
  38.             <div class="netto-container">
  39.                 <div class="price-detail-netto-headline">Netto</div>
  40.                 {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-price.html.twig' %}
  41.             </div>
  42.             <div class="brutto-container">
  43.                 <div class="price-detail-brutto-headline">Brutto</div>
  44.                 {% set brutto_price = page.product.calculatedPrice.unitPrice*1.19 %}
  45.                 <div class="product-detail-price-brutto">
  46.                     <span class="brutto-price-number">{{ brutto_price|currency }}</span> inkl. MwSt. inkl. Versandkosten
  47.                 </div>
  48.             </div>
  49.             <div class="product-detail-tax-container">
  50.                 {% if context.taxState == "gross" %}
  51.                     {% set taxText = "general.grossTaxInformation"|trans|sw_sanitize %}
  52.                 {% else %}
  53.                     {% set taxText = "general.netTaxInformation"|trans|sw_sanitize %}
  54.                 {% endif %}
  55.                 <p class="product-detail-tax">
  56.                     {% block page_product_detail_tax_link %}
  57.                         <a class="product-detail-tax-link"
  58.                            href="{{ path('frontend.cms.page',{ id: config('core.basicInformation.shippingPaymentInfoPage') }) }}"
  59.                            title="{{ taxText }}"
  60.                            data-toggle="modal"
  61.                            data-url="{{ path('frontend.cms.page',{ id: config('core.basicInformation.shippingPaymentInfoPage') }) }}">
  62.                             {{ taxText }}
  63.                         </a>
  64.                     {% endblock %}
  65.                 </p>
  66.             </div>
  67.             <div class="product-detail-delivery-information">
  68.                 {% sw_include '@Storefront/storefront/component/delivery-information.html.twig' %} <p>Lieferzeit</p>
  69.             </div>
  70.             {% if page.product.productNumber == "parking3000" %}
  71.                 <p class="product-detail-start-add-hint"><span style="font-weight: bold">Hinweis:</span><br> Für die elektrischen Schranken empfehlen wir eine persönliche Beratung durch unsere Experten! 
  72.                 Sie sind Ihnen ebenso behilflich bei der Auswahl von Zubehör. Kontaktieren Sie uns direkt unter +49 (0) 2373 17809-0 oder per <a target="_blank" href="https://poller24.de/Shop-Service/Kontakt/">Kontaktformular</a>. 
  73.                 Gern können Sie auch erste Fragen im Konfigurator beantworten und uns Ihre Anfrage senden.</p>
  74.                 <span id="xconfig_start_description" style="font-weight: bold"></span>                
  75.             {% endif %}                 
  76.         </div>
  77.         {% if has_config %}
  78.         <div id="xconfig">
  79.             <div id="xconfig_body">
  80.             </div>
  81.             <div id="xconfig_footer">
  82.             </div>
  83.         </div>
  84.         {% endif %}
  85.         <div class="xconfig_end_block">
  86.             {% if has_config %}
  87.             <div class="x-chosen-article-box">
  88.                 <div class="table-detail-headline">Ausgewählte Produktvariante</div>
  89.                 <div class="x-chosen-article">
  90.                 Ausführung:
  91.                 <span class="xconfig_description"></span>
  92.                 </div>
  93.             </div>
  94. <!--             <div class="xprice_block">
  95.                 <div class="x-chosen-article-box">
  96.                     <div class="table-detail-headline">Übersicht</div>
  97.                     <div class="x-chosen-article">
  98.                     Ausführung:
  99.                     <span class="xconfig_description"></span>
  100.                     </div>
  101.                 </div> 
  102.             </div> -->
  103.             {% endif %}
  104.             <div class="col-14 x-buy-field" {% if not has_config %} style="position:inherit!important" {% endif %}>
  105.                 <div class="col-4 x-select" style="margin-right:0px!important">
  106.                     <select class="custom-select">
  107.                     {% for quantity in range(page.product.minPurchase, page.product.calculatedMaxPurchase, page.product.purchaseSteps) %}
  108.                         <option value="{{ quantity }}">
  109.                             {{ quantity }}
  110.                             {% if quantity == 1 %}
  111.                                 {% if page.product.translated.packUnit %} {{ page.product.translated.packUnit }}{% endif %}
  112.                             {% else %}
  113.                                 {% if page.product.translated.packUnitPlural %}
  114.                                     {{ page.product.translated.packUnitPlural }}
  115.                                 {% elseif page.product.translated.packUnit %}
  116.                                     {{ page.product.translated.packUnit }}
  117.                                 {% endif %}
  118.                             {% endif %}
  119.                         </option>
  120.                     {% endfor %}
  121.                     </select>  
  122.                 </div>
  123.             <div class="col-8 x-buttons">
  124.                     <button id="cart_primary" form="productDetailPageBuyProductForm" class="btn btn-primary btn-block btn-buy"
  125.                             title="{{ "detail.addProduct"|trans|striptags }}"
  126.                             aria-label="{{ "detail.addProduct"|trans|striptags }}">
  127.                         {{ "detail.addProduct"|trans|sw_sanitize }}
  128.                     </button>
  129.                     <a href="mailto:m.wette@pse-technik.de?subject=Anfrage für {{ page.product.translated.name }}&body=Ihr Firmenname: %0D%0A %0D%0A Ihr Vor- und Nachname: %0D%0A %0D%0A Ihre Telefonnummer: %0D%0A %0D%0A Ihre Nachricht: %0D%0A" id="detail-config-request" class="btn btn-primary btn-block btn-buy">
  130.                         Produkt anfragen {% sw_icon "envelope" %}</a>
  131.                     </a>
  132.             </div>   
  133.                 <div class="x-calc-table">
  134.                       <div class="x-calc-table-firstrow">
  135.                         <div class="x-calc-table-row1">Artikel</div>
  136.                         <div class="x-calc-table-row2">Menge</div>
  137.                         <div class="x-calc-table-row3">Preis</div>
  138.                         <div class="x-calc-table-row4"></div>
  139.                       </div>
  140.                       <div class="x-calc-table-secondrow lchline">
  141.                         <div class="x-calc-table-row1">{{ page.product.translated.name }}</div>
  142.                         <div id="x-main-article-qty" class="x-calc-table-row2">1</div>
  143.                         <div id="x-main-article-price" class="x-calc-table-row3">{{ page.product.calculatedPrice.unitPrice|currency }}*</div>
  144.                       </div>
  145.                 </div> 
  146.                 <div class="xprice-netto-row">
  147.                     <div class="price-detail-netto-headline-table">Gesamtpreis Netto</div>
  148.                     <div class="x-full-price">{{ page.product.calculatedPrice.unitPrice|currency }}*</div>
  149.                 </div>
  150.                 <div class="xprice-brutto-row">
  151.                     <div class="price-detail-brutto-headline-table">Gesamtpreis Brutto</div>
  152.                     <div class="x-full-price-brutto">{{ brutto_price|currency }}</div>
  153.                 </div>
  154.                 <div class="product-detail-tax-container-table">
  155.                     {% if context.taxState == "gross" %}
  156.                         {% set taxText = "general.grossTaxInformation"|trans|sw_sanitize %}
  157.                     {% else %}
  158.                         {% set taxText = "general.netTaxInformation"|trans|sw_sanitize %}
  159.                     {% endif %}
  160.                     <p class="product-detail-tax">
  161.                         <a class="product-detail-tax-link"
  162.                            href="{{ path('frontend.cms.page',{ id: config('core.basicInformation.shippingPaymentInfoPage') }) }}"
  163.                            title="{{ taxText }}"
  164.                            data-toggle="modal"
  165.                            data-url="{{ path('frontend.cms.page',{ id: config('core.basicInformation.shippingPaymentInfoPage') }) }}">
  166.                             {{ taxText }}
  167.                         </a>
  168.                     </p>
  169.                 </div>
  170.             </div>
  171.         {% if page.product.active %}
  172.             <div class="product-detail-form-container">
  173.                 {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' %}
  174.             </div>
  175.             <div class="product-detail-accessory-form-container">
  176.                 {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-form-accessory.html.twig' %}
  177.             </div>    
  178.         {% endif %}
  179.         </div> 
  180.     </div>    
  181.     <div class="product-detail-tab-content" id="tab-info">
  182.         <p class="tab-info-headline">Ihre Ansprechpartner</p>
  183.         {% if page.product.productNumber == "parking" || page.product.productNumber == "industrial" ||
  184.         page.product.productNumber == "koloss" || page.product.productNumber == "solar" || page.product.productNumber == "parking3000" %}
  185.         <div class="tab-info-personcard">
  186.             <div class="tab-info-personcard-image">
  187.                 <img class="personcard-image" alt="Dubravka Bukna - Service, Wartung und Reparatur Bereich Absperrtechnik" src="/media/c9/6a/6e/1677056857/dubravka_bukna.jpg" alt="Frau Bukna" title="Frau Bukna">
  188.             </div>
  189.             <div class="tab-info-personcard-description">
  190.                 <p class="tab-info-personcard-description-name">Dubravka Bukna</p>
  191.                 <p class="tab-info-personcard-description-title">Ansprechpartner Absperrtechnik</p>
  192.                 <p class="tab-info-personcard-description-phone"><a title="+49 (0) 2373 17809-15" href="tel:+4923731780915">+49 (0) 2373 17809-15<br></a></p>
  193.                 <p class="tab-info-personcard-description-mail"><a title="E-Mail-Adresse Dubravka Bukna" href="mailto:d.bukna@pse-technik.de" target="_blank">d.bukna@pse-technik.de</a></p>
  194.             </div>
  195.         </div>
  196.         <div class="tab-info-personcard">
  197.             <div class="tab-info-personcard-image">
  198.                 <img class="personcard-image" alt="Sebastian Toth - Bereich Absperrtechnik/Zutrittskontrolle" src="/media/90/ef/af/1677056857/sebastian_toth.jpg" alt="Herr Toth" title="Herr Toth">
  199.             </div>
  200.             <div class="tab-info-personcard-description">
  201.                 <p class="tab-info-personcard-description-name">Sebastian Toth</p>
  202.                 <p class="tab-info-personcard-description-title">Ansprechpartner Absperrtechnik/Zutrittskontrolle</p>
  203.                 <p class="tab-info-personcard-description-phone"><a title="+49 (0) 2373 17809-10" href="tel:+4923731780910">+49 (0) 2373 17809-10<br></a></p>
  204.                 <p class="tab-info-personcard-description-mail"><a title="E-Mail-Adresse Sebastian Toth" href="mailto:s.toth@pse-technik.de" target="_blank">s.toth@pse-technik.de</a></p>
  205.             </div>
  206.         </div>        
  207.         {% else %}
  208.         <div class="tab-info-personcard">
  209.             <div class="tab-info-personcard-image">
  210.                 <img class="personcard-image" alt="Marion Wette - Produktmanagerin" src="/media/5f/67/80/1647334115/frau_wette.jpg" alt="Frau Wette" title="Frau Wette">
  211.             </div>
  212.             <div class="tab-info-personcard-description">
  213.                 <p class="tab-info-personcard-description-name">Marion Wette</p>
  214.                 <p class="tab-info-personcard-description-title">Produktmanagerin</p>
  215.                 <p class="tab-info-personcard-description-phone"><a title="+49 (0) 2373 17809-11" href="tel:+4923731780911">+49 (0) 2373 17809-11<br></a></p>
  216.                 <p class="tab-info-personcard-description-mail"><a title="E-Mail-Adresse Marion Wette" href="mailto:m.wette@pse-technik.de" target="_blank">m.wette@pse-technik.de</a></p>
  217.             </div>
  218.         </div>
  219.         <div class="tab-info-personcard">
  220.             <div class="tab-info-personcard-image">
  221.                 <img class="personcard-image" alt="Christian Preuß - Produktmanager" src="/media/f9/f0/29/1647334352/herr_preuss.jpg" alt="Herr Preuß" title="Herr Preuß">
  222.             </div>
  223.             <div class="tab-info-personcard-description">
  224.                 <p class="tab-info-personcard-description-name">Christian Preuß</p>
  225.                 <p class="tab-info-personcard-description-title">Produktmanager</p>
  226.                 <p class="tab-info-personcard-description-phone"><a title="+49 (0) 2373 17809-0" href="tel:+492373178090">+49 (0) 2373 17809-0
  227.                 </a></p>
  228.                 <p class="tab-info-personcard-description-mail"><a title="E-Mail-Adresse Christian Preuß" href="mailto:c.preuss@pse-technik.de" target="_blank">c.preuss@pse-technik.de</a><a title="+49 (0) 2373 17809-0" href="tel:+492373178090"></a></p>
  229.             </div>
  230.         </div>
  231.         {% endif %}
  232.         <div class="tab-info-personcard">
  233.             <div class="tab-info-personcard-image">
  234.                 <img class="personcard-image" alt="Florian Thier (Leiter Vetriebsinnendienst)" src="/media/cb/50/82/1647334507/herr_thier.jpg" alt="Herr Thier" title="Herr Thier">
  235.             </div>
  236.             <div class="tab-info-personcard-description">
  237.                 <p class="tab-info-personcard-description-name">Florian Thier</p>
  238.                 <p class="tab-info-personcard-description-title">Leiter Vetriebsinnendienst</p><p class="tab-info-personcard-description-phone"><a title="+49 (0) 2373 17809-0" href="tel:+492373178090">+49 (0) 2373 17809-0</a></p>
  239.                 <p class="tab-info-personcard-description-mail"><a title="E-Mail-Adresse Florian Thier" href="mailto:f.thier@pse-technik.de">f.thier@pse-technik.de</a><a title="+49 (0) 2373 17809-0" href="tel:+492373178090"></a></p>
  240.             </div>
  241.         </div>
  242.     </div>
  243.     
  244.     <div class="product-detail-tab-content" id="tab-manufacturer">
  245.         <p class="tab-info-headline">Fragen Sie unverbindlich die aktuellen Staffelpreise und Mengenrabatte für diesen Artikel an.</p>
  246.         <p></p>
  247.         <div class="discount-button-container">
  248.             <a href="mailto:m.wette@pse-technik.de?subject=Anfrage%20Mengenrabatt%20/%20Staffelpreise%20für%20Artikel%20{{ page.product.translated.name }} &amp;body=Guten%20Tag,%0D%0A%0D%0AAnfrage%20zu%20Artikel%20{{ page.product.translated.name }}.%0D%0A%0D%0AGewünschte%20Menge:">
  249.                 <button class="btn btn-primary btn-block btn-discount">E-Mail Anfrage stellen</button> 
  250.             </a>
  251.         </div>
  252.     </div>
  253.     {% if page.product.productNumber == "SchrankeS" || page.product.productNumber == "parking" || page.product.productNumber == "industrial" ||
  254.      page.product.productNumber == "koloss" || page.product.productNumber == "solar" %}
  255.     <script>
  256.         $("#cart_primary").hide();
  257.         $(".x-calc-table").hide();
  258.         $(".xprice-netto-row").hide();
  259.         $(".xprice-brutto-row").hide();
  260.         $(".x-select").hide();
  261.         $(".product-detail-tax-container-table").hide();
  262.         $(".netto-container").html('<meta itemprop="price" content="0"><p class="product-detail-price">Preis auf Anfrage</p><p>Wir erstellen Ihnen gern ein Angebot. Einfach konfigurieren und Produktberatung anfragen! Weitere Details klären wir in einem persönlichen Gespräch.</p>');
  263.         $(".netto-container").css({"float": "inherit", "width": "100%"});
  264.         //$(".netto-container").hide();
  265.         $(".brutto-container").hide();
  266.         $(".product-detail-delivery-information").hide();
  267.         $(".product-detail-tax-container").hide();
  268.         $(".xconfig_start_block").hide();
  269.         $(".x-chosen-article-box").hide();
  270.         $(".product-detail-ordernumber-container").hide();
  271.         $(".manufacturer-website").hide();
  272.         $("#detail-config-request").attr('href', 'mailto:d.bukna@pse-technik.de?subject=Anfrage für {{ page.product.translated.name }}&body=Ihr Firmenname: %0D%0A %0D%0A Ihr Vor- und Nachname: %0D%0A %0D%0A Ihre Telefonnummer: %0D%0A %0D%0A Ihre Nachricht: %0D%0A');
  273.         $( document ).ready(function() {
  274.             $("#x-order-tab").hide();
  275.         });
  276.     </script>
  277.     {% endif %}
  278.     {% if page.product.productNumber == "parking3000" %}
  279.     <script>
  280.         $("#detail-config-request").attr('href', 'mailto:d.bukna@pse-technik.de?subject=Anfrage für {{ page.product.translated.name }}&body=Ihr Firmenname: %0D%0A %0D%0A Ihr Vor- und Nachname: %0D%0A %0D%0A Ihre Telefonnummer: %0D%0A %0D%0A Ihre Nachricht: %0D%0A');
  281.         $(".manufacturer-website").hide();
  282.         $(".xconfig_start_block").hide();
  283.         $(".x-chosen-article-box").hide();
  284.     </script>
  285.     {% endif %}    
  286.     <script>
  287.     var groupIds     = new Array();
  288.     var groupValues    = new Array();
  289.     var start_variant = getSearchParams("xconfig");
  290.     var preconf = getSearchParams("preconf");
  291.     var num            = 0;    
  292.     var original_price = $(".product-detail-price").html();
  293.     var brutto_price = $(".product-detail-price-brutto").html();
  294.     var productnumber = "{{ page.product.productNumber }}";
  295.     var currency = "{{ context.currency.isoCode }}";                                                
  296.     var main_price = 0;
  297.     {% if not has_config %}
  298.     main_price = {{ page.product.calculatedPrice.unitPrice }};
  299.     {% endif %}
  300.     $( ".tab-button" ).click(function() {
  301.         var tab = $(this).attr("value");
  302.         $( ".tab-button" ).removeClass("tab-active");
  303.         $(this).addClass("tab-active");
  304.         $( ".product-detail-tab-content" ).css("display", "none");
  305.         $( "#tab-"+tab ).css("display", "block");
  306.         if (tab != "price") {
  307.             $( ".product-detail-form-container" ).hide();
  308.         } else {
  309.             $( ".product-detail-form-container" ).show();
  310.         }
  311.     });
  312.     
  313.     $( document ).ready(function() {
  314.         $.getScript("https://xconfig003.com/mvc_structure2/assets/js/jquery-ui.js", function() { 
  315.             getConfiguration(0, productnumber, groupIds, groupValues, start_variant);             
  316.         }); 
  317.         
  318.         $(".x-accessory-container:first .x-accessory-bottom-container").show(); 
  319.         $(".x-accessory-top-header-container").click(function () {
  320.             $(this).next(".x-accessory-bottom-container").slideToggle("slow");
  321.             $(".x-accessory-bottom-container").not($(this).next()).slideUp("slow");
  322.         }); 
  323.         
  324.          
  325.         $(".x-tab-accessory-top-header-container").click(function () {
  326.                 $(this).next(".x-tab-accessory-bottom-container").slideToggle("slow");
  327.             $(".x-tab-accessory-bottom-container").not($(this).next()).slideUp("slow");
  328.         }); 
  329.     });
  330.     
  331.     function getConfiguration(id, productnumber, option_ids, value_ids, start_variant) {
  332.         $.ajax({
  333.             url:"https://xconfig003.com/mvc_structure2/get_configuration_poller_new_config_DEV.php",
  334.             type:'POST',
  335.             dataType: 'json',
  336.             data: { id: id, productnumber: productnumber, option_ids: option_ids, value_ids: value_ids , start_variant: start_variant},
  337.             success: function(data){
  338.                 var main_tpl = decodeURIComponent(escape(window.atob(data.config_main_tpl)));
  339.                 var footer_tpl = decodeURIComponent(escape(window.atob(data.config_footer_tpl)));
  340.                 $('#xconfig_body').html(main_tpl);
  341.                 $('#xconfig_footer').html(footer_tpl);
  342.                 $('#xconfigDesc').val(data.config_description);
  343.                 var buy_btn = $('.btn-buy');
  344.                 var text = data.config_description;
  345.                 //text = text.replace("$$", "");
  346.                 //var newchar = ", %0D%0A";
  347.                 //text = text.split("$$").join(newchar);
  348.                 text = text.replaceAll(",", ", %0D%0A");
  349.                 if (text != "") {
  350.                     if (productnumber == "SchrankeS" || productnumber == "parking" || productnumber == "industrial" ||
  351.                         productnumber == "koloss" || productnumber == "solar" || productnumber == "parking3000") {
  352.                         $("#detail-config-request").attr('href',"mailto:d.bukna@pse-technik.de?subject=Anfrage für {{ page.product.translated.name }}&body=Ihr Firmenname: %0D%0A %0D%0A Ihr Vor- und Nachname: %0D%0A %0D%0A Ihre Telefonnummer: %0D%0A %0D%0A Ihre Konfiguration: %0D%0A"+ text + "%0D%0A Ihre Nachricht: %0D%0A");
  353.                     } else {
  354.                         $("#detail-config-request").attr('href',"mailto:m.wette@pse-technik.de?subject=Anfrage für {{ page.product.translated.name }}&body=Ihr Firmenname: %0D%0A %0D%0A Ihr Vor- und Nachname: %0D%0A %0D%0A Ihre Telefonnummer: %0D%0A %0D%0A Ihre Konfiguration: %0D%0A"+ text + "%0D%0A Ihre Nachricht: %0D%0A");
  355.                     }
  356.                     if (productnumber == "parking3000") {
  357.                         $("#cart_primary").hide();
  358.                         $(".x-calc-table").hide();
  359.                         $(".xprice-netto-row").hide();
  360.                         $(".xprice-brutto-row").hide();
  361.                         $(".x-select").hide();
  362.                         $(".product-detail-tax-container-table").hide();
  363.                         $(".netto-container").html('<p class="product-detail-price">Preis auf Anfrage</p><p>Wir erstellen Ihnen gern ein Angebot. Einfach konfigurieren und Produktberatung anfragen! Weitere Details klären wir in einem persönlichen Gespräch.</p>');
  364.                         $(".netto-container").css({"float": "inherit", "width": "100%"});
  365.                         //$(".netto-container").hide();
  366.                         $(".brutto-container").hide();
  367.                         $(".product-detail-delivery-information").hide();
  368.                         $(".product-detail-tax-container").hide();
  369.                         $(".xconfig_start_block").hide();
  370.                         $(".x-chosen-article-box").hide();
  371.                         $(".product-detail-ordernumber-container").hide();
  372.                         $(".manufacturer-website").hide();
  373.                         $( document ).ready(function() {
  374.                             $("#x-order-tab").hide();
  375.                         });                        
  376.                     }                    
  377.                 }
  378.                 value_ids.forEach (function (value_id, index) {
  379.                     if (value_id) {
  380.                         $( ".config--has-summary" ).show();
  381.                     }               
  382.                 });
  383.                 if(value_ids.length == 0) {
  384.                     $( ".config--has-summary" ).hide();
  385.                     if (preconf !== undefined) {
  386.                         searchAndTrigger(preconf);
  387.                     }                    
  388.                 }
  389.                 if(data.config_complete) {
  390.                     buy_btn.removeAttr('disabled');
  391.                 } else {
  392.                     buy_btn.attr('disabled', 'disabled');
  393.                 }
  394.                 
  395.                 //if (data.variant_product_productnumber != null) {
  396.                 //    $("#xconfigProductNumber").html(data.variant_product_productnumber;
  397.                 //}
  398.                 //if (data.variant_product_ean != null) {
  399.                 //    $("#xconfigEan").html(data.variant_product_ean;
  400.                 //}
  401.                 var buy_form = $("#productDetailPageBuyProductForm");
  402.                 buy_form.attr("action", "/checkout/xconfig-line-item/add");
  403.                 if (productnumber != "parking3000") {
  404.                     if (data.variant_product_price1.raw != null) {
  405.                         main_price = data.variant_product_price1.raw;
  406.                         if (currency == "CHF") {
  407.                             $(".product-detail-price").html(data.variant_product_price1_chf.formatted);
  408.                             $("#x-main-article-price").html(data.variant_product_price1_chf.formatted);
  409.                             $(".product-detail-price-brutto").html("<span class='brutto-price-number'>" + data.variant_product_price1_brutto_chf.formatted + "</span><br>inkl. MwSt.");                   
  410.                         } else {
  411.                             $(".product-detail-price").html(data.variant_product_price1.formatted);
  412.                             $("#x-main-article-price").html(data.variant_product_price1.formatted);
  413.                             $(".product-detail-price-brutto").html("<span class='brutto-price-number'>" + data.variant_product_price1_brutto.formatted + "</span><br>inkl. MwSt.");
  414.                         }
  415.                         calcprice();
  416.                     }
  417.                 }
  418.                 $(".xconfig_description").html(data.config_product_description);
  419.                 // if (data.variant_product_media != "") {
  420.                     // var gallery_image = $(".gallery-slider-image").first();
  421.                     // $('#xconfigMedia').val(data.variant_product_media[0].media_path);
  422.                     // gallery_image.attr("src", data.variant_product_media[0].media_path.replace(/ /g, '%20'));
  423.                     // gallery_image.attr("srcset", data.variant_product_media[0].media_path.replace(/ /g, '%20')+" 1921w, "+data.variant_product_media[0].media_path.replace(/ /g, '%20')+" 1920w, "+data.variant_product_media[0].media_path.replace(/ /g, '%20')+" 800w, "+data.variant_product_media[0].media_path.replace(/ /g, '%20')+" 400w");
  424.                     // gallery_image.attr("data-full-image", data.variant_product_media[0].media_path.replace(/ /g, '%20'));
  425.                     // $( ".product-media-append" ).hide();
  426.                 // } else {
  427.                 //if(data.config_complete) {
  428.                 //    $( ".product-media-append" ).show();
  429.                 //} else {
  430.                 //    $( ".product-media-append" ).hide();
  431.                 //}
  432.                 
  433.                 // }
  434.                 if (productnumber == "SchrankeS" || productnumber == "parking" || productnumber == "industrial" ||
  435.                     productnumber == "koloss" || productnumber == "solar" || productnumber == "parking3000") {
  436.                 
  437.                 } else {
  438.                     var item_pdf = "";
  439.                     if (data.variant_product_media != "") {
  440.                         data.variant_product_media.forEach(function(item){
  441.                             if(item.media_path.includes('pdf')) {
  442.                                 item_pdf = item_pdf +  '<a class="pdf-media-download" target="_blank" rel="noopener noreferrer" href="'+ item.media_path +'">Download: '+ item.media_name +'.pdf</a> <br />';  
  443.                             }
  444.                         });
  445.                         $("#pdf-media").html(item_pdf);                
  446.                     }
  447.                     if (item_pdf == "") {
  448.                         $("#pdf-media").html('Leider gibt es für diesen Artikel bzw. für die von Ihnen gewählte Variante bisher keine Datenblätter. Sie können jedoch unter 0 23 73 / 1 78 09-11 oder <a href="mailto:m.wette@pse-technik.de" target="_self">m.wette@pse-technik.de</a> bei Frau Wette eine Anfrage für ein Datenblatt stellen oder weitere Informationen zu diesem Produkt einholen.');
  449.                     }
  450.                 }
  451.                 if(data.variant_product_start_config.values != "" && data.variant_product_start_config.options != "") {
  452.                     $("#xStartGroupValues").val(data.variant_product_start_config.values);
  453.                     $("#xStartGroupIds").val(data.variant_product_start_config.options); 
  454.                     $("#xconfig_start_description").html(data.variant_product_start_config_description);
  455.                     $('#xconfigStartDesc').val(data.variant_product_start_config_description);                    
  456.                     $('#startCartBtn').removeAttr('disabled');
  457.                     $("#xGroupIds").val(data.variant_product_start_config.values);
  458.                     $("#xGroupValues").val(data.variant_product_start_config.options); 
  459.                     $('#xconfigDesc').val(data.variant_product_start_config_description);                    
  460.                     buy_btn.removeAttr('disabled');                    
  461.                 } else {
  462.                     $('#startCartBtn').attr('disabled', 'disabled');
  463.                     $('.xconfig_start_block').hide();
  464.                 }
  465.                 if (main_tpl == "") {
  466.                     $('#startCartBtn').hide();
  467.                     $('.xconfig_start_block').hide();
  468.                 }
  469.                 //$(".accessory-hidden-input-id").each(function(e){
  470.                 //    this.value = data.variant_id + $(this).attr("originalid");
  471.                 //});
  472.                 $('.x-accessory-item-container').hide();
  473.                 $('.x-accessories-headline').hide();
  474.                 
  475.                 // if (data.product_accessories != "") {
  476.                     // //$('.x-accessory-item-container').hide();
  477.                     // data.product_accessories.forEach(function(item){
  478.                         // var product_number = item.product.base.product_number;
  479.                         // product_number = product_number.replace(".", "_")
  480.                         // $('#accessory_'+product_number).show();
  481.                         // $('.x-accessories-headline').show();
  482.                     // });
  483.                 // }
  484.                 
  485.                 if (data.variant_product_accessories != "") {
  486.                     //$('.x-accessory-item-container').hide();
  487.                     data.variant_product_accessories.forEach(function(item){
  488.                         var product_number = item.product.base.product_number;
  489.                         product_number = product_number.replace(".", "_")
  490.                         $('#accessory_'+product_number).show();
  491.                         $('.x-accessories-headline').show();
  492.                     });
  493.                 }                
  494.                 // if (data.variant_product_accessories == "" || data.product_accessories == "") {
  495.                     // $('.x-accessories-headline').hide();
  496.                     // $('.x-accessory-item-container').hide();
  497.                 // }
  498.                 $("#xVariantId").val(data.variant_id);
  499.                 $(".accessory-variant-id").val(data.variant_id);
  500.                 
  501.                 if (productnumber == "SchrankeS" || productnumber == "parking" || productnumber == "industrial" ||
  502.                     productnumber == "koloss" || productnumber == "solar") {
  503.                     $(".product--headline").html("Konfigurieren Sie jetzt Ihre Anfrage:");
  504.                 }
  505.                 
  506.                 if (productnumber == "parking3000") {
  507.                     $(".product--headline").html("Konfigurieren Sie jetzt Ihren Anfrage:");
  508.                     buy_btn.removeAttr('disabled');
  509.                 }
  510.                 var steps = value_ids.filter(obj => obj != "").length;
  511.                 if (steps != 0) {
  512.                     gtag('event', 'Konfigurator: '+productnumber, {'event_category': 'configuration','event_label': 'Schritt:'+steps,'value': true});
  513.                     //gtag('event', 'Konfigurator: '+productnumber, {
  514.                     //  'SCHRITT': steps
  515.                     //});                    
  516.                 }                 
  517.             }
  518.         });    
  519.     }    
  520.     
  521.     function submitXData() {
  522.         $("#xconfig_body :input[name^='group']").each(function(e){
  523.             if(this.type == "hidden" || this.type == "text")
  524.             {
  525.                 string = this.name;
  526.                 string = string.substring(string.lastIndexOf("[")+1,string.lastIndexOf("]"));
  527.                 groupIds[num] = string;
  528.                 groupValues[num] = this.value;
  529.                 num++;
  530.             }
  531.         });
  532.         $("#xGroupIds").val(groupIds);
  533.         $("#xGroupValues").val(groupValues);
  534.         
  535.         getConfiguration(0, productnumber, groupIds, groupValues);
  536.         
  537.         groupIds = [];
  538.         groupValues = [];
  539.         num = 0;
  540.         return false;
  541.     }
  542.     function getSearchParams(k){
  543.         var p={};
  544.         location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(s,k,v){p[k]=v})
  545.         return k?p[k]:p;
  546.     }                                
  547.     
  548.     function submitRestart() {
  549.         var groupIds     = new Array();
  550.         var groupValues = new Array();
  551.         config_count = 0;
  552.         getConfiguration(0, productnumber, groupIds, groupValues);
  553.         $('#startCartBtn').removeAttr('disabled');
  554.         $('.xconfig_start_block').show();
  555.         $(".product-detail-price").html(original_price);   
  556.         $("#x-main-article-price").html(original_price);   
  557.         $(".product-detail-price-brutto").html(brutto_price);   
  558.     }
  559.     
  560.     function calcprice() {
  561.         var main_qty = $( ".custom-select option:selected" ).text();
  562.         var fullprice = main_qty * main_price;
  563.         $('.x-accessory-item').each(function() {
  564.             if($( this ).hasClass("active")) {
  565.                 accessory_price = $( this ).attr("data-price");
  566.                 accessory_qty = $( this ).attr("data-qty");
  567.                 full_accessory = accessory_price * accessory_qty;
  568.                 fullprice = fullprice + full_accessory;
  569.             } 
  570.         });
  571.         if (currency == "CHF") {
  572.             fullprice_brutto = fullprice * 1.077;
  573.             fullprice_brutto = formatPrice(fullprice_brutto, "CHF")
  574.             fullprice = formatPrice(fullprice, "CHF*")
  575.         } else {
  576.             fullprice_brutto = fullprice * 1.19;
  577.             fullprice_brutto = formatPrice(fullprice_brutto, "€")
  578.             fullprice = formatPrice(fullprice, "€*")            
  579.         }
  580.         $(".x-full-price").html(fullprice);  
  581.         $(".x-full-price-brutto").html(fullprice_brutto);  
  582.     }
  583.         
  584.     function formatPrice(num, currency) { 
  585.         var p = Number(num).toFixed(2).split("."); 
  586.         return p[0].split("").reverse().reduce(function(acc, num, i, orig) 
  587.         { 
  588.             return num + (i && !(i % 3) ? "." : "") + acc; 
  589.         } , "") + "," + p[1] + " "+ currency; 
  590.     } 
  591.     // Function to search for the option and trigger onchange if found
  592.     function searchAndTrigger(preconf) {
  593.         var selectElements = document.querySelectorAll('.config_select'); // Select by class name
  594.         var searchterm;
  595.         if (preconf == "of") {
  596.             searchTerm = 'ortsfest';
  597.         }
  598.         if (preconf == "hn") {
  599.             searchTerm = 'herausnehmbar';
  600.         } 
  601.         if (preconf == "ul") {
  602.             searchTerm = 'umlegbar';
  603.         }         
  604.         var triggered = false;
  605.         selectElements.forEach(function (selectElement) {
  606.             if (triggered) {
  607.                 return;
  608.             }
  609.             // Enable the select field temporarily
  610.             selectElement.disabled = false;
  611.             for (var i = 0; i < selectElement.options.length; i++) {
  612.                 var option = selectElement.options[i];
  613.                 if (option.innerHTML.toLowerCase().includes(searchTerm)) {
  614.                     // Option found, trigger onchange
  615.                     selectElement.value = option.value;
  616.                     xSend(selectElement); // Pass the select element as a parameter
  617.                     triggered = true; // Set the flag to true
  618.                     break;
  619.                 }
  620.             }
  621.         });
  622.     }
  623.     
  624.     $("#x_info_click").click(function () {
  625.         $('#x_info_modal').addClass("show"); 
  626.     });
  627.     $(".x-modal-dialog .x-dialog-close").click(function(){
  628.         
  629.         $(this).closest(".x-modal-dialog").removeClass("show");
  630.         
  631.     });    
  632. </script>       
  633. {% endblock %}
  634. {% block page_product_detail_delivery_informations %}
  635. {% endblock %}
  636. {% block page_product_detail_tax %}
  637. {% endblock %}
  638. {% block page_product_detail_ordernumber_container %} 
  639.     {% for shop_detail in page.extensions.xconfig.product.data.shop_details %}
  640.         {% if shop_detail.type_id == "2" %}
  641.             <button class="xaccordion">{{ shop_detail.item_name }}</button>
  642.             <div class="xpanel">
  643.                 <p>{{ shop_detail.item_value|raw }}</p>
  644.             </div>                            
  645.         {% endif %}
  646.     {% endfor %}    
  647. <script>
  648. var icon_delete_html = '<span class="icon icon-trash" title="entfernen"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#f01d4a" fill-rule="evenodd" d="M5 21c0 .5523.4477 1 1 1h12c.5523 0 1-.4477 1-1V9H5v12zM17 3h2c1.6569 0 3 1.3431 3 3v2c0 .5523-.4477 1-1 1v12c0 1.6569-1.3431 3-3 3H6c-1.6569 0-3-1.3431-3-3V9c-.5523 0-1-.4477-1-1V6c0-1.6569 1.3431-3 3-3h2c0-1.6569 1.3431-3 3-3h4c1.6569 0 3 1.3431 3 3zM7 13v5c0 .5523.4477 1 1 1s1-.4477 1-1v-5c0-.5523-.4477-1-1-1s-1 .4477-1 1zm4 0v5c0 .5523.4477 1 1 1s1-.4477 1-1v-5c0-.5523-.4477-1-1-1s-1 .4477-1 1zm4 0v5c0 .5523.4477 1 1 1s1-.4477 1-1v-5c0-.5523-.4477-1-1-1s-1 .4477-1 1zM10 2c-.5523 0-1 .4477-1 1h6c0-.5523-.4477-1-1-1h-4zM4 7h16V6c0-.5523-.4477-1-1-1H5c-.5523 0-1 .4477-1 1v1z"/></svg></span>';
  649. $( ".xaccordion" ).click(function() {
  650.     this.classList.toggle("xactive");
  651.     var panel = this.nextElementSibling;
  652.     if (panel.style.maxHeight) {
  653.       panel.style.maxHeight = null;
  654.     } else {
  655.       panel.style.maxHeight = panel.scrollHeight + "px";
  656.     }
  657. });
  658. $('.cms-element-').css({                      
  659.     position: 'sticky',
  660.     top: '140px'
  661. });
  662. $( ".gallery-slider-image" ).click(function() {
  663.     $('.cms-element-').css({                      
  664.         position: 'relative'
  665.     });
  666. });
  667. $( ".modal-close" ).click(function() {
  668.     $('.cms-element-').css({                      
  669.         position: 'sticky'
  670.     });
  671. });
  672. $( ".custom-select" ).change(function() {
  673.     $('#x-main-article-qty').html(this.value);
  674.     $('#main_article_quantity_form').val(this.value);
  675.     calcprice();
  676. });
  677. // $( ".x-accessory-item-select" ).change(function() {
  678.     // var parent = $( this ).parents(".x-accessory-item");
  679.     // parent.attr("data-qty", this.value)
  680.     // $( "#x-acc-article-qty-"+ parent.attr("data-id") ).html(this.value);
  681.     // calcprice();
  682. // });
  683. // $(".x-accessory-item-input").click(function() {
  684.     // var parent = $( this ).parents(".x-accessory-item");
  685.     // acc_qty = parent.attr("data-qty");
  686.     // acc_price = parent.attr("data-price");
  687.     // acc_price = formatPrice(acc_price, "€*");
  688.     // acc_name = parent.attr("data-name");
  689.     // acc_id = parent.attr("data-id");    
  690.     // if(!parent.hasClass("active")) {
  691.         // parent.addClass("active");
  692.         // parent.find(".accessory-hidden-input").each(function() { 
  693.             // $( this ).removeAttr("disabled");
  694.         // });
  695.         
  696.         // $('.x-calc-table').append('<div class="x-acc-article lchline visible" id="x-acc-article-'+ acc_id +'"><div class="x-acc-article-name" id="x-acc-article-name'+ acc_id +'">'+ acc_name +'</div><div class="x-acc-article-qty" id="x-acc-article-qty-'+ acc_id +'">'+ acc_qty +'</div><div class="x-acc-article-price" id="x-acc-article-price'+ acc_id +'">'+ acc_price +'</div><div style="cursor: pointer;" onclick="article_delete('+ "'" + acc_id + "'" +')" class="x-article-delete"><span class="x-article-icon-delete"'+ icon_delete_html +'</span></div></div>');        
  697.     // } else {
  698.         // parent.removeClass("active");
  699.         // parent.find(".accessory-hidden-input").each(function() {
  700.             // $( this ).attr("disabled", true);
  701.         // });
  702.         // $( "#x-acc-article-"+ acc_id ).remove();
  703.     // }
  704.     // calcprice();  
  705. // }); 
  706. function article_delete(acc_id) {
  707.     $("#acc_input_"+ acc_id ).click();
  708. }    
  709.     
  710. $( "#show-more-accessory" ).click(function() {
  711.   $( '.x-accessories-rest' ).show( "slow" );
  712.   $( '#show-more-accessory' ).hide();
  713. });
  714. $( "#show-less-accessory" ).click(function() {
  715.   $( '.x-accessories-rest' ).hide( "slow" );
  716.   $( '#show-more-accessory' ).show();
  717.   $('html, body').animate({
  718.         scrollTop: parseInt($('.x-accessories-headline').offset().top)
  719.     }, 500);
  720. });
  721.     
  722. function accessoryCheck() {
  723.   let total = document.querySelectorAll('.x-accessory-item-input:checked').length;
  724.   document.getElementById("totalaccessory").innerHTML = "ausgewählte Zubehörartikel: " + total;
  725. }
  726. </script>
  727. {% endblock %}