{% block page_product_detail_buy_inner %}
<div class="product-detail-buy js-magnifier-zoom-image-container">
{% block page_product_detail_rich_snippets %}
{% block page_product_detail_rich_snippets_brand %}
{% if page.product.manufacturer %}
<meta itemprop="brand"
content="{{ page.product.manufacturer.translated.name }}"/>
{% endif %}
{% endblock %}
{% block page_product_detail_rich_snippets_gtin13 %}
{% if page.product.ean %}
<meta itemprop="gtin13"
content="{{ page.product.ean }}"/>
{% endif %}
{% endblock %}
{% block page_product_detail_rich_snippets_mpn %}
<meta itemprop="mpn"
content="{{ page.product.productNumber }}"/>
{% endblock %}
{% block page_product_detail_rich_snippets_weight %}
{% if page.product.weight %}
<meta itemprop="weight"
content="{{ page.product.weight }} kg"/>
{% endif %}
{% endblock %}
{% block page_product_detail_rich_snippets_height %}
{% if page.product.height %}
<meta itemprop="height"
content="{{ page.product.height }} mm"/>
{% endif %}
{% endblock %}
{% block page_product_detail_rich_snippets_width %}
{% if page.product.width %}
<meta itemprop="width"
content="{{ page.product.width }} mm"/>
{% endif %}
{% endblock %}
{% block page_product_detail_rich_snippets_depth %}
{% if page.product.length %}
<meta itemprop="depth"
content="{{ page.product.length }} mm"/>
{% endif %}
{% endblock %}
{% block page_product_detail_rich_snippets_release_date %}
<meta itemprop="releaseDate"
content="{{ page.product.releaseDate|format_date('short', locale=app.request.locale) }}"/>
{% endblock %}
{% endblock %}
{% block page_product_detail_not_available %}
{#TODO: NEXT-2784 - product not available message#}
{% endblock %}
{% block page_product_detail_buy_container %}
<div itemprop="offers"
itemscope
itemtype="{% if page.product.calculatedPrices|length > 1 %}http://schema.org/AggregateOffer{% else %}http://schema.org/Offer{% endif %}">
{% block page_product_detail_configurator_include %}
{% if page.product.parentId and page.configuratorSettings|length > 0 %}
<div class="product-detail-configurator-container">
{% sw_include '@Storefront/storefront/page/product-detail/configurator.html.twig' %}
</div>
{% endif %}
{% endblock %}
{% block page_product_detail_data %}
{% block page_product_detail_data_rich_snippet_url %}
<meta itemprop="url"
content="{{ seoUrl('frontend.detail.page', { productId: page.product.id }) }}"/>
{% endblock %}
{% block page_product_detail_data_rich_snippet_price_range %}
{% if page.product.calculatedPrices|length > 1 %}
{% set lowestPrice = false %}
{% set highestPrice = false %}
{% for price in page.product.calculatedPrices %}
{% if not lowestPrice or price.unitPrice < lowestPrice %}
{% set lowestPrice = price.unitPrice %}
{% endif %}
{% if not highestPrice or price.unitPrice > highestPrice %}
{% set highestPrice = price.unitPrice %}
{% endif %}
{% endfor %}
<meta itemprop="lowPrice" content="{{ lowestPrice }}"/>
<meta itemprop="highPrice" content="{{ highestPrice }}"/>
<meta itemprop="offerCount" content="{{ page.product.calculatedPrices|length }}"/>
{% endif %}
{% endblock %}
{% block page_product_detail_data_rich_snippet_price_currency %}
<meta itemprop="priceCurrency"
content="{{ context.currency.translated.shortName }}"/>
{% endblock %}
{% block page_product_detail_price %}
<div class="main-mc-block">
<div class="product-detail-price-container">
{% sw_include '@Storefront/storefront/page/product-detail/buy-widget-price.html.twig' %}
</div>
{% block page_product_detail_tax %}
<div class="product-detail-tax-container">
{% if context.taxState == "gross" %}
{% set taxText = "general.grossTaxInformation"|trans|sw_sanitize %}
{% else %}
{% set taxText = "general.netTaxInformation"|trans|sw_sanitize %}
{% endif %}
<p class="product-detail-tax">
{% block page_product_detail_tax_link %}
<a class="product-detail-tax-link"
href="/kundenservice/versandkosten/"
title="{{ taxText }}"
target="_blank">
{{ taxText }}
</a>
{% endblock %}
</p>
</div>
{% endblock %}
{% if page.product.customFields.product_custom_fields_feed_voucher_price_string %}
{% if context.salesChannel.id !='45be9f42765d42e8ae1137d1812040f4' && context.salesChannel.id !='4faca3b6a7f149cea7ade06ee340ce19' %}
<div class="product-detail-promotion-container">
<div class="promotion-icon">
<img src="{{ asset('assets/images/discount.svg', "@AmMacTrade") }}" alt="Rabatt">
</div>
<div class="promotion-text">
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>
<div class="promotion-link">Mehr Infos <a href="{{ page.product.customFields.product_custom_fields_feed_voucher_promotion_link }}" target="_blank"></a></div>
</div>
</div>
{% endif %}
{% endif %}
{% block page_product_detail_reviews %}
{% if page.product.ratingAverage > 0 and shopware.config.detail.showReviews %}
<p class="product-detail-reviews">
{% sw_include '@Storefront/storefront/component/review/rating.html.twig' with {
points: page.product.ratingAverage,
style: 'text-primary'
} %}
<a data-toggle="tab"
class="product-detail-reviews-link"
data-offcanvas-tabs="true"
data-remote-click="true"
data-remote-click-options='{
"selector": "#review-tab",
"scrollToElement": true
}'
href="#review-tab-pane"
aria-controls="review-tab-pane">
{{ page.reviews.totalReviews}}
{{ "detail.reviewLinkText"|trans({'%count%': page.reviews.totalReviews})|sw_sanitize }}
</a>
</p>
{% endif %}
{% endblock %}
{% block page_product_detail_buy_form %}
{% if page.product.active %}
<div class="product-detail-form-container">
<div class="col-12 pl-0">
{% sw_include '@Storefront/storefront/page/product-detail/buy-widget-form.html.twig' %}
</div>
</div>
{% endif %}
{% endblock %}
{% block page_product_detail_delivery_informations %}
<div class="pro-del-infobottom">
<div class="product-detail-delivery-information">
{% sw_include '@Storefront/storefront/component/delivery-information.html.twig' %}
</div>
<div class="product-detail-delivery-information pro-daynamic-info">
{% if page.product.productNumber %}
<div class="sb-tt-info">Produktnummer: {{page.product.productNumber }} </div>
{% endif %}
{% if page.product.manufacturerNumber %}
<div class="sb-tt-info">Herstellernummer: {{ page.product.manufacturerNumber }} </div>
{% endif %}
</div>
</div>
{% endblock %}
</div>
{% endblock %}
{% endblock %}
</div>
{% endblock %}
{% block page_product_detail_c2_widget %}
{#{% if page.product.customFields.product_custom_fields_subscription == 1 and page.product.restockTime <= 10 %}#}
{% 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 %}
<div class="product-detail-c2-widget-container">
<div class="mac-abo-block"><div class="abo1">
<script>
var button
function initWi() {
button = new wi({
productId: "{{page.product.productNumber}}",
trackingId: "",
color: "FFFFFF",
backgroundColor: "4A4A49",
hoverColor: "FFFFFF",
hoverBackgroundColor: "042e41",
//poweredBy: "powered by c2 [circle]",
poweredBy: "",
widgetTitle: "",
retailerTitle: "MacTrade Abo",
manufacturerTitle: "",
button: "MacTrade Abo starten",
priceCopy: "/Monat ({{ page.product.customFields.product_custom_fields_subscription_durationInMonths }} Mon.)",
marketingLinkText: "Mehr Infos",
marketingURL: "/mactrade-abo/",
API: "https://backend.c2-circle.com",
merchantIdentifier: "mactrade",
buttonType: "large"
})
button.render(document.querySelectorAll("[data-wi-id=wi-button-container]"))
}
(function () {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://www.c2-circle.com/partner/static/mactrade/script.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
})();
</script>
<script>
//var newProductId = "{{page.product.productNumber}}"
//button.updateProduct(document.querySelectorAll("[data-wi-id=wi-button-container]"), newProductId)
</script>
<div data-wi-id="wi-button-container"></div>
<script>
setTimeout(function() {
var wiPrice = $(".wi-price").html();
wiPrice = wiPrice.trim();
console.log(wiPrice);
var wiPriceArr = wiPrice.split(" ");
$(".wi-price").html(wiPriceArr[1]+" "+wiPriceArr[0]+"*");
}, 1500);
console.log("Kaufen=========");
console.log('{{ page.extensions['amMactradeap1'].get('keyApi') }}');
</script>
</div>
{# start #}
{% if page.extensions['amMactradeap1'].get('keyApi') %}
<div class="abo2-right">
<h3>Gutschrift für Ihr Altgerät</h3>
<div class="price-txt-zw"><p>zwischen</p> <h2 class='price_range_block'></h2></div>
<p class="price-mid-txt">
{{ page.extensions['amMactradeap1'].get('keyApiText') }}
</p>
<button class="btn-black" onclick="javascript:window.open('https://mactrade.kauft-an.de/', '_blank');">Ankaufspreis ermitteln</button>
<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>
</div>
<script>
var categoryName = '{{page.product.customFields.product_custom_fields_product_family}}';
//var categoryName = '{{name}}';
var kaufenCatId = '';
if(categoryName=='MAC')
{
kaufenCatId = 110;
}
else if(categoryName=='IPAD')
{
kaufenCatId = 3;
}
else if(categoryName=='IPHONE')
{
kaufenCatId = 18;
}
else if(categoryName=='WATCH')
{
kaufenCatId = 102;
}
else if(categoryName=='ACCESSORIES')
{
kaufenCatId = 320;
}
else if(categoryName=='MacBook Air')
{
kaufenCatId = 6;
}
kaufenCatId = '{{ page.extensions['amMactradeap1'].get('keyApi') }}';
fetch('https://api.kauft-an.de/api/v1/product.pricerange/'+kaufenCatId, {
headers: {
'Authorization': 'Bearer 6|a46tPuG1bkeMaXx9JoxyI1VAC0LdSHOdalgqspem'
}
})
.then(response => response.json())
.then(data => {
// Process the retrieved data
console.log(data);
document.querySelector('[class^="price_range_block"]').innerHTML = data.result.min_price+' € - '+data.result.max_price+' €*';
document.querySelector('[class^="price_range"]').innerHTML = data.result.min_price+' € - '+data.result.max_price+' €*';
})
.catch(error => {
// Handle any errors that occurred during the API call
console.error(error);
});
</script>
{% endif %}
{# end #}
</div>
</div>
{% else %}
<div class="product-detail-c2-widget-container
{% if category %}
{% set breadcrumbCategories = sw_breadcrumb_full(category, context.context) %}
{% for breadcrumbCategory in breadcrumbCategories %}
{% set key = breadcrumbCategory.id %}
{% set name = breadcrumbCategory.translated.name %}
{% if loop.index == 1 %}
{% if name == 'Zubehör' %}
d-none
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
">
<div class="mac-abo-block">
{% if page.extensions['amMactradeap1'].get('keyApi') %}
<div class="abo2-right">
<h3>Gutschrift für Ihr Altgerät</h3>
<div class="price-txt-zw"><p>zwischen</p> <h2 class='price_range_block'></h2></div>
<p class="price-mid-txt">für Ihr altes
{% set category = page.header.navigation.active %}
{% if category %}
{% set breadcrumbCategories = sw_breadcrumb_full(category, context.context) %}
{% set categoryId = category.id %}
{% for breadcrumbCategory in breadcrumbCategories %}
{% set key = breadcrumbCategory.id %}
{% set name = breadcrumbCategory.translated.name %}
{% if loop.index == 2 %}
{{ name }}
{% endif %}
{% endfor %}
{% endif %}
</p>
<button class="btn-black" onclick="javascript:window.open('https://mactrade.kauft-an.de/', '_blank');">Ankaufspreis ermitteln</button>
<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>
</div>
<script>
var categoryName = '{{page.product.customFields.product_custom_fields_product_family}}';
var kaufenCatId = '';
if(categoryName=='MAC')
{
kaufenCatId = 110;
}
else if(categoryName=='IPAD')
{
kaufenCatId = 3;
}
else if(categoryName=='IPHONE')
{
kaufenCatId = 18;
}
else if(categoryName=='WATCH')
{
kaufenCatId = 102;
}
else if(categoryName=='ACCESSORIES')
{
kaufenCatId = 320;
}
kaufenCatId = '{{ page.extensions['amMactradeap1'].get('keyApi') }}';
fetch('https://api.kauft-an.de/api/v1/product.pricerange/'+kaufenCatId, {
headers: {
'Authorization': 'Bearer 6|a46tPuG1bkeMaXx9JoxyI1VAC0LdSHOdalgqspem'
}
})
.then(response => response.json())
.then(data => {
// Process the retrieved data
console.log(data);
document.querySelector('[class^="price_range_block"]').innerHTML = data.result.min_price+' € - '+data.result.max_price+' €*';
document.querySelector('[class^="price_range"]').innerHTML = data.result.min_price+' € - '+data.result.max_price+' €*';
})
.catch(error => {
// Handle any errors that occurred during the API call
console.error(error);
});
//$(".wi-price").append("*");
</script>
{% endif %}
{# end #}
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
</div>
{% endblock %}