Error compiling template "Designs/Swift/eCom7/CartV2/Step/QuoteRequestUser.cshtml"
Line 11: The using directive for 'Dynamicweb' appeared previously in this namespace
Line 12: The using directive for 'System.IO' appeared previously in this namespace
Line 13: The using directive for 'Dynamicweb' appeared previously in this namespace
Line 19: The using directive for 'System.Text.RegularExpressions' appeared previously in this namespace
Line 21: The using directive for 'System.Text' appeared previously in this namespace
Line 45: The name 'RenderLogo' does not exist in the current context
Line 50: The name 'RenderErrors' does not exist in the current context
Line 51: The name 'RenderStepSummary' does not exist in the current context
Line 62: The name 'RenderStepsNavigation' does not exist in the current context
Line 63: The name 'RenderSummarySidebar' does not exist in the current context

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Linq; 9 using Dynamicweb; 10 using System.IO; 11 using Dynamicweb; 12 using System.IO; 13 using Dynamicweb; 14 using Dynamicweb.Ecommerce.ProductCatalog; 15 using Dynamicweb.Ecommerce.Orders; 16 using System.Text.RegularExpressions; 17 using System.Text; 18 using System.Collections.Generic; 19 using System.Text.RegularExpressions; 20 using Dynamicweb.Ecommerce.International; 21 using System.Text; 22 internal class RazorEngine_0dea47aebcc7488283477447f043df74 : Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 23 { 24 #pragma warning disable 1998 25 public async override global::System.Threading.Tasks.Task ExecuteAsync() 26 { 27 WriteLiteral("\r\n"); 28 29 var themeRaw = Pageview.CurrentParagraph.Item["Theme"]?.ToString(); 30 string theme = !string.IsNullOrEmpty(themeRaw) ? " theme " + themeRaw.Replace(" ", "").Trim().ToLower() : ""; 31 WriteLiteral("\r\n<div class=\"grid gap-0 h-100\">\r\n\t<div"); 32 BeginWriteAttribute("class", " class=\"", 390, "\"", 487, 10); 33 WriteAttributeValue("", 398, "g-col-12", 398, 8, true); 34 WriteAttributeValue(" ", 406, "g-col-lg-8", 407, 11, true); 35 WriteAttributeValue(" ", 417, "p-3", 418, 4, true); 36 WriteAttributeValue(" ", 421, "p-lg-4", 422, 7, true); 37 WriteAttributeValue(" ", 428, "pe-xl-5", 429, 8, true); 38 WriteAttributeValue(" ", 436, "ps-xl-6", 437, 8, true); 39 WriteAttributeValue(" ", 444, "ps-xxl-8", 445, 9, true); 40 WriteAttributeValue(" ", 453, "order-last", 454, 11, true); 41 WriteAttributeValue(" ", 464, "order-lg-first", 465, 15, true); 42 WriteAttributeValue("", 479, theme, 479, 8, false); 43 EndWriteAttribute(); 44 WriteLiteral(">\r\n\t\t<form name=\"ordersubmit\" id=\"ordersubmit\" method=\"post\" autocomplete=\"off\" style=\"max-width: 65rem; margin-left: auto;\">\r\n\r\n"); 45 RenderLogo();WriteLiteral("\r\n\t\t\t<h1 class=\"h2\">"); 46 Write(Translate("Request quote")); 47 WriteLiteral("</h1>\r\n\t\t\t<p>"); 48 Write(Translate("Please fill out the form below to request a quote. We will get back to you within 24 hours")); 49 WriteLiteral("</p>\r\n\r\n"); 50 RenderErrors();WriteLiteral("\r\n"); 51 RenderStepSummary();WriteLiteral("\r\n\t\t\t<div class=\"form-floating mt-4\">\r\n\t\t\t\t<textarea class=\"form-control\""); 52 BeginWriteAttribute("placeholder", " placeholder=\"", 997, "\"", 1047, 1); 53 WriteAttributeValue("", 1011, Translate("Add quote request here"), 1011, 36, false); 54 EndWriteAttribute(); 55 WriteLiteral(" name=\"QuoteRequest\" id=\"QuoteRequest\" style=\"min-height: 100px\""); 56 BeginWriteAttribute("value", " value=\"", 1112, "\"", 1152, 1); 57 WriteAttributeValue("", 1120, GetString("QuoteRequest.Clean"), 1120, 32, false); 58 EndWriteAttribute(); 59 WriteLiteral("></textarea>\r\n\t\t\t\t<label for=\"QuoteRequest\">"); 60 Write(Translate("Add quote request here")); 61 WriteLiteral("</label>\r\n\t\t\t</div>\r\n\r\n"); 62 RenderStepsNavigation();WriteLiteral("\r\n\t\t\t<input type=\"hidden\" id=\"CurrentStep\">\r\n\t\t</form>\r\n\t</div>\r\n\r\n"); 63 RenderSummarySidebar();WriteLiteral("\r\n</div>\r\n\r\n<script>\r\n\tfunction submitForm() {\r\n\t\tdocument.querySelector(\"#CurrentStep\").name = \""); 64 Write(GetString("CartV2.CurrentStepButtonName")); 65 WriteLiteral("\";\r\n\t\tswift.PageUpdater.Update(document.querySelector(\"#ordersubmit\"));\r\n\t}\r\n</script>\r\n\r\n"); 66 WriteLiteral("\n"); 67 string logoLink = Pageview.CurrentParagraph?.Item["LogoLink"] != null ? Pageview.CurrentParagraph.Item["LogoLink"].ToString() : string.Empty; string logoImage = Pageview.CurrentParagraph?.Item["Logo"] != null ? Pageview.CurrentParagraph.Item["Logo"].ToString() : string.Empty; string title = Pageview.CurrentParagraph?.Item["Title"] != null ? Pageview.CurrentParagraph.Item["Title"].ToString() : Pageview.Area.Name; string maxWidth = Pageview.CurrentParagraph?.Item["MaxWidth"] != null ? "max-width: " + Pageview.CurrentParagraph.Item["MaxWidth"].ToString() + "px" : string.Empty; maxWidth = maxWidth == "max-width: 0px" ? string.Empty : maxWidth; WriteLiteral("\n<div class=\"mb-4 text-center\">\n"); 68 if (!string.IsNullOrWhiteSpace(logoLink)) { WriteLiteral("\t\t"); 69 WriteLiteral("<a href=\""); 70 Write(logoLink); 71 WriteLiteral("\" class=\"text-decoration-none\" title=\""); 72 Write(Translate("Leave checkout")); 73 WriteLiteral("\">\n"); 74 } WriteLiteral("\n"); 75 if (logoImage != "") { if (Path.GetExtension(logoImage).ToLower() == ".svg") { WriteLiteral("\t\t\t<div class=\"icon-auto\""); 76 BeginWriteAttribute("style", " style=\"", 2751, "\"", 2768, 1); 77 WriteAttributeValue("", 2759, maxWidth, 2759, 9, false); 78 EndWriteAttribute(); 79 WriteLiteral(">\n\t\t\t\t"); 80 Write(ReadFile(logoImage)); 81 WriteLiteral("\n\t\t\t</div>\n"); 82 } else { string imageWidth = Pageview.CurrentParagraph.Item["MaxWidth"] != null ? Pageview.CurrentParagraph.Item["MaxWidth"].ToString() : "400"; string imagePath = "/Admin/Public/GetImage.ashx?width=" + imageWidth + "&image=" + logoImage; WriteLiteral("\t\t\t<picture class=\"mx-auto d-block\">\n\t\t\t\t<img"); 83 BeginWriteAttribute("src", " src=\"", 3103, "\"", 3119, 1); 84 WriteAttributeValue("", 3109, logoImage, 3109, 10, false); 85 EndWriteAttribute(); 86 BeginWriteAttribute("alt", " alt=\"", 3120, "\"", 3132, 1); 87 WriteAttributeValue("", 3126, title, 3126, 6, false); 88 EndWriteAttribute(); 89 BeginWriteAttribute("style", " style=\"", 3133, "\"", 3150, 1); 90 WriteAttributeValue("", 3141, maxWidth, 3141, 9, false); 91 EndWriteAttribute(); 92 WriteLiteral(">\n\t\t\t</picture>\n"); 93 } } else { WriteLiteral("\t\t<div class=\"fs-3 p-0\">"); 94 Write(title); 95 WriteLiteral("</div>\n"); 96 } WriteLiteral("\n"); 97 if (!string.IsNullOrWhiteSpace(logoLink)) { WriteLiteral("\t\t"); 98 WriteLiteral("</a>\n"); 99 } WriteLiteral("</div>\n\r\n"); 100 WriteLiteral("\n"); 101 if (GetLoop("ValidationErrors").Count() != 0) { WriteLiteral("\t<div class=\"alert alert-warning\" role=\"alert\">\n\t\t<ul class=\"m-0 list-unstyled\">\n"); 102 foreach (LoopItem item in GetLoop("ValidationErrors")) { WriteLiteral("\t\t\t\t<li>"); 103 Write(item.GetValue("Ecom:Cart.ValidationError.ErrorMessage")); 104 WriteLiteral("</li>\n"); 105 } WriteLiteral("\t\t</ul>\n\t</div>\n"); 106 } WriteLiteral("\n\r\n"); 107 WriteLiteral("\n"); 108 bool summaryIsPaymentStep = GetLoop("StepButtons").Count == 0; int summaryCurrentStep = !summaryIsPaymentStep ? 1 : 4; int summaryCurrentUserId = Dynamicweb.Core.Converter.ToInt32(GetGlobalValue("Global:Extranet.UserID")); foreach (LoopItem step in GetLoop("StepButtons")) { if (step.GetBoolean("Step.Current")) { summaryCurrentStep = step.GetInteger("Step.Number"); } } WriteLiteral("\n"); 109 if (!string.IsNullOrEmpty(GetString("UserManagement:User.Address")) || !string.IsNullOrEmpty(GetString("Ecom:Order.ShippingMethodID")) || !string.IsNullOrEmpty(GetString("Ecom:Order.PaymentMethodID")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Name")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Company")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address2")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Zip")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.City")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Email")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Phone")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Name")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Company")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Address")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Address2")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Zip")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.City")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone")) || !string.IsNullOrEmpty(GetString("Ecom:Order.ShippingMethod")) || !string.IsNullOrEmpty(GetString("Ecom:Order.ShippingDate")) || !string.IsNullOrEmpty(GetString("Ecom:Order.PaymentMethod"))) { if (summaryCurrentUserId != 0) { WriteLiteral("\t\t<div class=\"list-group mb-5\">\n"); 110 WriteLiteral("\n"); 111 WriteLiteral("\n"); 112 var summaryCustomerHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int summaryCustomerCurrentUserId = Dynamicweb.Core.Converter.ToInt32(GetGlobalValue("Global:Extranet.UserID")); List<string> contact = new List<string>(); if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone"))) { if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email"))) { contact.Add(GetString("Ecom:Order.Customer.Email")); } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone"))) { contact.Add(GetString("Ecom:Order.Customer.Phone")); } } string summaryCustomerContactString = (string.Join(",", contact.Select(x => x.ToString()).ToArray())).Replace(",", ", "); string summaryCustomerUserAccountPage = Pageview.CurrentParagraph.Item["UserAccountPageLink"] != null ? Pageview.CurrentParagraph.Item["UserAccountPageLink"].ToString() + "&GoBackToPage=" + Pageview.Page.ID : ""; WriteLiteral("\n"); 113 if (!string.IsNullOrEmpty(summaryCustomerContactString)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\" id=\"ContactGroup\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 114 Write(Translate("Contact")); 115 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 116 Write(summaryCustomerContactString); 117 WriteLiteral("</dd>\n\n"); 118 if (!summaryCustomerHideEditBillingAddress) { WriteLiteral("\t\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n"); 119 if (summaryCustomerCurrentUserId == 0) { WriteLiteral("\t\t\t\t\t\t<button type=\"submit\" class=\"btn btn-small btn-link fs-8 p-0\" name=\"CartV2.GotoStep0\" id=\"EditBillingAddressButton\">\n\t\t\t\t\t\t\t<span class=\"text-uppercase\">"); 120 Write(Translate("Edit")); 121 WriteLiteral("</span>\n\t\t\t\t\t\t</button>\n"); 122 } else { WriteLiteral("\t\t\t\t\t\t<a"); 123 BeginWriteAttribute("href", " href=\"", 7826, "\"", 7864, 1); 124 WriteAttributeValue("", 7833, summaryCustomerUserAccountPage, 7833, 31, false); 125 EndWriteAttribute(); 126 WriteLiteral(" class=\"btn btn-small btn-link fs-8 p-0\" id=\"EditBillingAddressButton\">\n\t\t\t\t\t\t\t<span class=\"text-uppercase\">"); 127 Write(Translate("Edit")); 128 WriteLiteral("</span>\n\t\t\t\t\t\t</a>\n"); 129 } WriteLiteral("\t\t\t\t</dd>\n"); 130 } WriteLiteral("\t\t</dl>\n\t</div>\n"); 131 } WriteLiteral("\n\t\t\t\t"); 132 WriteLiteral("\n"); 133 WriteLiteral("\n"); 134 WriteLiteral("\n"); 135 var summaryUserHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int summaryUserFieldCount = 0; //Helps us render addresses that contains more than just the auto set country bool summaryUserIsStandardSwiftTemplates = Pageview.AreaSettings.GetString("AddressFieldsBasedOn", "swift") == "swift"; string stepSummaryAddressString = string.Empty; if (summaryUserIsStandardSwiftTemplates) { Dynamicweb.Security.UserManagement.User user = Pageview.User; List<string> address = new List<string>(); if (!string.IsNullOrEmpty(user.Company)) { address.Add(user.Company); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.Name)) { address.Add(user.Name); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.Address)) { address.Add(user.Address); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.Address2)) { address.Add(user.Address2); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.Zip)) { address.Add(user.Zip); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.City)) { address.Add(user.City); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.State)) { var countryCode = user.CountryCode; string stateName = Dynamicweb.Ecommerce.Services.Countries.GetRegion(countryCode, user.State)?.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID) ?? string.Empty; address.Add(stateName); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.CountryCode)) { string country = user.Region.DisplayName; address.Add(country); summaryUserFieldCount++; } stepSummaryAddressString = (string.Join(",", address.Select(x => x.ToString()).ToArray())).Replace(",", ", "); } else { stepSummaryAddressString = GetUserAddressString(); } string editStep = Pageview.CurrentParagraph.Item["UserAccountPageLink"] != null ? Pageview.CurrentParagraph.Item["UserAccountPageLink"].ToString() + "&GoBackToPage=" + Pageview.Page.ID : ""; WriteLiteral("\n"); 136 if (!string.IsNullOrEmpty(stepSummaryAddressString) && ((summaryUserIsStandardSwiftTemplates && summaryUserFieldCount > 1) || !summaryUserIsStandardSwiftTemplates)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 137 Write(Translate("Billing")); 138 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 139 Write(stepSummaryAddressString); 140 WriteLiteral("</dd>\n"); 141 if (!summaryUserHideEditBillingAddress) { WriteLiteral("\t\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n\t\t\t\t\t<a"); 142 BeginWriteAttribute("href", " href=\"", 10953, "\"", 10969, 1); 143 WriteAttributeValue("", 10960, editStep, 10960, 9, false); 144 EndWriteAttribute(); 145 WriteLiteral(" class=\"btn btn-small btn-link fs-8 p-0\" id=\"EditBillingAddressButton\">\n\t\t\t\t\t\t<span class=\"text-uppercase\">"); 146 Write(Translate("Edit")); 147 WriteLiteral("</span>\n\t\t\t\t\t</a>\n\t\t\t\t</dd>\n"); 148 } WriteLiteral("\t\t</dl>\n\t</div>\n"); 149 } WriteLiteral("\n\t\t\t\t"); 150 WriteLiteral("\n"); 151 if (summaryCurrentStep != 1) { WriteLiteral("\n"); 152 WriteLiteral("\n"); 153 var billingHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int billingFieldCount = 0; //Helps us render addresses that contains more than just the auto set country bool summaryBillingIsStandardSwiftTemplates = Pageview.AreaSettings.GetString("AddressFieldsBasedOn", "swift") == "swift"; string billingAddressString = string.Empty; if (summaryBillingIsStandardSwiftTemplates) { List<string> address = new List<string>(); if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Company"))) { address.Add(GetString("Ecom:Order.Delivery.Company")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Name"))) { address.Add(GetString("Ecom:Order.Delivery.Name")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address"))) { address.Add(GetString("Ecom:Order.Delivery.Address")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address2"))) { address.Add(GetString("Ecom:Order.Delivery.Address2")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Zip"))) { address.Add(GetString("Ecom:Order.Delivery.Zip")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.City"))) { address.Add(GetString("Ecom:Order.Delivery.City")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Region"))) { string regionName = GetString("Ecom:Order.Delivery.Region"); foreach (LoopItem region in GetLoop("DeliveryRegions")) { if (region.GetString("Ecom:DeliveryRegion.IsDeliveryRegion") == "true") { regionName = region.GetString("Ecom:DeliveryRegion.Name"); } } address.Add(regionName); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Country"))) { address.Add(GetString("Ecom:Order.Delivery.Country")); billingFieldCount++; } billingAddressString = (string.Join(",", address.Select(x => x.ToString()).ToArray())).Trim(',').Replace(",", ", "); } else { billingAddressString = GetDeliveryAddressString(); } WriteLiteral("\n"); 154 if (!string.IsNullOrEmpty(billingAddressString) && ((summaryBillingIsStandardSwiftTemplates && billingFieldCount > 1) || !summaryBillingIsStandardSwiftTemplates)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 155 Write(Translate("Selected address")); 156 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 157 Write(billingAddressString); 158 WriteLiteral("</dd>\n\n"); 159 if (!billingHideEditBillingAddress) { WriteLiteral("\t\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n\t\t\t\t\t<button class=\"btn btn-small btn-link fs-8 p-0\" type=\"submit\" name=\"CartV2.GotoStep0\" id=\"EditDeliveryAddressButton\">\n\t\t\t\t\t\t<span class=\"text-uppercase\">"); 160 Write(Translate("Edit")); 161 WriteLiteral("</span>\n\t\t\t\t\t</button>\n\t\t\t\t</dd>\n"); 162 } WriteLiteral("\t\t</dl>\n\t</div>\n"); 163 } WriteLiteral("\n\t\t\t\t"); 164 WriteLiteral("\n"); 165 WriteLiteral("\n"); 166 WriteLiteral("\n"); 167 string shippingMethod = GetString("Ecom:Order.ShippingMethod"); WriteLiteral("\n"); 168 if (!string.IsNullOrEmpty(shippingMethod)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 169 Write(Translate("Delivery")); 170 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 171 Write(shippingMethod); 172 WriteLiteral("</dd>\n\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n\t\t\t\t<button class=\"btn btn-small btn-link fs-8 p-0\" type=\"submit\" name=\"CartV2.GotoStep1\" id=\"EditDeliveryButton\">\n\t\t\t\t\t<span class=\"text-uppercase\">"); 173 Write(Translate("Edit")); 174 WriteLiteral("</span>\n\t\t\t\t</button>\n\t\t\t</dd>\n\t\t</dl>\n\t</div>\n"); 175 } WriteLiteral("\n\t\t\t\t"); 176 WriteLiteral("\n"); 177 WriteLiteral("\n"); 178 WriteLiteral("\n"); 179 string shippingDate = GetString("Ecom:Order.ShippingDate"), shippingDateFormatted = GetDate("Ecom:Order.ShippingDate").ToShortDateString(); WriteLiteral("\n"); 180 if (!string.IsNullOrEmpty(shippingDate)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 181 Write(Translate("Delivery date")); 182 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 183 Write(shippingDateFormatted); 184 WriteLiteral("</dd>\n\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n\t\t\t\t<button class=\"btn btn-small btn-link fs-8 p-0\" type=\"submit\" name=\"CartV2.GotoStep1\" id=\"EditDeliveryDateButton\">\n\t\t\t\t\t<span class=\"text-uppercase\">"); 185 Write(Translate("Edit")); 186 WriteLiteral("</span>\n\t\t\t\t</button>\n\t\t\t</dd>\n\t\t</dl>\n\t</div>\n"); 187 } WriteLiteral("\n\n\t\t\t\t"); 188 } WriteLiteral("\t\t</div>\n"); 189 } else { if (summaryCurrentStep != 1) { WriteLiteral("\t\t\t<div class=\"list-group\">\n"); 190 WriteLiteral("\n"); 191 WriteLiteral("\n"); 192 var summaryCustomerHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int summaryCustomerCurrentUserId = Dynamicweb.Core.Converter.ToInt32(GetGlobalValue("Global:Extranet.UserID")); List<string> contact = new List<string>(); if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone"))) { if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email"))) { contact.Add(GetString("Ecom:Order.Customer.Email")); } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone"))) { contact.Add(GetString("Ecom:Order.Customer.Phone")); } } string summaryCustomerContactString = (string.Join(",", contact.Select(x => x.ToString()).ToArray())).Replace(",", ", "); string summaryCustomerUserAccountPage = Pageview.CurrentParagraph.Item["UserAccountPageLink"] != null ? Pageview.CurrentParagraph.Item["UserAccountPageLink"].ToString() + "&GoBackToPage=" + Pageview.Page.ID : ""; WriteLiteral("\n"); 193 if (!string.IsNullOrEmpty(summaryCustomerContactString)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\" id=\"ContactGroup\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 194 Write(Translate("Contact")); 195 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 196 Write(summaryCustomerContactString); 197 WriteLiteral("</dd>\n\n"); 198 if (!summaryCustomerHideEditBillingAddress) { WriteLiteral("\t\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n"); 199 if (summaryCustomerCurrentUserId == 0) { WriteLiteral("\t\t\t\t\t\t<button type=\"submit\" class=\"btn btn-small btn-link fs-8 p-0\" name=\"CartV2.GotoStep0\" id=\"EditBillingAddressButton\">\n\t\t\t\t\t\t\t<span class=\"text-uppercase\">"); 200 Write(Translate("Edit")); 201 WriteLiteral("</span>\n\t\t\t\t\t\t</button>\n"); 202 } else { WriteLiteral("\t\t\t\t\t\t<a"); 203 BeginWriteAttribute("href", " href=\"", 18452, "\"", 18490, 1); 204 WriteAttributeValue("", 18459, summaryCustomerUserAccountPage, 18459, 31, false); 205 EndWriteAttribute(); 206 WriteLiteral(" class=\"btn btn-small btn-link fs-8 p-0\" id=\"EditBillingAddressButton\">\n\t\t\t\t\t\t\t<span class=\"text-uppercase\">"); 207 Write(Translate("Edit")); 208 WriteLiteral("</span>\n\t\t\t\t\t\t</a>\n"); 209 } WriteLiteral("\t\t\t\t</dd>\n"); 210 } WriteLiteral("\t\t</dl>\n\t</div>\n"); 211 } WriteLiteral("\n\t\t\t\t\t"); 212 WriteLiteral("\n"); 213 WriteLiteral("\n"); 214 WriteLiteral("\n"); 215 var billingHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int billingFieldCount = 0; //Helps us render addresses that contains more than just the auto set country bool summaryBillingIsStandardSwiftTemplates = Pageview.AreaSettings.GetString("AddressFieldsBasedOn", "swift") == "swift"; string billingAddressString = string.Empty; if (summaryBillingIsStandardSwiftTemplates) { List<string> address = new List<string>(); if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Company"))) { address.Add(GetString("Ecom:Order.Delivery.Company")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Name"))) { address.Add(GetString("Ecom:Order.Delivery.Name")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address"))) { address.Add(GetString("Ecom:Order.Delivery.Address")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address2"))) { address.Add(GetString("Ecom:Order.Delivery.Address2")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Zip"))) { address.Add(GetString("Ecom:Order.Delivery.Zip")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.City"))) { address.Add(GetString("Ecom:Order.Delivery.City")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Region"))) { string regionName = GetString("Ecom:Order.Delivery.Region"); foreach (LoopItem region in GetLoop("DeliveryRegions")) { if (region.GetString("Ecom:DeliveryRegion.IsDeliveryRegion") == "true") { regionName = region.GetString("Ecom:DeliveryRegion.Name"); } } address.Add(regionName); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Country"))) { address.Add(GetString("Ecom:Order.Delivery.Country")); billingFieldCount++; } billingAddressString = (string.Join(",", address.Select(x => x.ToString()).ToArray())).Trim(',').Replace(",", ", "); } else { billingAddressString = GetDeliveryAddressString(); } WriteLiteral("\n"); 216 if (!string.IsNullOrEmpty(billingAddressString) && ((summaryBillingIsStandardSwiftTemplates && billingFieldCount > 1) || !summaryBillingIsStandardSwiftTemplates)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 217 Write(Translate("Selected address")); 218 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 219 Write(billingAddressString); 220 WriteLiteral("</dd>\n\n"); 221 if (!billingHideEditBillingAddress) { WriteLiteral("\t\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n\t\t\t\t\t<button class=\"btn btn-small btn-link fs-8 p-0\" type=\"submit\" name=\"CartV2.GotoStep0\" id=\"EditDeliveryAddressButton\">\n\t\t\t\t\t\t<span class=\"text-uppercase\">"); 222 Write(Translate("Edit")); 223 WriteLiteral("</span>\n\t\t\t\t\t</button>\n\t\t\t\t</dd>\n"); 224 } WriteLiteral("\t\t</dl>\n\t</div>\n"); 225 } WriteLiteral("\n\t\t\t\t\t"); 226 WriteLiteral("\n"); 227 if (summaryCurrentStep > 2) { WriteLiteral("\n"); 228 WriteLiteral("\n"); 229 string shippingMethod = GetString("Ecom:Order.ShippingMethod"); WriteLiteral("\n"); 230 if (!string.IsNullOrEmpty(shippingMethod)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 231 Write(Translate("Delivery")); 232 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 233 Write(shippingMethod); 234 WriteLiteral("</dd>\n\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n\t\t\t\t<button class=\"btn btn-small btn-link fs-8 p-0\" type=\"submit\" name=\"CartV2.GotoStep1\" id=\"EditDeliveryButton\">\n\t\t\t\t\t<span class=\"text-uppercase\">"); 235 Write(Translate("Edit")); 236 WriteLiteral("</span>\n\t\t\t\t</button>\n\t\t\t</dd>\n\t\t</dl>\n\t</div>\n"); 237 } WriteLiteral("\n\t\t\t\t\t"); 238 WriteLiteral("\n"); 239 WriteLiteral("\n"); 240 WriteLiteral("\n"); 241 string shippingDate = GetString("Ecom:Order.ShippingDate"), shippingDateFormatted = GetDate("Ecom:Order.ShippingDate").ToShortDateString(); WriteLiteral("\n"); 242 if (!string.IsNullOrEmpty(shippingDate)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 243 Write(Translate("Delivery date")); 244 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 245 Write(shippingDateFormatted); 246 WriteLiteral("</dd>\n\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n\t\t\t\t<button class=\"btn btn-small btn-link fs-8 p-0\" type=\"submit\" name=\"CartV2.GotoStep1\" id=\"EditDeliveryDateButton\">\n\t\t\t\t\t<span class=\"text-uppercase\">"); 247 Write(Translate("Edit")); 248 WriteLiteral("</span>\n\t\t\t\t</button>\n\t\t\t</dd>\n\t\t</dl>\n\t</div>\n"); 249 } WriteLiteral("\n\n\t\t\t\t\t"); 250 } if (summaryCurrentStep > 3) { WriteLiteral("\n"); 251 WriteLiteral("\n"); 252 string PaymentMethodID = GetString("Ecom:Order.ShippingMethodID"); string paymentMethod = GetString("Ecom:Order.PaymentMethod"); WriteLiteral("\n"); 253 if(!string.IsNullOrEmpty(PaymentMethodID)) { WriteLiteral("\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\">\n\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 254 Write(Translate("Payment")); 255 WriteLiteral("</dt>\n\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 256 Write(paymentMethod); 257 WriteLiteral("</dd>\n\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n\t\t\t\t<button class=\"btn btn-small btn-link fs-8 p-0\" type=\"submit\" name=\"CartV2.GotoStep2\" id=\"EditPaymentButton\">\n\t\t\t\t\t<span class=\"text-uppercase\">"); 258 Write(Translate("Edit")); 259 WriteLiteral("</span>\n\t\t\t\t</button>\n\t\t\t</dd>\n\t\t</dl>\n\t</div>\n"); 260 } WriteLiteral("\n\t\t\t\t\t"); 261 WriteLiteral("\n"); 262 WriteLiteral("\n"); 263 WriteLiteral("\n"); 264 string stepSummaryOrderReference = !string.IsNullOrWhiteSpace(GetString("Ecom:Order.Reference")) ? GetString("Ecom:Order.Reference") : ""; if (!string.IsNullOrEmpty(stepSummaryOrderReference)) { WriteLiteral("\t\t<div class=\"list-group-item py-2 fs-7\" style=\"background-color: rgba(var(--swift-foreground-color-rgb), 0.05)\">\n\t\t\t<dl class=\"grid gap-1 gap-sm-3 mb-0\">\n\t\t\t\t<dt class=\"g-col-8 g-col-sm-4 fw-normal\">"); 265 Write(Translate("Order reference")); 266 WriteLiteral("</dt>\n\t\t\t\t<dd class=\"g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0\">"); 267 Write(stepSummaryOrderReference); 268 WriteLiteral("</dd>\n\t\t\t\t<dd class=\"g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end\">\n\t\t\t\t\t<button class=\"btn btn-small btn-link fs-8 p-0\" type=\"submit\" name=\"CartV2.GotoStep2\" id=\"EditorderReferenceButton\">\n\t\t\t\t\t\t<span class=\"text-uppercase\">"); 269 Write(Translate("Edit")); 270 WriteLiteral("</span>\n\t\t\t\t\t</button>\n\t\t\t\t</dd>\n\t\t\t</dl>\n\t\t</div>\n"); 271 } WriteLiteral("\n\t\t\t\t\t"); 272 } WriteLiteral("\t\t\t</div>\n"); 273 } } } WriteLiteral("\n\n\n\n\n\n\n\r\n"); 274 WriteLiteral("\n<div class=\"g-col-12 g-col-lg-4 py-2 p-3 p-lg-4 p-xl-5\" id=\"summarySidebar\">\n"); 275 WriteLiteral("\n"); 276 string iconPath = "/Files/Icons/"; WriteLiteral(@" <button class=""toggle-order-summary btn text-reset w-100 d-block d-lg-none px-0"" type=""button"" data-bs-toggle=""collapse"" data-bs-target=""#orderSummary"" aria-expanded=""false"" aria-controls=""orderSummary"" id=""OrderSummaryToggleButton""> <span class=""d-flex align-items-center justify-content-between""> <span class=""d-flex align-items-center gap-2""> <span class=""fs-7 lh-1""> <span class=""toggle-order-summary-text"" id=""OrderSummaryToggleButtonLabel"">"); 277 Write(Translate("Show order summary")); 278 WriteLiteral("</span>\n\t\t\t</span>\n\t\t\t<span class=\"icon-2\" id=\"OrderSummaryToggleButtonIcon\" style=\"transition: all 0.25s ease-in-out;\">\n\t\t\t\t"); 279 Write(ReadFile(iconPath + "chevron-down.svg")); 280 WriteLiteral("\n\t\t\t</span>\n\t\t</span>\n\t\t<span class=\"fw-bold\">\n\t\t\t<span class=\"text-price\">"); 281 Write(GetString("Ecom:Order.Price")); 282 WriteLiteral(@"</span> </span> </span> </button> <script> const orderSummaryToggleButton = document.getElementById(""OrderSummaryToggleButton""); const orderSummaryToggleButtonLabel = document.getElementById(""OrderSummaryToggleButtonLabel""); const orderSummaryToggleButtonIcon = document.getElementById(""OrderSummaryToggleButtonIcon""); const orderSummaryToggleText = '"); 283 Write(Translate("Show order summary")); 284 WriteLiteral("\';\n\n\torderSummaryToggleButton.addEventListener(\'click\', function handleClick() {\n\t\tif (orderSummaryToggleButtonLabel.textContent.toLowerCase().includes(orderSummaryToggleText.toLowerCase())) {\n\t\t\torderSummaryToggleButtonLabel.textContent = \'"); 285 Write(Translate("Hide order summary")); 286 WriteLiteral("\';\n\t\t\torderSummaryToggleButtonIcon.classList.add(\"rotate-180\");\n\t\t} else {\n\t\t\torderSummaryToggleButtonLabel.textContent = orderSummaryToggleText;\n\t\t\torderSummaryToggleButtonIcon.classList.remove(\"rotate-180\");\n\t\t}\n\t});\n</script>\n\n\n"); 287 WriteLiteral("\n<div class=\"d-lg-block h-lg-auto collapse pt-2 pt-lg-0\" id=\"orderSummary\">\n\t<div class=\"d-flex flex-column gap-2 gap-lg-3 pb-2 pb-lg-3\">\n"); 288 WriteLiteral("\n"); 289 WriteLiteral("\n"); 290 var orderlines = GetLoop("OrderLines"); WriteLiteral("\n"); 291 for (int i = orderlines.Count - 1; i >= 0; i--) { var orderline = orderlines[i]; string name = orderline.GetString("Ecom:Order:OrderLine.ProductName"); string orderlineImage = GetPrimaryImage(orderline, GetString("Ecom:Order.ShopID")); string image = "/Admin/Public/GetImage.ashx?width=" + 180 + "&height=" + 180 + "&crop=5&fillcanvas=true&Background=ffffff&image=" + orderlineImage + "&format=webp"; image = !orderlineImage.StartsWith("/Files/", StringComparison.OrdinalIgnoreCase) ? orderlineImage : image; string removeFromBasketLink = orderline.GetString("Ecom:Order:OrderLine.DeleteLink"); string priceTotalWithDiscounts = orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts.PriceFormatted"); string priceBefore = orderline.GetString("Ecom:Product.InformativePrice.PriceFormatted"); string unitPrice = orderline.GetString("Ecom:Order:OrderLine.UnitPrice.PriceFormatted"); string discountPrice = orderline.GetString("Ecom:Order:OrderLine.UnitPriceWithProductDiscount.PriceFormatted"); string discountTotal = orderline.GetString("Ecom:Order:OrderLine.TotalDiscount.PriceFormatted"); string variantText = orderline.GetString("Ecom:Order:OrderLine.ProductVariantText"); var orderlineId = orderline.GetValue("Ecom:Order:OrderLine.Id"); var quantity = orderline.GetDouble("Ecom:Order:OrderLine.Quantity"); var unitName = orderline.GetString("Ecom:Order:OrderLine.UnitName"); string primaryGroupId = orderline.GetString("Ecom:Order:OrderLine.PrimaryOrDefaultGroupId"); string productId = orderline.GetString("Ecom:Order:OrderLine.ProductID"); string variantId = orderline.GetString("Ecom:Order:OrderLine.ProductVariantID"); string link = "Default.aspx?ID=" + GetPageIdByNavigationTag("Shop"); link += $"&GroupID={primaryGroupId}"; link += $"&ProductID={productId}"; link += !string.IsNullOrEmpty(variantId) ? $"&VariantID={variantId}" : ""; bool isProductIdOrNumber = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductID")) || !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductNumber")); //Live Cart orderlines may not return ProductId. Manually entered products may not have ProductNumber bool isProduct = orderline.GetBoolean("Ecom:Order:OrderLine.IsProduct") || (orderline.GetBoolean("Ecom:Order:OrderLine.IsDiscount") && isProductIdOrNumber); if (isProduct) { WriteLiteral("\t\t<article class=\"grid grid-12\">\n\n\t\t\t<div class=\"g-col-2\">\n\t\t\t\t<a"); 292 BeginWriteAttribute("href", " href=\"", 31927, "\"", 31939, 1); 293 WriteAttributeValue("", 31934, link, 31934, 5, false); 294 EndWriteAttribute(); 295 WriteLiteral(" class=\"ratio ratio-1x1 d-block \""); 296 BeginWriteAttribute("title", " title=\"", 31973, "\"", 31986, 1); 297 WriteAttributeValue("", 31981, name, 31981, 5, false); 298 EndWriteAttribute(); 299 WriteLiteral(">\n\t\t\t\t\t<img"); 300 BeginWriteAttribute("src", " src=\"", 31998, "\"", 32010, 1); 301 WriteAttributeValue("", 32004, image, 32004, 6, false); 302 EndWriteAttribute(); 303 WriteLiteral(" style=\"object-fit: contain;\""); 304 BeginWriteAttribute("alt", " alt=\"", 32040, "\"", 32051, 1); 305 WriteAttributeValue("", 32046, name, 32046, 5, false); 306 EndWriteAttribute(); 307 WriteLiteral(">\n\t\t\t\t</a>\n\t\t\t</div>\n\n\t\t\t<div class=\"g-col-10\">\n\n\t\t\t\t<div class=\"d-flex flex-column gap-1\">\n"); 308 WriteLiteral("\t\t\t\t\t<h3 class=\"h6 fs-7 m-0\">\n\t\t\t\t\t\t<a"); 309 BeginWriteAttribute("href", " href=\"", 32199, "\"", 32211, 1); 310 WriteAttributeValue("", 32206, link, 32206, 5, false); 311 EndWriteAttribute(); 312 WriteLiteral(" class=\"text-decoration-none\""); 313 BeginWriteAttribute("title", " title=\"", 32241, "\"", 32254, 1); 314 WriteAttributeValue("", 32249, name, 32249, 5, false); 315 EndWriteAttribute(); 316 WriteLiteral(">"); 317 Write(name); 318 WriteLiteral("</a>\n\t\t\t\t\t</h3>\n\n"); 319 if (!string.IsNullOrEmpty(variantText)) { WriteLiteral("\t\t\t\t\t\t<p class=\"fs-8 m-0\">"); 320 Write(variantText); 321 WriteLiteral("</p>\n"); 322 } WriteLiteral("\n"); 323 if (orderline.GetBoolean("Ecom:Order:OrderLine.IsDiscount")) { WriteLiteral("\t\t\t\t\t\t<p class=\"fs-8 m-0\">"); 324 Write(Translate("Free product")); 325 WriteLiteral("</p>\n"); 326 } else { WriteLiteral("\t\t\t\t\t\t<p class=\"fs-8 m-0\">\n"); 327 if (!string.IsNullOrEmpty(unitName)) { WriteLiteral("\t\t\t\t\t\t\t\t<span>"); 328 Write(unitName); 329 WriteLiteral(": </span>\n"); 330 } if (discountPrice == unitPrice) { WriteLiteral("\t\t\t\t\t\t\t\t<span class=\"text-price\">"); 331 Write(unitPrice); 332 WriteLiteral("</span>\n"); 333 } else { WriteLiteral("\t\t\t\t\t\t\t\t<span class=\"text-price\">"); 334 Write(discountPrice); 335 WriteLiteral("</span>\n\t\t\t\t\t\t\t\t<span class=\"text-decoration-line-through\">\n\t\t\t\t\t\t\t\t\t<span class=\"text-price\">"); 336 Write(unitPrice); 337 WriteLiteral("</span>\n\t\t\t\t\t\t\t\t</span>\n"); 338 } WriteLiteral("\t\t\t\t\t\t</p>\n"); 339 } WriteLiteral("\t\t\t\t\t<div class=\"d-flex flex-row justify-content-between\">\n"); 340 WriteLiteral("\t\t\t\t\t\t<span class=\"fs-8 d-block\">"); 341 Write(Translate("Qty")); 342 WriteLiteral(": "); 343 Write(quantity); 344 WriteLiteral("</span>\n\n\t\t\t\t\t\t<div class=\"text-end flex-fill\">\n"); 345 WriteLiteral("\t\t\t\t\t\t\t<span class=\"h6 d-block fs-7 m-0\">\n\t\t\t\t\t\t\t\t<span class=\"text-price\">"); 346 Write(priceTotalWithDiscounts); 347 WriteLiteral("</span>\n\t\t\t\t\t\t\t</span>\n"); 348 if (orderline.GetDouble("Ecom:Order:OrderLine.TotalDiscount.Price.Value") != 0.0) { WriteLiteral("\t\t\t\t\t\t\t\t<span class=\"d-block fs-8\">\n\t\t\t\t\t\t\t\t\t<span class=\"text-price\">"); 349 Write(discountTotal); 350 WriteLiteral("</span>\n\t\t\t\t\t\t\t\t</span>\n"); 351 } WriteLiteral("\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</article>\n"); 352 } } WriteLiteral("\n\t</div>\n\n"); 353 WriteLiteral("\n"); 354 double totalPriceWithoutOrderDiscountsFeesAndTaxesValue = GetDouble("Ecom:Order.TotalPriceWithoutDiscountsFeesAndTaxes.Price.Value") + GetDouble("Ecom:Order.TotalProductDiscount.Price.Value"); var orderCurrency = Dynamicweb.Ecommerce.Services.Currencies.GetCurrency(GetString("Ecom:Order.Currency.Code")); string totalPriceWithoutOrderDiscountsFeesAndTaxes = Dynamicweb.Ecommerce.Services.Currencies.Format(orderCurrency, totalPriceWithoutOrderDiscountsFeesAndTaxesValue); string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); bool disableVouchers = Pageview.CurrentParagraph?.Item["DisableVouchers"] != null ? (Boolean)Pageview.CurrentParagraph.Item["DisableVouchers"] : false; disableVouchers = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("CompletedOrderId")) ? true : disableVouchers; WriteLiteral("\t<div class=\"d-flex flex-column gap-2 gap-lg-3 pb-3 bottom-0 sticky-receipt theme\" id=\"orderSummaryFooter\">\n\n"); 355 if (!disableVouchers && Pageview.CurrentParagraph?.Item.SystemName != "Swift_QuoteCheckoutApp") { WriteLiteral("\n"); 356 WriteLiteral("\n"); 357 string voucherCode = GetString("Ecom:Order.Customer.VoucherCode"); string voucherCodeError = GetString("Ecom:Cart.ValidationError.EcomOrderVoucherCode.ErrorMessage"); string validState = string.Empty; bool vouchersAppliedAsDiscounts = false; IEnumerable<string> voucherCodes = new List<string>(); Order order = new OrderService().GetById(GetString("Ecom:Order.ID")); if (!string.IsNullOrWhiteSpace(voucherCode)) { if (order.VoucherUseType.HasFlag(VoucherUseCategoryType.Discount)) { voucherCodes = voucherCode.Split(new string[] { ",", ";", " " }, StringSplitOptions.RemoveEmptyEntries); vouchersAppliedAsDiscounts = true; } else { voucherCodes = new string[] { voucherCode.Trim() }; } } var voucherErrors = new List<string>(); if(!vouchersAppliedAsDiscounts) { foreach (string code in voucherCodes) { Dynamicweb.Ecommerce.Orders.Vouchers.Voucher vouch = Dynamicweb.Ecommerce.Services.Vouchers.GetVoucherByCode(code); if (vouch == null) { validState = "is-invalid"; voucherErrors.Add(Translate("Voucher") + " <span class='fw-bold'>" + code + "</span> " + Translate("not found")); continue; } if (vouch.DateUsed.HasValue) { validState = "is-invalid"; voucherErrors.Add(Translate("Voucher") + " <span class='fw-bold'>" + code + "</span> " + Translate("already used")); continue; } } } var voucherErrorMessage = string.Join(",", voucherErrors); WriteLiteral("<div class=\"py-3 border-top\" id=\"orderVoucherForm\">\n\t<form method=\"post\" id=\"VoucherForm\">\n\t\t<div class=\"input-group input-primary-button-group has-validation\">\n\t\t\t<input type=\"text\""); 358 BeginWriteAttribute("class", " class=\"", 36742, "\"", 36776, 2); 359 WriteAttributeValue("", 36750, "form-control", 36750, 12, true); 360 WriteAttributeValue(" ", 36762, validState, 36763, 13, false); 361 EndWriteAttribute(); 362 WriteLiteral(" name=\"EcomOrderVoucherCodeField\""); 363 BeginWriteAttribute("placeholder", " placeholder=\"", 36810, "\"", 36854, 1); 364 WriteAttributeValue("", 36824, Translate("Add voucher here"), 36824, 30, false); 365 EndWriteAttribute(); 366 WriteLiteral(" id=\"EcomOrderVoucherCodeField\""); 367 BeginWriteAttribute("value", " value=\"", 36886, "\"", 36894, 0); 368 EndWriteAttribute(); 369 BeginWriteAttribute("aria-label", " aria-label=\"", 36895, "\"", 36935, 1); 370 WriteAttributeValue("", 36908, Translate("Voucher input"), 36908, 27, false); 371 EndWriteAttribute(); 372 WriteLiteral(@" oninput=""document.querySelector('#EcomOrderVoucherCode').value = this.value;"" onkeyup=""document.querySelector('#EcomOrderVoucherCode').value = this.value;""> <button class=""btn btn-sm btn-primary d-inline-flex align-items-center justify-content-center"" type=""submit"" id=""EcomOrderVoucherApply"" style=""min-width: 100px;""> <span>"); 373 Write(Translate("Apply")); 374 WriteLiteral("</span>\n\t\t\t</button>\n\n\t\t\t\t<div class=\"invalid-feedback\">\n\t\t\t\t\t"); 375 Write(voucherErrorMessage); 376 WriteLiteral("\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<input type=\"hidden\" name=\"EcomOrderVoucherCode\" id=\"EcomOrderVoucherCode\""); 377 BeginWriteAttribute("value", " value=\"", 37470, "\"", 37490, 1); 378 WriteAttributeValue("", 37478, voucherCode, 37478, 12, false); 379 EndWriteAttribute(); 380 WriteLiteral(">\n\t\t\t<label for=\"EcomOrderVoucherCodeField\" class=\"visually-hidden\">"); 381 Write(Translate("Add voucher here")); 382 WriteLiteral("</label>\n\t\t</form>\n\t\t\n"); 383 if (!string.IsNullOrWhiteSpace(voucherCode) && vouchersAppliedAsDiscounts) { WriteLiteral("\t\t<div class=\"d-flex flex-wrap gap-2 pt-3\">\n\n"); 384 foreach (string code in voucherCodes) { WriteLiteral("\t\t\t\t<form method=\"post\">\n\t\t\t\t\t<input type=\"hidden\" name=\"EcomOrderVoucherCode\""); 385 BeginWriteAttribute("value", " value=\"", 37863, "\"", 37945, 1); 386 WriteAttributeValue("", 37871, voucherCode.Replace(code+",", "").Replace(","+code, "").Replace(code, ""), 37871, 74, false); 387 EndWriteAttribute(); 388 WriteLiteral(">\n\t\t\t\t\t<span class=\"badge fw-normal d-inline-flex align-items-center justify-content-center opacity-50 opacity-100-hover\" style=\"background-color:var(--swift-foreground-color);color:var(--swift-background-color);\">\n\t\t\t\t\t\t<span class=\"icon-2\">\n\t\t\t\t\t\t\t"); 389 Write(ReadFile("/Files/Templates/Designs/Swift/Assets/icons/tag.svg")); 390 WriteLiteral("\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span class=\"mx-2\">"); 391 Write(code); 392 WriteLiteral("</span>\n\t\t\t\t\t\t<button type=\"submit\" class=\"text-reset bg-transparent border-0 p-0\""); 393 BeginWriteAttribute("aria-label", " aria-label=\"", 38387, "\"", 38428, 1); 394 WriteAttributeValue("", 38400, Translate("Remove voucher"), 38400, 28, false); 395 EndWriteAttribute(); 396 WriteLiteral(" id=\"RemoveVoucherButton\">\n\t\t\t\t\t\t\t<span class=\"icon-2\">\n\t\t\t\t\t\t\t\t"); 397 Write(ReadFile("/Files/Templates/Designs/Swift/Assets/icons/x.svg")); 398 WriteLiteral("\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</span>\n\t\t\t\t</form>\n"); 399 } WriteLiteral("\t\t\t</div>\n"); 400 } WriteLiteral("\t\t"); 401 Write(voucherCodeError); 402 WriteLiteral("\n\t</div>\n"); 403 WriteLiteral("\n\t\t\t"); 404 } WriteLiteral("\n\t\t<div class=\"fs-8 border-top pt-2 pt-lg-3\">\n"); 405 WriteLiteral("\t\t\t<div class=\"d-flex justify-content-between fw-bold\">\n\t\t\t\t<span>"); 406 Write(Translate("Subtotal")); 407 WriteLiteral("</span>\n\t\t\t\t<span class=\"text-end\">\n\t\t\t\t\t<span class=\"d-block\">\n"); 408 if (GetDouble("Ecom:Order.TotalPriceWithoutDiscountsFeesAndTaxes.Price.Value") != totalPriceWithoutOrderDiscountsFeesAndTaxesValue) { WriteLiteral("\t\t\t\t\t\t\t<span class=\"text-price fw-normal text-decoration-line-through\">"); 409 Write(GetString("Ecom:Order.TotalPriceWithoutDiscountsFeesAndTaxes.PriceFormatted")); 410 WriteLiteral("</span>\n"); 411 } WriteLiteral("\t\t\t\t\t\t<span class=\"text-price\">"); 412 Write(totalPriceWithoutOrderDiscountsFeesAndTaxes); 413 WriteLiteral("</span>\n\t\t\t\t\t</span>\n\n"); 414 if (!neverShowVat && showPricesWithVat == "false") { WriteLiteral("\t\t\t\t\t\t<span class=\"fs-8 fw-normal d-block\">"); 415 Write(Translate("Excl. VAT")); 416 WriteLiteral("</span>\n"); 417 } else if (!neverShowVat) { WriteLiteral("\t\t\t\t\t\t<span class=\"fs-8 fw-normal d-block\">"); 418 Write(Translate("Incl. VAT")); 419 WriteLiteral("</span>\n"); 420 } WriteLiteral("\t\t\t\t</span>\n\t\t\t</div>\n\n"); 421 foreach (LoopItem orderline in GetLoop("OrderLines")) { bool isDiscount = orderline.GetBoolean("Ecom:Order:OrderLine.IsDiscount"); bool isProductIdOrNumber = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductID")) || !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductNumber")); //Live Cart orderlines may not return ProductId. Manually entered products may not have ProductNumber bool isOrderAmountDiscount = orderline.GetInteger("Ecom:Order:OrderLine.Type") == 1 && !isProductIdOrNumber; if (isDiscount && isOrderAmountDiscount) { WriteLiteral("\t\t\t\t\t<div class=\"d-flex justify-content-between\"><span>"); 422 Write(orderline.GetString("Ecom:Order:OrderLine.ProductName")); 423 WriteLiteral("</span><span class=\"text-price\">"); 424 Write(orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts.PriceFormatted")); 425 WriteLiteral("</span></div>\n"); 426 } } WriteLiteral("\n"); 427 if (!string.IsNullOrEmpty(GetString("Ecom:Order.ShippingMethodID"))) { if (GetDouble("Ecom:Order.ShippingFee.Price.Value") != 0.0) { WriteLiteral("\t\t\t\t\t<div class=\"d-flex justify-content-between\">\n\t\t\t\t\t\t<span>"); 428 Write(Translate("Delivery")); 429 WriteLiteral("</span>\n\t\t\t\t\t\t<span>"); 430 Write(GetString("Ecom:Order.ShippingFee.PriceFormatted")); 431 WriteLiteral("</span>\n\t\t\t\t\t</div>\n"); 432 } } else { WriteLiteral("\t\t\t\t<div class=\"d-flex justify-content-between\">\n\t\t\t\t\t<span>"); 433 Write(Translate("Delivery")); 434 WriteLiteral("</span>\n\t\t\t\t\t<span>"); 435 Write(Translate("Calculated in next step")); 436 WriteLiteral("</span>\n\t\t\t\t</div>\n"); 437 } WriteLiteral("\n"); 438 if (!string.IsNullOrEmpty(GetString("Ecom:Order.PaymentMethodID"))) { if (GetDouble("Ecom:Order.PaymentFee.Price.Value") != 0) { WriteLiteral("\t\t\t\t\t<div class=\"d-flex justify-content-between\">\n\t\t\t\t\t\t<span>"); 439 Write(Translate("Payment")); 440 WriteLiteral("</span>\n\t\t\t\t\t\t<span class=\"text-price\">"); 441 Write(GetString("Ecom:Order.PaymentFee.PriceFormatted")); 442 WriteLiteral("</span>\n\t\t\t\t\t</div>\n"); 443 } } else { WriteLiteral("\t\t\t\t<div class=\"d-flex justify-content-between\">\n\t\t\t\t\t<span>"); 444 Write(Translate("Payment")); 445 WriteLiteral("</span>\n\t\t\t\t\t<span>"); 446 Write(Translate("Calculated in next step")); 447 WriteLiteral("</span>\n\t\t\t\t</div>\n"); 448 } WriteLiteral("\n"); 449 if (GetDouble("Ecom:Order.Taxes.Total.Price.Value") != 0) { WriteLiteral("\t\t\t\t<div class=\"d-flex justify-content-between mb-2\">\n\t\t\t\t\t<span>"); 450 Write(Translate("Sales tax")); 451 WriteLiteral("</span>\n\t\t\t\t\t<span>"); 452 Write(GetString("Ecom:Order.Taxes.Total.PriceFormatted")); 453 WriteLiteral("</span>\n\t\t\t\t</div>\n"); 454 } WriteLiteral("\t\t</div>\n\t\t<div class=\"fs-8 border-top pt-2 pt-lg-3\">\n\t\t\t<div class=\"d-flex justify-content-between fs-6 fw-bold\">\n\t\t\t\t<span>"); 455 Write(Translate("Total")); 456 WriteLiteral("</span>\n"); 457 if (!neverShowVat && showPricesWithVat == "false") { WriteLiteral("\t\t\t\t\t<span class=\"text-price text-end\">\n\t\t\t\t\t\t<span class=\"fs-5 d-block\">"); 458 Write(GetString("Ecom:Order.Price.PriceFormatted")); 459 WriteLiteral("</span>\n\t\t\t\t\t\t<span class=\"fs-8 fw-normal d-block\">"); 460 Write(Translate("Excl. VAT")); 461 WriteLiteral("</span>\n\t\t\t\t\t</span>\n"); 462 } else if (!neverShowVat && showPricesWithVat == "true") { WriteLiteral("\t\t\t\t\t<span class=\"text-price text-end\">\n\t\t\t\t\t\t<span class=\"fs-5 d-block\">"); 463 Write(GetString("Ecom:Order.Price.PriceFormatted")); 464 WriteLiteral("</span>\n\t\t\t\t\t\t<span class=\"fs-8 fw-normal d-block\">"); 465 Write(Translate("Incl. VAT")); 466 WriteLiteral("</span>\n\t\t\t\t\t</span>\n"); 467 } else { WriteLiteral("\t\t\t\t\t<span class=\"text-price fs-5\">"); 468 Write(GetString("Ecom:Order.Price.PriceFormatted")); 469 WriteLiteral("</span>\n"); 470 } WriteLiteral("\t\t\t</div>\n\n"); 471 if (!neverShowVat) { WriteLiteral("\t\t\t\t<div class=\"d-flex justify-content-between\"><span>"); 472 Write(Translate("VAT")); 473 WriteLiteral("</span><span class=\"text-price\">"); 474 Write(GetString("Ecom:Order.Price.VATFormatted")); 475 WriteLiteral("</span></div>\n"); 476 if (showPricesWithVat == "false") { WriteLiteral("\t\t\t\t\t<div class=\"d-flex justify-content-between\"><span>"); 477 Write(Translate("Total incl. VAT")); 478 WriteLiteral("</span><span class=\"text-price\">"); 479 Write(GetString("Ecom:Order.OrderLines.Total.PriceWithVAT")); 480 WriteLiteral("</span></div>\n"); 481 } } WriteLiteral("\n"); 482 if (GetDouble("Ecom:Order.TotalDiscount.Price.Value") != 0) { WriteLiteral("\t\t\t\t<div class=\"d-flex justify-content-between\"><span>"); 483 Write(Translate("Discount")); 484 WriteLiteral("</span><span class=\"text-price\">"); 485 Write(GetString("Ecom:Order.TotalDiscount.PriceFormatted")); 486 WriteLiteral("</span></div>\n"); 487 } WriteLiteral("\t\t</div>\n\t</div>\n"); 488 WriteLiteral("\n</div>\n\n</div>\n\r\n"); 489 WriteLiteral("\n"); 490 string stepsIconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; int currentStep = 1; string nextButtonName = Translate("Next"); string previousButtonName = Translate("Back"); bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); string erpDownCartBehavior = Pageview.AreaSettings.GetRawValueString("ErpDownCartBehavior", "none"); foreach (LoopItem step in GetLoop("StepButtons")) { if (step.GetBoolean("Step.Current")) { currentStep = step.GetInteger("Step.Number"); } if (step.GetInteger("Step.Number") == currentStep + 1) { nextButtonName = Translate(step.GetString("Step.Name")); } if (step.GetInteger("Step.Number") == currentStep + step.GetInteger("Step.Index")) { previousButtonName = Translate("Back to") + " " + Translate(step.GetString("Step.Name")); } } if (currentStep == GetLoop("StepButtons").Count - 1 && Pageview.CurrentParagraph.Item.SystemName != "Swift_QuoteCheckoutApp") { WriteLiteral("\n"); 491 WriteLiteral("\n"); 492 string termsAndConditionsCheckboxValue = GetBoolean("Ecom:Order.Customer.Accepted").ToString(); string termsAndConditionsPageLink = Pageview.CurrentParagraph.Item["TermsAndConditionsPageLink"] != null ? Pageview.CurrentParagraph.Item["TermsAndConditionsPageLink"].ToString() : string.Empty; WriteLiteral("\n"); 493 if (!string.IsNullOrEmpty(termsAndConditionsPageLink)) { WriteLiteral("\t<div class=\"mt-4\" id=\"TermsAndConditions\">\n\t\t<h3 class=\"fs-6 fw-normal mb-0\">"); 494 Write(Translate("Terms and conditions")); 495 WriteLiteral("</h3>\n\t\t<p class=\"fs-8 mb-3\">"); 496 Write(Translate("Agree to terms and conditions and that your informations are correct")); 497 WriteLiteral(@"</p> <div class=""list-group""> <label class=""list-group-item list-group-item-action d-flex justify-content-between"" for=""EcomOrderCustomerAccepted""> <span class=""d-flex justify-content-between align-items-center gap-3""> <input class=""form-check-input m-0"" type=""checkbox"" name=""EcomOrderCustomerAccepted"" id=""EcomOrderCustomerAccepted"""); 498 BeginWriteAttribute("value", " value=\"", 45587, "\"", 45627, 1); 499 WriteAttributeValue("", 45595, termsAndConditionsCheckboxValue, 45595, 32, false); 500 EndWriteAttribute(); 501 WriteLiteral(" "); 502 if (GetString("Ecom:Order.Customer.Accepted") == "true") { WriteLiteral(" checked=\"checked\" "); 503 }WriteLiteral(">\n\t\t\t\t\t<span>"); 504 Write(Translate("I accept the")); 505 WriteLiteral(" <a"); 506 BeginWriteAttribute("href", " href=\'", 45765, "\'", 45799, 1); 507 WriteAttributeValue("", 45772, termsAndConditionsPageLink, 45772, 27, false); 508 EndWriteAttribute(); 509 WriteLiteral(" target=\'_blank\' rel=\'noopener\' id=\"TermsAndConditionsButton\">"); 510 Write(Translate("terms and conditions")); 511 WriteLiteral("</a></span>\n\t\t\t\t</span>\n\t\t\t</label>\n\t\t</div>\n\t</div>\n"); 512 } WriteLiteral("\n\n\t\t"); 513 nextButtonName = Translate("Place Order"); } else if (GetLoop("StepButtons").Count == 0) { nextButtonName = Translate("Pay"); } WriteLiteral("\n<div class=\"mt-4 d-flex flex-column flex-md-row justify-content-end gap-3 mt-lg-4\" id=\"StepsNavigation\">\n"); 514 if (currentStep == 1) { var cartLink = $"Default.aspx?id={Pageview.CurrentParagraph.Page.Parent.ID}"; WriteLiteral("\t\t<a"); 515 BeginWriteAttribute("href", " href=\"", 46320, "\"", 46336, 1); 516 WriteAttributeValue("", 46327, cartLink, 46327, 9, false); 517 EndWriteAttribute(); 518 WriteLiteral(@" class=""btn btn-link link-secondary text-decoration-none order-last order-md-first"" id=""BackToCartButton""> <div class=""d-flex align-items-center justify-content-center position-relative""> <span class=""icon-2 me-1 position-absolute position-md-static start-0""> "); 519 Write(ReadFile(stepsIconPath + "chevron-left.svg")); 520 WriteLiteral("\n\t\t\t\t</span>\n\t\t\t\t<span>"); 521 Write(Translate("Back to cart")); 522 WriteLiteral("</span>\n\t\t\t</div>\n\t\t</a>\n"); 523 } else { WriteLiteral("\t\t<button"); 524 BeginWriteAttribute("name", " name=\"", 46749, "\"", 46799, 1); 525 WriteAttributeValue("", 46756, GetString("CartV2.PreviousStepButtonName"), 46756, 43, false); 526 EndWriteAttribute(); 527 BeginWriteAttribute("id", " id=\"", 46800, "\"", 46848, 1); 528 WriteAttributeValue("", 46805, GetString("CartV2.PreviousStepButtonName"), 46805, 43, false); 529 EndWriteAttribute(); 530 WriteLiteral(" class=\"btn btn-link link-secondary text-decoration-none\">\n\t\t\t<div class=\"d-flex align-items-center justify-content-center position-relative\">\n\t\t\t\t<span class=\"icon-2 me-1 position-absolute position-md-static start-0\">\n\t\t\t\t\t"); 531 Write(ReadFile(stepsIconPath + "chevron-left.svg")); 532 WriteLiteral("\t\n\t\t\t\t</span>\n\t\t\t\t<span>"); 533 Write(previousButtonName); 534 WriteLiteral("</span>\n\t\t\t</div>\n\t\t</button>\n"); 535 } WriteLiteral("\n"); 536 if (!(currentStep == GetLoop("StepButtons").Count - 1 && isErpConnectionDown && erpDownCartBehavior == "disable")) { var buttonId = GetLoop("StepButtons").Count == 0 ? "PayButton" : GetString("CartV2.NextStepButtonName"); WriteLiteral("\t\t<button type=\"submit\""); 537 BeginWriteAttribute("name", " name=\"", 47445, "\"", 47491, 1); 538 WriteAttributeValue("", 47452, GetString("CartV2.NextStepButtonName"), 47452, 39, false); 539 EndWriteAttribute(); 540 BeginWriteAttribute("id", " id=\"", 47492, "\"", 47506, 1); 541 WriteAttributeValue("", 47497, buttonId, 47497, 9, false); 542 EndWriteAttribute(); 543 WriteLiteral(" class=\"btn btn-primary order-first order-md-last\" >\n\t\t\t<div class=\"d-flex align-items-center justify-content-center position-relative pe-none\">\n\t\t\t\t<span>"); 544 Write(nextButtonName); 545 WriteLiteral("</span>\n\t\t\t\t<span class=\"icon-2 ms-1 position-absolute position-md-static end-0\">\n\t\t\t\t\t"); 546 Write(ReadFile(stepsIconPath + "chevron-right.svg")); 547 WriteLiteral("\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</button>\n"); 548 if (currentStep == GetLoop("StepButtons").Count - 1) { if (GetBoolean("Ecom:Order.Delivery.isPickupPoint")) { WriteLiteral("\t\t\t\t<input type=\"hidden\""); 549 BeginWriteAttribute("name", " name=\"", 48121, "\"", 48167, 1); 550 WriteAttributeValue("", 48128, GetString("CartV2.NextStepButtonName"), 48128, 39, false); 551 EndWriteAttribute(); 552 WriteLiteral(" />\n\t\t\t\t<script>\n\t\t\t\t\tdocument.getElementById(\""); 553 Write(GetString("CartV2.NextStepButtonName")); 554 WriteLiteral(@""").addEventListener(""click"", function (e) { const form = e.target.closest(""form""), hiddenParcelShopFields = form.querySelector(""#hiddenParcelshopFields""), hiddenParcelShopFieldsDisabled = hiddenParcelShopFields.querySelectorAll(""input""); e.preventDefault(); if (hiddenParcelShopFieldsDisabled.length > 0) { hiddenParcelShopFieldsDisabled.forEach( (input) => { input.disabled = false; }); } form.submit() }); </script> "); 555 } } } else { WriteLiteral("\t\t<button class=\"btn btn-primary pe-none disabled\">"); 556 Write(Translate("Payment is temporarily disabled")); 557 WriteLiteral("</button>\n"); 558 } WriteLiteral("\n\t<script>\n\t\tif (window.history.replaceState) {\n\t\t\twindow.history.replaceState(null, null, window.location.href);\n\t\t}\n\t</script>\n</div>\n\r\n"); 559 WriteLiteral("\n"); 560 WriteLiteral("\r\n"); 561 WriteLiteral("\n"); 562 WriteLiteral("\r\n"); 563 } 564 #pragma warning restore 1998 565 private static string GetPrimaryImage(LoopItem orderline, string shopId) { bool isProductIdOrNumber = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductID")) || !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductNumber")); //Live Cart orderlines may not return ProductId. Manually entered products may not have ProductNumber bool isProduct = orderline.GetBoolean("Ecom:Order:OrderLine.IsProduct") || (orderline.GetBoolean("Ecom:Order:OrderLine.IsDiscount") && isProductIdOrNumber); string productId = orderline.GetString("Ecom:Order:OrderLine.ProductID"); string variantId = orderline.GetString("Ecom:Order:OrderLine.ProductVariantID"); if (!isProduct || string.IsNullOrEmpty(productId)) return ""; ProductViewModelSettings productSetting = new ProductViewModelSettings { LanguageId = Dynamicweb.Ecommerce.Common.Context.LanguageID, CurrencyCode = Dynamicweb.Ecommerce.Common.Context.Currency.Code, CountryCode = Dynamicweb.Ecommerce.Common.Context.Country.Code2, ShopId = shopId }; ProductViewModel product = ViewModelFactory.CreateView(productSetting, productId, variantId); return product.DefaultImage.Value; } public string RenderDeliveryAddressInline() { List<List<string>> addressFormat = Dynamicweb.Ecommerce.International.Country.GetDisplayAddress(GetString("Ecom:Order.Delivery.Country.Code")); var result = new StringBuilder(); foreach (List<string> addressLine in addressFormat) { for (var i = 0; i < addressLine.Count; i++) { addressLine[i] = Regex.Replace(addressLine[i], "{name}", GetString("Ecom:Order.Delivery.Name"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{firstName}", GetString("Ecom:Order.Delivery.FirstName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{lastName}", GetString("Ecom:Order.Delivery.Surname"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{company}", GetString("Ecom:Order.Delivery.Company"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address}", GetString("Ecom:Order.Delivery.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address1}", GetString("Ecom:Order.Delivery.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address2}", GetString("Ecom:Order.Delivery.Address2"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{zip}", GetString("Ecom:Order.Delivery.Zip"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{city}", GetString("Ecom:Order.Delivery.City"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{regionCode}", GetString("Ecom:Order.Delivery.Region"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{region}", GetDeliveryRegionName(), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{countryCode}", GetString("Ecom:Order.Delivery.Country.Code"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{country}", GetString("Ecom:Order.Delivery.Country"), RegexOptions.IgnoreCase); // Remove any bad placeholders the user may have submitted addressLine[i] = Regex.Replace(addressLine[i], "{phone}", "", RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{email}", "", RegexOptions.IgnoreCase); } var completeLine = string.Join(string.Empty, addressLine.ToArray()); if (!string.IsNullOrWhiteSpace(completeLine)) { result.Append($"<span>{completeLine}</span>"); if (addressLine != addressFormat.Last()) { result.Append(" "); } } } return result.ToString(); } public string GetDeliveryAddressString() { List<List<string>> addressFormat = Dynamicweb.Ecommerce.International.Country.GetDisplayAddress(GetString("Ecom:Order.Delivery.Country.Code")); List<string> completeAddress = new List<string>(); foreach (var addressLine in addressFormat) { for (var i = 0; i < addressLine.Count; i++) { addressLine[i] = Regex.Replace(addressLine[i], "{name}", GetString("Ecom:Order.Delivery.Name"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{firstName}", GetString("Ecom:Order.Delivery.FirstName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{lastName}", GetString("Ecom:Order.Delivery.LastName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{company}", GetString("Ecom:Order.Delivery.Company"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address}", GetString("Ecom:Order.Delivery.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address1}", GetString("Ecom:Order.Delivery.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address2}", GetString("Ecom:Order.Delivery.Address2"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{zip}", GetString("Ecom:Order.Delivery.Zip"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{city}", GetString("Ecom:Order.Delivery.City"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{regionCode}", GetString("Ecom:Order.Delivery.Region"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{region}", GetDeliveryRegionName(), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{countryCode}", GetString("Ecom:Order.Delivery.Country.Code"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{country}", GetString("Ecom:Order.Delivery.Country"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{phone}", GetString("Ecom:Order.Delivery.Phone"), RegexOptions.IgnoreCase); // Remove any bad placeholders the user may have submitted addressLine[i] = Regex.Replace(addressLine[i], "{phone}", "", RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{email}", "", RegexOptions.IgnoreCase); } var completeLine = string.Join(string.Empty, addressLine.ToArray()); if (!string.IsNullOrWhiteSpace(completeLine)) { completeAddress.Add(completeLine); } } return string.Join(", ", completeAddress.ToArray()); } public string GetDeliveryRegionName() { foreach (LoopItem region in GetLoop("DeliveryRegions")) { if (region.GetBoolean("Ecom:DeliveryRegion.IsDeliveryRegion")) { return region.GetString("Ecom:DeliveryRegion.Name"); } } return GetString("Ecom:Order.Delivery.Region"); } public string RenderUserItemAddressInline(LoopItem address) { string regionCode = GetRegionCode(address.GetString("UserManagement:User.UserAddress.CountryCode"), address.GetString("UserManagement:User.UserAddress.State")); string regionName = GetRegionName(address.GetString("UserManagement:User.UserAddress.CountryCode"), address.GetString("UserManagement:User.UserAddress.State")); List<List<string>> addressFormat = Dynamicweb.Ecommerce.International.Country.GetDisplayAddress(address.GetString("UserManagement:User.UserAddress.CountryCode")); var result = new StringBuilder(); foreach (List<string> addressLine in addressFormat) { for (var i = 0; i < addressLine.Count; i++) { addressLine[i] = Regex.Replace(addressLine[i], "{name}", address.GetString("UserManagement:User.UserAddress.Name"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{firstName}", address.GetString("UserManagement:User.UserAddress.FirstName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{lastName}", address.GetString("UserManagement:User.UserAddress.lastName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{company}", address.GetString("UserManagement:User.UserAddress.Company"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address}", address.GetString("UserManagement:User.UserAddress.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address1}", address.GetString("UserManagement:User.UserAddress.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address2}", address.GetString("UserManagement:User.UserAddress.Address2"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{zip}", address.GetString("UserManagement:User.UserAddress.Zip"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{city}", address.GetString("UserManagement:User.UserAddress.City"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{regionCode}", regionCode, RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{region}", regionName, RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{countryCode}", address.GetString("UserManagement:User.UserAddress.Culture.CountryCode"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{country}", address.GetString("UserManagement:User.UserAddress.Culture.CountryName"), RegexOptions.IgnoreCase); // Remove any bad placeholders the user may have submitted addressLine[i] = Regex.Replace(addressLine[i], "{phone}", "", RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{email}", "", RegexOptions.IgnoreCase); } var completeLine = string.Join(string.Empty, addressLine.ToArray()); if (!string.IsNullOrWhiteSpace(completeLine)) { result.Append($"<span>{completeLine}</span> "); } } return result.ToString(); } public string GetUserAddressString() { List<List<string>> addressFormat = Dynamicweb.Ecommerce.International.Country.GetDisplayAddress(GetString("UserManagement:User.CountryCode")); string regionCode = GetRegionCode(GetString("UserManagement:User.CountryCode"), GetString("UserManagement:User.State")); string regionName = GetRegionName(GetString("UserManagement:User.CountryCode"), GetString("UserManagement:User.State")); List<string> completeAddress = new List<string>(); foreach (var addressLine in addressFormat) { for (var i = 0; i < addressLine.Count; i++) { addressLine[i] = Regex.Replace(addressLine[i], "{name}", GetString("UserManagement:User.Name"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{firstName}", GetString("UserManagement:User.FirstName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{lastName}", GetString("UserManagement:User.LastName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{company}", GetString("UserManagement:User.Company"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address}", GetString("UserManagement:User.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address1}", GetString("UserManagement:User.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address2}", GetString("UserManagement:User.Address2"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{zip}", GetString("UserManagement:User.Zip"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{city}", GetString("UserManagement:User.City"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{regionCode}", regionCode, RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{region}", regionName, RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{countryCode}", GetString("UserManagement:User.CountryCode"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{country}", GetString("UserManagement:User.Culture.CountryName"), RegexOptions.IgnoreCase); // Remove any bad placeholders the user may have submitted addressLine[i] = Regex.Replace(addressLine[i], "{phone}", "", RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{email}", "", RegexOptions.IgnoreCase); } var completeLine = string.Join(string.Empty, addressLine.ToArray()); if (!string.IsNullOrWhiteSpace(completeLine)) { completeAddress.Add(completeLine); } } return string.Join(" ", completeAddress.ToArray()); } public string GetRegionName(string countryCode, string regionValue) { return GetRegionNameOrCode(countryCode, regionValue); } public string GetRegionCode(string countryCode, string regionValue) { return GetRegionNameOrCode(countryCode, regionValue, "code"); } public string GetRegionNameOrCode(string countryCode, string regionValue, string nameOrCode = "name") { CountryCollection allCountryRegions = Dynamicweb.Ecommerce.Services.Countries.GetRegions(countryCode); Country matchedRegion = allCountryRegions.FirstOrDefault(r => r.RegionCode == regionValue || r.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID) == regionValue); if (matchedRegion == null) return regionValue; return nameOrCode == "name" ? matchedRegion.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID) : matchedRegion.RegionCode; } } 566 } 567 #pragma warning restore 1591 568

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb 3 @using System.IO 4 5 @{ 6 var themeRaw = Pageview.CurrentParagraph.Item["Theme"]?.ToString(); 7 string theme = !string.IsNullOrEmpty(themeRaw) ? " theme " + themeRaw.Replace(" ", "").Trim().ToLower() : ""; 8 } 9 10 <div class="grid gap-0 h-100"> 11 <div class="g-col-12 g-col-lg-8 p-3 p-lg-4 pe-xl-5 ps-xl-6 ps-xxl-8 order-last order-lg-first@(theme)"> 12 <form name="ordersubmit" id="ordersubmit" method="post" autocomplete="off" style="max-width: 65rem; margin-left: auto;"> 13 14 @{ <text>@{RenderLogo();}</text> } 15 16 <h1 class="h2">@Translate("Request quote")</h1> 17 <p>@Translate("Please fill out the form below to request a quote. We will get back to you within 24 hours")</p> 18 19 @{ 20 <text>@{RenderErrors();}</text> 21 22 <text>@{RenderStepSummary();}</text> 23 } 24 25 <div class="form-floating mt-4"> 26 <textarea class="form-control" placeholder="@Translate("Add quote request here")" name="QuoteRequest" id="QuoteRequest" style="min-height: 100px" value="@GetString("QuoteRequest.Clean")"></textarea> 27 <label for="QuoteRequest">@Translate("Add quote request here")</label> 28 </div> 29 30 @{ <text>@{RenderStepsNavigation();}</text> } 31 32 <input type="hidden" id="CurrentStep"> 33 </form> 34 </div> 35 36 @{ <text>@{RenderSummarySidebar();}</text> } 37 38 </div> 39 40 <script> 41 function submitForm() { 42 document.querySelector("#CurrentStep").name = "@GetString("CartV2.CurrentStepButtonName")"; 43 swift.PageUpdater.Update(document.querySelector("#ordersubmit")); 44 } 45 </script> 46 47 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb @using System.IO @{ string logoLink = Pageview.CurrentParagraph?.Item["LogoLink"] != null ? Pageview.CurrentParagraph.Item["LogoLink"].ToString() : string.Empty; string logoImage = Pageview.CurrentParagraph?.Item["Logo"] != null ? Pageview.CurrentParagraph.Item["Logo"].ToString() : string.Empty; string title = Pageview.CurrentParagraph?.Item["Title"] != null ? Pageview.CurrentParagraph.Item["Title"].ToString() : Pageview.Area.Name; string maxWidth = Pageview.CurrentParagraph?.Item["MaxWidth"] != null ? "max-width: " + Pageview.CurrentParagraph.Item["MaxWidth"].ToString() + "px" : string.Empty; maxWidth = maxWidth == "max-width: 0px" ? string.Empty : maxWidth; } <div class="mb-4 text-center"> @if (!string.IsNullOrWhiteSpace(logoLink)) { @:<a href="@logoLink" class="text-decoration-none" title="@Translate("Leave checkout")"> } @if (logoImage != "") { if (Path.GetExtension(logoImage).ToLower() == ".svg") { <div class="icon-auto" style="@maxWidth"> @ReadFile(logoImage) </div> } else { string imageWidth = Pageview.CurrentParagraph.Item["MaxWidth"] != null ? Pageview.CurrentParagraph.Item["MaxWidth"].ToString() : "400"; string imagePath = "/Admin/Public/GetImage.ashx?width=" + imageWidth + "&image=" + logoImage; <picture class="mx-auto d-block"> <img src="@logoImage" alt="@title" style="@maxWidth"> </picture> } } else { <div class="fs-3 p-0">@title</div> } @if (!string.IsNullOrWhiteSpace(logoLink)) { @:</a> } </div> 48 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @if (GetLoop("ValidationErrors").Count() != 0) { <div class="alert alert-warning" role="alert"> <ul class="m-0 list-unstyled"> @foreach (LoopItem item in GetLoop("ValidationErrors")) { <li>@item.GetValue("Ecom:Cart.ValidationError.ErrorMessage")</li> } </ul> </div> } 49 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ bool summaryIsPaymentStep = GetLoop("StepButtons").Count == 0; int summaryCurrentStep = !summaryIsPaymentStep ? 1 : 4; int summaryCurrentUserId = Dynamicweb.Core.Converter.ToInt32(GetGlobalValue("Global:Extranet.UserID")); foreach (LoopItem step in GetLoop("StepButtons")) { if (step.GetBoolean("Step.Current")) { summaryCurrentStep = step.GetInteger("Step.Number"); } } } @if (!string.IsNullOrEmpty(GetString("UserManagement:User.Address")) || !string.IsNullOrEmpty(GetString("Ecom:Order.ShippingMethodID")) || !string.IsNullOrEmpty(GetString("Ecom:Order.PaymentMethodID")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Name")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Company")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address2")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Zip")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.City")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Email")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Phone")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Name")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Company")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Address")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Address2")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Zip")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.City")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone")) || !string.IsNullOrEmpty(GetString("Ecom:Order.ShippingMethod")) || !string.IsNullOrEmpty(GetString("Ecom:Order.ShippingDate")) || !string.IsNullOrEmpty(GetString("Ecom:Order.PaymentMethod"))) { @* User *@ if (summaryCurrentUserId != 0) { <div class="list-group mb-5"> @{ <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ var summaryCustomerHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int summaryCustomerCurrentUserId = Dynamicweb.Core.Converter.ToInt32(GetGlobalValue("Global:Extranet.UserID")); List<string> contact = new List<string>(); if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone"))) { if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email"))) { contact.Add(GetString("Ecom:Order.Customer.Email")); } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone"))) { contact.Add(GetString("Ecom:Order.Customer.Phone")); } } string summaryCustomerContactString = (string.Join(",", contact.Select(x => x.ToString()).ToArray())).Replace(",", ", "); string summaryCustomerUserAccountPage = Pageview.CurrentParagraph.Item["UserAccountPageLink"] != null ? Pageview.CurrentParagraph.Item["UserAccountPageLink"].ToString() + "&GoBackToPage=" + Pageview.Page.ID : ""; } @if (!string.IsNullOrEmpty(summaryCustomerContactString)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)" id="ContactGroup"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Contact")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@summaryCustomerContactString</dd> @if (!summaryCustomerHideEditBillingAddress) { <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> @if (summaryCustomerCurrentUserId == 0) { <button type="submit" class="btn btn-small btn-link fs-8 p-0" name="CartV2.GotoStep0" id="EditBillingAddressButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> } else { <a href="@summaryCustomerUserAccountPage" class="btn btn-small btn-link fs-8 p-0" id="EditBillingAddressButton"> <span class="text-uppercase">@Translate("Edit")</span> </a> } </dd> } </dl> </div> } </text> <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb @{ var summaryUserHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int summaryUserFieldCount = 0; //Helps us render addresses that contains more than just the auto set country bool summaryUserIsStandardSwiftTemplates = Pageview.AreaSettings.GetString("AddressFieldsBasedOn", "swift") == "swift"; string stepSummaryAddressString = string.Empty; if (summaryUserIsStandardSwiftTemplates) { Dynamicweb.Security.UserManagement.User user = Pageview.User; List<string> address = new List<string>(); if (!string.IsNullOrEmpty(user.Company)) { address.Add(user.Company); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.Name)) { address.Add(user.Name); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.Address)) { address.Add(user.Address); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.Address2)) { address.Add(user.Address2); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.Zip)) { address.Add(user.Zip); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.City)) { address.Add(user.City); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.State)) { var countryCode = user.CountryCode; string stateName = Dynamicweb.Ecommerce.Services.Countries.GetRegion(countryCode, user.State)?.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID) ?? string.Empty; address.Add(stateName); summaryUserFieldCount++; } if (!string.IsNullOrEmpty(user.CountryCode)) { string country = user.Region.DisplayName; address.Add(country); summaryUserFieldCount++; } stepSummaryAddressString = (string.Join(",", address.Select(x => x.ToString()).ToArray())).Replace(",", ", "); } else { stepSummaryAddressString = GetUserAddressString(); } string editStep = Pageview.CurrentParagraph.Item["UserAccountPageLink"] != null ? Pageview.CurrentParagraph.Item["UserAccountPageLink"].ToString() + "&GoBackToPage=" + Pageview.Page.ID : ""; } @if (!string.IsNullOrEmpty(stepSummaryAddressString) && ((summaryUserIsStandardSwiftTemplates && summaryUserFieldCount > 1) || !summaryUserIsStandardSwiftTemplates)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Billing")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@stepSummaryAddressString</dd> @if (!summaryUserHideEditBillingAddress) { <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> <a href="@editStep" class="btn btn-small btn-link fs-8 p-0" id="EditBillingAddressButton"> <span class="text-uppercase">@Translate("Edit")</span> </a> </dd> } </dl> </div> } </text> } @if (summaryCurrentStep != 1) { <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ var billingHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int billingFieldCount = 0; //Helps us render addresses that contains more than just the auto set country bool summaryBillingIsStandardSwiftTemplates = Pageview.AreaSettings.GetString("AddressFieldsBasedOn", "swift") == "swift"; string billingAddressString = string.Empty; if (summaryBillingIsStandardSwiftTemplates) { List<string> address = new List<string>(); if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Company"))) { address.Add(GetString("Ecom:Order.Delivery.Company")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Name"))) { address.Add(GetString("Ecom:Order.Delivery.Name")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address"))) { address.Add(GetString("Ecom:Order.Delivery.Address")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address2"))) { address.Add(GetString("Ecom:Order.Delivery.Address2")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Zip"))) { address.Add(GetString("Ecom:Order.Delivery.Zip")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.City"))) { address.Add(GetString("Ecom:Order.Delivery.City")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Region"))) { string regionName = GetString("Ecom:Order.Delivery.Region"); foreach (LoopItem region in GetLoop("DeliveryRegions")) { if (region.GetString("Ecom:DeliveryRegion.IsDeliveryRegion") == "true") { regionName = region.GetString("Ecom:DeliveryRegion.Name"); } } address.Add(regionName); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Country"))) { address.Add(GetString("Ecom:Order.Delivery.Country")); billingFieldCount++; } billingAddressString = (string.Join(",", address.Select(x => x.ToString()).ToArray())).Trim(',').Replace(",", ", "); } else { billingAddressString = GetDeliveryAddressString(); } } @if (!string.IsNullOrEmpty(billingAddressString) && ((summaryBillingIsStandardSwiftTemplates && billingFieldCount > 1) || !summaryBillingIsStandardSwiftTemplates)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Selected address")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@billingAddressString</dd> @if (!billingHideEditBillingAddress) { <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> <button class="btn btn-small btn-link fs-8 p-0" type="submit" name="CartV2.GotoStep0" id="EditDeliveryAddressButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> </dd> } </dl> </div> } </text> <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ string shippingMethod = GetString("Ecom:Order.ShippingMethod"); } @if (!string.IsNullOrEmpty(shippingMethod)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Delivery")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@shippingMethod</dd> <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> <button class="btn btn-small btn-link fs-8 p-0" type="submit" name="CartV2.GotoStep1" id="EditDeliveryButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> </dd> </dl> </div> } </text> <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ string shippingDate = GetString("Ecom:Order.ShippingDate"), shippingDateFormatted = GetDate("Ecom:Order.ShippingDate").ToShortDateString(); } @if (!string.IsNullOrEmpty(shippingDate)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Delivery date")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@shippingDateFormatted</dd> <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> <button class="btn btn-small btn-link fs-8 p-0" type="submit" name="CartV2.GotoStep1" id="EditDeliveryDateButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> </dd> </dl> </div> } </text> } </div> } @* Anonymous *@ else { if (summaryCurrentStep != 1) { <div class="list-group"> @{ <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ var summaryCustomerHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int summaryCustomerCurrentUserId = Dynamicweb.Core.Converter.ToInt32(GetGlobalValue("Global:Extranet.UserID")); List<string> contact = new List<string>(); if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email")) || !string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone"))) { if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Email"))) { contact.Add(GetString("Ecom:Order.Customer.Email")); } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Customer.Phone"))) { contact.Add(GetString("Ecom:Order.Customer.Phone")); } } string summaryCustomerContactString = (string.Join(",", contact.Select(x => x.ToString()).ToArray())).Replace(",", ", "); string summaryCustomerUserAccountPage = Pageview.CurrentParagraph.Item["UserAccountPageLink"] != null ? Pageview.CurrentParagraph.Item["UserAccountPageLink"].ToString() + "&GoBackToPage=" + Pageview.Page.ID : ""; } @if (!string.IsNullOrEmpty(summaryCustomerContactString)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)" id="ContactGroup"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Contact")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@summaryCustomerContactString</dd> @if (!summaryCustomerHideEditBillingAddress) { <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> @if (summaryCustomerCurrentUserId == 0) { <button type="submit" class="btn btn-small btn-link fs-8 p-0" name="CartV2.GotoStep0" id="EditBillingAddressButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> } else { <a href="@summaryCustomerUserAccountPage" class="btn btn-small btn-link fs-8 p-0" id="EditBillingAddressButton"> <span class="text-uppercase">@Translate("Edit")</span> </a> } </dd> } </dl> </div> } </text> <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ var billingHideEditBillingAddress = Pageview.CurrentParagraph?.Item["HideEditBillingAddress"] != null ? Convert.ToBoolean(Pageview.CurrentParagraph.Item["HideEditBillingAddress"].ToString()) : false; int billingFieldCount = 0; //Helps us render addresses that contains more than just the auto set country bool summaryBillingIsStandardSwiftTemplates = Pageview.AreaSettings.GetString("AddressFieldsBasedOn", "swift") == "swift"; string billingAddressString = string.Empty; if (summaryBillingIsStandardSwiftTemplates) { List<string> address = new List<string>(); if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Company"))) { address.Add(GetString("Ecom:Order.Delivery.Company")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Name"))) { address.Add(GetString("Ecom:Order.Delivery.Name")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address"))) { address.Add(GetString("Ecom:Order.Delivery.Address")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Address2"))) { address.Add(GetString("Ecom:Order.Delivery.Address2")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Zip"))) { address.Add(GetString("Ecom:Order.Delivery.Zip")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.City"))) { address.Add(GetString("Ecom:Order.Delivery.City")); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Region"))) { string regionName = GetString("Ecom:Order.Delivery.Region"); foreach (LoopItem region in GetLoop("DeliveryRegions")) { if (region.GetString("Ecom:DeliveryRegion.IsDeliveryRegion") == "true") { regionName = region.GetString("Ecom:DeliveryRegion.Name"); } } address.Add(regionName); billingFieldCount++; } if (!string.IsNullOrEmpty(GetString("Ecom:Order.Delivery.Country"))) { address.Add(GetString("Ecom:Order.Delivery.Country")); billingFieldCount++; } billingAddressString = (string.Join(",", address.Select(x => x.ToString()).ToArray())).Trim(',').Replace(",", ", "); } else { billingAddressString = GetDeliveryAddressString(); } } @if (!string.IsNullOrEmpty(billingAddressString) && ((summaryBillingIsStandardSwiftTemplates && billingFieldCount > 1) || !summaryBillingIsStandardSwiftTemplates)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Selected address")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@billingAddressString</dd> @if (!billingHideEditBillingAddress) { <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> <button class="btn btn-small btn-link fs-8 p-0" type="submit" name="CartV2.GotoStep0" id="EditDeliveryAddressButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> </dd> } </dl> </div> } </text> } @if (summaryCurrentStep > 2) { <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ string shippingMethod = GetString("Ecom:Order.ShippingMethod"); } @if (!string.IsNullOrEmpty(shippingMethod)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Delivery")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@shippingMethod</dd> <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> <button class="btn btn-small btn-link fs-8 p-0" type="submit" name="CartV2.GotoStep1" id="EditDeliveryButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> </dd> </dl> </div> } </text> <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ string shippingDate = GetString("Ecom:Order.ShippingDate"), shippingDateFormatted = GetDate("Ecom:Order.ShippingDate").ToShortDateString(); } @if (!string.IsNullOrEmpty(shippingDate)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Delivery date")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@shippingDateFormatted</dd> <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> <button class="btn btn-small btn-link fs-8 p-0" type="submit" name="CartV2.GotoStep1" id="EditDeliveryDateButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> </dd> </dl> </div> } </text> } @if (summaryCurrentStep > 3) { <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ string PaymentMethodID = GetString("Ecom:Order.ShippingMethodID"); string paymentMethod = GetString("Ecom:Order.PaymentMethod"); } @if(!string.IsNullOrEmpty(PaymentMethodID)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Payment")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@paymentMethod</dd> <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> <button class="btn btn-small btn-link fs-8 p-0" type="submit" name="CartV2.GotoStep2" id="EditPaymentButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> </dd> </dl> </div> } </text> <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ string stepSummaryOrderReference = !string.IsNullOrWhiteSpace(GetString("Ecom:Order.Reference")) ? GetString("Ecom:Order.Reference") : ""; if (!string.IsNullOrEmpty(stepSummaryOrderReference)) { <div class="list-group-item py-2 fs-7" style="background-color: rgba(var(--swift-foreground-color-rgb), 0.05)"> <dl class="grid gap-1 gap-sm-3 mb-0"> <dt class="g-col-8 g-col-sm-4 fw-normal">@Translate("Order reference")</dt> <dd class="g-col-12 g-col-sm-7 order-2 order-sm-1 mb-0">@stepSummaryOrderReference</dd> <dd class="g-col-4 g-col-sm-1 order-1 order-sm-2 mb-0 text-end"> <button class="btn btn-small btn-link fs-8 p-0" type="submit" name="CartV2.GotoStep2" id="EditorderReferenceButton"> <span class="text-uppercase">@Translate("Edit")</span> </button> </dd> </dl> </div> } } </text> } </div> } } } 50 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> <div class="g-col-12 g-col-lg-4 py-2 p-3 p-lg-4 p-xl-5" id="summarySidebar"> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ string iconPath = "/Files/Icons/"; } <button class="toggle-order-summary btn text-reset w-100 d-block d-lg-none px-0" type="button" data-bs-toggle="collapse" data-bs-target="#orderSummary" aria-expanded="false" aria-controls="orderSummary" id="OrderSummaryToggleButton"> <span class="d-flex align-items-center justify-content-between"> <span class="d-flex align-items-center gap-2"> <span class="fs-7 lh-1"> <span class="toggle-order-summary-text" id="OrderSummaryToggleButtonLabel">@Translate("Show order summary")</span> </span> <span class="icon-2" id="OrderSummaryToggleButtonIcon" style="transition: all 0.25s ease-in-out;"> @ReadFile(iconPath + "chevron-down.svg") </span> </span> <span class="fw-bold"> <span class="text-price">@GetString("Ecom:Order.Price")</span> </span> </span> </button> <script> const orderSummaryToggleButton = document.getElementById("OrderSummaryToggleButton"); const orderSummaryToggleButtonLabel = document.getElementById("OrderSummaryToggleButtonLabel"); const orderSummaryToggleButtonIcon = document.getElementById("OrderSummaryToggleButtonIcon"); const orderSummaryToggleText = '@Translate("Show order summary")'; orderSummaryToggleButton.addEventListener('click', function handleClick() { if (orderSummaryToggleButtonLabel.textContent.toLowerCase().includes(orderSummaryToggleText.toLowerCase())) { orderSummaryToggleButtonLabel.textContent = '@Translate("Hide order summary")'; orderSummaryToggleButtonIcon.classList.add("rotate-180"); } else { orderSummaryToggleButtonLabel.textContent = orderSummaryToggleText; orderSummaryToggleButtonIcon.classList.remove("rotate-180"); } }); </script> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> <div class="d-lg-block h-lg-auto collapse pt-2 pt-lg-0" id="orderSummary"> <div class="d-flex flex-column gap-2 gap-lg-3 pb-2 pb-lg-3"> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Ecommerce.ProductCatalog @functions { private static string GetPrimaryImage(LoopItem orderline, string shopId) { bool isProductIdOrNumber = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductID")) || !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductNumber")); //Live Cart orderlines may not return ProductId. Manually entered products may not have ProductNumber bool isProduct = orderline.GetBoolean("Ecom:Order:OrderLine.IsProduct") || (orderline.GetBoolean("Ecom:Order:OrderLine.IsDiscount") && isProductIdOrNumber); string productId = orderline.GetString("Ecom:Order:OrderLine.ProductID"); string variantId = orderline.GetString("Ecom:Order:OrderLine.ProductVariantID"); if (!isProduct || string.IsNullOrEmpty(productId)) return ""; ProductViewModelSettings productSetting = new ProductViewModelSettings { LanguageId = Dynamicweb.Ecommerce.Common.Context.LanguageID, CurrencyCode = Dynamicweb.Ecommerce.Common.Context.Currency.Code, CountryCode = Dynamicweb.Ecommerce.Common.Context.Country.Code2, ShopId = shopId }; ProductViewModel product = ViewModelFactory.CreateView(productSetting, productId, variantId); return product.DefaultImage.Value; } } @{ var orderlines = GetLoop("OrderLines"); } @for (int i = orderlines.Count - 1; i >= 0; i--) { var orderline = orderlines[i]; string name = orderline.GetString("Ecom:Order:OrderLine.ProductName"); string orderlineImage = GetPrimaryImage(orderline, GetString("Ecom:Order.ShopID")); string image = "/Admin/Public/GetImage.ashx?width=" + 180 + "&height=" + 180 + "&crop=5&fillcanvas=true&Background=ffffff&image=" + orderlineImage + "&format=webp"; image = !orderlineImage.StartsWith("/Files/", StringComparison.OrdinalIgnoreCase) ? orderlineImage : image; string removeFromBasketLink = orderline.GetString("Ecom:Order:OrderLine.DeleteLink"); string priceTotalWithDiscounts = orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts.PriceFormatted"); string priceBefore = orderline.GetString("Ecom:Product.InformativePrice.PriceFormatted"); string unitPrice = orderline.GetString("Ecom:Order:OrderLine.UnitPrice.PriceFormatted"); string discountPrice = orderline.GetString("Ecom:Order:OrderLine.UnitPriceWithProductDiscount.PriceFormatted"); string discountTotal = orderline.GetString("Ecom:Order:OrderLine.TotalDiscount.PriceFormatted"); string variantText = orderline.GetString("Ecom:Order:OrderLine.ProductVariantText"); var orderlineId = orderline.GetValue("Ecom:Order:OrderLine.Id"); var quantity = orderline.GetDouble("Ecom:Order:OrderLine.Quantity"); var unitName = orderline.GetString("Ecom:Order:OrderLine.UnitName"); string primaryGroupId = orderline.GetString("Ecom:Order:OrderLine.PrimaryOrDefaultGroupId"); string productId = orderline.GetString("Ecom:Order:OrderLine.ProductID"); string variantId = orderline.GetString("Ecom:Order:OrderLine.ProductVariantID"); string link = "Default.aspx?ID=" + GetPageIdByNavigationTag("Shop"); link += $"&GroupID={primaryGroupId}"; link += $"&ProductID={productId}"; link += !string.IsNullOrEmpty(variantId) ? $"&VariantID={variantId}" : ""; bool isProductIdOrNumber = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductID")) || !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductNumber")); //Live Cart orderlines may not return ProductId. Manually entered products may not have ProductNumber bool isProduct = orderline.GetBoolean("Ecom:Order:OrderLine.IsProduct") || (orderline.GetBoolean("Ecom:Order:OrderLine.IsDiscount") && isProductIdOrNumber); if (isProduct) { <article class="grid grid-12"> <div class="g-col-2"> <a href="@link" class="ratio ratio-1x1 d-block " title="@name"> <img src="@image" style="object-fit: contain;" alt="@name"> </a> </div> <div class="g-col-10"> <div class="d-flex flex-column gap-1"> @* Title *@ <h3 class="h6 fs-7 m-0"> <a href="@link" class="text-decoration-none" title="@name">@name</a> </h3> @* Variants *@ @if (!string.IsNullOrEmpty(variantText)) { <p class="fs-8 m-0">@variantText</p> } @if (orderline.GetBoolean("Ecom:Order:OrderLine.IsDiscount")) { @* Free product notice *@ <p class="fs-8 m-0">@Translate("Free product")</p> } else { @* Unit price *@ <p class="fs-8 m-0"> @if (!string.IsNullOrEmpty(unitName)) { <span>@unitName: </span> } @if (discountPrice == unitPrice) { <span class="text-price">@unitPrice</span> } else { <span class="text-price">@discountPrice</span> <span class="text-decoration-line-through"> <span class="text-price">@unitPrice</span> </span> } </p> } <div class="d-flex flex-row justify-content-between"> @* Quantity *@ <span class="fs-8 d-block">@Translate("Qty"): @quantity</span> <div class="text-end flex-fill"> @* Total *@ <span class="h6 d-block fs-7 m-0"> <span class="text-price">@priceTotalWithDiscounts</span> </span> @if (orderline.GetDouble("Ecom:Order:OrderLine.TotalDiscount.Price.Value") != 0.0) { <span class="d-block fs-8"> <span class="text-price">@discountTotal</span> </span> } </div> </div> </div> </div> </article> } } </div> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ double totalPriceWithoutOrderDiscountsFeesAndTaxesValue = GetDouble("Ecom:Order.TotalPriceWithoutDiscountsFeesAndTaxes.Price.Value") + GetDouble("Ecom:Order.TotalProductDiscount.Price.Value"); var orderCurrency = Dynamicweb.Ecommerce.Services.Currencies.GetCurrency(GetString("Ecom:Order.Currency.Code")); string totalPriceWithoutOrderDiscountsFeesAndTaxes = Dynamicweb.Ecommerce.Services.Currencies.Format(orderCurrency, totalPriceWithoutOrderDiscountsFeesAndTaxesValue); string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); bool disableVouchers = Pageview.CurrentParagraph?.Item["DisableVouchers"] != null ? (Boolean)Pageview.CurrentParagraph.Item["DisableVouchers"] : false; disableVouchers = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("CompletedOrderId")) ? true : disableVouchers; <div class="d-flex flex-column gap-2 gap-lg-3 pb-3 bottom-0 sticky-receipt theme" id="orderSummaryFooter"> @if (!disableVouchers && Pageview.CurrentParagraph?.Item.SystemName != "Swift_QuoteCheckoutApp") { <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using Dynamicweb.Ecommerce.Orders @{ string voucherCode = GetString("Ecom:Order.Customer.VoucherCode"); string voucherCodeError = GetString("Ecom:Cart.ValidationError.EcomOrderVoucherCode.ErrorMessage"); string validState = string.Empty; bool vouchersAppliedAsDiscounts = false; IEnumerable<string> voucherCodes = new List<string>(); Order order = new OrderService().GetById(GetString("Ecom:Order.ID")); if (!string.IsNullOrWhiteSpace(voucherCode)) { if (order.VoucherUseType.HasFlag(VoucherUseCategoryType.Discount)) { voucherCodes = voucherCode.Split(new string[] { ",", ";", " " }, StringSplitOptions.RemoveEmptyEntries); vouchersAppliedAsDiscounts = true; } else { voucherCodes = new string[] { voucherCode.Trim() }; } } var voucherErrors = new List<string>(); if(!vouchersAppliedAsDiscounts) { foreach (string code in voucherCodes) { Dynamicweb.Ecommerce.Orders.Vouchers.Voucher vouch = Dynamicweb.Ecommerce.Services.Vouchers.GetVoucherByCode(code); if (vouch == null) { validState = "is-invalid"; voucherErrors.Add(Translate("Voucher") + " <span class='fw-bold'>" + code + "</span> " + Translate("not found")); continue; } if (vouch.DateUsed.HasValue) { validState = "is-invalid"; voucherErrors.Add(Translate("Voucher") + " <span class='fw-bold'>" + code + "</span> " + Translate("already used")); continue; } } } var voucherErrorMessage = string.Join(",", voucherErrors); <div class="py-3 border-top" id="orderVoucherForm"> <form method="post" id="VoucherForm"> <div class="input-group input-primary-button-group has-validation"> <input type="text" class="form-control @(validState)" name="EcomOrderVoucherCodeField" placeholder="@Translate("Add voucher here")" id="EcomOrderVoucherCodeField" value="" aria-label="@Translate("Voucher input")" oninput="document.querySelector('#EcomOrderVoucherCode').value = this.value;" onkeyup="document.querySelector('#EcomOrderVoucherCode').value = this.value;"> <button class="btn btn-sm btn-primary d-inline-flex align-items-center justify-content-center" type="submit" id="EcomOrderVoucherApply" style="min-width: 100px;"> <span>@Translate("Apply")</span> </button> <div class="invalid-feedback"> @voucherErrorMessage </div> </div> <input type="hidden" name="EcomOrderVoucherCode" id="EcomOrderVoucherCode" value="@voucherCode"> <label for="EcomOrderVoucherCodeField" class="visually-hidden">@Translate("Add voucher here")</label> </form> @if (!string.IsNullOrWhiteSpace(voucherCode) && vouchersAppliedAsDiscounts) { <div class="d-flex flex-wrap gap-2 pt-3"> @foreach (string code in voucherCodes) { <form method="post"> <input type="hidden" name="EcomOrderVoucherCode" value="@voucherCode.Replace(code+",", "").Replace(","+code, "").Replace(code, "")"> <span class="badge fw-normal d-inline-flex align-items-center justify-content-center opacity-50 opacity-100-hover" style="background-color:var(--swift-foreground-color);color:var(--swift-background-color);"> <span class="icon-2"> @ReadFile("/Files/Templates/Designs/Swift/Assets/icons/tag.svg") </span> <span class="mx-2">@code</span> <button type="submit" class="text-reset bg-transparent border-0 p-0" aria-label="@Translate("Remove voucher")" id="RemoveVoucherButton"> <span class="icon-2"> @ReadFile("/Files/Templates/Designs/Swift/Assets/icons/x.svg") </span> </button> </span> </form> } </div> } @voucherCodeError </div> } </text> } <div class="fs-8 border-top pt-2 pt-lg-3"> @* Subtotal *@ <div class="d-flex justify-content-between fw-bold"> <span>@Translate("Subtotal")</span> <span class="text-end"> <span class="d-block"> @if (GetDouble("Ecom:Order.TotalPriceWithoutDiscountsFeesAndTaxes.Price.Value") != totalPriceWithoutOrderDiscountsFeesAndTaxesValue) { <span class="text-price fw-normal text-decoration-line-through">@GetString("Ecom:Order.TotalPriceWithoutDiscountsFeesAndTaxes.PriceFormatted")</span> } <span class="text-price">@totalPriceWithoutOrderDiscountsFeesAndTaxes</span> </span> @if (!neverShowVat && showPricesWithVat == "false") { <span class="fs-8 fw-normal d-block">@Translate("Excl. VAT")</span> } else if (!neverShowVat) { <span class="fs-8 fw-normal d-block">@Translate("Incl. VAT")</span> } </span> </div> @* Discounts (only order discounts) *@ @foreach (LoopItem orderline in GetLoop("OrderLines")) { bool isDiscount = orderline.GetBoolean("Ecom:Order:OrderLine.IsDiscount"); bool isProductIdOrNumber = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductID")) || !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductNumber")); //Live Cart orderlines may not return ProductId. Manually entered products may not have ProductNumber bool isOrderAmountDiscount = orderline.GetInteger("Ecom:Order:OrderLine.Type") == 1 && !isProductIdOrNumber; if (isDiscount && isOrderAmountDiscount) { <div class="d-flex justify-content-between"><span>@orderline.GetString("Ecom:Order:OrderLine.ProductName")</span><span class="text-price">@orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts.PriceFormatted")</span></div> } } @* Delivery *@ @if (!string.IsNullOrEmpty(GetString("Ecom:Order.ShippingMethodID"))) { if (GetDouble("Ecom:Order.ShippingFee.Price.Value") != 0.0) { <div class="d-flex justify-content-between"> <span>@Translate("Delivery")</span> <span>@GetString("Ecom:Order.ShippingFee.PriceFormatted")</span> </div> } } else { <div class="d-flex justify-content-between"> <span>@Translate("Delivery")</span> <span>@Translate("Calculated in next step")</span> </div> } @* Payment *@ @if (!string.IsNullOrEmpty(GetString("Ecom:Order.PaymentMethodID"))) { if (GetDouble("Ecom:Order.PaymentFee.Price.Value") != 0) { <div class="d-flex justify-content-between"> <span>@Translate("Payment")</span> <span class="text-price">@GetString("Ecom:Order.PaymentFee.PriceFormatted")</span> </div> } } else { <div class="d-flex justify-content-between"> <span>@Translate("Payment")</span> <span>@Translate("Calculated in next step")</span> </div> } @* Taxes *@ @if (GetDouble("Ecom:Order.Taxes.Total.Price.Value") != 0) { <div class="d-flex justify-content-between mb-2"> <span>@Translate("Sales tax")</span> <span>@GetString("Ecom:Order.Taxes.Total.PriceFormatted")</span> </div> } </div> <div class="fs-8 border-top pt-2 pt-lg-3"> <div class="d-flex justify-content-between fs-6 fw-bold"> <span>@Translate("Total")</span> @if (!neverShowVat && showPricesWithVat == "false") { <span class="text-price text-end"> <span class="fs-5 d-block">@GetString("Ecom:Order.Price.PriceFormatted")</span> <span class="fs-8 fw-normal d-block">@Translate("Excl. VAT")</span> </span> } else if (!neverShowVat && showPricesWithVat == "true") { <span class="text-price text-end"> <span class="fs-5 d-block">@GetString("Ecom:Order.Price.PriceFormatted")</span> <span class="fs-8 fw-normal d-block">@Translate("Incl. VAT")</span> </span> } else { <span class="text-price fs-5">@GetString("Ecom:Order.Price.PriceFormatted")</span> } </div> @if (!neverShowVat) { <div class="d-flex justify-content-between"><span>@Translate("VAT")</span><span class="text-price">@GetString("Ecom:Order.Price.VATFormatted")</span></div> if (showPricesWithVat == "false") { <div class="d-flex justify-content-between"><span>@Translate("Total incl. VAT")</span><span class="text-price">@GetString("Ecom:Order.OrderLines.Total.PriceWithVAT")</span></div> } } @if (GetDouble("Ecom:Order.TotalDiscount.Price.Value") != 0) { <div class="d-flex justify-content-between"><span>@Translate("Discount")</span><span class="text-price">@GetString("Ecom:Order.TotalDiscount.PriceFormatted")</span></div> } </div> </div> } </div> </div> 51 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ string stepsIconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; int currentStep = 1; string nextButtonName = Translate("Next"); string previousButtonName = Translate("Back"); bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); string erpDownCartBehavior = Pageview.AreaSettings.GetRawValueString("ErpDownCartBehavior", "none"); foreach (LoopItem step in GetLoop("StepButtons")) { if (step.GetBoolean("Step.Current")) { currentStep = step.GetInteger("Step.Number"); } if (step.GetInteger("Step.Number") == currentStep + 1) { nextButtonName = Translate(step.GetString("Step.Name")); } if (step.GetInteger("Step.Number") == currentStep + step.GetInteger("Step.Index")) { previousButtonName = Translate("Back to") + " " + Translate(step.GetString("Step.Name")); } } if (currentStep == GetLoop("StepButtons").Count - 1 && Pageview.CurrentParagraph.Item.SystemName != "Swift_QuoteCheckoutApp") { <text> @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ string termsAndConditionsCheckboxValue = GetBoolean("Ecom:Order.Customer.Accepted").ToString(); string termsAndConditionsPageLink = Pageview.CurrentParagraph.Item["TermsAndConditionsPageLink"] != null ? Pageview.CurrentParagraph.Item["TermsAndConditionsPageLink"].ToString() : string.Empty; } @if (!string.IsNullOrEmpty(termsAndConditionsPageLink)) { <div class="mt-4" id="TermsAndConditions"> <h3 class="fs-6 fw-normal mb-0">@Translate("Terms and conditions")</h3> <p class="fs-8 mb-3">@Translate("Agree to terms and conditions and that your informations are correct")</p> <div class="list-group"> <label class="list-group-item list-group-item-action d-flex justify-content-between" for="EcomOrderCustomerAccepted"> <span class="d-flex justify-content-between align-items-center gap-3"> <input class="form-check-input m-0" type="checkbox" name="EcomOrderCustomerAccepted" id="EcomOrderCustomerAccepted" value="@termsAndConditionsCheckboxValue" @if (GetString("Ecom:Order.Customer.Accepted") == "true") { <text> checked="checked" </text> }> <span>@Translate("I accept the") <a href='@termsAndConditionsPageLink' target='_blank' rel='noopener' id="TermsAndConditionsButton">@Translate("terms and conditions")</a></span> </span> </label> </div> </div> } </text> nextButtonName = Translate("Place Order"); } else if (GetLoop("StepButtons").Count == 0) { nextButtonName = Translate("Pay"); } } <div class="mt-4 d-flex flex-column flex-md-row justify-content-end gap-3 mt-lg-4" id="StepsNavigation"> @if (currentStep == 1) { var cartLink = $"Default.aspx?id={Pageview.CurrentParagraph.Page.Parent.ID}"; <a href="@cartLink" class="btn btn-link link-secondary text-decoration-none order-last order-md-first" id="BackToCartButton"> <div class="d-flex align-items-center justify-content-center position-relative"> <span class="icon-2 me-1 position-absolute position-md-static start-0"> @ReadFile(stepsIconPath + "chevron-left.svg") </span> <span>@Translate("Back to cart")</span> </div> </a> } else { <button name="@GetString("CartV2.PreviousStepButtonName")" id="@GetString("CartV2.PreviousStepButtonName")" class="btn btn-link link-secondary text-decoration-none"> <div class="d-flex align-items-center justify-content-center position-relative"> <span class="icon-2 me-1 position-absolute position-md-static start-0"> @ReadFile(stepsIconPath + "chevron-left.svg") </span> <span>@previousButtonName</span> </div> </button> } @if (!(currentStep == GetLoop("StepButtons").Count - 1 && isErpConnectionDown && erpDownCartBehavior == "disable")) { var buttonId = GetLoop("StepButtons").Count == 0 ? "PayButton" : GetString("CartV2.NextStepButtonName"); <button type="submit" name="@GetString("CartV2.NextStepButtonName")" id="@buttonId" class="btn btn-primary order-first order-md-last" > <div class="d-flex align-items-center justify-content-center position-relative pe-none"> <span>@nextButtonName</span> <span class="icon-2 ms-1 position-absolute position-md-static end-0"> @ReadFile(stepsIconPath + "chevron-right.svg") </span> </div> </button> @* // SHIPMONDO Following script prevents writing pickup point address to order.delivery before finalizing the order. *@ if (currentStep == GetLoop("StepButtons").Count - 1) { if (GetBoolean("Ecom:Order.Delivery.isPickupPoint")) { <input type="hidden" name="@GetString("CartV2.NextStepButtonName")" /> <script> document.getElementById("@GetString("CartV2.NextStepButtonName")").addEventListener("click", function (e) { const form = e.target.closest("form"), hiddenParcelShopFields = form.querySelector("#hiddenParcelshopFields"), hiddenParcelShopFieldsDisabled = hiddenParcelShopFields.querySelectorAll("input"); e.preventDefault(); if (hiddenParcelShopFieldsDisabled.length > 0) { hiddenParcelShopFieldsDisabled.forEach( (input) => { input.disabled = false; }); } form.submit() }); </script> } } } else { <button class="btn btn-primary pe-none disabled">@Translate("Payment is temporarily disabled")</button> } <script> if (window.history.replaceState) { window.history.replaceState(null, null, window.location.href); } </script> </div> 52 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System.Text.RegularExpressions @using System.Text @functions { public string RenderDeliveryAddressInline() { List<List<string>> addressFormat = Dynamicweb.Ecommerce.International.Country.GetDisplayAddress(GetString("Ecom:Order.Delivery.Country.Code")); var result = new StringBuilder(); foreach (List<string> addressLine in addressFormat) { for (var i = 0; i < addressLine.Count; i++) { addressLine[i] = Regex.Replace(addressLine[i], "{name}", GetString("Ecom:Order.Delivery.Name"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{firstName}", GetString("Ecom:Order.Delivery.FirstName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{lastName}", GetString("Ecom:Order.Delivery.Surname"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{company}", GetString("Ecom:Order.Delivery.Company"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address}", GetString("Ecom:Order.Delivery.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address1}", GetString("Ecom:Order.Delivery.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address2}", GetString("Ecom:Order.Delivery.Address2"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{zip}", GetString("Ecom:Order.Delivery.Zip"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{city}", GetString("Ecom:Order.Delivery.City"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{regionCode}", GetString("Ecom:Order.Delivery.Region"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{region}", GetDeliveryRegionName(), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{countryCode}", GetString("Ecom:Order.Delivery.Country.Code"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{country}", GetString("Ecom:Order.Delivery.Country"), RegexOptions.IgnoreCase); // Remove any bad placeholders the user may have submitted addressLine[i] = Regex.Replace(addressLine[i], "{phone}", "", RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{email}", "", RegexOptions.IgnoreCase); } var completeLine = string.Join(string.Empty, addressLine.ToArray()); if (!string.IsNullOrWhiteSpace(completeLine)) { result.Append($"<span>{completeLine}</span>"); if (addressLine != addressFormat.Last()) { result.Append(" "); } } } return result.ToString(); } public string GetDeliveryAddressString() { List<List<string>> addressFormat = Dynamicweb.Ecommerce.International.Country.GetDisplayAddress(GetString("Ecom:Order.Delivery.Country.Code")); List<string> completeAddress = new List<string>(); foreach (var addressLine in addressFormat) { for (var i = 0; i < addressLine.Count; i++) { addressLine[i] = Regex.Replace(addressLine[i], "{name}", GetString("Ecom:Order.Delivery.Name"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{firstName}", GetString("Ecom:Order.Delivery.FirstName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{lastName}", GetString("Ecom:Order.Delivery.LastName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{company}", GetString("Ecom:Order.Delivery.Company"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address}", GetString("Ecom:Order.Delivery.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address1}", GetString("Ecom:Order.Delivery.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address2}", GetString("Ecom:Order.Delivery.Address2"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{zip}", GetString("Ecom:Order.Delivery.Zip"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{city}", GetString("Ecom:Order.Delivery.City"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{regionCode}", GetString("Ecom:Order.Delivery.Region"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{region}", GetDeliveryRegionName(), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{countryCode}", GetString("Ecom:Order.Delivery.Country.Code"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{country}", GetString("Ecom:Order.Delivery.Country"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{phone}", GetString("Ecom:Order.Delivery.Phone"), RegexOptions.IgnoreCase); // Remove any bad placeholders the user may have submitted addressLine[i] = Regex.Replace(addressLine[i], "{phone}", "", RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{email}", "", RegexOptions.IgnoreCase); } var completeLine = string.Join(string.Empty, addressLine.ToArray()); if (!string.IsNullOrWhiteSpace(completeLine)) { completeAddress.Add(completeLine); } } return string.Join(", ", completeAddress.ToArray()); } public string GetDeliveryRegionName() { foreach (LoopItem region in GetLoop("DeliveryRegions")) { if (region.GetBoolean("Ecom:DeliveryRegion.IsDeliveryRegion")) { return region.GetString("Ecom:DeliveryRegion.Name"); } } return GetString("Ecom:Order.Delivery.Region"); } } 53 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System.Collections.Generic @using System.Text.RegularExpressions @using Dynamicweb.Ecommerce.International @using System.Text @functions { public string RenderUserItemAddressInline(LoopItem address) { string regionCode = GetRegionCode(address.GetString("UserManagement:User.UserAddress.CountryCode"), address.GetString("UserManagement:User.UserAddress.State")); string regionName = GetRegionName(address.GetString("UserManagement:User.UserAddress.CountryCode"), address.GetString("UserManagement:User.UserAddress.State")); List<List<string>> addressFormat = Dynamicweb.Ecommerce.International.Country.GetDisplayAddress(address.GetString("UserManagement:User.UserAddress.CountryCode")); var result = new StringBuilder(); foreach (List<string> addressLine in addressFormat) { for (var i = 0; i < addressLine.Count; i++) { addressLine[i] = Regex.Replace(addressLine[i], "{name}", address.GetString("UserManagement:User.UserAddress.Name"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{firstName}", address.GetString("UserManagement:User.UserAddress.FirstName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{lastName}", address.GetString("UserManagement:User.UserAddress.lastName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{company}", address.GetString("UserManagement:User.UserAddress.Company"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address}", address.GetString("UserManagement:User.UserAddress.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address1}", address.GetString("UserManagement:User.UserAddress.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address2}", address.GetString("UserManagement:User.UserAddress.Address2"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{zip}", address.GetString("UserManagement:User.UserAddress.Zip"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{city}", address.GetString("UserManagement:User.UserAddress.City"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{regionCode}", regionCode, RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{region}", regionName, RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{countryCode}", address.GetString("UserManagement:User.UserAddress.Culture.CountryCode"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{country}", address.GetString("UserManagement:User.UserAddress.Culture.CountryName"), RegexOptions.IgnoreCase); // Remove any bad placeholders the user may have submitted addressLine[i] = Regex.Replace(addressLine[i], "{phone}", "", RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{email}", "", RegexOptions.IgnoreCase); } var completeLine = string.Join(string.Empty, addressLine.ToArray()); if (!string.IsNullOrWhiteSpace(completeLine)) { result.Append($"<span>{completeLine}</span> "); } } return result.ToString(); } public string GetUserAddressString() { List<List<string>> addressFormat = Dynamicweb.Ecommerce.International.Country.GetDisplayAddress(GetString("UserManagement:User.CountryCode")); string regionCode = GetRegionCode(GetString("UserManagement:User.CountryCode"), GetString("UserManagement:User.State")); string regionName = GetRegionName(GetString("UserManagement:User.CountryCode"), GetString("UserManagement:User.State")); List<string> completeAddress = new List<string>(); foreach (var addressLine in addressFormat) { for (var i = 0; i < addressLine.Count; i++) { addressLine[i] = Regex.Replace(addressLine[i], "{name}", GetString("UserManagement:User.Name"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{firstName}", GetString("UserManagement:User.FirstName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{lastName}", GetString("UserManagement:User.LastName"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{company}", GetString("UserManagement:User.Company"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address}", GetString("UserManagement:User.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address1}", GetString("UserManagement:User.Address"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{address2}", GetString("UserManagement:User.Address2"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{zip}", GetString("UserManagement:User.Zip"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{city}", GetString("UserManagement:User.City"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{regionCode}", regionCode, RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{region}", regionName, RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{countryCode}", GetString("UserManagement:User.CountryCode"), RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{country}", GetString("UserManagement:User.Culture.CountryName"), RegexOptions.IgnoreCase); // Remove any bad placeholders the user may have submitted addressLine[i] = Regex.Replace(addressLine[i], "{phone}", "", RegexOptions.IgnoreCase); addressLine[i] = Regex.Replace(addressLine[i], "{email}", "", RegexOptions.IgnoreCase); } var completeLine = string.Join(string.Empty, addressLine.ToArray()); if (!string.IsNullOrWhiteSpace(completeLine)) { completeAddress.Add(completeLine); } } return string.Join(" ", completeAddress.ToArray()); } public string GetRegionName(string countryCode, string regionValue) { return GetRegionNameOrCode(countryCode, regionValue); } public string GetRegionCode(string countryCode, string regionValue) { return GetRegionNameOrCode(countryCode, regionValue, "code"); } public string GetRegionNameOrCode(string countryCode, string regionValue, string nameOrCode = "name") { CountryCollection allCountryRegions = Dynamicweb.Ecommerce.Services.Countries.GetRegions(countryCode); Country matchedRegion = allCountryRegions.FirstOrDefault(r => r.RegionCode == regionValue || r.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID) == regionValue); if (matchedRegion == null) return regionValue; return nameOrCode == "name" ? matchedRegion.GetName(Dynamicweb.Ecommerce.Common.Context.LanguageID) : matchedRegion.RegionCode; } } 54
By clicking 'Accept All' you consent that we may collect information about you for various purposes, including: Statistics and Marketing