{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_body %}
{% if app.request.get('dmits-cart') && controllerName|lower=="checkout"%}
<span class="cart">{{ app.session.get('sw-context-token') }}</span>
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block base_script_hmr_mode %}
<script>
var optionsOpend=false;
var optionsClickToogle=true;
var createFunction="";
var pricegross_net="";
var dmits_customproducts_shopid="{{appShopId}}";
var dmits_customproducts_checkouturl=window.location.origin+"{{ path('frontend.checkout.cart.page') }}";
var dmits_customproducts_custom_product_js="{{ page.product.customFields.dmits_customproducts_product_custom_js|raw }}";
var dmits_customproducts_productid='{{ page.product.id }}';
var dmits_customproducts_showpreviewClass="{{config('DmitsCustomProducts.config.previewClass')}}";
var dmits_customproducts_labelprice="{{ "dmits.customproducts.custom.price"|trans|raw }}";
var dmits_customproducts_labelproduct="{{ "dmits.customproducts.custom.addtitle"|trans|raw }}";
var dmits_customproducts_currency='{{100000.8888888888|currency}}';
var dmits_customproducts_taxState="{{context.taxState}}";
var dmits_customproducts_label_pricefrom="{{ "dmits.customproducts.custom.pricefrom"|trans|raw }}";
var dmits_customproducts_label_pricingtitle="{{ "dmits.customproducts.custom.pricingtitle"|trans|raw }}";
var dmits_customproducts_error="{{ "dmits.customproducts.custom.error"|trans|raw|escape }}";
{% if (config('DmitsCustomProducts.config.active')) %}
var dmits_customproducts_active=1;
{% else %}
var dmits_customproducts_active=0;
{% endif %}
{% if (config('DmitsCustomProducts.config.showpricing')) %}
var dmits_customproducts_showpricing=1;
{% else %}
var dmits_customproducts_showpricing=0;
{% endif %}
{% if (config('DmitsCustomProducts.config.underimage')) %}
var dmits_customproducts_underimage=1;
{% else %}
var dmits_customproducts_underimage=0;
{% endif %}
{% if (config('DmitsCustomProducts.config.preview')) %}
var dmits_customproducts_showpreview=1;
{% else %}
var dmits_customproducts_showpreview=0;
{% endif %}
dmits_customproducts_token="";
function loadCartToken(){
if(dmits_customproducts_token=="") {
var xhr = new XMLHttpRequest();
xhr.open('GET', dmits_customproducts_checkouturl+"?dmits-cart=1", true);
xhr.onload = function () {
for(let i=0;i<$(this.responseText).length;i++){
if($($(this.responseText)[i]).hasClass("cart")){
dmits_customproducts_token=$($(this.responseText)[i]).text();
//callback();
}
}
}
xhr.send();
}else{
//callback();
}
}
loadCartToken();
</script>
{{ parent() }}
{% endblock %}