custom/apps/DmitsCustomerGroupsPriceApp/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') %}
  4.             hello
  5.     {% else %}
  6.         {{ parent() }}
  7.     {% endif %}
  8.     
  9. {% endblock %}
  10. {% block base_script_hmr_mode %}
  11.     {{ parent() }}
  12.     <script>
  13.     const data = JSON.stringify({
  14.   items: [
  15.     {
  16.       type: 'promotion',
  17.       referencedId: 'sss'
  18.     }
  19.   ]
  20. });
  21. const xhr = new XMLHttpRequest();
  22. xhr.withCredentials = true;
  23. xhr.addEventListener('readystatechange', function () {
  24.   if (this.readyState === this.DONE) {
  25.     console.log(this.responseText);
  26.   }
  27. });
  28. xhr.open('POST', '/store-api/checkout/cart/line-item');
  29. xhr.setRequestHeader('Content-Type', 'application/json');
  30. xhr.setRequestHeader('Accept', 'application/json');
  31. xhr.setRequestHeader('sw-access-key', '{{context.salesChannel.accessKey}}');
  32. xhr.setRequestHeader('sw-context-token', '{{ app.session.get('sw-context-token') }}');
  33. xhr.send(data);
  34.         var dmits_customergroupprice_active="0";
  35.         {% if context.customer &&  config('DmitsCustomerGroupsPriceApp.config.isActive')=="1"%}
  36.             var dmits_customergroupprice_active="1";
  37.         {% endif %}
  38.         var dmits_customergroupprice_shopid="{{appShopId}}";
  39.         var dmits_customergroupprice_saleschannel="{{context.salesChannel.id}}";
  40.         var dmits_customergroupprice_token="{{ app.session.get('sw-context-token') }}";
  41.         var dmits_customergroupprice_productname="{{  "dmits.customergrouppriceapp.discountproductname"|trans|raw }}";
  42.         var dmits_customergroupprice_savedText="{{  "detail.listPricePercentage"|trans }}";
  43.         var dmits_customergroupprice_percentageRounding="{{  config('DmitsCustomerGroupsPriceApp.config.percentageRounding') }}";
  44.         var dmits_customergroupprice_showSaving="{{  config('DmitsCustomerGroupsPriceApp.config.showSaving') }}";
  45.         {% if controllerName|lower=="checkout" && controllerAction|lower!="finishpage"%}
  46.             var dmits_customergroupprice_currentpage="{{controllerName|lower}}";
  47.         {% else %}
  48.             var dmits_customergroupprice_currentpage="";
  49.         {% endif %}
  50.         var dmits_customergroupprice_numberTemplate="{{100000.00|currency}}";
  51.       
  52.     </script>
  53. {% endblock %}