custom/plugins/CustomFieldAdd/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_inner %}
  3.     <div class="product-detail-buy js-magnifier-zoom-image-container">
  4.         {% block page_product_detail_rich_snippets %}
  5.             {% block page_product_detail_rich_snippets_brand %}
  6.                 {% if page.product.manufacturer %}
  7.                     <meta itemprop="brand"
  8.                           content="{{ page.product.manufacturer.translated.name }}"/>
  9.                 {% endif %}
  10.             {% endblock %}
  11.             {% block page_product_detail_rich_snippets_gtin13 %}
  12.                 {% if page.product.ean %}
  13.                     <meta itemprop="gtin13"
  14.                           content="{{ page.product.ean }}"/>
  15.                 {% endif %}
  16.             {% endblock %}
  17.             {% block page_product_detail_rich_snippets_mpn %}
  18.                 {% if page.product.manufacturerNumber %}
  19.                     <meta itemprop="mpn"
  20.                           content="{{ page.product.manufacturerNumber }}"/>
  21.                 {% endif %}
  22.             {% endblock %}
  23.             {% block page_product_detail_rich_snippets_weight %}
  24.                 {% if page.product.weight %}
  25.                     <meta itemprop="weight"
  26.                           content="{{ page.product.weight }} kg"/>
  27.                 {% endif %}
  28.             {% endblock %}
  29.             {% block page_product_detail_rich_snippets_height %}
  30.                 {% if page.product.height %}
  31.                     <meta itemprop="height"
  32.                           content="{{ page.product.height }} mm"/>
  33.                 {% endif %}
  34.             {% endblock %}
  35.             {% block page_product_detail_rich_snippets_width %}
  36.                 {% if page.product.width %}
  37.                     <meta itemprop="width"
  38.                           content="{{ page.product.width }} mm"/>
  39.                 {% endif %}
  40.             {% endblock %}
  41.             {% block page_product_detail_rich_snippets_depth %}
  42.                 {% if page.product.length %}
  43.                     <meta itemprop="depth"
  44.                           content="{{ page.product.length }} mm"/>
  45.                 {% endif %}
  46.             {% endblock %}
  47.             {% block page_product_detail_rich_snippets_release_date %}
  48.                 <meta itemprop="releaseDate"
  49.                       content="{{ page.product.releaseDate|format_date(pattern="Y-MM-dd", locale=app.request.locale) }}"/>
  50.             {% endblock %}
  51.         {% endblock %}
  52.         {#        {% if not feature('FEATURE_NEXT_16992') %} #}
  53.         {#            #}{# @deprecated tag:v6.5.0 tag:)(FEATURE_NEXT_16992) - Block will be removed in v6.5.0 #}
  54.         {#            {% block page_product_detail_not_available %} #}
  55.         {#            {% endblock %} #}
  56.         {#        {% endif %} #}
  57.         {% block page_product_detail_buy_container %}
  58.             <div itemprop="offers"
  59.                  itemscope
  60.                  itemtype="{% if page.product.calculatedPrices|length > 1 %}http://schema.org/AggregateOffer{% else %}http://schema.org/Offer{% endif %}">
  61.                 {% block page_product_detail_configurator_include %}
  62.                     {% if page.product.parentId and page.configuratorSettings|length > 0 %}
  63.                         <div class="product-detail-configurator-container">
  64.                             {% sw_include '@Storefront/storefront/page/product-detail/configurator.html.twig' %}
  65.                         </div>
  66.                     {% endif %}
  67.                 {% endblock %}
  68.                 {% block page_product_detail_custom_accessories %}
  69.                     {% if page.extensions['accessoriesProductsLoad'].get('accessories_product') or page.extensions['accessoriesProductsLoad'].get('accessories_product') %}
  70.                         <div class="product-detail-configurator-group-title">Passendes Zubehör</div>
  71.                     {% endif %}
  72.                     {% if page.extensions['accessoriesProductsLoad'].get('accessories_product') %}
  73.                         {% for accessoriesProductsLoadStream in page.extensions['accessoriesProductsLoadStream'].get('accessories_product_stream') %}
  74.                             <div class="product-accessories">
  75.                                 {% for accessoriesproduct in accessoriesProductsLoadStream %}
  76.                                     <div class="pro-detail-configurator" style="cursor: pointer;"
  77.                                          id="custom-ass-{{ accessoriesproduct.id }}"
  78.                                          onclick="setAccessoriesproduct('{{ accessoriesproduct.id }}')">
  79.                                         <div class="pp-box1">
  80.                                             {% if accessoriesproduct.cover.media.url %}
  81.                                                 <img src="{{ accessoriesproduct.cover.media.url }}" alt="aou">
  82.                                             {% else %}
  83.                                                 <img src="/bundles/radfabriktheme/assets/images/aou.png" alt="aou">
  84.                                             {% endif %}
  85.                                         </div>
  86.                                         <div class="pp-box2">
  87.                                             <h5 class="pro-head">{{ accessoriesproduct.translated.name }}</h5>
  88.                                             <p>
  89.                                                 <a href="{{ rawUrl('frontend.detail.page', { 'productId': accessoriesproduct.id }, salesChannel.domain|first.url) }}">Mehr
  90.                                                     Produktinfos</a></p>
  91.                                             {% if accessoriesproduct.deliveryTime.id == '32c6890dcfe34dae9ef1c16320b3afc2' %}
  92.                                                 <a class="deliverd color-green"
  93.                                                    style="color: #26c156;">• {{ accessoriesproduct.deliveryTime.name }}</a>
  94.                                             {% else %}
  95.                                                 <a class="deliverd color-green"
  96.                                                    style="color: #f89d0e;">• {{ accessoriesproduct.deliveryTime.name }}</a>
  97.                                             {% endif %}
  98.                                         </div>
  99.                                         <div class="pp-box3">
  100.                                             <div class="line-through-price">
  101.                                                 {% if price.listPrice.price %}
  102.                                                     <span class="line-price">{{ price.listPrice.price|currency }}</span>
  103.                                                 {% endif %}
  104.                                                 {% set price = accessoriesproduct.calculatedPrice %}
  105.                                                 {% if accessoriesproduct.calculatedPrices|length == 0 %}
  106.                                                     <span class="p-price">{{ price.unitPrice|currency }}</span>
  107.                                                 {% endif %}
  108.                                             </div>
  109.                                             <a class="click-icon" id="click-icon-accessories"> +</a>
  110.                                         </div>
  111.                                     </div>
  112.                                 {% endfor %}
  113.                             </div>
  114.                         {% endfor %}
  115.                     {% endif %}
  116.                     {% if page.extensions['accessoriesProductsLoad'].get('accessories_product') %}
  117.                         <div class="product-accessories">
  118.                             {% for accessoriesproduct in page.extensions['accessoriesProductsLoad'].get('accessories_product') %}
  119.                                 <div class="pro-detail-configurator" style="cursor: pointer;"
  120.                                      id="custom-ass-{{ accessoriesproduct.id }}"
  121.                                      onclick="setAccessoriesproduct('{{ accessoriesproduct.id }}')">
  122.                                     <div class="pp-box1">
  123.                                         {% if accessoriesproduct.cover.media.url %}
  124.                                             <img src="{{ accessoriesproduct.cover.media.url }}" alt="aou">
  125.                                         {% else %}
  126.                                             <img src="/bundles/radfabriktheme/assets/images/aou.png" alt="aou">
  127.                                         {% endif %}
  128.                                     </div>
  129.                                     <div class="pp-box2">
  130.                                         <h5 class="pro-head">{{ accessoriesproduct.translated.name }}</h5>
  131.                                         <p><a target="_blank"
  132.                                               href="{{ seoUrl('frontend.detail.page', { 'productId': accessoriesproduct.id }, salesChannel.domain|first.url) }}">Mehr
  133.                                                 Produktinfos</a></p>
  134.                                         {% if accessoriesproduct.deliveryTime.id == '32c6890dcfe34dae9ef1c16320b3afc2' %}
  135.                                             <a class="deliverd color-green"
  136.                                                style="color: #26c156;">• {{ accessoriesproduct.deliveryTime.name }}</a>
  137.                                         {% else %}
  138.                                             <a class="deliverd color-green"
  139.                                                style="color: #f89d0e;">• {{ accessoriesproduct.deliveryTime.name }}</a>
  140.                                         {% endif %}
  141.                                     </div>
  142.                                     <div class="pp-box3">
  143.                                         <div class="line-through-price">
  144.                                             {% if accessoriesproduct.calculatedPrice.listPrice %}
  145.                                                 <span class="line-price">{{ "UVP" }} {{ accessoriesproduct.calculatedPrice.listPrice.price|currency }}</span>
  146.                                             {% endif %}
  147.                                             {% set price = accessoriesproduct.calculatedPrice %}
  148.                                             {% if accessoriesproduct.calculatedPrices|length == 0 %}
  149.                                                 <span class="p-price">{{ price.unitPrice|currency }}</span>
  150.                                             {% endif %}
  151.                                         </div>
  152.                                         <a class="click-icon" id="click-icon-accessories"> +</a>
  153.                                     </div>
  154.                                 </div>
  155.                             {% endfor %}
  156.                         </div>
  157.                     {% endif %}
  158.                 {% endblock %}
  159.                 {% block page_product_detail_data %}
  160.                     {% block page_product_detail_data_rich_snippet_url %}
  161.                         <meta itemprop="url"
  162.                               content="{{ seoUrl('frontend.detail.page', { productId: page.product.id }) }}"/>
  163.                     {% endblock %}
  164.                     {% block page_product_detail_data_rich_snippet_price_range %}
  165.                         {% if page.product.calculatedPrices|length > 1 %}
  166.                             {% set lowestPrice = false %}
  167.                             {% set highestPrice = false %}
  168.                             {% for price in page.product.calculatedPrices %}
  169.                                 {% if not lowestPrice or price.unitPrice < lowestPrice %}
  170.                                     {% set lowestPrice = price.unitPrice %}
  171.                                 {% endif %}
  172.                                 {% if not highestPrice or price.unitPrice > highestPrice %}
  173.                                     {% set highestPrice = price.unitPrice %}
  174.                                 {% endif %}
  175.                             {% endfor %}
  176.                             <meta itemprop="lowPrice" content="{{ lowestPrice }}"/>
  177.                             <meta itemprop="highPrice" content="{{ highestPrice }}"/>
  178.                             <meta itemprop="offerCount" content="{{ page.product.calculatedPrices|length }}"/>
  179.                         {% endif %}
  180.                     {% endblock %}
  181.                     {% block page_product_detail_data_rich_snippet_price_currency %}
  182.                         <meta itemprop="priceCurrency"
  183.                               content="{{ context.currency.translated.shortName }}"/>
  184.                     {% endblock %}
  185.                     {% block page_product_detail_price %}
  186.                     {% if (config('AmMacTradeCustomPlugins.config.amMacTradeInsuranceWarranty')) %}
  187.                     {% set insurance_warranty = page.extensions['insurance_warranty'].all() %}
  188.                     {% if page.extensions['insurance_warranty'] is not null %}
  189.                     <div class="product-details-insurance-warranty">
  190.                         <div class="product-detail-configurator-group-title">
  191.                             {{ insurance_warranty['insurance_title'] }}
  192.                             <div class="info-text"></div>
  193.                             <a href="https://www.mactrade.de/garantiepaket" target="_blank"
  194.                                title="{{ "macTrade.pdp.moreInformationText"|trans|sw_sanitize }}">{{ "macTrade.pdp.moreInformationText"|trans|sw_sanitize }}</a>
  195.                         </div>
  196.                         <div class="product-detail-configurator-option">
  197.                             <input type="radio" name="ammactrade-insurance-warranty"
  198.                                    value="{{ insurance_warranty['insurance_prod_id'] }}"
  199.                                    class="product-detail-configurator-option-input-insurance-warranty is-combinable"
  200.                                    title="{{ "macTrade.pdp.insuranceProductTitle"|trans|sw_sanitize }}"
  201.                                    id="ammactrade-insurance-warranty" onclick="insurance_warranty_change(this);">
  202.                             <label class="product-detail-configurator-option-label is-combinable is-display-text"
  203.                                    title="{{ insurance_warranty['insurance_name'] }}" for="ammactrade-insurance-warranty">
  204.                                 <div class="insurance_details_option">
  205.                                     <div class="insurance_details_option_img">
  206.                                         {% if page.insurance is not null %}
  207.                                             {% if page.insurance.cover.media.url %}
  208.                                                 <img src="{{ page.insurance.cover.media.url }}" width="50px"/>
  209.                                             {% else %}
  210.                                                 {% sw_icon 'placeholder' style {
  211.                                                     'default': '100px'
  212.                                                 } %}
  213.                                             {% endif %}
  214.                                         {% endif %}
  215.                                     </div>
  216.                                     <div class="insurance_details_option_title">
  217.                                         {{ insurance_warranty['insurance_name'] }}
  218.                                     </div>
  219.                                     <div class="insurance_details_option_price">
  220.                                         + {{ insurance_warranty['insurance_price']|number_format(2, ',', '.') }} €
  221.                                     </div>
  222.                                 </div>
  223.                                 <div class="insurance_details_option_desc">
  224.                                     {{ insurance_warranty['insurance_desc']|raw }}
  225.                                 </div>
  226.                             </label>
  227.                             <input type="radio" name="ammactrade-insurance-warranty" value="0"
  228.                                    class="product-detail-configurator-option-input-insurance-warranty is-combinable"
  229.                                    title="{{ "macTrade.pdp.insuranceProductTitle"|trans|sw_sanitize }}"
  230.                                    id="ammactrade-insurance-warranty0" checked="checked"
  231.                                    onclick="insurance_warranty_change(this);">
  232.                             <label class="product-detail-configurator-option-label is-combinable is-display-text"
  233.                                    title="{{ "macTrade.pdp.noInsuranceProduct"|trans|sw_sanitize }}"
  234.                                    for="ammactrade-insurance-warranty0">
  235.                                 {{ insurance_warranty['insurance_no'] }}
  236.                             </label>
  237.                         </div>
  238.                     </div>
  239.                     <script>
  240.                         function insurance_warranty_change(t) {
  241.                             var input_product_insurance = document.getElementsByClassName("product-insurance");
  242.                             for (var i = 0; i < input_product_insurance.length; i++) {
  243.                                 input_product_insurance[i].value = t.value;
  244.                             }
  245.                         };
  246.                     </script>
  247.                     {% endif %}
  248.                     {{ parent() }}
  249.                     {% else %}
  250.                         {{ parent() }}
  251.                     {% endif %}
  252.                         <div class="main-mc-block">
  253.                         <div class="product-detail-price-container">
  254.                             {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-price.html.twig' %}
  255.                         </div>
  256.                         {% block page_product_detail_tax %}
  257.                             <div class="product-detail-tax-container">
  258.                                 {% if context.taxState == "gross" %}
  259.                                     {% set taxText = "general.grossTaxInformation"|trans|sw_sanitize %}
  260.                                 {% else %}
  261.                                     {% set taxText = "general.netTaxInformation"|trans|sw_sanitize %}
  262.                                 {% endif %}
  263.                                 <p class="product-detail-tax">
  264.                                     {% block page_product_detail_tax_link %}
  265.                                         <a class="product-detail-tax-link"
  266.                                            href="{{ path('frontend.cms.page',{ id: config('core.basicInformation.shippingPaymentInfoPage') }) }}"
  267.                                            title="{{ taxText }}"
  268.                                            data-toggle="modal"
  269.                                            data-url="{{ path('frontend.cms.page',{ id: config('core.basicInformation.shippingPaymentInfoPage') }) }}">
  270.                                             {{ taxText }}
  271.                                         </a>
  272.                                     {% endblock %}
  273.                                 </p>
  274.                             </div>
  275.                         {% endblock %}
  276.                         {% if page.product.customFields.product_custom_fields_feed_voucher_price_string %}
  277.                         {% if context.salesChannel.id !='45be9f42765d42e8ae1137d1812040f4' && context.salesChannel.id !='28cc3b3554794114a8df96aeca8d78ae' %}
  278.                             <div class="product-detail-promotion-container">
  279.                                 <div class="promotion-icon">
  280.                                     <img src="{{ asset('assets/images/discount.svg', "@AmMacTrade") }}" alt="Rabatt">
  281.                                 </div>
  282.                                 <div class="promotion-text">
  283.                                     Auch für
  284.                                     <span> {{ page.product.customFields.product_custom_fields_feed_voucher_price_string|number_format(2, ',', '.') }} €</span>
  285.                                     zinsfrei finanzieren mit dem Gutscheincode:
  286.                                     <span>{{ page.product.customFields.product_custom_fields_feed_voucher_text }}</span>
  287.                                     <div class="promotion-link">Mehr Infos <a
  288.                                                 href="{{ page.product.customFields.product_custom_fields_feed_voucher_promotion_link }}"
  289.                                                 target="_blank"></a></div>
  290.                                 </div>
  291.                             </div>
  292.                         {% endif %}
  293.                         {% endif %}
  294.                         {% set remoteClickOptions = {
  295.                             selector: "#review-tab",
  296.                             scrollToElement: true
  297.                         } %}
  298.                         {% block page_product_detail_reviews %}
  299.                             {% if page.product.ratingAverage > 0 and page.reviews.totalReviews > 0 and config('core.listing.showReview') %}
  300.                                 <div class="product-detail-reviews">
  301.                                     {% sw_include '@Storefront/storefront/component/review/rating.html.twig' with {
  302.                                         points: page.product.ratingAverage,
  303.                                         style: 'text-primary'
  304.                                     } %}
  305.                                     <a data-toggle="tab"
  306.                                        class="product-detail-reviews-link"
  307.                                        data-offcanvas-tabs="true"
  308.                                        data-remote-click="true"
  309.                                        data-remote-click-options='{{ remoteClickOptions|json_encode }}'
  310.                                        href="#review-tab-pane"
  311.                                        aria-controls="review-tab-pane">
  312.                                         {{ page.reviews.totalReviews }}
  313.                                         {{ "detail.reviewLinkText"|trans({'%count%': page.reviews.totalReviews})|sw_sanitize }}
  314.                                     </a>
  315.                                 </div>
  316.                             {% endif %}
  317.                         {% endblock %}
  318.                     {% endblock %}
  319.                     {% block page_product_detail_buy_form %}
  320.                         {% if page.product.active %}
  321.                             <div class="product-detail-form-container">
  322.                                 {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' %}
  323.                             </div>
  324.                         {% endif %}
  325.                     {% endblock %}
  326.                     {% block page_product_detail_delivery_informations %}
  327.                         <div class="product-detail-delivery-information">
  328.                             {% sw_include '@Storefront/storefront/component/delivery-information.html.twig' %}
  329.                         </div>
  330.                     {% endblock %}
  331.                     {% block page_product_detail_ordernumber_container %}
  332.                         {% if page.product.productNumber %}
  333.                             <div class="product-detail-ordernumber-container">
  334.                                 {% block page_product_detail_ordernumber_label %}
  335.                                     <span class="product-detail-ordernumber-label">
  336.                         {{ "detail.productNumberLabel"|trans|sw_sanitize }}
  337.                     </span>
  338.                                 {% endblock %}
  339.                                 {% block page_product_detail_ordernumber %}
  340.                                     <meta itemprop="productID"
  341.                                           content="{{ page.product.id }}"/>
  342.                                     <span class="product-detail-ordernumber"
  343.                                           itemprop="sku">
  344.                         {{ page.product.productNumber }}
  345.                     </span>
  346.                                 {% endblock %}
  347.                             </div>
  348.                         {% endif %}
  349.                         {% if page.product.manufacturerNumber %}
  350.                             <div class="product-detail-ordernumber-container" style="margin-top: -10px;">
  351.                 <span class="product-detail-ordernumber-label">
  352.                     Herstellernummer:
  353.                 </span>
  354.                                 <span class="product-detail-ordernumber"
  355.                                       itemprop="sku">
  356.                     {{ page.product.manufacturerNumber }}
  357.                 </span>
  358.                             </div>
  359.                         {% endif %}
  360.                     {% endblock %}
  361.                     </div>
  362.                 {% endblock %}
  363.             </div>
  364.         {% endblock %}
  365.         {% if config('core.cart.wishlistEnabled') %}
  366.             {% block page_product_detail_wishlist %}
  367.                 {% sw_include '@Storefront/storefront/component/product/card/wishlist.html.twig' with {
  368.                     showText: true,
  369.                     size: 'md',
  370.                     productId: page.product.id
  371.                 } %}
  372.             {% endblock %}
  373.         {% endif %}
  374.         {% block page_product_detail_c2_widget %}
  375.         {# {% if page.product.customFields.product_custom_fields_subscription == 1 and page.product.restockTime <= 10 %} #}
  376.         {% if page.product.customFields.product_custom_fields_subscription == true and (page.product.customFields.product_custom_fields_subscription_productType != 'ACCESSORY') and page.product.customFields.product_custom_fields_subscription_monthlyPriceGross > 0 %}
  377.         <div class="product-detail-c2-widget-container">
  378.             <div class="mac-abo-block">
  379.                 <div class="abo1">
  380.                     <script>
  381.                         var button
  382.                         function initWi() {
  383.                             button = new wi({
  384.                                 productId: "{{ page.product.productNumber }}",
  385.                                 trackingId: "",
  386.                                 color: "FFFFFF",
  387.                                 backgroundColor: "4A4A49",
  388.                                 hoverColor: "FFFFFF",
  389.                                 hoverBackgroundColor: "042e41",
  390.                                 //poweredBy: "powered by c2 [circle]",
  391.                                 poweredBy: "",
  392.                                 widgetTitle: "",
  393.                                 retailerTitle: "MacTrade Abo",
  394.                                 manufacturerTitle: "",
  395.                                 button: "MacTrade Abo starten",
  396.                                 priceCopy: "/Monat ({{ page.product.customFields.product_custom_fields_subscription_durationInMonths }} Mon.)",
  397.                                 marketingLinkText: "Mehr Infos",
  398.                                 marketingURL: "/mactrade-abo/",
  399.                                 API: "https://backend.c2-circle.com",
  400.                                 merchantIdentifier: "mactrade",
  401.                                 buttonType: "large"
  402.                             })
  403.                             button.render(document.querySelectorAll("[data-wi-id=wi-button-container]"))
  404.                         }
  405.                         (function () {
  406.                             var s = document.createElement('script');
  407.                             s.type = 'text/javascript';
  408.                             s.async = true;
  409.                             s.src = 'https://www.c2-circle.com/partner/static/mactrade/script.js';
  410.                             var x = document.getElementsByTagName('script')[0];
  411.                             x.parentNode.insertBefore(s, x);
  412.                         })();
  413.                     </script>
  414.                     <script>
  415.                         //var newProductId = "{{ page.product.productNumber }}"
  416.                         //button.updateProduct(document.querySelectorAll("[data-wi-id=wi-button-container]"), newProductId)
  417.                     </script>
  418.                     <div data-wi-id="wi-button-container"></div>
  419.                     <script>
  420.                         setTimeout(function () {
  421.                             var wiPrice = $(".wi-price").html();
  422.                             wiPrice = wiPrice.trim();
  423.                             console.log(wiPrice);
  424.                             var wiPriceArr = wiPrice.split("&nbsp;");
  425.                             $(".wi-price").html(wiPriceArr[1] + " " + wiPriceArr[0] + "*");
  426.                         }, 1500);
  427.                         console.log("Kaufen=========");
  428.                         console.log('{{ page.extensions['amMactradeap1'].get('keyApi') }}');
  429.                     </script>
  430.                 </div>
  431.                 {# start #}
  432.                 {% if page.extensions['amMactradeap1'].get('keyApi') %}
  433.                     <div class="abo2-right">
  434.                         <h3>Gutschrift für Ihr Altgerät</h3>
  435.                         <div class="price-txt-zw"><p>zwischen</p>
  436.                             <h2 class='price_range_block'></h2></div>
  437.                         <p class="price-mid-txt">
  438.                             {{ page.extensions['amMactradeap1'].get('keyApiText') }}
  439.                         </p>
  440.                         <button class="btn-black"
  441.                                 onclick="javascript:window.open('https://mactrade.kauft-an.de/', '_blank');">
  442.                             Ankaufspreis ermitteln
  443.                         </button>
  444.                         <div class="powe-line"><a href="https://mactrade.kauft-an.de/mactrade_c/hilfe/" target="_blank"
  445.                                                   class="small-link">Mehr Infos </a>
  446.                             <p>powered by kauft-an</p></div>
  447.                     </div>
  448.                     <script>
  449.                         var categoryName = '{{ page.product.customFields.product_custom_fields_product_family }}';
  450.                         //var categoryName = '{{ name }}';
  451.                         var kaufenCatId = '';
  452.                         if (categoryName == 'MAC') {
  453.                             kaufenCatId = 110;
  454.                         } else if (categoryName == 'IPAD') {
  455.                             kaufenCatId = 3;
  456.                         } else if (categoryName == 'IPHONE') {
  457.                             kaufenCatId = 18;
  458.                         } else if (categoryName == 'WATCH') {
  459.                             kaufenCatId = 102;
  460.                         } else if (categoryName == 'ACCESSORIES') {
  461.                             kaufenCatId = 320;
  462.                         } else if (categoryName == 'MacBook Air') {
  463.                             kaufenCatId = 6;
  464.                         }
  465.                         kaufenCatId = '{{ page.extensions['amMactradeap1'].get('keyApi') }}';
  466.                         fetch('https://api.kauft-an.de/api/v1/product.pricerange/' + kaufenCatId, {
  467.                             headers: {
  468.                                 'Authorization': 'Bearer 6|a46tPuG1bkeMaXx9JoxyI1VAC0LdSHOdalgqspem'
  469.                             }
  470.                         })
  471.                             .then(response => response.json())
  472.                             .then(data => {
  473.                                 // Process the retrieved data
  474.                                 console.log(data);
  475.                                 document.querySelector('[class^="price_range_block"]').innerHTML = data.result.min_price + ' € - ' + data.result.max_price + ' €*';
  476.                                 document.querySelector('[class^="price_range"]').innerHTML = data.result.min_price + ' € - ' + data.result.max_price + ' €*';
  477.                             })
  478.                             .catch(error => {
  479.                                 // Handle any errors that occurred during the API call
  480.                                 console.error(error);
  481.                             });
  482.                     </script>
  483.                 {% endif %}
  484.                 {# end #}
  485.             </div>
  486.         </div>
  487.         {% else %}
  488.         <div class="product-detail-c2-widget-container
  489. {% if category %}
  490. {% set breadcrumbCategories = sw_breadcrumb_full(category, context.context) %}
  491. {% for breadcrumbCategory in breadcrumbCategories %}
  492. {% set key = breadcrumbCategory.id %}
  493. {% set name = breadcrumbCategory.translated.name %}
  494. {% if loop.index == 1 %}
  495. {% if name == 'Zubehör' %}
  496. d-none
  497. {% endif %}
  498. {% endif %}
  499. {% endfor %}
  500. {% endif %}
  501. ">
  502.             <div class="mac-abo-block">
  503.                 {% if page.extensions['amMactradeap1'].get('keyApi') %}
  504.                     <div class="abo2-right">
  505.                         <h3>Gutschrift für Ihr Altgerät</h3>
  506.                         <div class="price-txt-zw"><p>zwischen</p>
  507.                             <h2 class='price_range_block'></h2></div>
  508.                         <p class="price-mid-txt">für Ihr altes
  509.                             {% set category = page.header.navigation.active %}
  510.                             {% if category %}
  511.                                 {% set breadcrumbCategories = sw_breadcrumb_full(category, context.context) %}
  512.                                 {% set categoryId = category.id %}
  513.                                 {% for breadcrumbCategory in breadcrumbCategories %}
  514.                                     {% set key = breadcrumbCategory.id %}
  515.                                     {% set name = breadcrumbCategory.translated.name %}
  516.                                     {% if loop.index == 2 %}
  517.                                         {{ name }}
  518.                                     {% endif %}
  519.                                 {% endfor %}
  520.                             {% endif %}
  521.                         </p>
  522.                         <button class="btn-black"
  523.                                 onclick="javascript:window.open('https://mactrade.kauft-an.de/', '_blank');">
  524.                             Ankaufspreis ermitteln
  525.                         </button>
  526.                         <div class="powe-line"><a href="https://mactrade.kauft-an.de/mactrade_c/hilfe/" target="_blank"
  527.                                                   class="small-link">Mehr Infos </a>
  528.                             <p>powered by kauft-an</p></div>
  529.                     </div>
  530.                     <script>
  531.                         var categoryName = '{{ page.product.customFields.product_custom_fields_product_family }}';
  532.                         var kaufenCatId = '';
  533.                         if (categoryName == 'MAC') {
  534.                             kaufenCatId = 110;
  535.                         } else if (categoryName == 'IPAD') {
  536.                             kaufenCatId = 3;
  537.                         } else if (categoryName == 'IPHONE') {
  538.                             kaufenCatId = 18;
  539.                         } else if (categoryName == 'WATCH') {
  540.                             kaufenCatId = 102;
  541.                         } else if (categoryName == 'ACCESSORIES') {
  542.                             kaufenCatId = 320;
  543.                         }
  544.                         kaufenCatId = '{{ page.extensions['amMactradeap1'].get('keyApi') }}';
  545.                         fetch('https://api.kauft-an.de/api/v1/product.pricerange/' + kaufenCatId, {
  546.                             headers: {
  547.                                 'Authorization': 'Bearer 6|a46tPuG1bkeMaXx9JoxyI1VAC0LdSHOdalgqspem'
  548.                             }
  549.                         })
  550.                             .then(response => response.json())
  551.                             .then(data => {
  552.                                 // Process the retrieved data
  553.                                 console.log(data);
  554.                                 document.querySelector('[class^="price_range_block"]').innerHTML = data.result.min_price + ' € - ' + data.result.max_price + ' €*';
  555.                                 document.querySelector('[class^="price_range"]').innerHTML = data.result.min_price + ' € - ' + data.result.max_price + ' €*';
  556.                             })
  557.                             .catch(error => {
  558.                                 // Handle any errors that occurred during the API call
  559.                                 console.error(error);
  560.                             });
  561.                         //$(".wi-price").append("*");
  562.                     </script>
  563.                 {% endif %}
  564.                 {# end #}
  565.             </div>
  566.         </div>
  567.     </div>
  568.     </div>
  569.     {% endif %}
  570. {% endblock %}
  571.     <script>
  572.         function setAccessoriesproduct(idValue) {
  573.             if (!$('.setValueDynamic-' + idValue).html()) {
  574.                 console.log($('.setValueDynamic-' + idValue).html())
  575.                 $('#custom-ass-' + idValue).css('border', '2px solid #1c516c');
  576.                 $('#custom-ass-' + idValue).addClass('border-dark');
  577.                 $('.setValueDynamic-' + idValue).html('<input type=hidden name=lineItems[' + idValue + '][id] class=product-accessories-id-' + idValue + ' value=' + idValue + '><input type=hidden name=lineItems[' + idValue + '][referencedId] value=' + idValue + ' ><input type=hidden name=lineItems[' + idValue + '][quantity] value=1 ><input type=hidden name=lineItems[' + idValue + '][stackable] value=1 ><input type=hidden name=lineItems[' + idValue + '][removable] value=1 ><input type=hidden name=lineItems[' + idValue + '][type] value=product >');
  578.             } else {
  579.                 $('.setValueDynamic-' + idValue).html('');
  580.                 $('#custom-ass-' + idValue).css('border', '1px solid #d0d0d0');
  581.                 $('#custom-ass-' + idValue).removeClass('border-dark');
  582.             }
  583.         }
  584.     </script>
  585.     </div>
  586. {% endblock %}