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

Open in your IDE?
  1. {% block page_product_detail_buy_inner %}
  2. <div class="product-detail-buy js-magnifier-zoom-image-container">
  3.     {% block page_product_detail_rich_snippets %}
  4.     {% block page_product_detail_rich_snippets_brand %}
  5.     {% if page.product.manufacturer %}
  6.     <meta itemprop="brand"
  7.     content="{{ page.product.manufacturer.translated.name }}"/>
  8.     {% endif %}
  9.     {% endblock %}
  10.     {% block page_product_detail_rich_snippets_gtin13 %}
  11.     {% if page.product.ean %}
  12.     <meta itemprop="gtin13"
  13.     content="{{ page.product.ean }}"/>
  14.     {% endif %}
  15.     {% endblock %}
  16.     {% block page_product_detail_rich_snippets_mpn %}
  17.     <meta itemprop="mpn"
  18.     content="{{ page.product.productNumber }}"/>
  19.     {% endblock %}
  20.     {% block page_product_detail_rich_snippets_weight %}
  21.     {% if page.product.weight %}
  22.     <meta itemprop="weight"
  23.     content="{{ page.product.weight }} kg"/>
  24.     {% endif %}
  25.     {% endblock %}
  26.     {% block page_product_detail_rich_snippets_height %}
  27.     {% if page.product.height %}
  28.     <meta itemprop="height"
  29.     content="{{ page.product.height }} mm"/>
  30.     {% endif %}
  31.     {% endblock %}
  32.     {% block page_product_detail_rich_snippets_width %}
  33.     {% if page.product.width %}
  34.     <meta itemprop="width"
  35.     content="{{ page.product.width }} mm"/>
  36.     {% endif %}
  37.     {% endblock %}
  38.     {% block page_product_detail_rich_snippets_depth %}
  39.     {% if page.product.length %}
  40.     <meta itemprop="depth"
  41.     content="{{ page.product.length }} mm"/>
  42.     {% endif %}
  43.     {% endblock %}
  44.     {% block page_product_detail_rich_snippets_release_date %}
  45.     <meta itemprop="releaseDate"
  46.     content="{{ page.product.releaseDate|format_date('short', locale=app.request.locale) }}"/>
  47.     {% endblock %}
  48.     {% endblock %}
  49.     {% block page_product_detail_not_available %}
  50.     {#TODO: NEXT-2784 - product not available message#}
  51.     {% endblock %}
  52.     {% block page_product_detail_buy_container %}
  53.     <div itemprop="offers"
  54.     itemscope
  55.     itemtype="{% if page.product.calculatedPrices|length > 1 %}http://schema.org/AggregateOffer{% else %}http://schema.org/Offer{% endif %}">
  56.     {% block page_product_detail_configurator_include %}
  57.     {% if page.product.parentId and page.configuratorSettings|length > 0 %}
  58.     <div class="product-detail-configurator-container">
  59.         {% sw_include '@Storefront/storefront/page/product-detail/configurator.html.twig' %}
  60.     </div>
  61.     {% endif %}
  62.     {% endblock %}
  63.     {% block page_product_detail_data %}
  64.     {% block page_product_detail_data_rich_snippet_url %}
  65.     <meta itemprop="url"
  66.     content="{{ seoUrl('frontend.detail.page', { productId: page.product.id }) }}"/>
  67.     {% endblock %}
  68.     {% block page_product_detail_data_rich_snippet_price_range %}
  69.     {% if page.product.calculatedPrices|length > 1 %}
  70.     {% set lowestPrice = false %}
  71.     {% set highestPrice = false %}
  72.     {% for price in page.product.calculatedPrices %}
  73.     {% if not lowestPrice or price.unitPrice < lowestPrice %}
  74.     {% set lowestPrice = price.unitPrice %}
  75.     {% endif %}
  76.     {% if not highestPrice or price.unitPrice > highestPrice %}
  77.     {% set highestPrice = price.unitPrice %}
  78.     {% endif %}
  79.     {% endfor %}
  80.     <meta itemprop="lowPrice" content="{{ lowestPrice }}"/>
  81.     <meta itemprop="highPrice" content="{{ highestPrice }}"/>
  82.     <meta itemprop="offerCount" content="{{ page.product.calculatedPrices|length }}"/>
  83.     {% endif %}
  84.     {% endblock %}
  85.     {% block page_product_detail_data_rich_snippet_price_currency %}
  86.     <meta itemprop="priceCurrency"
  87.     content="{{ context.currency.translated.shortName }}"/>
  88.     {% endblock %}
  89.     {% block page_product_detail_price %}
  90.     <div class="main-mc-block">
  91.         <div class="product-detail-price-container">
  92.             {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-price.html.twig' %}
  93.         </div>
  94.         {% block page_product_detail_tax %}
  95.         <div class="product-detail-tax-container">
  96.             {% if context.taxState == "gross" %}
  97.             {% set taxText = "general.grossTaxInformation"|trans|sw_sanitize %}
  98.             {% else %}
  99.             {% set taxText = "general.netTaxInformation"|trans|sw_sanitize %}
  100.             {% endif %}
  101.             <p class="product-detail-tax">
  102.                 {% block page_product_detail_tax_link %}
  103.                 <a class="product-detail-tax-link"
  104.                 href="/kundenservice/versandkosten/"
  105.                 title="{{ taxText }}"
  106.                 target="_blank">
  107.                 {{ taxText }}
  108.             </a>
  109.             {% endblock %}
  110.         </p>
  111.     </div>
  112.     {% endblock %}
  113.     {% if page.product.customFields.product_custom_fields_feed_voucher_price_string %}
  114.     {% if context.salesChannel.id !='45be9f42765d42e8ae1137d1812040f4' && context.salesChannel.id !='4faca3b6a7f149cea7ade06ee340ce19' %}
  115.     <div class="product-detail-promotion-container">
  116.         <div class="promotion-icon">
  117.             <img src="{{ asset('assets/images/discount.svg', "@AmMacTrade") }}" alt="Rabatt">
  118.         </div>
  119.         <div class="promotion-text">
  120.             Auch für <span> {{ page.product.customFields.product_custom_fields_feed_voucher_price_string|number_format(2, ',', '.') }} €</span> zinsfrei finanzieren mit dem Gutscheincode: <span>{{ page.product.customFields.product_custom_fields_feed_voucher_text }}</span>
  121.             <div class="promotion-link">Mehr Infos <a href="{{ page.product.customFields.product_custom_fields_feed_voucher_promotion_link }}" target="_blank"></a></div>
  122.         </div>
  123.     </div>
  124.     {% endif %}
  125.     {% endif %}
  126.     {% block page_product_detail_reviews %}
  127.     {% if page.product.ratingAverage > 0 and shopware.config.detail.showReviews %}
  128.     <p class="product-detail-reviews">
  129.         {% sw_include '@Storefront/storefront/component/review/rating.html.twig' with {
  130.             points: page.product.ratingAverage,
  131.             style: 'text-primary'
  132.         } %}
  133.         <a data-toggle="tab"
  134.         class="product-detail-reviews-link"
  135.         data-offcanvas-tabs="true"
  136.         data-remote-click="true"
  137.         data-remote-click-options='{
  138.             "selector": "#review-tab",
  139.             "scrollToElement": true
  140.         }'
  141.         href="#review-tab-pane"
  142.         aria-controls="review-tab-pane">
  143.         {{ page.reviews.totalReviews}}
  144.         {{ "detail.reviewLinkText"|trans({'%count%': page.reviews.totalReviews})|sw_sanitize }}
  145.     </a>
  146. </p>
  147. {% endif %}
  148. {% endblock %}
  149. {% block page_product_detail_buy_form %}
  150. {% if page.product.active %}
  151. <div class="product-detail-form-container">
  152.     <div class="col-12 pl-0">
  153.         {% sw_include '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' %}
  154.     </div>
  155. </div>
  156. {% endif %}
  157. {% endblock %}
  158. {% block page_product_detail_delivery_informations %}
  159.     <div class="pro-del-infobottom">
  160.         <div class="product-detail-delivery-information">
  161.             {% sw_include '@Storefront/storefront/component/delivery-information.html.twig' %}
  162.         </div>
  163.         <div class="product-detail-delivery-information pro-daynamic-info">
  164.         {% if page.product.productNumber %}
  165.             <div class="sb-tt-info">Produktnummer: {{page.product.productNumber }} </div>
  166.             {% endif %}
  167.                     {% if page.product.manufacturerNumber %}
  168.                     <div class="sb-tt-info">Herstellernummer: {{ page.product.manufacturerNumber }} </div>
  169.             {% endif %}
  170.         </div>
  171.     </div>
  172. {% endblock %}
  173. </div>
  174.     {% endblock %}
  175. {% endblock %}
  176. </div>
  177. {% endblock %}
  178. {% block page_product_detail_c2_widget %}
  179. {#{% if page.product.customFields.product_custom_fields_subscription == 1 and page.product.restockTime <= 10 %}#}
  180. {% 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 %}
  181. <div class="product-detail-c2-widget-container">
  182.  <div class="mac-abo-block"><div class="abo1">
  183.     <script>
  184.         var button
  185.         function initWi() {
  186.             button = new wi({
  187.                 productId: "{{page.product.productNumber}}",
  188.                 trackingId: "",
  189.                 color: "FFFFFF",
  190.                 backgroundColor: "4A4A49",
  191.                 hoverColor: "FFFFFF",
  192.                 hoverBackgroundColor: "042e41",
  193.                                 //poweredBy: "powered by c2 [circle]",
  194.                 poweredBy: "",
  195.                 widgetTitle: "",
  196.                 retailerTitle: "MacTrade Abo",
  197.                 manufacturerTitle: "", 
  198.                 button: "MacTrade Abo starten",
  199.                 priceCopy: "/Monat ({{ page.product.customFields.product_custom_fields_subscription_durationInMonths }} Mon.)",
  200.                 marketingLinkText: "Mehr Infos",
  201.                 marketingURL: "/mactrade-abo/",
  202.                 API: "https://backend.c2-circle.com",
  203.                 merchantIdentifier: "mactrade",
  204.                 buttonType: "large"
  205.             })
  206.             button.render(document.querySelectorAll("[data-wi-id=wi-button-container]"))
  207.         }
  208.         (function () {
  209.                 var s = document.createElement('script');
  210.                 s.type = 'text/javascript';
  211.                 s.async = true;
  212.                 s.src = 'https://www.c2-circle.com/partner/static/mactrade/script.js';
  213.                 var x = document.getElementsByTagName('script')[0];
  214.                 x.parentNode.insertBefore(s, x);
  215.             })();
  216.     </script>
  217.     <script>
  218.                         //var newProductId = "{{page.product.productNumber}}"
  219.                         //button.updateProduct(document.querySelectorAll("[data-wi-id=wi-button-container]"), newProductId)
  220.     </script>
  221.     <div data-wi-id="wi-button-container"></div>
  222.      <script>
  223.     
  224.         setTimeout(function() {
  225.             var wiPrice = $(".wi-price").html();
  226.             wiPrice = wiPrice.trim();
  227. console.log(wiPrice);
  228.             var wiPriceArr = wiPrice.split("&nbsp;");
  229.             $(".wi-price").html(wiPriceArr[1]+" "+wiPriceArr[0]+"*");
  230.         }, 1500);
  231. console.log("Kaufen=========");
  232. console.log('{{ page.extensions['amMactradeap1'].get('keyApi') }}');
  233.     </script>
  234. </div>
  235. {# start #} 
  236. {% if page.extensions['amMactradeap1'].get('keyApi') %}
  237. <div class="abo2-right">
  238.     <h3>Gutschrift für Ihr Altgerät</h3>
  239.     <div class="price-txt-zw"><p>zwischen</p> <h2 class='price_range_block'></h2></div>
  240.     <p class="price-mid-txt">
  241. {{ page.extensions['amMactradeap1'].get('keyApiText') }}
  242.     </p>
  243.     <button class="btn-black" onclick="javascript:window.open('https://mactrade.kauft-an.de/', '_blank');">Ankaufspreis ermitteln</button>
  244.     <div class="powe-line"><a href="https://mactrade.kauft-an.de/mactrade_c/hilfe/" target="_blank" class="small-link">Mehr Infos </a> <p>powered by kauft-an</p> </div>
  245. </div>
  246. <script>
  247. var categoryName = '{{page.product.customFields.product_custom_fields_product_family}}';
  248. //var categoryName = '{{name}}';
  249. var kaufenCatId = '';
  250. if(categoryName=='MAC')
  251. {
  252.     kaufenCatId = 110;
  253. }
  254. else if(categoryName=='IPAD')
  255. {
  256.     kaufenCatId = 3;
  257. }
  258. else if(categoryName=='IPHONE')
  259. {
  260.     kaufenCatId = 18;
  261. }
  262. else if(categoryName=='WATCH')
  263. {
  264.     kaufenCatId = 102;
  265. }
  266. else if(categoryName=='ACCESSORIES')
  267. {
  268.     kaufenCatId = 320;
  269. }
  270. else if(categoryName=='MacBook Air')
  271. {
  272.     kaufenCatId = 6;
  273. }
  274. kaufenCatId = '{{ page.extensions['amMactradeap1'].get('keyApi') }}';
  275. fetch('https://api.kauft-an.de/api/v1/product.pricerange/'+kaufenCatId, {
  276.   headers: {
  277.     'Authorization': 'Bearer 6|a46tPuG1bkeMaXx9JoxyI1VAC0LdSHOdalgqspem'
  278.   }
  279. })
  280.   .then(response => response.json())
  281.   .then(data => {
  282.     // Process the retrieved data
  283.     console.log(data);
  284.     document.querySelector('[class^="price_range_block"]').innerHTML = data.result.min_price+' € - '+data.result.max_price+' €*';
  285.     document.querySelector('[class^="price_range"]').innerHTML = data.result.min_price+' € - '+data.result.max_price+' €*';
  286.   })
  287.   .catch(error => {
  288.     // Handle any errors that occurred during the API call
  289.     console.error(error);
  290.   });
  291. </script>
  292. {% endif %}
  293. {# end #}
  294. </div>
  295. </div>
  296. {% else %}
  297. <div class="product-detail-c2-widget-container
  298. {% if category %}
  299. {% set breadcrumbCategories = sw_breadcrumb_full(category, context.context) %}
  300. {% for breadcrumbCategory in breadcrumbCategories %}
  301. {% set key = breadcrumbCategory.id %}
  302. {% set name = breadcrumbCategory.translated.name %}
  303. {% if loop.index == 1 %}
  304. {% if name == 'Zubehör' %}
  305. d-none
  306. {% endif %}
  307. {% endif %}
  308. {% endfor %}
  309. {% endif %}
  310. ">
  311.  <div class="mac-abo-block">
  312.  
  313.  {% if page.extensions['amMactradeap1'].get('keyApi') %}
  314. <div class="abo2-right">
  315.         
  316.          
  317.     <h3>Gutschrift für Ihr Altgerät</h3>
  318.     <div class="price-txt-zw"><p>zwischen</p> <h2 class='price_range_block'></h2></div>
  319.     <p class="price-mid-txt">für Ihr altes 
  320.     {% set category = page.header.navigation.active %}
  321. {% if category %}
  322. {% set breadcrumbCategories = sw_breadcrumb_full(category, context.context) %}
  323. {% set categoryId = category.id %}
  324. {% for breadcrumbCategory in breadcrumbCategories %}
  325. {% set key = breadcrumbCategory.id %}
  326. {% set name = breadcrumbCategory.translated.name %}
  327. {% if loop.index == 2 %}
  328. {{ name }}
  329. {% endif %}
  330. {% endfor %}
  331. {% endif %}
  332.     </p>
  333.     <button class="btn-black" onclick="javascript:window.open('https://mactrade.kauft-an.de/', '_blank');">Ankaufspreis ermitteln</button>
  334.     <div class="powe-line"><a href="https://mactrade.kauft-an.de/mactrade_c/hilfe/" target="_blank" class="small-link">Mehr Infos </a> <p>powered by kauft-an</p> </div>
  335. </div>
  336. <script>
  337. var categoryName = '{{page.product.customFields.product_custom_fields_product_family}}';
  338. var kaufenCatId = '';
  339. if(categoryName=='MAC')
  340. {
  341.     kaufenCatId = 110;
  342. }
  343. else if(categoryName=='IPAD')
  344. {
  345.     kaufenCatId = 3;
  346. }
  347. else if(categoryName=='IPHONE')
  348. {
  349.     kaufenCatId = 18;
  350. }
  351. else if(categoryName=='WATCH')
  352. {
  353.     kaufenCatId = 102;
  354. }
  355. else if(categoryName=='ACCESSORIES')
  356. {
  357.     kaufenCatId = 320;
  358. }
  359. kaufenCatId = '{{ page.extensions['amMactradeap1'].get('keyApi') }}';
  360. fetch('https://api.kauft-an.de/api/v1/product.pricerange/'+kaufenCatId, {
  361.   headers: {
  362.     'Authorization': 'Bearer 6|a46tPuG1bkeMaXx9JoxyI1VAC0LdSHOdalgqspem'
  363.   }
  364. })
  365.   .then(response => response.json())
  366.   .then(data => {
  367.     // Process the retrieved data
  368.     console.log(data);
  369.     document.querySelector('[class^="price_range_block"]').innerHTML = data.result.min_price+' € - '+data.result.max_price+' €*';
  370.     document.querySelector('[class^="price_range"]').innerHTML = data.result.min_price+' € - '+data.result.max_price+' €*';
  371.   })
  372.   .catch(error => {
  373.     // Handle any errors that occurred during the API call
  374.     console.error(error);
  375.   });
  376. //$(".wi-price").append("*");
  377. </script>
  378. {% endif %}
  379. {# end #}
  380. </div>
  381. </div>
  382. </div>
  383. </div>
  384. {% endif %}
  385. {% endblock %}
  386. </div>
  387. {% endblock %}