custom/apps/DmitsCustomProducts/Resources/views/storefront/base.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/base.html.twig' %}
  2. {% block base_body %}
  3.     {% if app.request.get('dmits-cart') && controllerName|lower=="checkout"%}
  4.         <span class="cart">{{ app.session.get('sw-context-token') }}</span>
  5.     {% else %}
  6.         {{ parent() }}
  7.     {% endif %}
  8. {% endblock %}
  9. {% block base_script_hmr_mode  %}
  10.     <script>
  11.         var optionsOpend=false;
  12.         var optionsClickToogle=true;
  13.         var createFunction="";
  14.         var pricegross_net="";
  15.         
  16.         var dmits_customproducts_shopid="{{appShopId}}";
  17.         
  18.         var dmits_customproducts_checkouturl=window.location.origin+"{{ path('frontend.checkout.cart.page') }}";
  19.         
  20.         var dmits_customproducts_custom_product_js="{{ page.product.customFields.dmits_customproducts_product_custom_js|raw }}";
  21.         
  22.         var dmits_customproducts_productid='{{ page.product.id }}';
  23.         
  24.             var dmits_customproducts_showpreviewClass="{{config('DmitsCustomProducts.config.previewClass')}}";
  25.         
  26.         var dmits_customproducts_labelprice="{{  "dmits.customproducts.custom.price"|trans|raw }}";
  27.         var dmits_customproducts_labelproduct="{{  "dmits.customproducts.custom.addtitle"|trans|raw }}";
  28.         var dmits_customproducts_currency='{{100000.8888888888|currency}}';
  29.         var dmits_customproducts_taxState="{{context.taxState}}";
  30.         
  31.         
  32.         var dmits_customproducts_label_pricefrom="{{  "dmits.customproducts.custom.pricefrom"|trans|raw }}";
  33.         
  34.         var dmits_customproducts_label_pricingtitle="{{  "dmits.customproducts.custom.pricingtitle"|trans|raw }}";
  35.         
  36.         var dmits_customproducts_error="{{  "dmits.customproducts.custom.error"|trans|raw|escape }}"; 
  37.         {%  if (config('DmitsCustomProducts.config.active')) %}
  38.         var dmits_customproducts_active=1;
  39.         {% else %}
  40.         var dmits_customproducts_active=0;
  41.         {% endif %}
  42.         {%  if (config('DmitsCustomProducts.config.showpricing')) %}
  43.         var dmits_customproducts_showpricing=1;
  44.         {% else %}
  45.         var dmits_customproducts_showpricing=0;
  46.         {% endif %}
  47.         
  48.         {%  if (config('DmitsCustomProducts.config.underimage')) %}
  49.         var dmits_customproducts_underimage=1;
  50.         {% else %}
  51.         var dmits_customproducts_underimage=0;
  52.         {% endif %}
  53.         {%  if (config('DmitsCustomProducts.config.preview')) %}
  54.         var dmits_customproducts_showpreview=1;
  55.         {% else %}
  56.         var dmits_customproducts_showpreview=0;
  57.         {% endif %}
  58.         dmits_customproducts_token="";
  59.     function     loadCartToken(){
  60.             if(dmits_customproducts_token=="") {
  61.                 var xhr = new XMLHttpRequest();
  62.           
  63.                   xhr.open('GET', dmits_customproducts_checkouturl+"?dmits-cart=1", true);
  64.                   xhr.onload = function () {
  65.                       for(let i=0;i<$(this.responseText).length;i++){
  66.                           if($($(this.responseText)[i]).hasClass("cart")){
  67.                               dmits_customproducts_token=$($(this.responseText)[i]).text();
  68.                               //callback();
  69.                           }
  70.                       }
  71.                   }
  72.                   xhr.send();
  73.             }else{
  74.                 //callback();
  75.                 }
  76.             
  77.         }
  78.     loadCartToken();
  79.   </script>
  80.     {{ parent() }}
  81. {% endblock %}