KURV TEST

Exception in template (Designs\Rapido\eCom7/CartV2/Step/CartDWTESTER.cshtml): System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.eabcbecbbe.b__11(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateWriter.cs:line 50
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateBase.cs:line 337
   at CompiledRazorTemplates.Dynamic.eabcbecbbe.<>c__DisplayClass6.b__5(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateWriter.cs:line 50
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateBase.cs:line 337
   at CompiledRazorTemplates.Dynamic.eabcbecbbe.<>c__DisplayClass2.b__0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateWriter.cs:line 50
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateBase.cs:line 337
   at CompiledRazorTemplates.Dynamic.eabcbecbbe.<>c__DisplayClass6.b__5(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateWriter.cs:line 50
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateBase.cs:line 337
   at CompiledRazorTemplates.Dynamic.eabcbecbbe.<>c__DisplayClass2.b__0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateWriter.cs:line 50
   at RazorEngine.Templating.TemplateBase.Write(TemplateWriter helper) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateBase.cs:line 192
   at CompiledRazorTemplates.Dynamic.eabcbecbbe.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateBase.cs:line 126
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateService.cs:line 608
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Templating\TemplateService.cs:line 439
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, DynamicViewBag viewBag, String cacheName) in c:\Users\abbottm\Documents\GitHub\RazorEngine\src\Core\RazorEngine.Core\Razor.cs:line 290
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Extensibility @using Dynamicweb.Content @using Dynamicweb.Core @using Dynamicweb.Ecommerce.Orders @using Dynamicweb.Ecommerce.Orders.SalesDiscounts @using System @using Dynamicweb.Rapido.Blocks @functions{ BlocksPage checkoutPage = BlocksPage.GetBlockPage("CheckoutPage"); string checkoutPageType = "onestep"; } @{ string pageId = GetGlobalValue("Global:Page.ID"); Block checkoutTopSnippets = new Block() { Id = "CheckoutTopSnippets", SortId = 10 }; checkoutPage.Add(checkoutTopSnippets); Block addressContainer = new Block() { Id = "AddressContainer", SortId = 20, Design = new Design { RenderType = RenderType.Column, Size = "4", HidePadding = true }, BlocksList = new List<Block> { new Block() { Id = "AddressContainerRow", SortId = 10, Design = new Design { RenderType = RenderType.Row } } } }; checkoutPage.Add(addressContainer); Block orderContainer = new Block() { Id = "OrderContainer", SortId = 30, Design = new Design { RenderType = RenderType.Column, Size = "auto", HidePadding = true }, BlocksList = new List<Block> { new Block() { Id = "OrderContainerRow", SortId = 10, Design = new Design { RenderType = RenderType.Row } } } }; checkoutPage.Add(orderContainer); Block checkoutBottomSnippets = new Block() { Id = "CheckoutBottomSnippets", SortId = 50 }; checkoutPage.Add(checkoutBottomSnippets); } @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ @using System.Text.RegularExpressions @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @*--- START: Base block renderers ---*@ @helper RenderBlockList(List<Block> blocks) { blocks = blocks.OrderBy(item => item.SortId).ToList(); foreach (Block item in blocks) { <!-- START: @item.Id --> if (item.Design == null) { @RenderBlock(item) } else if (item.Design.RenderType != RenderType.Hide) { if (item.Design.RenderType == RenderType.Row) { <div class="grid grid--align-content-start"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.Column) { string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; string size = item.Design.Size != null ? item.Design.Size : "12"; size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding" id="Block__@item.Id"> @RenderBlock(item) </div> } if (item.SkipRenderBlocksList == true) { @RenderBlock(item) } } <!-- END: @item.Id --> } } @helper RenderBlock(Block item) { if (item.Template != null) { @BlocksPage.RenderTemplate(item.Template) } if (item.BlocksList.Count > 0 && item.SkipRenderBlocksList == false) { @RenderBlockList(item.BlocksList) } } @*--- END: Base block renderers ---*@ @* Include the Blocks for the page *@ @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @{ BlocksPage billingAddressCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); Block billingAddressBlock = new Block() { Id = "BillingAddress", SortId = 10, Template = RenderCustomerAddress(), Design = new Design { RenderType = RenderType.Column, Size = "12" } }; billingAddressCheckoutPage.Add("AddressContainerRow", billingAddressBlock); Block addressScriptTemplates = new Block() { Id = "AddressTemplates", SortId = 10, Template = RenderAddressScriptTemplates() }; billingAddressCheckoutPage.Add("CheckoutBottomSnippets", addressScriptTemplates); } @helper RenderCustomerAddress() { string editProfileLink = "/Default.aspx?ID=" + GetPageIdByNavigationTag("CustomerProfile").ToString(); <div class="card-header u-color-light--bg dw-mod"> <h3><i class="fas fa-home"></i> @Translate("Billing address")</h3> </div> <div class="card u-color-light--bg dw-mod"> @if (!Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")) || GetLoop("ValidationErrors").Count > 0) { //When the user is not signed in, or there are form errors, give the possibility to either sign in or create address if (!Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) { @*<label class="btn btn--secondary btn--full dw-mod more" for="SignInModalTrigger">@Translate("Already a customer?")</label>*@ } <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerCompany">@Translate("Company")</label> <input type="text" class="u-full-width" name="EcomOrderCustomerCompany" id="EcomOrderCustomerCompany" value="@GetString("Ecom:Order.Customer.Company")" /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCompany.ErrorMessage")</div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerName">@Translate("Name")</label> <input type="text" class="u-full-width" name="EcomOrderCustomerName" id="EcomOrderCustomerName" value="@GetString("Ecom:Order.Customer.Name")" required /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerName.ErrorMessage")</div> </div> <div class="form__fields-collection form__fields-collection--2-3"> <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerPhone">@Translate("Phone")</label> <input type="tel" class="u-full-width" name="EcomOrderCustomerPhone" id="EcomOrderCustomerPhone" value="@GetString("Ecom:Order.Customer.Phone")" required /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerPhone.ErrorMessage")</div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerEmail">@Translate("Email")</label> @if (GetBoolean("Ecom:Cart.CreateUserInCheckout") && string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName"))) { <input type="email" class="u-full-width" name="EcomOrderCustomerEmail" id="EcomOrderCustomerEmail" value="@GetString("Ecom:Order.Customer.Email")" onchange="document.getElementById('EcomUserCreateUserName').value = this.value;" required /> <input type="hidden" name="EcomUserCreateUserName" id="EcomUserCreateUserName" value="@GetString("Ecom:Order.Customer.Email")" /> <input type="hidden" name="EcomUserCreateNew" value="True" /> string pass = Guid.NewGuid().ToString(); <input type="hidden" name="EcomUserCreatePassword" value="@pass" /> <input type="hidden" name="EcomUserCreateConfirmPassword" value="@pass" /> } else { <input type="email" class="u-full-width" name="EcomOrderCustomerEmail" id="EcomOrderCustomerEmail" value="@GetString("Ecom:Order.Customer.Email")" required /> } <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerEmail.ErrorMessage")</div> </div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerAddress">@Translate("Address")</label> <input type="text" class="u-full-width" name="EcomOrderCustomerAddress" id="EcomOrderCustomerAddress" value="@GetString("Ecom:Order.Customer.Address")" required /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerAddress.ErrorMessage")</div> </div> <div class="form__fields-collection form__fields-collection--2-3"> <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerZip">@Translate("Zip code")</label> <input type="text" class="u-full-width" name="EcomOrderCustomerZip" id="EcomOrderCustomerZip" value="@GetString("Ecom:Order.Customer.Zip")" required /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerZip.ErrorMessage")</div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerCity">@Translate("City")</label> <input type="text" class="u-full-width" name="EcomOrderCustomerCity" id="EcomOrderCustomerCity" value="@GetString("Ecom:Order.Customer.City")" required /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCity.ErrorMessage")</div> </div> </div> if (GetLoop("CustomerRegions").Count > 0) { <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerState">@Translate("State/Region")</label> <select class="u-full-width" name="EcomOrderCustomerRegion" id="EcomOrderCustomerRegion" onchange="Cart.SubmitCart()"> @foreach (LoopItem state in GetLoop("CustomerRegions")) { string selected = GetString("Ecom:Order.Customer.Region") == state.GetString("Ecom:CustomerRegion.Name") ? "selected" : ""; <option value="@state.GetString("Ecom:CustomerRegion.Name")" @selected>@state.GetString("Ecom:CustomerRegion.Name")</option> } </select> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerState.ErrorMessage")</div> </div> } <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerCountry">@Translate("Country")</label> <select class="u-full-width" name="EcomOrderCustomerCountry" id="EcomOrderCustomerCountry" onchange="Cart.SubmitCart()"> @{ string customerCountry = GetString("Ecom:Order.Customer.Country.Code"); foreach (LoopItem country2 in GetLoop("Countries")) { string selected = GetString("Ecom:Order.Customer.Country.Code") == country2.GetString("Ecom:Country.Code2") ? "selected" : ""; if (string.IsNullOrEmpty(customerCountry) && string.IsNullOrEmpty(selected)) { selected = country2.GetString("Ecom:Country.Code2") == GetGlobalValue("Global:Area.Culture.CountryCode").ToString() ? "selected" : ""; } <option value="@country2.GetString("Ecom:Country.Code2")" @selected>@country2.GetString("Ecom:Country.Name")</option> } } </select> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCountry.ErrorMessage")</div> </div> } else { //When the user is signed in, show static address fields <table class="table table--clean table--condensed"> @if (!String.IsNullOrEmpty(GetString("Ecom:Order.Customer.Company"))) { <tr> <td class="u-bold">@Translate("Company")</td> <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerCompany" id="EcomOrderCustomerCompany" value="@GetString("Ecom:Order.Customer.Company")" readonly /></td> </tr> } <tr> <td class="u-bold">@Translate("Name")</td> <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerName" id="EcomOrderCustomerName" value="@GetString("Ecom:Order.Customer.Name")" readonly /></td> </tr> <tr> <td class="u-bold">@Translate("Phone")</td> <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerPhone" id="EcomOrderCustomerPhone" value="@GetString("Ecom:Order.Customer.Phone")" readonly /></td> </tr> <tr> <td class="u-bold">@Translate("Email")</td> <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerEmail" id="EcomOrderCustomerEmail" value="@GetString("Ecom:Order.Customer.Email")" readonly /></td> </tr> <tr> <td class="u-bold">@Translate("Address")</td> <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerAddress" id="EcomOrderCustomerAddress" value="@GetString("Ecom:Order.Customer.Address")" readonly /></td> </tr> <tr> <td class="u-bold">@Translate("Zip code")</td> <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerZip" id="EcomOrderCustomerZip" value="@GetString("Ecom:Order.Customer.Zip")" readonly /></td> </tr> <tr> <td class="u-bold">@Translate("City")</td> <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerCity" id="EcomOrderCustomerCity" value="@GetString("Ecom:Order.Customer.City")" readonly /></td> </tr> @if (GetLoop("CustomerRegions").Count > 0) { string selectedStateName = ""; foreach (LoopItem state in GetLoop("CustomerRegions")) { if (GetString("Ecom:Order.Customer.Region") == state.GetString("Ecom:CustomerRegion.Name")) { selectedStateName = state.GetString("Ecom:CustomerRegion.Name"); } } <tr> <td class="u-bold">@Translate("State/Region")</td> <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerRegion" id="EcomOrderCustomerRegion" value="@selectedStateName" readonly /></td> </tr> } <tr> <td class="u-bold">@Translate("Country")</td> <td> @foreach (LoopItem country in GetLoop("Countries")) { if (GetString("Ecom:Order.Customer.Country") == country.GetString("Ecom:Country.Code2") || GetString("Ecom:Order.Customer.Country.Code") == country.GetString("Ecom:Country.Code2")) { <input type="hidden" name="EcomOrderCustomerCountry" id="EcomOrderCustomerCountry" value="@country.GetString("Ecom:Country.Code2")" /> <input type="text" class="u-full-width u-truncate-text" value="@country.GetString("Ecom:Country.Name")" readonly /> } } @if (GetLoop("Countries").Count == 0) { <input type="hidden" name="EcomOrderCustomerCountry" id="EcomOrderCustomerCountry" value="" /> <input type="text" class="u-full-width u-truncate-text" value="" readonly /> } </td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> </table> <a href="@editProfileLink" class="btn btn--secondary btn--full u-no-margin dw-mod">@Translate("Edit profile")</a> } </div> } @helper RenderAddressScriptTemplates() { @* Templates for addresses *@ <script id="DeliveryAddressFieldsTemplate" type="text/x-template"> {{#.}} <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryCompany">@Translate("Company")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryCompany" id="EcomOrderDeliveryCompany" value="{{company}}" /> <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCompany.ErrorMessage")</div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryName">@Translate("Name")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryName" id="EcomOrderDeliveryName" value="{{name}}" /> <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryName.ErrorMessage")</div> </div> <div class="form__fields-collection form__fields-collection--2-3"> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryPhone">@Translate("Phone")</label> <input type="tel" class="u-full-width" name="EcomOrderDeliveryPhone" id="EcomOrderDeliveryPhone" value="{{phone}}" /> <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryPhone.ErrorMessage")</div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryEmail">@Translate("Email")</label> <input type="email" class="u-full-width" name="EcomOrderDeliveryEmail" id="EcomOrderDeliveryEmail" value="{{email}}" /> <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryEmail.ErrorMessage")</div> </div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryAddress">@Translate("Address")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryAddress" id="EcomOrderDeliveryAddress" value="{{address}}" /> <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryAddress.ErrorMessage")</div> </div> <div class="form__fields-collection form__fields-collection--2-3"> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryZip">@Translate("Zip")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryZip" id="EcomOrderDeliveryZip" value="{{zip}}" /> <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryZip.ErrorMessage")</div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryCity">@Translate("City")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryCity" id="EcomOrderDeliveryCity" value="{{city}}" /> <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCity.ErrorMessage")</div> </div> </div> <div class="form__field-group dw-mod"> <label for="Country">@Translate("Country")</label> <select class="u-full-width" name="EcomOrderDeliveryCountry" id="Country" onchange="Cart.SubmitCart()" data-countryCode="{{countryCode}}"> {{#Country}} <option value="{{id}}" {{selected}}>{{name}}</option> {{/Country}} </select> </div> {{/.}} {{^.}} @Translate("No address found") {{/.}} </script> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @functions { string Truncate(string str, int count) { return str.Substring(0, Math.Min(str.Length, count)); } } @{ BlocksPage shippingAddressCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); Block shippingAddressBlock = new Block() { Id = "ShippingAddress", SortId = 20, Template = RenderShippingAddress(), Design = new Design { RenderType = RenderType.Column, Size = "12" } }; shippingAddressCheckoutPage.Add("AddressContainerRow", shippingAddressBlock); } @helper RenderShippingAddress() { string manageAddresses = "/Default.aspx?ID=" + GetPageIdByNavigationTag("CustomerProfile").ToString() + "&Action=ManageAddresses"; int cartAddressesFeedPageId = GetPageIdByNavigationTag("CartAddressesFeed"); <div class="card-header u-color-light--bg dw-mod"> <h3><i class="fas fa-map-marker"></i> @Translate("Shipping address")</h3> </div> <div class="card u-color-light--bg dw-mod"> <div class="form__field-group u-margin-bottom--lg"> <input type="checkbox" id="AlternateAddressBlock" class="js-remember-state form__control" data-expand="AlternateAddressBlock" /> <label for="AlternateAddressBlock">@Translate("Add alternative adr.")</label> </div> <div class="expandable--collapsed" data-trigger="AlternateAddressBlock"> @if (GetLoop("UserManagement:User.UserAddresses").Count > 0) { <div class="form__field-combi"> <select id="DeliveryAddressSelector" class="u-full-width" onchange="HandlebarsBolt.UpdateContent('DeliveryAddressFields', '/Default.aspx?ID=@cartAddressesFeedPageId&AddressId=' + this.value);"> <option value="-1">@Translate("Select saved address")</option> @foreach (LoopItem address in GetLoop("UserManagement:User.UserAddresses")) { string description = Truncate(address.GetString("UserManagement:User.UserAddress.Description"), 25); string userAddress = Truncate(address.GetString("UserManagement:User.UserAddress.Address"), 20); <option value="@address.GetString("UserManagement:User.UserAddress.ID")">@description (@userAddress)</option> } </select> <a href="@manageAddresses" id="ManageAddressButton" class="btn btn--primary dw-mod btn--condensed u-no-margin" title="@Translate("Add new address", "Add new address")"><i class="fas fa-plus"></i></a> </div> } @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")) && GetLoop("UserManagement:User.UserAddresses").Count > 0) { <div class="js-handlebars-root" id="DeliveryAddressFields" data-template="DeliveryAddressFieldsTemplate" data-json-feed="/Default.aspx?ID=@cartAddressesFeedPageId&AddressId=0" data-preloader="minimal"></div> } else { <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryCompany">@Translate("Company")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryCompany" id="EcomOrderDeliveryCompany" value="@GetString("Ecom:Order.Delivery.Company")" /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCompany.ErrorMessage")</div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryName">@Translate("Name")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryName" id="EcomOrderDeliveryName" value="@GetString("Ecom:Order.Delivery.Name")" /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryName.ErrorMessage")</div> </div> <div class="form__fields-collection form__fields-collection--2-3"> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryPhone">@Translate("Phone")</label> <input type="tel" class="u-full-width" name="EcomOrderDeliveryPhone" id="EcomOrderDeliveryPhone" value="@GetString("Ecom:Order.Delivery.Phone")" /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryPhone.ErrorMessage")</div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryEmail">@Translate("Email")</label> <input type="email" class="u-full-width" name="EcomOrderDeliveryEmail" id="EcomOrderDeliveryEmail" value="@GetString("Ecom:Order.Delivery.Email")" /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryEmail.ErrorMessage")</div> </div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryAddress">@Translate("Address")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryAddress" id="EcomOrderDeliveryAddress" value="@GetString("Ecom:Order.Delivery.Address")" /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryAddress.ErrorMessage")</div> </div> <div class="form__fields-collection form__fields-collection--2-3"> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryZip">@Translate("Zip")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryZip" id="EcomOrderDeliveryZip" value="@GetString("Ecom:Order.Delivery.Zip")" /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryZip.ErrorMessage")</div> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryCity">@Translate("City")</label> <input type="text" class="u-full-width" name="EcomOrderDeliveryCity" id="EcomOrderDeliveryCity" value="@GetString("Ecom:Order.Delivery.City")" /> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCity.ErrorMessage")</div> </div> </div> if (GetLoop("DeliveryRegions").Count > 0) { <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryRegion">@Translate("State/Region")</label> <select class="u-full-width" name="EcomOrderDeliveryRegion" id="EcomOrderDeliveryRegion" onchange="Cart.SubmitCart()"> @foreach (LoopItem state in GetLoop("DeliveryRegions")) { string selected = GetString("Ecom:Order.Delivery.Region") == state.GetString("Ecom:DeliveryRegion.Name") ? "selected" : ""; <option value="@state.GetString("Ecom:DeliveryRegion.Name")" @selected>@state.GetString("Ecom:DeliveryRegion.Name")</option> } </select> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryState.ErrorMessage")</div> </div> } <div class="form__field-group dw-mod"> <label for="EcomOrderDeliveryCountry">@Translate("Country")</label> <select class="u-full-width" name="EcomOrderDeliveryCountry" id="EcomOrderDeliveryCountry" onchange="Cart.SubmitCart()"> @{ string deliveryCountry = GetString("Ecom:Order.Delivery.Country.Code"); foreach (LoopItem country in GetLoop("Countries")) { string selected = GetString("Ecom:Order.Delivery.Country.Code") == country.GetString("Ecom:Country.Code2") ? "selected" : ""; if (string.IsNullOrEmpty(deliveryCountry) && string.IsNullOrEmpty(selected)) { selected = country.GetString("Ecom:Country.Code2") == GetGlobalValue("Global:Area.Culture.CountryCode").ToString() ? "selected" : ""; } <option value="@country.GetString("Ecom:Country.Code2")" @selected>@country.GetString("Ecom:Country.Name")</option> } } </select> </div> } </div> </div> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @{ BlocksPage paymentCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); bool pointShop = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Ecommerce").GetString("PointShopOnly")) ? Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly") : false; if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HidePayment") && GetLoop("Paymethods").Count != 0 && !pointShop) { Block paymentBlock = new Block() { Id = "Payment", SortId = 10, Template = RenderPayment(), Design = new Design { RenderType = RenderType.Column, Size = "6" } }; paymentCheckoutPage.Add("OrderContainerRow", paymentBlock); } } @helper RenderPayment() { string cardHeightClass = Pageview.Device.ToString() != "Tablet" ? "u-full-height" : ""; string savedCardName = ""; <div class="card-header u-color-light--bg dw-mod"> <h3><i class="fas fa-credit-card"></i> @Translate("Payment")</h3> </div> <div class="card u-color-light--bg @cardHeightClass dw-mod"> @foreach (LoopItem payment in GetLoop("Paymethods")) { bool supportSavedCards = payment.GetBoolean("Ecom:Cart.Paymethod.SupportSavedCard") && Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")); string cardIsSaved = !String.IsNullOrEmpty(payment.GetString("Ecom:Order.SavedCardName")) ? "checked" : ""; string selected = payment.GetBoolean("Ecom:Cart.Paymethod.IsSelected") ? "checked" : ""; <div> <div class="form__field-group u-margin-bottom"> <input class="form__control" data-expand="savedCards_@payment.GetString("Ecom:Cart.Paymethod.Name")" onchange="Cart.DeselectRadioGroup('EcomCartSavedCardID'); Cart.SubmitCart()" type="radio" name="EcomCartPaymethodID" id="EcomCartPaymethodID_@payment.GetString("Ecom:Cart.Paymethod.ID")" value="@payment.GetString("Ecom:Cart.Paymethod.ID")" @selected /> <label for="EcomCartPaymethodID_@payment.GetString("Ecom:Cart.Paymethod.ID")" class="u-inline">@payment.GetString("Ecom:Cart.Paymethod.Name")</label> </div> @if (supportSavedCards) { <div class="expandable--collapsed dw-mod" data-trigger="savedCards_@payment.GetString("Ecom:Cart.Paymethod.Name")"> <div class="u-border-top u-border-bottom u-padding u-margin-bottom show"> <div class="form__field-group u-margin-bottom"> <input type="checkbox" class="form__control" name="EcomOrderSavedCardCreate" id="EcomOrderSavedCardCreate_@payment.GetString("Ecom:Cart.Paymethod.ID")" value="true" @cardIsSaved /> <label for="EcomOrderSavedCardCreate_@payment.GetString("Ecom:Cart.Paymethod.ID")">@Translate("Save used card")</label> </div> <div> <input type="text" class="u-full-width u-no-margin" onkeyup="document.getElementById('MySavedCardName').value = this.value;" placeholder="@Translate("Saved card name")" value="@payment.GetString("Ecom:Order.SavedCardName")" /> </div> </div> </div> } </div> } @if (GetLoop("SavedCards").Count > 0) { <div class="u-bold u-margin-top">@Translate("Pay with a saved card")</div> foreach (LoopItem card in GetLoop("SavedCards")) { string selected = card.GetBoolean("Ecom:SavedCard.IsSelected") ? "checked" : ""; <div> <input onchange="Cart.DeselectRadioGroup('EcomCartPaymethodID'); Cart.SubmitCart()" class="form__control" type="radio" name="EcomCartSavedCardID" id="EcomCartSavedCardID" value="@card.GetString("Ecom:SavedCard.ID")" @selected /> <label for="EcomCartSavedCardID" class="u-inline u-margin-bottom">@card.GetString("Ecom:SavedCard.Name")</label> </div> if (!String.IsNullOrEmpty(selected)) { savedCardName = card.GetString("Ecom:SavedCard.Name"); } } } <input type="hidden" name="EcomOrderSavedCardName" id="MySavedCardName" value="@savedCardName" /> </div> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @{ BlocksPage shippingCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); if (GetLoop("Shippingmethods").Count > 0) { Block shippingBlock = new Block() { Id = "Shipping", SortId = 20, Template = RenderShipping(), Design = new Design { RenderType = RenderType.Column, Size = "6" } }; shippingCheckoutPage.Add("OrderContainerRow", shippingBlock); Block parcelShopsModal = new Block() { Id = "ParcelShopsModal", SortId = 10, Template = RenderParcelShopsModal() }; shippingCheckoutPage.Add("CheckoutTopSnippets", parcelShopsModal); } } @helper RenderShipping() { string cardHeightClass = Pageview.Device.ToString() != "Tablet" ? "u-full-height" : ""; bool defaultShippingIsSet = Dynamicweb.Ecommerce.Orders.Shipping.GetDefaultShippingMethod(Dynamicweb.Ecommerce.Common.Context.Cart.ShippingMethodCountryCode) != null; <div class="card-header u-color-light--bg dw-mod"> <h3><i class="fas fa-truck"></i> @Translate("Shipping")</h3> </div> <div class="card u-color-light--bg @cardHeightClass dw-mod"> @{ bool haveShippingContent = GetLoop("Shippingmethods").Count != 1 || !defaultShippingIsSet; bool showShippingsBlock = haveShippingContent; } @foreach (LoopItem shipping in GetLoop("Shippingmethods")) { bool selected = Converter.ToBoolean(shipping.GetString("Ecom:Cart.Shippingmethod.IsSelected")); object shippingProviderContent = selected ? Newtonsoft.Json.JsonConvert.DeserializeObject(shipping.GetString("Ecom:ShippingProvider.Content")) : null; string isChecked = "checked"; //selected ? "checked" : ""; string hideLabel = haveShippingContent ? "" : "u-hidden"; string leftMargin = haveShippingContent ? "u-margin-left" : ""; <div class="form__field-group dw-mod"> <input onchange="Cart.SubmitCart()" type="radio" class="form__control" name="EcomCartShippingmethodID" id="EcomCartShippingmethodID_@shipping.GetString("Ecom:Cart.Shippingmethod.ID")" value="@shipping.GetString("Ecom:Cart.Shippingmethod.ID")" @isChecked /> @*<label for="EcomCartShippingmethodID_@shipping.GetString("Ecom:Cart.Shippingmethod.ID")" class="@hideLabel"> @shipping.GetString("Ecom:Cart.Shippingmethod.Name") </label>*@ <p>@Translate("Shipping free if you buy for more than 100EURO")</p> </div> if (shippingProviderContent != null) { showShippingsBlock = true; <div id="ShippingProviderContent" class="@leftMargin" data-template="ShippingProviderContentTemplate"></div> <script> document.addEventListener("DOMContentLoaded", function (event) { HandlebarsBolt.CreateItemsFromJson(@shippingProviderContent, "ShippingProviderContent", "ShippingProviderContentTemplate"); HandlebarsBolt.CreateItemsFromJson(@shippingProviderContent, "ParcelShops", "ParcelShopsTemplate"); }); var data = @shippingProviderContent; if (document.getElementById("DeliveryAddressFields")) { document.getElementById("DeliveryAddressFields").addEventListener("contentLoaded", setParcelShopToDeliveryFields); } else { setParcelShopToDeliveryFields(); } function setParcelShopToDeliveryFields() { var deliveryAddress = document.getElementById("EcomOrderDeliveryAddress").value; if (data != "") { if (deliveryAddress == "") { document.getElementById("AlternateAddressBlock").checked = true; document.getElementById("EcomOrderDeliveryCompany").value = data[0].ParcelShops[0].company; document.getElementById("EcomOrderDeliveryName").value = data[0].ParcelShops[0].company; document.getElementById("EcomOrderDeliveryPhone").value = ""; document.getElementById("EcomOrderDeliveryEmail").value = ""; document.getElementById("EcomOrderDeliveryAddress").value = data[0].ParcelShops[0].address; document.getElementById("EcomOrderDeliveryZip").value = data[0].ParcelShops[0].zip; document.getElementById("EcomOrderDeliveryCity").value = data[0].ParcelShops[0].city; document.getElementById("Country").setAttribute("data-countrycode", data[0].ParcelShops[0].countryCode); } } document.getElementById("DeliveryAddressFields").removeEventListener("contentLoaded", setParcelShopToDeliveryFields); } </script> } if (shipping.GetString("Ecom:ShippingProvider.Content") != "" && @shipping.GetString("Ecom:ShippingProvider.Content").Length < 10) { <button class="btn btn--secondary btn--full u-no-margin u-margin-bottom dw-mod" onclick="Cart.SubmitCart()">@Translate("Get parcel shops")</button> <small class="help-text dw-mod">@Translate("Requires an address for either billing og shipping")</small> } } @if (!showShippingsBlock) { <script> document.getElementById("shippingsBlock").classList.add("u-hidden"); </script> } </div> } @helper RenderParcelShopsModal() { string parcelShopModalHeader = Pageview.Device.ToString() != "Mobile" ? Translate("Choose a parcel shop") : Translate("Choose"); <!-- Trigger for the pacel shops modal --> <input type="checkbox" id="ParcelShopsModalTrigger" class="modal-trigger" /> <!-- Map modal --> <div class="modal-container"> <label for="ParcelShopsModalTrigger" id="ParcelShopsModalOverlay" class="modal-overlay"></label> <div class="modal modal--lg" id="ParcelShopsModal"> <div class="modal__header"> <h2>@parcelShopModalHeader</h2> </div> <div class="modal__body"> <div class="grid"> <div class="grid__col-auto"> <ul class="list list--clean list--scroll dw-mod" id="ParcelShops" data-template="ParcelShopsTemplate"></ul> </div> @if (Pageview.Device.ToString() != "Mobile") { <div class="grid__col-8"> <div class="map-container"> <div id="MapCanvas" class="map-container__canvas"></div> </div> </div> } </div> </div> </div> </div> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @{ BlocksPage voucherCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideVoucher")) { Block voucherBlock = new Block() { Id = "Voucher", SortId = 30, Template = RenderVoucher(), Design = new Design { RenderType = RenderType.Column, Size = "auto" } }; voucherCheckoutPage.Add("OrderContainerRow", voucherBlock); } } @helper RenderVoucher() { string cardHeightClass = Pageview.Device.ToString() != "Tablet" ? "u-full-height" : ""; <div class="card-header u-color-light--bg dw-mod"> <h3><i class="fas fa-gift"></i> @Translate("Voucher")</h3> </div> <div class="card u-color-light--bg @cardHeightClass dw-mod"> <div class="form__field-combi"> <input type="text" class="u-full-width" placeholder="@Translate("Enter voucher code")" name="EcomOrderVoucherCode" id="EcomOrderVoucherCode" onkeyup="checkEmpty();" value="@GetString("Ecom:Order.Customer.VoucherCode")" /> <button type="submit" class="btn btn--primary dw-mod btn--condensed u-no-margin" id="EcomOrderVoucherApply" disabled>@Translate("Apply")</button> </div> <script> function checkEmpty() { document.getElementById("EcomOrderVoucherApply").disabled = document.getElementById("EcomOrderVoucherCode").value.trim() == ""; } checkEmpty(); </script> @{ var errors = new List<string>(); string voucherCode = GetString("Ecom:Order.Customer.VoucherCode"); if (!string.IsNullOrWhiteSpace(voucherCode)) { Order order = new OrderService().GetOrder(GetString("Ecom:Order.ID")); IEnumerable<string> codes = new List<string>(); if (order.VoucherUseType.HasFlag(VoucherUseCategoryType.Discount)) { codes = voucherCode.Split(new string[] { ",", ";", " " }, StringSplitOptions.RemoveEmptyEntries); } else { codes = new string[] { voucherCode.Trim() }; } foreach (string code in codes) { Voucher vouch = Voucher.GetVoucherByCode(code); if (vouch == null) { errors.Add(Translate("Voucher") + " <span class=u-bold>" + code + "</span> " + Translate("not found")); continue; } if (vouch.DateUsed.HasValue) { errors.Add(Translate("Voucher") + " <span class=u-bold>" + code + "</span> " + Translate("already used")); continue; } VoucherList voucherList = VoucherList.GetListById(vouch.ListId); if (!voucherList.ListActive) { errors.Add(Translate("Voucher") + " <span class=u-bold>" + code + "</span> " + Translate("is not active")); continue; } <div class="field-success u-margin-bottom dw-mod">@Translate("Voucher") <span class="u-bold">@code</span> @Translate("applied to order")</div> } foreach (string error in errors) { <div class="field-error u-margin-bottom dw-mod">@error</div> } } } </div> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @{ BlocksPage recurringCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); if (!string.IsNullOrWhiteSpace(GetString("Ecom:Order.PaymentMethod.RecurringSupport")) && !Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideRecurringOrder")) { Block recurringOrderBlock = new Block() { Id = "RecurringOrder", SortId = 40, Template = RenderRecurringOrder(), Design = new Design { RenderType = RenderType.Column, Size = "12" } }; recurringCheckoutPage.Add("OrderContainerRow", recurringOrderBlock); } } @helper RenderRecurringOrder() { string cardHeightClass = Pageview.Device.ToString() != "Tablet" ? "u-full-height" : ""; string dateFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern; <div class="card-header u-color-light--bg dw-mod"> <h3><i class="fas fa-calendar"></i> @Translate("Recurring order")</h3> </div> <div class="card u-color-light--bg @cardHeightClass dw-mod"> <div class="form__field-group u-margin-bottom"> <input type="checkbox" class="js-remember-state form__control" checked="@GetBoolean("Ecom:Order.Recurring.Enabled")" name="EcomRecurringOrderCreate" data-expand="EcomRecurringOrderCreate" id="EcomRecurringOrderCreate"> <label for="EcomRecurringOrderCreate">@Translate("Create recurring order")</label> </div> <div class="expandable--collapsed" data-trigger="EcomRecurringOrderCreate"> <div class="form__field-group dw-mod"> <label for="Country">@Translate("I want my order every")</label> <div class="grid grid--external-bleed-x"> <div class="grid__col-6 grid__col--bleed-y"> <select class="u-full-width" name="EcomOrderRecurringInterval" id="EcomOrderRecurringInterval"> @*interval*@ @for (var i = 1; i <= 12; i++) { <option value="@i" @(GetInteger("Ecom:Order.Recurring.Interval") == i ? "selected" : "")> @i</option> } </select> </div> <div class="grid__col-6 grid__col--bleed-y"> <select class="u-full-width" name="EcomOrderRecurringIntervalUnit" id="EcomOrderRecurringIntervalUnit"> @{ var units = new[] { "Days", "Weeks", "Months" }; } @for (int i = 0; i < units.Length; i++) { <option value="@i" @(GetInteger("Ecom:Order.Recurring.IntervalUnit") == i ? "selected" : "")>@Translate(units[i])</option> } </select> </div> </div> </div> <div class="grid grid--external-bleed-x"> <div class="grid__col-6 grid__col--bleed-y"> <div class="form__field-group dw-mod"> <label for="EcomOrderRecurringStartDate">@Translate("Start date")</label> @{string startDate = !string.IsNullOrEmpty(GetString("Ecom:Order.Recurring.StartDate.Clean")) ? GetDate("Ecom:Order.Recurring.StartDate.Clean").ToString(dateFormat) : "";} <input type="text" class="u-full-width" id="EcomOrderRecurringStartDate" name="EcomOrderRecurringStartDate" placeholder="@Translate("Never")" value="@startDate" /> </div> </div> <div class="grid__col-6 grid__col--bleed-y"> <div class="form__field-group dw-mod"> <label for="EcomOrderRecurringEndDate">@Translate("And it should end on")</label> @{string endDate = !string.IsNullOrEmpty(GetString("Ecom:Order.Recurring.EndDate.Clean")) ? GetDate("Ecom:Order.Recurring.EndDate.Clean").ToString(dateFormat) : "";} <input type="text" class="u-full-width" id="EcomOrderRecurringEndDate" name="EcomOrderRecurringEndDate" placeholder="@Translate("Never")" value="@endDate"> </div> </div> </div> </div> </div> //* *// <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css"> <style> .flatpickr-months .flatpickr-month { height: 40px; } </style> <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script> <script> @{ dateFormat = dateFormat.Replace("dd", "d"); dateFormat = dateFormat.Replace("MM", "m"); dateFormat = dateFormat.Replace("yyyy", "Y"); } flatpickr("#EcomOrderRecurringStartDate, #EcomOrderRecurringEndDate", { dateFormat: "@dateFormat", minDate: "today" }); </script> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @functions{ BlocksPage reviewOrderCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); int cartOrderlinesFeedPageId; string pageId; } @{ string reviewOrderType = checkoutPageType != null ? checkoutPageType : "onestep"; //The "checkoutPageType" comes from the main template for the cart page pageId = GetGlobalValue("Global:Page.ID"); cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); Block reviewOrderBlock = new Block() { Id = "ReviewOrder", SortId = 50, Template = RenderReviewOrder(), SkipRenderBlocksList = true }; reviewOrderCheckoutPage.Add("OrderContainerRow", reviewOrderBlock); if (reviewOrderType == "onestep") { Block inlineAcceptanceBlock = new Block() { Id = "Acceptance", SortId = 10, Template = RenderInlineAcceptance() }; reviewOrderCheckoutPage.Add("ReviewOrder", inlineAcceptanceBlock); Block reviewOrderFooterBlock = new Block() { Id = "ReviewOrderFooter", SortId = 20, Template = RenderReviewOrderFooter() }; reviewOrderCheckoutPage.Add("ReviewOrder", reviewOrderFooterBlock); } if (reviewOrderType == "quote") { Block reviewOrderFooterBlock = new Block() { Id = "ReviewOrderFooter", SortId = 20, Template = RenderReviewOrderFooterQuote() }; reviewOrderCheckoutPage.Add("ReviewOrder", reviewOrderFooterBlock); } Block reviewOrderScriptTemplates = new Block() { Id = "ReviewOrderScriptTempaltes", SortId = 30, Template = RenderReviewOrderScriptTemplates() }; reviewOrderCheckoutPage.Add("CheckoutBottomSnippets", reviewOrderScriptTemplates); Block reviewOrderScripts = new Block() { Id = "ReviewOrderScripts", SortId = 40, Template = RenderOrderScripts() }; reviewOrderCheckoutPage.Add("CheckoutBottomSnippets", reviewOrderScripts); } @helper RenderReviewOrder() { cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); <div class="grid__col-12"> <div class="js-handlebars-root" id="Cart" data-template="CartContent" data-cart-id="@cartOrderlinesFeedPageId" data-json-feed="/Default.aspx?ID=@cartOrderlinesFeedPageId" data-preloader="overlay"></div> </div> } @helper RenderReviewOrderScriptTemplates() { List<Block> subBlocks = reviewOrderCheckoutPage.GetBlockListById("ReviewOrder").OrderBy(item => item.SortId).ToList(); bool pointShop = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Ecommerce").GetString("PointShopOnly")) ? Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly") : false; int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage"); bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); @* Template for when the cart is empty *@ <script id="EmptyCart" type="text/x-template"> @Translate("You have no items in the cart") </script> @* Template for the cart *@ <script id="CartContent" type="text/x-template"> {{#.}} @if (useGoogleTagManager) { <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> } <div class="card-header u-color-light--bg dw-mod"> <h3> @Translate("Review order") ({{numberofproducts}})</h3> </div> <div class="card u-color-light--bg u-no-padding--xs dw-mod"> <div class="{{isempty}}"> <table class="table cart-table dw-mod"> <tbody id="OrderLines"> {{#OrderLines}} {{#ifCond template "===" "CartOrderline"}} {{>CartOrderline}} {{/ifCond}} {{#ifCond template "===" "CartOrderlineMobile"}} {{>CartOrderlineMobile}} {{/ifCond}} {{#ifCond template "===" "CartOrderlineDiscount"}} {{>CartOrderlineDiscount}} {{/ifCond}} {{/OrderLines}} </tbody> </table> </div> <div class="grid u-border-top"> <div class="grid__col-sm-6"> @if (Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints") && !string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName"))) { <text> {{#if userPoints}} <div class="u-border u-border-color--loyalty-points u-padding--lg u-full-height"> <h3 class="u-no-margin">@Translate("Your point balance")</h3> <div class="u-font-size--lg u-margin-bottom"> <span class="u-color--loyalty-points">{{userPoints}}</span> @Translate("points") </div> <div>@Translate("On this order you will use"): <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")</div> </div> {{/if}} </text> } </div> <div class="grid__col-sm-6"> @if (!pointShop) { <div class="{{hideSubTotal}}"> <div class="cart-summary__subtotals dw-mod">@Translate("Subtotal")</div> <div class="cart-summary__subtotals u-pull--right dw-mod">{{subtotalprice}}</div> </div> <div class="{{hidePaymentfee}}"> <div class="cart-summary__info dw-mod"><i class="fas fa-credit-card"></i> {{paymentmethod}}</div> <div class="cart-summary__info u-pull--right dw-mod">{{paymentfee}}</div> </div> } <div class="{{hideShippingfee}}"> <div class="cart-summary__info dw-mod"><i class="fas fa-truck"></i> {{shippingmethod}}</div> <div class="cart-summary__info u-pull--right dw-mod">{{shippingfee}}</div> </div> @if (!pointShop) { <div> <div class="cart-summary__info dw-mod">@Translate("VAT")</div> <div class="cart-summary__info u-pull--right dw-mod">{{totalvat}}</div> </div> } @if (Pageview.User != null && Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints")) { <text> {{#if earnings}} <div> <div class="cart-summary__info dw-mod">@Translate("Earnings")</div> <div class="cart-summary__info u-pull--right dw-mod"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</div> </div> {{/if}} </text> } <div class="cart-summary__totals-container dw-mod"> <div class="cart-summary__totals dw-mod">@Translate("Total")</div> <div class="cart-summary__totals u-pull--right dw-mod"> @if (pointShop) { <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") } else { <text>{{totalprice}}</text> } </div> </div> </div> </div> <div class="grid"> <div class="grid__col-12 grid__col--line-top"></div> </div> <div class="grid__cell u-padding--xs {{hideComment}}"> <textarea rows="3" class="u-full-width" placeholder="@Translate("Enter comment")" name="EcomOrderCustomerComment" id="EcomOrderCustomerComment">{{comment}}</textarea> </div> @foreach (LoopItem error in GetLoop("ValidationErrors")) { <div class="error-block">@error.GetString("Ecom:Cart.ValidationError.ErrorMessage")</div> } @RenderBlockList(subBlocks) </div> {{/.}} </script> @* Template for the orderlines *@ <script id="CartOrderline" type="text/x-template"> <tr id="Orderline{{id}}" class="cart-orderline {{isempty}}"> <td class="cart-orderline__cell cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><div class="cart-orderline__cell__block {{hideimage}} dw-mod"><img src="/Admin/Public/GetImage.ashx?width=60&height=60&crop=5&Compression=75&image={{image}}" alt="{{name}} {{variantname}}"></div></td> <td class="cart-orderline__cell dw-mod" title="{{name}} {{variantname}}"> <a href="{{link}}" class="u-color-inherit cart-orderline__name">{{name}}</a> <div class="cart-orderline__cell__block item-number dw-mod">#{{productnumber}}</div> {{#if variantname}} <div class="cart-orderline__cell__block item-number dw-mod">{{variantname}}</div> {{/if}} {{#if unitname}} <div class="cart-orderline__cell__block item-number dw-mod">{{unitname}}</div> {{/if}} </td> <td class="cart-orderline__cell u-ta-right u-hidden-xs u-hidden-xxs dw-mod" width="120"> {{#if pointsTotal}} <span class="u-color--loyalty-points">{{pointPrice}}</span> @Translate("points") {{else}} {{unitprice}} {{/if}} </td> @if (!Dynamicweb.Ecommerce.Common.Context.Cart.IsQuote) { <td class="cart-orderline__cell u-ta-right dw-mod" width="80"><input class="u-w80px u-no-margin" id="Quantity_{{orderLineId}}" type="number" min="1" onchange="Cart.ChangeQuantity('@cartOrderlinesFeedPageId', '{{orderLineId}}', this.value)" name='QuantityOrderLine{{orderLineId}}' value="{{quantity}}"></td> <td class="cart-orderline__cell u-ta-left dw-mod" width="50"><button type="button" class="btn btn--clean btn--condensed u-no-margin" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', '&CartCmd=DelOrderLine&key={{orderLineId}}', true);"><i class="fas fa-times"></i></button></td> } else { <td class="cart-orderline__cell u-ta-right dw-mod" width="80"> <input id="Quantity_{{orderLineId}}" type="hidden" name='QuantityOrderLine{{orderLineId}}' value="{{quantity}}"> <div class="u-w80px u-no-margin">{{quantity}}</div> </td> } <td class="cart-orderline__cell u-ta-right dw-mod"> {{#if pointsTotal}} <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") {{else}} <div>{{totalprice}}</div> {{/if}} {{#if canBePurchasedWithPoints}} <button type="button" onclick="Cart.BuyForPoints('@pageId', '@cartOrderlinesFeedPageId', '{{orderLineId}}', '{{id}}', '{{variantId}}');" class="btn btn--loyalty-points dw-mod btn--sm u-no-margin" title="@Translate("Use") {{pointPrice}} @Translate("points")"><i class="far fa-tag"></i> @Translate("Use") {{pointPrice}} @Translate("points")</button> {{/if}} </td> </tr> <tr class="{{hideBomItems}}"> <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><div class="{{hideimage}}"></div></td> <td colspan="5" class="u-no-padding"> <table class="u-no-margin u-color-light-gray--bg"> <tbody> {{#BomItems}} <tr> <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><img src="/Admin/Public/GetImage.ashx?width=60&height=60&crop=5&Compression=75&image={{image}}" alt="{{name}} {{variantname}}"></td> <td title="{{name}} {{variantname}}"> <a href="{{link}}" class="u-color-inherit dw-mod">{{name}}</a> <div class="item-number dw-mod">#{{productnumber}}</div> {{#if variantname}} <div class="item-number dw-mod">{{variantname}}</div> {{/if}} {{#if unitname}} <div class="item-number dw-mod">{{unitname}}</div> {{/if}} </td> <td class="u-hidden-xs u-hidden-xxs">&nbsp;</td> <td>{{quantity}}</td> <td>&nbsp;</td> <td class="cart-table__price u-ta-right dw-mod">&nbsp;</td> </tr> {{/BomItems}} </tbody> </table> </td> </tr> </script> <script id="CartOrderlineMobile" type="text/x-template"> <tr id="Orderline{{id}}" class="{{isempty}}"> <td class="cart-table__image dw-mod"><div class="{{hideimage}}"><img src="/Admin/Public/GetImage.ashx?width=60&height=60&crop=5&Compression=75&image={{image}}" alt="{{name}} {{variantname}}"></div></td> <td title="{{name}} {{variantname}}" colspan="4"> <a href="{{link}}" class="u-color-inherit">{{name}}</a> <div>#{{productnumber}}</div> {{#if variantname}} <div>{{variantname}}</div> {{/if}} {{#if unitname}} <div>{{unitname}}</div> {{/if}} </td> </tr> <tr class="{{isempty}} table__row--no-border"> <td class="cart-table__image dw-mod"></td> <td colspan="4"> <div class="u-pull--left"> <input class="u-w80px u-no-margin" id="Quantity_{{orderLineId}}" type="number" min="1" onchange="Cart.ChangeQuantity('@cartOrderlinesFeedPageId', '{{orderLineId}}', this.value)" name='QuantityOrderLine{{orderLineId}}' value="{{quantity}}"> <span><button type="button" class="btn btn--clean btn--condensed u-no-margin" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', '&CartCmd=DelOrderLine&key={{orderLineId}}', true);"><i class="fas fa-times"></i></button></span> </div> <div class="u-pull--right u-ta-right"> {{#if pointsTotal}} <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") {{else}} <div>{{totalprice}}</div> {{/if}} {{#if canBePurchasedWithPoints}} <button type="button" onclick="Cart.BuyForPoints('@pageId', '@cartOrderlinesFeedPageId', '{{orderLineId}}', '{{id}}', '{{variantId}}');" class="btn btn--loyalty-points dw-mod btn--sm u-no-margin" name="CartCmd" value="addWithPoints" title="@Translate("Use") {{pointPrice}} @Translate("points")"><i class="far fa-tag"></i> @Translate("Use") {{pointPrice}} @Translate("points")</button> {{/if}} </div> </td> </tr> <tr class="{{hideBomItems}}"> <td colspan="6" class="u-no-padding"> <table class="u-no-margin u-color-light-gray--bg"> <tbody> {{#BomItems}} <tr> <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><img src="/Admin/Public/GetImage.ashx?width=120&height=120&crop=5&Compression=75&image={{image}}" alt="{{name}} {{variantname}}"></td> <td title="{{name}} {{variantname}}"> <a href="{{link}}" class="mini-cart-orderlines__name dw-mod">{{name}}</a> <div>#{{productnumber}}</div> {{#if variantname}} <div>{{variantname}}</div> {{/if}} {{#if unitname}} <div>{{unitname}}</div> {{/if}} </td> <td class="u-hidden-xs u-hidden-xxs">&nbsp;</td> <td>{{quantity}}</td> <td>&nbsp;</td> <td class="cart-table__price u-ta-right dw-mod">&nbsp;</td> </tr> {{/BomItems}} </tbody> </table> </td> </tr> </script> <script id="CartOrderlineDiscount" type="text/x-template"> <tr class="table__row--no-border"> <td class="cart-table__image dw-mod">&nbsp;</td> <td colspan="3">{{name}}</td> <td class="u-hidden-xs u-hidden-xxs">&nbsp;</td> <td class="cart-table__price u-ta-right dw-mod">{{totalprice}}</td> </tr> </script> } @helper RenderInlineAcceptance() { <div class="grid__cell u-padding--xs"> @if (GetBoolean("Ecom:Cart.UseNewsletterSubscription")) { <div class="form__field-group u-margin-bottom dw-mod"> <input type="hidden" name="EcomOrderSubscribeToNewsletter" /> <input type="checkbox" name="EcomOrderSubscribeToNewsletter" id="EcomOrderSubscribeToNewsletter" class="form__control"> <label for="EcomOrderSubscribeToNewsletter"> @Translate("Subscribe to newsletter") </label> </div> } <div class="form__field-group dw-mod"> <input type="checkbox" name="EcomOrderCustomerAccepted" id="EcomOrderCustomerAccepted" onchange="Cart.EnableCheckoutButton()" class="form__control"> <label for="EcomOrderCustomerAccepted"> @Translate("I accept the terms and conditions")&nbsp;<a href='@Translate("ConditionsLink","/Default.aspx?ID=585")' target="_blank">@Translate("Readmore", "Read more")</a> </label> </div> <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerAccepted.ErrorMessage")</div> </div> } @helper RenderReviewOrderFooter() { int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage"); <div class="grid"> <div class="grid__col-12 grid__col--line-top"></div> </div> <div class="grid__cell-footer"> <div class="grid__cell u-padding--xs"> <div class="u-pull--right"> <button type="submit" class="btn btn--primary btn--condensed dw-mod u-pull--right u-no-margin disabled" name="@GetString("CartV2.NextStepButtonName")" id="@GetString("CartV2.NextStepButtonName")" disabled>@Translate("Go to checkout")</button> </div> <div class="u-pull--left"> <button type="button" class="btn btn--secondary btn--condensed dw-mod u-pull--left u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button> </div> @if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideQuotesCartLink")) { <div class="u-pull--right"> <a href="/Default.aspx?ID=@quotesCartPageId" class="btn btn--link btn--condensed dw-mod u-no-margin u-margin-right--lg u-no-margin--xs">@Translate("Create quote request")</a> </div> } </div> </div> } @helper RenderReviewOrderFooterQuote() { <div class="grid"> <div class="grid__col-12 grid__col--line-top"></div> </div> <div class="grid__cell-footer"> <div class="grid__cell u-padding--xs"> <div class="u-pull--right"> <button type="submit" class="btn btn--primary btn--condensed dw-mod u-pull--right u-no-margin" name="@GetString("CartV2.NextStepButtonName")" id="@GetString("CartV2.NextStepButtonName")">@Translate("Submit quote request")</button> </div> <div class="u-pull--left"> <button type="button" class="btn btn--secondary btn--condensed dw-mod u-pull--left u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button> </div> </div> </div> } @helper RenderOrderScripts() { if (!string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"))) { <script> fbq('track', 'InitiateCheckout', { currency: '@GetString("Ecom:Order.Price.Currency.Code")', value: @GetDouble("Ecom:Order.Price.Price"), num_items: "@GetInteger("Ecom:Order.OrderLines.TotalProductQuantity")" }); </script> } } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @{ bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); BlocksPage googleImpressionsPage = BlocksPage.GetBlockPage("CheckoutPage"); Block googleImpressionsBlock = new Block() { Id = "GoogleImpressionsBlock", SortId = 10, Template = RenderScript() }; if (useGoogleTagManager) { googleImpressionsPage.Add("CheckoutBottomSnippets", googleImpressionsBlock); } } @helper RenderScript() { <script> /** * A function to handle a click on a checkout button. This function uses the eventCallback * data layer variable to handle navigation after the ecommerce data has been sent to Google Analytics. */ dataLayer.push({ 'event': 'checkout', 'ecommerce': { 'checkout': { 'actionField': {'step': 1}, 'products': [ @foreach (LoopItem orderline in GetLoop("OrderLines")) { var groupObject = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(orderline.GetString("Ecom:Product.PrimaryOrFirstGroupID")); <text> { 'name': "@orderline.GetString("Ecom:Order:OrderLine.ProductName")", 'id': "@orderline.GetString("Ecom:Product.ID")", 'price': "@orderline.GetDouble("Ecom:Order:OrderLine.UnitPrice.Price")", 'brand': "@orderline.GetString("Ecom:Product:Field.brand.Value")", 'category': "@(groupObject != null ? groupObject.Name : "")", 'variant': "@orderline.GetString("Ecom:Order:OrderLine.ProductVariantID")", 'quantity': @orderline.GetInteger("Ecom:Order:OrderLine.Quantity") }, </text> } ] } }, 'eventCallback': function() { document.location = 'checkout.html'; } }); </script> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @{ BlocksPage snippetsCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage"); Block parcelShopsScriptTemplates = new Block() { Id = "ShippingProviderTemplates", SortId = 10, Template = RenderShippingProviderTemplates() }; snippetsCheckoutPage.Add("CheckoutBottomSnippets", parcelShopsScriptTemplates); } @helper RenderShippingProviderTemplates() { <script id="ShippingProviderContentTemplate" type="text/x-template"> {{#.}} <div class="{{hideShippingProvider}}"> <ul class="list list--clean parcel-shop-address dw-mod" id="SelectedParcelShop"> {{#SelectedParcelShop}} <li data-number="{{number}}" data-lat="{{latitude}}" data-lng="{{longitude}}"> <div class="u-hidden"> <input type="radio" class="u-no-margin" name="{{fieldPrefix}}{{fieldPostfix}}" value="{{number}}" {{selected}} /> </div> <div> <i class="fas fa-map-marker"></i> <span class="u-bold">{{company}}, </span> <span>{{address}} </span> <span>{{city}} </span> <span>{{countryCode}} </span> </div> </li> {{/SelectedParcelShop}} {{^SelectedParcelShop}} <li>@Translate("No points found")</li> {{/SelectedParcelShop}} </ul> <div class="{{hideShippingProvider}}"> <label for="ParcelShopsModalTrigger" class="btn btn--secondary btn--full dw-mod" onclick="Maps.Init('MapCanvas', {{toJSON ParcelShops}}, Cart.SelectParcelShop, Cart.SubmitCart, '@Translate("Select")')">@Translate("Change parcel shop")</label> </div> </div> {{/.}} </script> <script id="ParcelShopsTemplate" type="text/x-template"> {{#.}} {{#ParcelShops}} <li data-number="{{number}}" data-lat="{{latitude}}" data-lng="{{longitude}}"> <input type="radio" name="{{fieldPrefix}}{{fieldPostfix}}" value="{{number}}" class="form__control" id="{{fieldPrefix}}ParcelShopNumber_{{number}}" {{selected}} onclick="Cart.SubmitCart()" /> <label for="{{fieldPrefix}}ParcelShopNumber_{{number}}" class="u-flex"> <span class="u-inline-block"> <span class="u-bold">{{company}}, </span> <span class="u-block">{{address}}, {{city}}</span> <span class="u-block">{{countryCode}} </span> </span> </label> </li> <li class="list__seperator"></li> {{/ParcelShops}} {{/.}} </script> string mapsScriptUrl = "//maps.googleapis.com/maps/api/js"; mapsScriptUrl += !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleMapsAPIKey")) ? "?key=" + Pageview.AreaSettings.GetItem("Settings").GetString("GoogleMapsAPIKey") : ""; <script src="@mapsScriptUrl"></script> if (Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")) && GetLoop("UserManagement:User.UserAddresses").Count > 0) { <script> document.addEventListener("DOMContentLoaded", function (event) { document.getElementById("DeliveryAddressFields").addEventListener('contentLoaded', function (e) { var target = getTarget(e); if (target.name == "EcomOrderDeliveryCountry") { target.value = target.getAttribute("data-countryCode"); } }, false); }); </script> } } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Core @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Rapido.Blocks.Extensibility @{ BlocksPage customBlocksPage = BlocksPage.GetBlockPage("CheckoutPage"); if (GetGlobalValue("Global:Area.LongLang") != "en-US") { Block vatTemplates = new Block() { Id = "VatTemplate", SortId = 10, Template = RenderVatTemplates() }; customBlocksPage.Add("AddressContainerRow", vatTemplates); Block vatScriptTemplates = new Block() { Id = "VatScriptTemplate", SortId = 11, Template = RenderVatScriptTemplates() }; customBlocksPage.Add("CheckoutBottomSnippets", vatScriptTemplates); } } @helper RenderVatTemplates() { @* Templates for Vat Input *@ <script id="CartVatInput" type="text/x-template"> <div> <input type="hidden" id="PricesWithVat" value="@Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat" /> </div> <div class="form__field-group dw-mod"> <label for="EcomOrderCustomerVatRegNumber">@Translate("VatRegNumber")</label> <input type="text" class="u-full-width" name="EcomOrderCustomerVatRegNumber" id="EcomOrderCustomerVatRegNumber" value="@GetString("Ecom:Order.Customer.VatRegNumber")" /> <div class="u-pull--right"> <button type="button" class="btn btn--secondary btn--condensed dw-mod u-pull--left u-no-margin" onclick="VatCheck.ValidateVat(document.getElementById('EcomOrderCustomerVatRegNumber').value, document.getElementById('EcomOrderCustomerCountry').value, '@GetString("Ecom:Order.ID")');">Validate VAT</button> </div> <div class="field-error dw-mod ValidationErrorCustomerVatRegNumber" id="">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerVatRegNumber.ErrorMessage")</div> <div class="field-success dw-mod ValidationsuccessCustomerVatRegNumber" id=""></div> <input type="hidden" class="u-full-width" name="OrderIsVatValid" id="OrderIsVatValid" value="@(GetString("OrderIsVatValid.Clean") == "yes" ? "yes" : "" )" /> </div> </script> } @helper RenderVatScriptTemplates() { @* Templates for addresses *@ <script type="text/javascript"> // insert template in billingaddress document.querySelector("#Block__BillingAddress .card").insertAdjacentHTML('beforeend', document.getElementById("CartVatInput").innerHTML); VatValidationTexts = { ValidOk: '@Translate("VatValid")', ValidError: '@Translate("VatError")' } </script> } <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> <div class="center-container center-container--with-background-image dw-mod"> <div class="paragraph-container"> <form name="ordersubmit" id="OrderSubmit" method="post" action="/Default.aspx?ID=@pageId" autocomplete="off"> <div class="grid"> @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ @RenderBlockList(checkoutPage.BlocksRoot.BlocksList) </div> </form> </div> </div> </section>