Basket
Error executing template "Designs/Rapido/eCom7/CartV2/Step/Cart.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_00de77e786a84e8aa8ea8420c99333f1.b__17_0(TextWriter __razor_helper_writer) in C:\DynamicWeb\Solutions\NewCarrot\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Cart.cshtml:line 1408
at CompiledRazorTemplates.Dynamic.RazorEngine_00de77e786a84e8aa8ea8420c99333f1.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\DynamicWeb\Solutions\NewCarrot\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Cart.cshtml:line 195
at CompiledRazorTemplates.Dynamic.RazorEngine_00de77e786a84e8aa8ea8420c99333f1.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\DynamicWeb\Solutions\NewCarrot\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Cart.cshtml:line 107
at CompiledRazorTemplates.Dynamic.RazorEngine_00de77e786a84e8aa8ea8420c99333f1.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\DynamicWeb\Solutions\NewCarrot\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Cart.cshtml:line 215
at CompiledRazorTemplates.Dynamic.RazorEngine_00de77e786a84e8aa8ea8420c99333f1.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\DynamicWeb\Solutions\NewCarrot\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Cart.cshtml:line 107
at CompiledRazorTemplates.Dynamic.RazorEngine_00de77e786a84e8aa8ea8420c99333f1.Execute() in C:\DynamicWeb\Solutions\NewCarrot\Files\Templates\Designs\Rapido\eCom7\CartV2\Step\Cart.cshtml:line 1710
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
2
3 @using Dynamicweb.Extensibility
4 @using Dynamicweb.Content
5 @using Dynamicweb.Core
6 @using Dynamicweb.Ecommerce.Orders
7 @using Dynamicweb.Ecommerce.Orders.SalesDiscounts
8 @using System
9 @using System.IO
10 @using Dynamicweb.Rapido.Blocks
11
12
13 @functions{
14 BlocksPage checkoutPage = BlocksPage.GetBlockPage("CheckoutPage");
15 string checkoutPageType = "onestep";
16 }
17
18 @{
19 string pageId = GetGlobalValue("Global:Page.ID");
20
21 Block checkoutTopSnippets = new Block()
22 {
23 Id = "CheckoutTopSnippets",
24 SortId = 10
25 };
26 checkoutPage.Add(checkoutTopSnippets);
27
28 Block addressContainer = new Block()
29 {
30 Id = "AddressContainer",
31 SortId = 20,
32 Design = new Design
33 {
34 RenderType = RenderType.Column,
35 Size = "4",
36 HidePadding = true
37 },
38 BlocksList = new List<Block> {
39 new Block()
40 {
41 Id = "AddressContainerRow",
42 SortId = 10,
43 Design = new Design
44 {
45 RenderType = RenderType.Row
46 }
47 }
48 }
49 };
50 checkoutPage.Add(addressContainer);
51
52 Block orderContainer = new Block()
53 {
54 Id = "OrderContainer",
55 SortId = 30,
56 Design = new Design
57 {
58 RenderType = RenderType.Column,
59 Size = "auto",
60 HidePadding = true
61 },
62 BlocksList = new List<Block> {
63 new Block()
64 {
65 Id = "OrderContainerRow",
66 SortId = 10,
67 Design = new Design
68 {
69 RenderType = RenderType.Row
70 }
71 }
72 }
73 };
74 checkoutPage.Add(orderContainer);
75
76 Block checkoutBottomSnippets = new Block()
77 {
78 Id = "CheckoutBottomSnippets",
79 SortId = 50
80 };
81 checkoutPage.Add(checkoutBottomSnippets);
82 }
83
84 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@
85 @using System.Text.RegularExpressions
86 @using System.Collections.Generic
87 @using System.Reflection
88 @using System.Web.UI.HtmlControls
89 @using Dynamicweb.Rapido.Blocks.Components
90 @using Dynamicweb.Rapido.Blocks.Components.Articles
91 @using Dynamicweb.Rapido.Blocks.Components.Documentation
92 @using Dynamicweb.Rapido.Blocks
93
94
95 @*--- START: Base block renderers ---*@
96
97 @helper RenderBlockList(List<Block> blocks)
98 {
99 blocks = blocks.OrderBy(item => item.SortId).ToList();
100
101 foreach (Block item in blocks)
102 {
103 <!-- START: @item.Id -->
104
105 if (item.Design == null)
106 {
107 @RenderBlock(item)
108 }
109 else if (item.Design.RenderType == RenderType.None) {
110 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
111
112 <div class="@cssClass dw-mod">
113 @RenderBlock(item)
114 </div>
115 }
116 else if (item.Design.RenderType != RenderType.Hide)
117 {
118 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : "";
119
120 if (!item.SkipRenderBlocksList) {
121 if (item.Design.RenderType == RenderType.Row)
122 {
123 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id">
124 @RenderBlock(item)
125 </div>
126 }
127
128 if (item.Design.RenderType == RenderType.Column)
129 {
130 string hidePadding = item.Design.HidePadding ? "u-no-padding" : "";
131 string size = item.Design.Size ?? "12";
132 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size;
133
134 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id">
135 @RenderBlock(item)
136 </div>
137 }
138
139 if (item.Design.RenderType == RenderType.Table)
140 {
141 <table class="table @cssClass dw-mod" id="Block__@item.Id">
142 @RenderBlock(item)
143 </table>
144 }
145
146 if (item.Design.RenderType == RenderType.TableRow)
147 {
148 <tr class="@cssClass dw-mod" id="Block__@item.Id">
149 @RenderBlock(item)
150 </tr>
151 }
152
153 if (item.Design.RenderType == RenderType.TableColumn)
154 {
155 <td class="@cssClass dw-mod" id="Block__@item.Id">
156 @RenderBlock(item)
157 </td>
158 }
159
160 if (item.Design.RenderType == RenderType.CardHeader)
161 {
162 <div class="card-header @cssClass dw-mod">
163 @RenderBlock(item)
164 </div>
165 }
166
167 if (item.Design.RenderType == RenderType.CardBody)
168 {
169 <div class="card @cssClass dw-mod">
170 @RenderBlock(item)
171 </div>
172 }
173
174 if (item.Design.RenderType == RenderType.CardFooter)
175 {
176 <div class="card-footer @cssClass dw-mod">
177 @RenderBlock(item)
178 </div>
179 }
180 }
181 else
182 {
183 @RenderBlock(item)
184 }
185 }
186
187 <!-- END: @item.Id -->
188 }
189 }
190
191 @helper RenderBlock(Block item)
192 {
193 if (item.Template != null)
194 {
195 @BlocksPage.RenderTemplate(item.Template)
196 }
197
198 if (item.Component != null)
199 {
200 string methodName = item.Component.HelperName;
201 dynamic[] methodParameters = new dynamic[1];
202 methodParameters[0] = item.Component;
203 Type methodType = this.GetType();
204 MethodInfo generalMethod = methodType.GetMethod(methodName);
205
206 if (generalMethod != null) {
207 @generalMethod.Invoke(this, methodParameters).ToString();
208 } else {
209 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked");
210 }
211 }
212
213 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList)
214 {
215 @RenderBlockList(item.BlocksList)
216 }
217 }
218
219 @*--- END: Base block renderers ---*@
220
221
222 @* Include the Blocks for the page *@
223 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
224 @using Dynamicweb.Core
225 @using System
226 @using System.Web
227 @using System.Collections.Generic
228 @using Dynamicweb.Rapido.Blocks
229
230 @{
231 BlocksPage billingAddressCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage");
232
233 Block billingAddressBlock = new Block()
234 {
235 Id = "BillingAddress",
236 SortId = 10,
237 Template = RenderCustomerAddress(),
238 Design = new Design
239 {
240 RenderType = RenderType.Column,
241 Size = "12"
242 }
243 };
244 billingAddressCheckoutPage.Add("AddressContainerRow", billingAddressBlock);
245 }
246
247 @helper RenderCustomerAddress() {
248 string editProfileLink = "/Default.aspx?ID=" + GetPageIdByNavigationTag("CustomerProfile").ToString();
249
250 <div class="card-header u-color-light--bg dw-mod">
251 <h3><i class="fas fa-home"></i> @Translate("Billing address")</h3>
252 </div>
253
254 <div class="card u-color-light--bg dw-mod">
255 @if (!Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")) || GetLoop("ValidationErrors").Count > 0)
256 {
257 //When the user is not signed in, or there are form errors, give the possibility to either sign in or create address
258 if (!Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")))
259 {
260 <label class="btn btn--secondary btn--full dw-mod more" for="SignInModalTrigger">@Translate("Already a customer?")</label>
261 }
262
263 <div class="form__field-group dw-mod">
264 <label for="EcomOrderCustomerCompany">@Translate("Company")</label>
265 <input type="text" class="u-full-width" name="EcomOrderCustomerCompany" id="EcomOrderCustomerCompany" value="@GetString("Ecom:Order.Customer.Company")" />
266 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCompany.ErrorMessage")</div>
267 </div>
268
269 <div class="form__field-group dw-mod">
270 <label for="EcomOrderCustomerName">@Translate("Name")</label>
271 <input type="text" class="u-full-width" name="EcomOrderCustomerName" id="EcomOrderCustomerName" value="@GetString("Ecom:Order.Customer.Name")" />
272 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerName.ErrorMessage")</div>
273 </div>
274
275 <div class="form__fields-collection form__fields-collection--2-3">
276 <div class="form__field-group dw-mod">
277 <label for="EcomOrderCustomerPhone">@Translate("Phone")</label>
278 <input type="tel" class="u-full-width" name="EcomOrderCustomerPhone" id="EcomOrderCustomerPhone" value="@GetString("Ecom:Order.Customer.Phone")" />
279 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerPhone.ErrorMessage")</div>
280 </div>
281
282 <div class="form__field-group dw-mod">
283 <label for="EcomOrderCustomerEmail">@Translate("Email")</label>
284 @if (GetBoolean("Ecom:Cart.CreateUserInCheckout") && string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName")))
285 {
286 <input type="email" class="u-full-width" name="EcomOrderCustomerEmail" id="EcomOrderCustomerEmail" value="@GetString("Ecom:Order.Customer.Email")" onchange="document.getElementById('EcomUserCreateUserName').value = this.value;" />
287 <input type="hidden" name="EcomUserCreateUserName" id="EcomUserCreateUserName" value="@GetString("Ecom:Order.Customer.Email")" />
288 <input type="hidden" name="EcomUserCreateNew" value="True" />
289 string pass = Guid.NewGuid().ToString();
290 <input type="hidden" name="EcomUserCreatePassword" value="@pass" />
291 <input type="hidden" name="EcomUserCreateConfirmPassword" value="@pass" />
292 }
293 else
294 {
295 <input type="email" class="u-full-width" name="EcomOrderCustomerEmail" id="EcomOrderCustomerEmail" value="@GetString("Ecom:Order.Customer.Email")" />
296 }
297 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerEmail.ErrorMessage")</div>
298 </div>
299 </div>
300 <div class="form__field-group dw-mod">
301 <label for="EcomOrderCustomerAddress">@Translate("Address")</label>
302 <input type="text" class="u-full-width" name="EcomOrderCustomerAddress" id="EcomOrderCustomerAddress" value="@GetString("Ecom:Order.Customer.Address")" />
303 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerAddress.ErrorMessage")</div>
304 </div>
305
306 <div class="form__fields-collection form__fields-collection--2-3">
307 <div class="form__field-group dw-mod">
308 <label for="EcomOrderCustomerZip">@Translate("Zip code")</label>
309 <input type="text" class="u-full-width" name="EcomOrderCustomerZip" id="EcomOrderCustomerZip" value="@GetString("Ecom:Order.Customer.Zip")" />
310 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerZip.ErrorMessage")</div>
311 </div>
312
313 <div class="form__field-group dw-mod">
314 <label for="EcomOrderCustomerCity">@Translate("City")</label>
315 <input type="text" class="u-full-width" name="EcomOrderCustomerCity" id="EcomOrderCustomerCity" value="@GetString("Ecom:Order.Customer.City")" />
316 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCity.ErrorMessage")</div>
317 </div>
318 </div>
319
320 if (GetLoop("CustomerRegions").Count > 0)
321 {
322 <div class="form__field-group dw-mod">
323 <label for="EcomOrderCustomerState">@Translate("State/Region")</label>
324 <select class="u-full-width" name="EcomOrderCustomerRegion" id="EcomOrderCustomerRegion" onchange="Cart.SubmitCart()">
325 @foreach (LoopItem state in GetLoop("CustomerRegions"))
326 {
327 string selected = GetString("Ecom:Order.Customer.Region") == state.GetString("Ecom:CustomerRegion.Name") ? "selected" : "";
328 <option value="@state.GetString("Ecom:CustomerRegion.Name")" @selected>@state.GetString("Ecom:CustomerRegion.Name")</option>
329 }
330 </select>
331 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerState.ErrorMessage")</div>
332 </div>
333 }
334
335 <div class="form__field-group dw-mod">
336 <label for="EcomOrderCustomerCountry">@Translate("Country")</label>
337 <select class="u-full-width" name="EcomOrderCustomerCountry" id="EcomOrderCustomerCountry" onchange="Cart.SubmitCart()">
338 @{
339 string customerCountry = GetString("Ecom:Order.Customer.Country.Code");
340 foreach (LoopItem country2 in GetLoop("Countries"))
341 {
342 string selected = GetString("Ecom:Order.Customer.Country.Code") == country2.GetString("Ecom:Country.Code2") ? "selected" : "";
343
344 if (string.IsNullOrEmpty(customerCountry) && string.IsNullOrEmpty(selected))
345 {
346 selected = country2.GetString("Ecom:Country.Code2") == GetGlobalValue("Global:Area.Culture.CountryCode").ToString() ? "selected" : "";
347 }
348
349 <option value="@country2.GetString("Ecom:Country.Code2")" @selected>@country2.GetString("Ecom:Country.Name")</option>
350 }
351 }
352 </select>
353 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerCountry.ErrorMessage")</div>
354 </div>
355 }
356 else
357 {
358 //When the user is signed in, show static address fields
359 <table class="table table--clean table--condensed">
360 @if (!String.IsNullOrEmpty(GetString("Ecom:Order.Customer.Company")))
361 {
362 <tr>
363 <td class="u-bold">@Translate("Company")</td>
364 <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerCompany" id="EcomOrderCustomerCompany" value="@GetString("Ecom:Order.Customer.Company")" readonly /></td>
365 </tr>
366 }
367 <tr>
368 <td class="u-bold">@Translate("Name")</td>
369 <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerName" id="EcomOrderCustomerName" value="@GetString("Ecom:Order.Customer.Name")" readonly /></td>
370 </tr>
371 <tr>
372 <td class="u-bold">@Translate("Phone")</td>
373 <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerPhone" id="EcomOrderCustomerPhone" value="@GetString("Ecom:Order.Customer.Phone")" readonly /></td>
374 </tr>
375 <tr>
376 <td class="u-bold">@Translate("Email")</td>
377 <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerEmail" id="EcomOrderCustomerEmail" value="@GetString("Ecom:Order.Customer.Email")" readonly /></td>
378 </tr>
379 <tr>
380 <td class="u-bold">@Translate("Address")</td>
381 <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerAddress" id="EcomOrderCustomerAddress" value="@GetString("Ecom:Order.Customer.Address")" readonly /></td>
382 </tr>
383 <tr>
384 <td class="u-bold">@Translate("Zip code")</td>
385 <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerZip" id="EcomOrderCustomerZip" value="@GetString("Ecom:Order.Customer.Zip")" readonly /></td>
386 </tr>
387 <tr>
388 <td class="u-bold">@Translate("City")</td>
389 <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerCity" id="EcomOrderCustomerCity" value="@GetString("Ecom:Order.Customer.City")" readonly /></td>
390 </tr>
391 @if (GetLoop("CustomerRegions").Count > 0)
392 {
393 string selectedStateName = "";
394 foreach (LoopItem state in GetLoop("CustomerRegions"))
395 {
396 if (GetString("Ecom:Order.Customer.Region") == state.GetString("Ecom:CustomerRegion.Name")) {
397 selectedStateName = state.GetString("Ecom:CustomerRegion.Name");
398 }
399 }
400 <tr>
401 <td class="u-bold">@Translate("State/Region")</td>
402 <td><input type="text" class="u-full-width u-truncate-text" name="EcomOrderCustomerRegion" id="EcomOrderCustomerRegion" value="@selectedStateName" readonly /></td>
403 </tr>
404 }
405 <tr>
406 <td class="u-bold">@Translate("Country")</td>
407 <td>
408 @foreach (LoopItem country in GetLoop("Countries"))
409 {
410 if (GetString("Ecom:Order.Customer.Country") == country.GetString("Ecom:Country.Code2") || GetString("Ecom:Order.Customer.Country.Code") == country.GetString("Ecom:Country.Code2"))
411 {
412 <input type="hidden" name="EcomOrderCustomerCountry" id="EcomOrderCustomerCountry" value="@country.GetString("Ecom:Country.Code2")" />
413 <input type="text" class="u-full-width u-truncate-text" value="@country.GetString("Ecom:Country.Name")" readonly />
414 }
415 }
416 @if (GetLoop("Countries").Count == 0)
417 {
418 <input type="hidden" name="EcomOrderCustomerCountry" id="EcomOrderCustomerCountry" value="" />
419 <input type="text" class="u-full-width u-truncate-text" value="" readonly />
420 }
421 </td>
422 </tr>
423 <tr>
424 <td colspan="2"> </td>
425 </tr>
426 </table>
427
428 <a href="@editProfileLink" class="btn btn--secondary btn--full u-no-margin dw-mod">@Translate("Edit profile")</a>
429 }
430 </div>
431 }
432 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
433 @using Dynamicweb.Core
434 @using System
435 @using System.Web
436 @using System.Collections.Generic
437 @using Dynamicweb.Rapido.Blocks
438
439 @functions {
440 string Truncate(string str, int count)
441 {
442 return str.Substring(0, Math.Min(str.Length, count));
443 }
444 }
445
446 @{
447 BlocksPage shippingAddressCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage");
448
449 Block shippingAddressBlock = new Block()
450 {
451 Id = "ShippingAddress",
452 SortId = 20,
453 Template = RenderShippingAddress(),
454 Design = new Design
455 {
456 RenderType = RenderType.Column,
457 Size = "12"
458 }
459 };
460 shippingAddressCheckoutPage.Add("AddressContainerRow", shippingAddressBlock);
461
462 Block addressScriptTemplates = new Block()
463 {
464 Id = "AddressTemplates",
465 SortId = 10,
466 Template = RenderAddressScriptTemplates()
467 };
468 shippingAddressCheckoutPage.Add("CheckoutBottomSnippets", addressScriptTemplates);
469 }
470
471 @helper RenderShippingAddress()
472 {
473 string manageAddresses = "/Default.aspx?ID=" + GetPageIdByNavigationTag("CustomerProfile").ToString() + "&Action=ManageAddresses";
474 int cartAddressesFeedPageId = GetPageIdByNavigationTag("CartAddressesFeed");
475
476 <div class="card-header u-color-light--bg dw-mod">
477 <h3><i class="fas fa-map-marker"></i> @Translate("Shipping address")</h3>
478 </div>
479
480 <div class="card u-color-light--bg dw-mod">
481 <div class="form__field-group u-margin-bottom--lg">
482 <input type="checkbox" id="AlternateAddressBlock" class="js-remember-state form__control" data-expand="AlternateAddressBlock" />
483 <label for="AlternateAddressBlock">@Translate("Add alternative adr.")</label>
484 </div>
485 <div class="expandable--collapsed" data-trigger="AlternateAddressBlock">
486 @if (GetLoop("UserManagement:User.UserAddresses").Count > 0)
487 {
488 <div class="form__field-combi">
489 <select id="DeliveryAddressSelector" class="u-full-width" onchange="HandlebarsBolt.UpdateContent('DeliveryAddressFields', '/Default.aspx?ID=@cartAddressesFeedPageId&AddressId=' + this.value);">
490 <option value="-1">@Translate("Select saved address")</option>
491
492 @foreach (LoopItem address in GetLoop("UserManagement:User.UserAddresses"))
493 {
494 string description = Truncate(address.GetString("UserManagement:User.UserAddress.Description"), 25);
495 string userAddress = Truncate(address.GetString("UserManagement:User.UserAddress.Address"), 20);
496
497 <option value="@address.GetString("UserManagement:User.UserAddress.ID")">@description (@userAddress)</option>
498 }
499 </select>
500 <a href="@manageAddresses" id="ManageAddressButton" class="btn btn--primary dw-mod btn--condensed u-no-margin" title="@Translate("Add new address", "Add new address")"><i class="fas fa-plus"></i></a>
501 </div>
502 }
503
504 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")) && GetLoop("UserManagement:User.UserAddresses").Count > 0)
505 {
506 <div class="js-handlebars-root" id="DeliveryAddressFields" data-template="DeliveryAddressFieldsTemplate" data-json-feed="/Default.aspx?ID=@cartAddressesFeedPageId&AddressId=0" data-preloader="minimal"></div>
507 }
508 else
509 {
510 <div class="form__field-group dw-mod">
511 <label for="EcomOrderDeliveryCompany">@Translate("Company")</label>
512 <input type="text" class="u-full-width" name="EcomOrderDeliveryCompany" id="EcomOrderDeliveryCompany" value="@GetString("Ecom:Order.Delivery.Company")" />
513 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCompany.ErrorMessage")</div>
514 </div>
515
516 <div class="form__field-group dw-mod">
517 <label for="EcomOrderDeliveryName">@Translate("Name")</label>
518 <input type="text" class="u-full-width" name="EcomOrderDeliveryName" id="EcomOrderDeliveryName" value="@GetString("Ecom:Order.Delivery.Name")" />
519 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryName.ErrorMessage")</div>
520 </div>
521
522 <div class="form__fields-collection form__fields-collection--2-3">
523 <div class="form__field-group dw-mod">
524 <label for="EcomOrderDeliveryPhone">@Translate("Phone")</label>
525 <input type="tel" class="u-full-width" name="EcomOrderDeliveryPhone" id="EcomOrderDeliveryPhone" value="@GetString("Ecom:Order.Delivery.Phone")" />
526 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryPhone.ErrorMessage")</div>
527 </div>
528
529 <div class="form__field-group dw-mod">
530 <label for="EcomOrderDeliveryEmail">@Translate("Email")</label>
531 <input type="email" class="u-full-width" name="EcomOrderDeliveryEmail" id="EcomOrderDeliveryEmail" value="@GetString("Ecom:Order.Delivery.Email")" />
532 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryEmail.ErrorMessage")</div>
533 </div>
534 </div>
535
536 <div class="form__field-group dw-mod">
537 <label for="EcomOrderDeliveryAddress">@Translate("Address")</label>
538 <input type="text" class="u-full-width" name="EcomOrderDeliveryAddress" id="EcomOrderDeliveryAddress" value="@GetString("Ecom:Order.Delivery.Address")" />
539 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryAddress.ErrorMessage")</div>
540 </div>
541
542 <div class="form__fields-collection form__fields-collection--2-3">
543 <div class="form__field-group dw-mod">
544 <label for="EcomOrderDeliveryZip">@Translate("Zip")</label>
545 <input type="text" class="u-full-width" name="EcomOrderDeliveryZip" id="EcomOrderDeliveryZip" value="@GetString("Ecom:Order.Delivery.Zip")" />
546 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryZip.ErrorMessage")</div>
547 </div>
548
549 <div class="form__field-group dw-mod">
550 <label for="EcomOrderDeliveryCity">@Translate("City")</label>
551 <input type="text" class="u-full-width" name="EcomOrderDeliveryCity" id="EcomOrderDeliveryCity" value="@GetString("Ecom:Order.Delivery.City")" />
552 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCity.ErrorMessage")</div>
553 </div>
554 </div>
555
556 if (GetLoop("DeliveryRegions").Count > 0)
557 {
558 <div class="form__field-group dw-mod">
559 <label for="EcomOrderDeliveryRegion">@Translate("State/Region")</label>
560 <select class="u-full-width" name="EcomOrderDeliveryRegion" id="EcomOrderDeliveryRegion" onchange="Cart.SubmitCart()">
561 @foreach (LoopItem state in GetLoop("DeliveryRegions"))
562 {
563 string selected = GetString("Ecom:Order.Delivery.Region") == state.GetString("Ecom:DeliveryRegion.Name") ? "selected" : "";
564 <option value="@state.GetString("Ecom:DeliveryRegion.Name")" @selected>@state.GetString("Ecom:DeliveryRegion.Name")</option>
565 }
566 </select>
567 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryState.ErrorMessage")</div>
568 </div>
569 }
570
571 <div class="form__field-group dw-mod">
572 <label for="EcomOrderDeliveryCountry">@Translate("Country")</label>
573 <select class="u-full-width" name="EcomOrderDeliveryCountry" id="EcomOrderDeliveryCountry" onchange="Cart.SubmitCart()">
574 @{
575 string deliveryCountry = GetString("Ecom:Order.Delivery.Country.Code");
576 foreach (LoopItem country in GetLoop("Countries"))
577 {
578 string selected = GetString("Ecom:Order.Delivery.Country.Code") == country.GetString("Ecom:Country.Code2") ? "selected" : "";
579
580 if (string.IsNullOrEmpty(deliveryCountry) && string.IsNullOrEmpty(selected))
581 {
582 selected = country.GetString("Ecom:Country.Code2") == GetGlobalValue("Global:Area.Culture.CountryCode").ToString() ? "selected" : "";
583 }
584
585 <option value="@country.GetString("Ecom:Country.Code2")" @selected>@country.GetString("Ecom:Country.Name")</option>
586 }
587 }
588 </select>
589 </div>
590 }
591 </div>
592 </div>
593 }
594
595 @helper RenderAddressScriptTemplates()
596 {
597 @* Templates for addresses *@
598 <script id="DeliveryAddressFieldsTemplate" type="text/x-template">
599 {{#.}}
600 <div class="form__field-group dw-mod">
601 <label for="EcomOrderDeliveryCompany">@Translate("Company")</label>
602 <input type="text" class="u-full-width" name="EcomOrderDeliveryCompany" id="EcomOrderDeliveryCompany" value="{{company}}" />
603 <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCompany.ErrorMessage")</div>
604 </div>
605
606 <div class="form__field-group dw-mod">
607 <label for="EcomOrderDeliveryName">@Translate("Name")</label>
608 <input type="text" class="u-full-width" name="EcomOrderDeliveryName" id="EcomOrderDeliveryName" value="{{name}}" />
609 <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryName.ErrorMessage")</div>
610 </div>
611
612 <div class="form__fields-collection form__fields-collection--2-3">
613 <div class="form__field-group dw-mod">
614 <label for="EcomOrderDeliveryPhone">@Translate("Phone")</label>
615 <input type="tel" class="u-full-width" name="EcomOrderDeliveryPhone" id="EcomOrderDeliveryPhone" value="{{phone}}" />
616 <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryPhone.ErrorMessage")</div>
617 </div>
618
619 <div class="form__field-group dw-mod">
620 <label for="EcomOrderDeliveryEmail">@Translate("Email")</label>
621 <input type="email" class="u-full-width" name="EcomOrderDeliveryEmail" id="EcomOrderDeliveryEmail" value="{{email}}" />
622 <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryEmail.ErrorMessage")</div>
623 </div>
624 </div>
625 <div class="form__field-group dw-mod">
626 <label for="EcomOrderDeliveryAddress">@Translate("Address")</label>
627 <input type="text" class="u-full-width" name="EcomOrderDeliveryAddress" id="EcomOrderDeliveryAddress" value="{{address}}" />
628 <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryAddress.ErrorMessage")</div>
629 </div>
630
631 <div class="form__fields-collection form__fields-collection--2-3">
632 <div class="form__field-group dw-mod">
633 <label for="EcomOrderDeliveryZip">@Translate("Zip")</label>
634 <input type="text" class="u-full-width" name="EcomOrderDeliveryZip" id="EcomOrderDeliveryZip" value="{{zip}}" />
635 <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryZip.ErrorMessage")</div>
636 </div>
637
638 <div class="form__field-group dw-mod">
639 <label for="EcomOrderDeliveryCity">@Translate("City")</label>
640 <input type="text" class="u-full-width" name="EcomOrderDeliveryCity" id="EcomOrderDeliveryCity" value="{{city}}" />
641 <div class="field-error dw-mod {{isSavedAddress}}">@GetString("Ecom:Cart.ValidationError.EcomOrderDeliveryCity.ErrorMessage")</div>
642 </div>
643 </div>
644
645 <div class="form__field-group dw-mod">
646 <label for="Country">@Translate("Country")</label>
647 <select class="u-full-width" name="EcomOrderDeliveryCountry" id="Country" onchange="Cart.SubmitCart()" data-countryCode="{{countryCode}}">
648 {{#Country}}
649 <option value="{{id}}" {{selected}}>{{name}}</option>
650 {{/Country}}
651 </select>
652 </div>
653 {{/.}}
654
655 {{^.}}
656 @Translate("No address found")
657 {{/.}}
658 </script>
659 }
660 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
661 @using Dynamicweb.Core
662 @using System
663 @using System.Web
664 @using System.Collections.Generic
665 @using Dynamicweb.Rapido.Blocks
666
667 @{
668 BlocksPage paymentCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage");
669 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
670
671 if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HidePayment") && GetLoop("Paymethods").Count != 0 && !pointShop)
672 {
673 Block paymentBlock = new Block()
674 {
675 Id = "Payment",
676 SortId = 10,
677 Template = RenderPayment(),
678 Design = new Design
679 {
680 RenderType = RenderType.Column,
681 Size = "6"
682 }
683 };
684 paymentCheckoutPage.Add("OrderContainerRow", paymentBlock);
685 }
686 }
687
688 @helper RenderPayment() {
689 string cardHeightClass = Pageview.Device.ToString() != "Tablet" ? "u-full-height" : "";
690 string savedCardName = "";
691
692 <div class="card-header u-color-light--bg dw-mod">
693 <h3><i class="fas fa-credit-card"></i> @Translate("Payment")</h3>
694 </div>
695
696 <div class="card u-color-light--bg @cardHeightClass dw-mod">
697 @foreach (LoopItem payment in GetLoop("Paymethods"))
698 {
699 bool supportSavedCards = payment.GetBoolean("Ecom:Cart.Paymethod.SupportSavedCard") && Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"));
700 string cardIsSaved = !String.IsNullOrEmpty(payment.GetString("Ecom:Order.SavedCardName")) ? "checked" : "";
701 string selected = payment.GetBoolean("Ecom:Cart.Paymethod.IsSelected") ? "checked" : "";
702
703 <div>
704 <div class="form__field-group u-margin-bottom">
705 <input class="form__control" data-expand="savedCards_@payment.GetString("Ecom:Cart.Paymethod.Name").Replace(" ", "_")" onchange="Cart.DeselectRadioGroup('EcomCartSavedCardID'); Cart.SubmitCart()" type="radio" name="EcomCartPaymethodID" id="EcomCartPaymethodID_@payment.GetString("Ecom:Cart.Paymethod.ID")" value="@payment.GetString("Ecom:Cart.Paymethod.ID")" @selected />
706 <label for="EcomCartPaymethodID_@payment.GetString("Ecom:Cart.Paymethod.ID")" class="u-inline">@payment.GetString("Ecom:Cart.Paymethod.Name")</label>
707 </div>
708 @if (supportSavedCards)
709 {
710 <div class="expandable--collapsed dw-mod" data-trigger="savedCards_@payment.GetString("Ecom:Cart.Paymethod.Name").Replace(" ", "_")">
711 <div class="u-border-top u-border-bottom u-padding u-margin-bottom show">
712 <div class="form__field-group u-margin-bottom">
713 <input type="checkbox" class="form__control" name="EcomOrderSavedCardCreate" id="EcomOrderSavedCardCreate_@payment.GetString("Ecom:Cart.Paymethod.ID")" value="true" @cardIsSaved />
714 <label for="EcomOrderSavedCardCreate_@payment.GetString("Ecom:Cart.Paymethod.ID")">@Translate("Save used card")</label>
715 </div>
716 <div>
717 <input type="text" class="u-full-width u-no-margin" onkeyup="document.getElementById('MySavedCardName').value = this.value;" placeholder="@Translate("Saved card name")" value="@payment.GetString("Ecom:Order.SavedCardName")" />
718 </div>
719 </div>
720 </div>
721 }
722 </div>
723 }
724
725 @if (GetLoop("SavedCards").Count > 0)
726 {
727 <div class="u-bold u-margin-top">@Translate("Pay with a saved card")</div>
728
729 foreach (LoopItem card in GetLoop("SavedCards"))
730 {
731 string selected = card.GetBoolean("Ecom:SavedCard.IsSelected") ? "checked" : "";
732
733 <div>
734 <input onchange="Cart.DeselectRadioGroup('EcomCartPaymethodID'); Cart.SubmitCart()" class="form__control" type="radio" name="EcomCartSavedCardID" id="EcomCartSavedCardID" value="@card.GetString("Ecom:SavedCard.ID")" @selected />
735 <label for="EcomCartSavedCardID" class="u-inline u-margin-bottom">@card.GetString("Ecom:SavedCard.Name")</label>
736 </div>
737
738 if (!String.IsNullOrEmpty(selected))
739 {
740 savedCardName = card.GetString("Ecom:SavedCard.Name");
741 }
742 }
743 }
744
745 <input type="hidden" name="EcomOrderSavedCardName" id="MySavedCardName" value="@savedCardName" />
746 </div>
747 }
748 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
749 @using Dynamicweb.Core
750 @using System
751 @using System.Web
752 @using System.Collections.Generic
753 @using Dynamicweb.Rapido.Blocks
754
755 @{
756 BlocksPage shippingCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage");
757
758 if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideShipping") && GetLoop("Shippingmethods").Count > 0) {
759 Block shippingBlock = new Block()
760 {
761 Id = "Shipping",
762 SortId = 20,
763 Template = RenderShipping(),
764 Design = new Design
765 {
766 RenderType = RenderType.Column,
767 Size = "6"
768 }
769 };
770 shippingCheckoutPage.Add("OrderContainerRow", shippingBlock);
771
772 Block parcelShopsModal = new Block()
773 {
774 Id = "ParcelShopsModal",
775 SortId = 10,
776 Template = RenderParcelShopsModal()
777 };
778 shippingCheckoutPage.Add("CheckoutTopSnippets", parcelShopsModal);
779
780 Block parcelShopsScriptTemplates = new Block()
781 {
782 Id = "ShippingProviderTemplates",
783 SortId = 10,
784 Template = RenderShippingProviderTemplates()
785 };
786 shippingCheckoutPage.Add("CheckoutBottomSnippets", parcelShopsScriptTemplates);
787 }
788 }
789
790 @helper RenderShipping()
791 {
792 string cardHeightClass = Pageview.Device.ToString() != "Tablet" ? "u-full-height" : "";
793 bool defaultShippingIsSet = Dynamicweb.Ecommerce.Orders.Shipping.GetDefaultShippingMethod(Dynamicweb.Ecommerce.Common.Context.Cart.ShippingMethodCountryCode) != null;
794
795 <div class="card-header u-color-light--bg dw-mod">
796 <h3><i class="fas fa-truck"></i> @Translate("Shipping")</h3>
797 </div>
798
799 <div class="card u-color-light--bg @cardHeightClass dw-mod">
800 @{
801 bool haveShippingContent = GetLoop("Shippingmethods").Count != 1 || !defaultShippingIsSet;
802 bool showShippingsBlock = haveShippingContent;
803 }
804
805 @foreach (LoopItem shipping in GetLoop("Shippingmethods"))
806 {
807 bool selected = Converter.ToBoolean(shipping.GetString("Ecom:Cart.Shippingmethod.IsSelected"));
808 object shippingProviderContent = selected ? Newtonsoft.Json.JsonConvert.DeserializeObject(shipping.GetString("Ecom:ShippingProvider.Content")) : null;
809 string isChecked = selected ? "checked" : "";
810 string hideLabel = haveShippingContent ? "" : "u-hidden";
811 string leftMargin = haveShippingContent ? "u-margin-left" : "";
812
813 <div class="form__field-group dw-mod">
814 <input onchange="Cart.SubmitCart()" type="radio" class="form__control" name="EcomCartShippingmethodID" id="EcomCartShippingmethodID_@shipping.GetString("Ecom:Cart.Shippingmethod.ID")" value="@shipping.GetString("Ecom:Cart.Shippingmethod.ID")" @isChecked />
815 <label for="EcomCartShippingmethodID_@shipping.GetString("Ecom:Cart.Shippingmethod.ID")" class="@hideLabel">
816 @shipping.GetString("Ecom:Cart.Shippingmethod.Name")
817 </label>
818 </div>
819
820 if (shippingProviderContent != null)
821 {
822 showShippingsBlock = true;
823
824 <div id="ShippingProviderContent" class="@leftMargin" data-template="ShippingProviderContentTemplate"></div>
825 <script>
826 document.addEventListener("DOMContentLoaded", function (event) {
827 HandlebarsBolt.CreateItemsFromJson(@shippingProviderContent, "ShippingProviderContent", "ShippingProviderContentTemplate");
828 HandlebarsBolt.CreateItemsFromJson(@shippingProviderContent, "ParcelShops", "ParcelShopsTemplate");
829
830 if (document.getElementById("DeliveryAddressFields")) {
831 document.getElementById("DeliveryAddressFields").addEventListener("contentLoaded", function () {
832 setParcelShopToDeliveryFields();
833 });
834 } else {
835 setParcelShopToDeliveryFields();
836 }
837 });
838
839 let data = @shippingProviderContent;
840
841 function setParcelShopToDeliveryFields(parcelShop) {
842 let deliveryAddress = document.getElementById("EcomOrderDeliveryAddress").value;
843 let selectedParcelShop = parcelShop || data[0].ParcelShops[0];
844
845 if (data != "") {
846 if (deliveryAddress == "" || parcelShop != null) {
847 document.getElementById("AlternateAddressBlock").checked = true;
848
849 document.getElementById("EcomOrderDeliveryCompany").value = selectedParcelShop.company;
850 document.getElementById("EcomOrderDeliveryName").value = selectedParcelShop.company;
851 document.getElementById("EcomOrderDeliveryPhone").value = "";
852 document.getElementById("EcomOrderDeliveryEmail").value = "";
853 document.getElementById("EcomOrderDeliveryAddress").value = selectedParcelShop.address;
854 document.getElementById("EcomOrderDeliveryZip").value = selectedParcelShop.zip;
855 document.getElementById("EcomOrderDeliveryCity").value = selectedParcelShop.city;
856 document.getElementById("Country").setAttribute("data-countrycode", selectedParcelShop.countryCode);
857 }
858 }
859
860 document.getElementById("DeliveryAddressFields").removeEventListener("contentLoaded", setParcelShopToDeliveryFields);
861 }
862 </script>
863 }
864
865 if (shipping.GetString("Ecom:ShippingProvider.Content") != "" && @shipping.GetString("Ecom:ShippingProvider.Content").Length < 10)
866 {
867 <button class="btn btn--secondary btn--full u-no-margin u-margin-bottom dw-mod" onclick="Cart.SubmitCart()">@Translate("Get parcel shops")</button>
868 <small class="help-text dw-mod">@Translate("Requires an address for either billing og shipping")</small>
869 }
870 }
871 @if (!showShippingsBlock)
872 {
873 <script>
874 document.getElementById("shippingsBlock").classList.add("u-hidden");
875 </script>
876 }
877 </div>
878 }
879
880 @helper RenderParcelShopsModal()
881 {
882 string parcelShopModalHeader = Pageview.Device.ToString() != "Mobile" ? Translate("Choose a parcel shop") : Translate("Choose");
883
884 <!-- Trigger for the pacel shops modal -->
885 <input type="checkbox" id="ParcelShopsModalTrigger" class="modal-trigger" />
886
887 <!-- Map modal -->
888 <div class="modal-container">
889 <label for="ParcelShopsModalTrigger" id="ParcelShopsModalOverlay" class="modal-overlay"></label>
890 <div class="modal modal--lg" id="ParcelShopsModal">
891 <div class="modal__header">
892 <h2>@parcelShopModalHeader</h2>
893 </div>
894 <div class="modal__body">
895 <div class="grid">
896 <div class="grid__col-auto">
897 <ul class="list list--clean list--scroll dw-mod" id="ParcelShops" data-template="ParcelShopsTemplate"></ul>
898 </div>
899 @if (Pageview.Device.ToString() != "Mobile")
900 {
901 <div class="grid__col-8">
902 <div class="map-container">
903 <div id="MapCanvas" class="map-container__canvas"></div>
904 </div>
905 </div>
906 }
907 </div>
908 </div>
909 </div>
910 </div>
911 }
912
913 @helper RenderShippingProviderTemplates()
914 {
915 <script id="ShippingProviderContentTemplate" type="text/x-template">
916 {{#.}}
917 <div class="{{hideShippingProvider}}">
918 <ul class="list list--clean parcel-shop-address dw-mod" id="SelectedParcelShop">
919 {{#SelectedParcelShop}}
920 <li data-number="{{number}}" data-lat="{{latitude}}" data-lng="{{longitude}}">
921 <div class="u-hidden">
922 <input type="radio" class="u-no-margin" name="{{fieldPrefix}}{{fieldPostfix}}" value="{{number}}" {{selected}} />
923 </div>
924 <div>
925 <i class="fas fa-map-marker"></i>
926 <span class="u-bold">{{company}}, </span>
927 <span>{{address}} </span>
928 <span>{{city}} </span>
929 <span>{{countryCode}} </span>
930 </div>
931 </li>
932 {{/SelectedParcelShop}}
933 {{^SelectedParcelShop}}
934 <li>@Translate("No points found")</li>
935 {{/SelectedParcelShop}}
936 </ul>
937 <div class="{{hideShippingProvider}}">
938 <label for="ParcelShopsModalTrigger" class="btn btn--secondary btn--full dw-mod" onclick="Maps.Init({containerId: 'MapCanvas', locationsList: {{toJSON ParcelShops}}, markerCallback: Cart.SelectParcelShop, selectionCallback: Cart.SubmitCart, buttonText: '@Translate("Select")'})">@Translate("Change parcel shop")</label>
939 </div>
940 </div>
941 {{/.}}
942 </script>
943
944 <script id="ParcelShopsTemplate" type="text/x-template">
945 {{#.}}
946 {{#ParcelShops}}
947 <li data-number="{{number}}" data-lat="{{latitude}}" data-lng="{{longitude}}">
948 <input type="radio" name="{{fieldPrefix}}{{fieldPostfix}}" value="{{number}}" class="form__control" id="{{fieldPrefix}}ParcelShopNumber_{{number}}" {{selected}}
949 onclick="setParcelShopToDeliveryFields({company: '{{company}}', address: '{{address}}', zip: {{zip}}, city: '{{city}}', countryCode: '{{countryCode}}'});
950 document.getElementById('OrderSubmit').submit();" />
951 <label for="{{fieldPrefix}}ParcelShopNumber_{{number}}" class="u-flex">
952 <span class="u-inline-block">
953 <span class="u-bold">{{company}}, </span>
954 <span class="u-block">{{address}}, {{city}}</span>
955 <span class="u-block">{{countryCode}} </span>
956 </span>
957 </label>
958 </li>
959 <li class="list__seperator"></li>
960 {{/ParcelShops}}
961 {{/.}}
962 </script>
963
964
965 string mapsScriptUrl = "//maps.googleapis.com/maps/api/js";
966 mapsScriptUrl += !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleMapsAPIKey")) ? "?key=" + Pageview.AreaSettings.GetItem("Settings").GetString("GoogleMapsAPIKey") : "";
967
968 <script src="@mapsScriptUrl"></script>
969
970 if (Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")) && GetLoop("UserManagement:User.UserAddresses").Count > 0)
971 {
972 <script>
973 document.addEventListener("DOMContentLoaded", function (event) {
974 document.getElementById("DeliveryAddressFields").addEventListener('contentLoaded', function (e) {
975 var target = getTarget(e);
976 if (target.name == "EcomOrderDeliveryCountry") {
977 target.value = target.getAttribute("data-countryCode");
978 }
979 }, false);
980 });
981 </script>
982 }
983 }
984 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
985 @using Dynamicweb.Core
986 @using System
987 @using System.Web
988 @using System.Collections.Generic
989 @using Dynamicweb.Rapido.Blocks
990
991 @{
992 BlocksPage voucherCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage");
993
994 if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideVoucher"))
995 {
996 Block voucherBlock = new Block()
997 {
998 Id = "Voucher",
999 SortId = 30,
1000 Template = RenderVoucher(),
1001 Design = new Design
1002 {
1003 RenderType = RenderType.Column,
1004 Size = "auto"
1005 }
1006 };
1007 voucherCheckoutPage.Add("OrderContainerRow", voucherBlock);
1008 }
1009 }
1010
1011 @helper RenderVoucher() {
1012 string cardHeightClass = Pageview.Device.ToString() != "Tablet" ? "u-full-height" : "";
1013
1014 <div class="card-header u-color-light--bg dw-mod">
1015 <h3><i class="fas fa-gift"></i> @Translate("Voucher")</h3>
1016 </div>
1017
1018 <div class="card u-color-light--bg @cardHeightClass dw-mod">
1019 <div class="form__field-combi">
1020 <input type="text" class="u-full-width" placeholder="@Translate("Enter voucher code")" name="EcomOrderVoucherCode" id="EcomOrderVoucherCode" onkeyup="checkEmpty();" value="@GetString("Ecom:Order.Customer.VoucherCode")" />
1021 <button type="submit" class="btn btn--primary dw-mod btn--condensed u-no-margin" id="EcomOrderVoucherApply">@Translate("Apply")</button>
1022 </div>
1023
1024 @{
1025 var errors = new List<string>();
1026 string voucherCode = GetString("Ecom:Order.Customer.VoucherCode");
1027 if (!string.IsNullOrWhiteSpace(voucherCode))
1028 {
1029 Order order = new OrderService().GetOrder(GetString("Ecom:Order.ID"));
1030
1031 IEnumerable<string> codes = new List<string>();
1032 bool vouchersAppliedAsDiscounts = false;
1033
1034 if (order.VoucherUseType.HasFlag(VoucherUseCategoryType.Discount))
1035 {
1036 codes = voucherCode.Split(new string[] { ",", ";", " " }, StringSplitOptions.RemoveEmptyEntries);
1037 vouchersAppliedAsDiscounts = true;
1038 }
1039 else
1040 {
1041 codes = new string[] { voucherCode.Trim() };
1042 }
1043
1044 if (vouchersAppliedAsDiscounts && codes.Count() == 1)
1045 {
1046 <div class="field-success u-margin-bottom dw-mod">@Translate("Voucher") <span class="u-bold">@voucherCode</span> @Translate("applied to order")</div>
1047 }
1048 else
1049 {
1050 foreach (string code in codes)
1051 {
1052 Voucher vouch = Voucher.GetVoucherByCode(code);
1053 if (vouch == null)
1054 {
1055 errors.Add(Translate("Voucher") + " <span class=u-bold>" + code + "</span> " + Translate("not found"));
1056 continue;
1057 }
1058 if (vouch.DateUsed.HasValue)
1059 {
1060 errors.Add(Translate("Voucher") + " <span class=u-bold>" + code + "</span> " + Translate("already used"));
1061 continue;
1062 }
1063 VoucherList voucherList = VoucherList.GetListById(vouch.ListId);
1064 if (!voucherList.ListActive)
1065 {
1066 errors.Add(Translate("Voucher") + " <span class=u-bold>" + code + "</span> " + Translate("is not active"));
1067 continue;
1068 }
1069 <div class="field-success u-margin-bottom dw-mod">@Translate("Voucher") <span class="u-bold">@code</span> @Translate("applied to order")</div>
1070 }
1071 }
1072
1073 foreach (string error in errors)
1074 {
1075 <div class="field-error u-margin-bottom dw-mod">@error</div>
1076 }
1077 }
1078 }
1079 </div>
1080 }
1081 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
1082 @using Dynamicweb.Core
1083 @using System
1084 @using System.Web
1085 @using System.Collections.Generic
1086 @using Dynamicweb.Rapido.Blocks
1087
1088 @{
1089 BlocksPage recurringCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage");
1090
1091 if (!string.IsNullOrWhiteSpace(GetString("Ecom:Order.PaymentMethod.RecurringSupport")) && !Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideRecurringOrder"))
1092 {
1093 Block recurringOrderBlock = new Block()
1094 {
1095 Id = "RecurringOrder",
1096 SortId = 40,
1097 Template = RenderRecurringOrder(),
1098 Design = new Design
1099 {
1100 RenderType = RenderType.Column,
1101 Size = "12"
1102 }
1103 };
1104 recurringCheckoutPage.Add("OrderContainerRow", recurringOrderBlock);
1105 }
1106 }
1107
1108 @helper RenderRecurringOrder() {
1109 string cardHeightClass = Pageview.Device.ToString() != "Tablet" ? "u-full-height" : "";
1110 string dateFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
1111
1112 <div class="card-header u-color-light--bg dw-mod">
1113 <h3><i class="fas fa-calendar"></i> @Translate("Recurring order")</h3>
1114 </div>
1115
1116 <div class="card u-color-light--bg @cardHeightClass dw-mod">
1117 <div class="form__field-group u-margin-bottom">
1118 <input type="checkbox" class="js-remember-state form__control" checked="@GetBoolean("Ecom:Order.Recurring.Enabled")" name="EcomRecurringOrderCreate" data-expand="EcomRecurringOrderCreate" id="EcomRecurringOrderCreate">
1119 <label for="EcomRecurringOrderCreate">@Translate("Create recurring order")</label>
1120 </div>
1121 <div class="expandable--collapsed" data-trigger="EcomRecurringOrderCreate">
1122 <div class="form__field-group dw-mod">
1123 <label for="Country">@Translate("I want my order every")</label>
1124 <div class="grid grid--external-bleed-x">
1125 <div class="grid__col-6 grid__col--bleed-y">
1126 <select class="u-full-width" name="EcomOrderRecurringInterval" id="EcomOrderRecurringInterval">
1127 @*interval*@
1128 @for (var i = 1; i <= 12; i++)
1129 {
1130 <option value="@i" @(GetInteger("Ecom:Order.Recurring.Interval") == i ? "selected" : "")> @i</option>
1131 }
1132 </select>
1133 </div>
1134 <div class="grid__col-6 grid__col--bleed-y">
1135 <select class="u-full-width" name="EcomOrderRecurringIntervalUnit" id="EcomOrderRecurringIntervalUnit">
1136 @{ var units = new[] { "Days", "Weeks", "Months" }; }
1137 @for (int i = 0; i < units.Length; i++)
1138 {
1139 <option value="@i" @(GetInteger("Ecom:Order.Recurring.IntervalUnit") == i ? "selected" : "")>@Translate(units[i])</option>
1140 }
1141 </select>
1142 </div>
1143 </div>
1144 </div>
1145 <div class="grid grid--external-bleed-x">
1146 <div class="grid__col-6 grid__col--bleed-y">
1147 <div class="form__field-group dw-mod">
1148 <label for="EcomOrderRecurringStartDate">@Translate("Start date")</label>
1149 @{string startDate = !string.IsNullOrEmpty(GetString("Ecom:Order.Recurring.StartDate.Clean")) ? GetDate("Ecom:Order.Recurring.StartDate.Clean").ToString(dateFormat) : "";}
1150 <input type="text" class="u-full-width" id="EcomOrderRecurringStartDate" name="EcomOrderRecurringStartDate" placeholder="@Translate("Never")" value="@startDate" />
1151 </div>
1152 </div>
1153 <div class="grid__col-6 grid__col--bleed-y">
1154 <div class="form__field-group dw-mod">
1155 <label for="EcomOrderRecurringEndDate">@Translate("And it should end on")</label>
1156 @{string endDate = !string.IsNullOrEmpty(GetString("Ecom:Order.Recurring.EndDate.Clean")) ? GetDate("Ecom:Order.Recurring.EndDate.Clean").ToString(dateFormat) : "";}
1157 <input type="text" class="u-full-width" id="EcomOrderRecurringEndDate" name="EcomOrderRecurringEndDate" placeholder="@Translate("Never")" value="@endDate">
1158 </div>
1159 </div>
1160 </div>
1161 </div>
1162 </div>
1163
1164 //* *//
1165 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
1166 <style>
1167 .flatpickr-months .flatpickr-month {
1168 height: 40px;
1169 }
1170 </style>
1171 <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
1172 <script>
1173 @{
1174 dateFormat = dateFormat.Replace("dd", "d");
1175 dateFormat = dateFormat.Replace("MM", "m");
1176 dateFormat = dateFormat.Replace("yyyy", "Y");
1177 }
1178
1179 flatpickr("#EcomOrderRecurringStartDate, #EcomOrderRecurringEndDate", {
1180 dateFormat: "@dateFormat",
1181 minDate: "today"
1182 });
1183 </script>
1184 }
1185
1186 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
1187 @using Dynamicweb
1188 @using Dynamicweb.Core
1189 @using System
1190 @using System.Web
1191 @using System.Collections.Generic
1192 @using Dynamicweb.Rapido.Blocks
1193
1194 @functions{
1195 BlocksPage reviewOrderCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage");
1196 int cartOrderlinesFeedPageId;
1197 }
1198
1199 @{
1200 string reviewOrderType = checkoutPageType ?? "onestep"; //The "checkoutPageType" comes from the main template for the cart page
1201 cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed");
1202
1203 Block reviewOrderBlock = new Block()
1204 {
1205 Id = "ReviewOrder",
1206 SortId = 50,
1207 Template = RenderReviewOrder(),
1208 SkipRenderBlocksList = true
1209 };
1210 reviewOrderCheckoutPage.Add("OrderContainerRow", reviewOrderBlock);
1211
1212 if (reviewOrderType == "onestep")
1213 {
1214 Block inlineAcceptanceBlock = new Block()
1215 {
1216 Id = "Acceptance",
1217 SortId = 10,
1218 Template = RenderInlineAcceptance()
1219 };
1220 reviewOrderCheckoutPage.Add("ReviewOrder", inlineAcceptanceBlock);
1221
1222 Block reviewOrderFooterBlock = new Block()
1223 {
1224 Id = "ReviewOrderFooter",
1225 SortId = 20,
1226 Template = RenderReviewOrderFooter()
1227 };
1228 reviewOrderCheckoutPage.Add("ReviewOrder", reviewOrderFooterBlock);
1229 }
1230
1231 if (reviewOrderType == "quote")
1232 {
1233 Block reviewOrderFooterBlock = new Block()
1234 {
1235 Id = "ReviewOrderFooter",
1236 SortId = 20,
1237 Template = RenderReviewOrderFooterQuote()
1238 };
1239 reviewOrderCheckoutPage.Add("ReviewOrder", reviewOrderFooterBlock);
1240 }
1241
1242 Block reviewOrderScriptTemplates = new Block()
1243 {
1244 Id = "ReviewOrderScriptTempaltes",
1245 SortId = 30,
1246 Template = RenderReviewOrderScriptTemplates()
1247 };
1248 reviewOrderCheckoutPage.Add("CheckoutBottomSnippets", reviewOrderScriptTemplates);
1249
1250 Block reviewOrderScripts = new Block()
1251 {
1252 Id = "ReviewOrderScripts",
1253 SortId = 40,
1254 Template = RenderOrderScripts()
1255 };
1256 reviewOrderCheckoutPage.Add("CheckoutBottomSnippets", reviewOrderScripts);
1257 }
1258
1259 @helper RenderReviewOrder() {
1260 cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed");
1261
1262 <div class="grid__col-12">
1263 <div class="js-handlebars-root" id="Cart" data-template="CartContent" data-cart-id="@cartOrderlinesFeedPageId" data-json-feed="/Default.aspx?ID=@cartOrderlinesFeedPageId" data-preloader="overlay"></div>
1264 </div>
1265 }
1266
1267 @helper RenderReviewOrderScriptTemplates() {
1268 List<Block> subBlocks = reviewOrderCheckoutPage.GetBlockListById("ReviewOrder").OrderBy(item => item.SortId).ToList();
1269
1270 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly");
1271 int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage");
1272 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
1273
1274 @* Template for when the cart is empty *@
1275 <script id="EmptyCart" type="text/x-template">
1276 @Translate("You have no items in the cart")
1277 </script>
1278
1279 @* Template for the cart *@
1280 <script id="CartContent" type="text/x-template">
1281 {{#.}}
1282 @if (useGoogleTagManager)
1283 {
1284 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text>
1285 }
1286 <div class="card-header u-color-light--bg dw-mod">
1287 <h3><i class="fas fa-list-ul"></i> @Translate("Review order") ({{numberofproducts}})</h3>
1288 </div>
1289 <div class="card u-color-light--bg u-no-padding--xs dw-mod">
1290 {{#unless isEmpty}}
1291 <table class="table cart-table dw-mod">
1292 <tbody id="OrderLines">
1293 {{#OrderLines}}
1294 {{> (lookup . 'template') }}
1295 {{/OrderLines}}
1296 </tbody>
1297 </table>
1298 {{/unless}}
1299 <div class="grid u-border-top">
1300 <div class="grid__col-sm-6">
1301 @if (Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints") && !string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName")))
1302 {
1303 <text>
1304 {{#if userPoints}}
1305 <div class="u-border u-border-color--loyalty-points u-padding--lg u-full-height">
1306 <h3 class="u-no-margin">@Translate("Your point balance")</h3>
1307 <div class="u-font-size--lg u-margin-bottom">
1308 <span class="u-color--loyalty-points">{{userPoints}}</span> @Translate("points")
1309 </div>
1310 <div>@Translate("On this order you will use"): <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")</div>
1311 </div>
1312 {{/if}}
1313 </text>
1314 }
1315 </div>
1316
1317 <div class="grid__col-sm-6">
1318 @if (!pointShop)
1319 {
1320 <div class="{{hideSubTotal}}">
1321 <div class="cart-summary__subtotals dw-mod">@Translate("Subtotal")</div>
1322 <div class="cart-summary__subtotals u-pull--right dw-mod">{{subtotalprice}}</div>
1323 </div>
1324 <div class="{{hidePaymentfee}}">
1325 <div class="cart-summary__info dw-mod"><i class="fas fa-credit-card"></i> {{paymentmethod}}</div>
1326 <div class="cart-summary__info u-pull--right dw-mod">{{paymentfee}}</div>
1327 </div>
1328 }
1329 <div class="{{hideShippingfee}}">
1330 <div class="cart-summary__info dw-mod"><i class="fas fa-truck"></i> {{shippingmethod}}</div>
1331 <div class="cart-summary__info u-pull--right dw-mod">{{shippingfee}}</div>
1332 </div>
1333 @if (!pointShop)
1334 {
1335 <div>
1336 <div class="cart-summary__info dw-mod">@Translate("VAT")</div>
1337 <div class="cart-summary__info u-pull--right dw-mod">{{totalvat}}</div>
1338 </div>
1339 }
1340 @if (Pageview.User != null && Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints"))
1341 {
1342 <text>
1343 {{#if earnings}}
1344 <div>
1345 <div class="cart-summary__info dw-mod">@Translate("Earnings")</div>
1346 <div class="cart-summary__info u-pull--right dw-mod"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</div>
1347 </div>
1348 {{/if}}
1349 </text>
1350 }
1351 <div class="cart-summary__totals-container dw-mod">
1352 <div class="cart-summary__totals dw-mod">@Translate("Total")</div>
1353 <div class="cart-summary__totals u-pull--right dw-mod">
1354 @if (pointShop)
1355 {
1356 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points")
1357 }
1358 else
1359 {
1360 <text>{{totalprice}}</text>
1361 }
1362 </div>
1363 </div>
1364 </div>
1365 </div>
1366
1367 <div class="grid">
1368 <div class="grid__col-12 grid__col--line-top"></div>
1369 </div>
1370
1371 <div class="grid__cell u-padding--xs {{hideComment}}">
1372 <textarea rows="3" class="u-full-width" placeholder="@Translate("Enter comment")" name="EcomOrderCustomerComment" id="EcomOrderCustomerComment">{{comment}}</textarea>
1373 </div>
1374
1375 @foreach (LoopItem error in GetLoop("ValidationErrors"))
1376 {
1377 <div class="error-block">@error.GetString("Ecom:Cart.ValidationError.ErrorMessage")</div>
1378 }
1379
1380 @RenderBlockList(subBlocks)
1381 </div>
1382 {{/.}}
1383 </script>
1384
1385 @* Template for the orderlines *@
1386 <script id="CartOrderline" type="text/x-template">
1387 {{#unless isEmpty}}
1388 <tr id="Orderline{{id}}" class="cart-orderline">
1389 <td class="cart-orderline__cell cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><div class="cart-orderline__cell__block {{hideimage}} dw-mod"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&height=60&crop=5&Compression=75&image={{image}}" alt="{{name}} {{variantname}}"></div></td>
1390 <td class="cart-orderline__cell dw-mod" title="{{name}} {{variantname}}">
1391 <a href="{{link}}" class="u-color-inherit cart-orderline__name">{{name}}</a>
1392 <div class="cart-orderline__cell__block item-number dw-mod">#{{productnumber}}</div>
1393 {{#if variantname}}
1394 <div class="cart-orderline__cell__block item-number dw-mod">{{variantname}}</div>
1395 {{/if}}
1396 {{#if unitname}}
1397 <div class="cart-orderline__cell__block item-number dw-mod">{{unitname}}</div>
1398 {{/if}}
1399 </td>
1400 <td class="cart-orderline__cell u-ta-right u-hidden-xs u-hidden-xxs dw-mod" width="120">
1401 {{#if pointsTotal}}
1402 <span class="u-color--loyalty-points">{{pointPrice}}</span> @Translate("points")
1403 {{else}}
1404 {{unitprice}}
1405 {{/if}}
1406 </td>
1407
1408 @if (!Dynamicweb.Ecommerce.Common.Context.Cart.IsQuote)
1409 {
1410 <td class="cart-orderline__cell u-ta-right dw-mod" width="80">
1411 <input class="u-w80px u-no-margin" id="Quantity_{{orderLineId}}" type="number" min="1" onchange="Cart.ChangeQuantity('@cartOrderlinesFeedPageId', '{{orderLineId}}', this.value)" name='QuantityOrderLine{{orderLineId}}' value="{{quantity}}">
1412 </td>
1413 <td class="cart-orderline__cell u-ta-left dw-mod u-no-padding-x" width="50">
1414 <button type="button" title="@Translate("Remove orderline")" class="btn btn--condensed btn--clean u-no-margin" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&Redirect=Default.aspx%3FID%3D@(cartOrderlinesFeedPageId)', true);"><i class="far fa-times"></i></button>
1415 </td>
1416 }
1417 else
1418 {
1419 <td class="cart-orderline__cell u-ta-right dw-mod" width="80">
1420 <input id="Quantity_{{orderLineId}}" type="hidden" name='QuantityOrderLine{{orderLineId}}' value="{{quantity}}">
1421 <div class="u-w80px u-no-margin">{{quantity}}</div>
1422 </td>
1423 }
1424
1425 <td class="cart-orderline__cell u-ta-right dw-mod">
1426 {{#if pointsTotal}}
1427 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
1428 {{else}}
1429 <div>{{totalprice}}</div>
1430 {{/if}}
1431 {{#if canBePurchasedWithPoints}}
1432 <button type="button" onclick="Cart.BuyForPoints('@GetGlobalValue("Global:Page.ID")', '@cartOrderlinesFeedPageId', '{{orderLineId}}', '{{id}}', '{{variantId}}');" class="btn btn--loyalty-points dw-mod btn--sm u-no-margin" title="@Translate("Use") {{pointPrice}} @Translate("points")"><i class="far fa-tag"></i> @Translate("Use") {{pointPrice}} @Translate("points")</button>
1433 {{/if}}
1434 </td>
1435 </tr>
1436 {{/unless}}
1437 <tr class="{{hideBomItems}}">
1438 <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><div class="{{hideimage}}"></div></td>
1439 <td colspan="5" class="u-no-padding">
1440 <table class="u-no-margin u-color-light-gray--bg">
1441 <tbody>
1442 {{#BomItems}}
1443 <tr>
1444 <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&height=60&crop=5&Compression=75&image={{image}}" alt="{{name}} {{variantname}}"></td>
1445 <td title="{{name}} {{variantname}}">
1446 <a href="{{link}}" class="u-color-inherit dw-mod">{{name}}</a>
1447 <div class="item-number dw-mod">#{{productnumber}}</div>
1448 {{#if variantname}}
1449 <div class="item-number dw-mod">{{variantname}}</div>
1450 {{/if}}
1451 {{#if unitname}}
1452 <div class="item-number dw-mod">{{unitname}}</div>
1453 {{/if}}
1454 </td>
1455 <td class="u-hidden-xs u-hidden-xxs"> </td>
1456 <td>{{quantity}}</td>
1457 <td> </td>
1458 <td class="cart-table__price u-ta-right dw-mod"> </td>
1459 </tr>
1460 {{/BomItems}}
1461 </tbody>
1462 </table>
1463 </td>
1464 </tr>
1465 </script>
1466
1467 <script id="CartOrderlineMobile" type="text/x-template">
1468 {{#unless isEmpty}}
1469 <tr id="Orderline{{id}}">
1470 <td class="cart-table__image dw-mod"><div class="{{hideimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&height=60&crop=5&Compression=75&image={{image}}" alt="{{name}} {{variantname}}"></div></td>
1471 <td title="{{name}} {{variantname}}" colspan="4">
1472 <a href="{{link}}" class="u-color-inherit">{{name}}</a>
1473 <div>#{{productnumber}}</div>
1474 {{#if variantname}}
1475 <div>{{variantname}}</div>
1476 {{/if}}
1477 {{#if unitname}}
1478 <div>{{unitname}}</div>
1479 {{/if}}
1480 </td>
1481 </tr>
1482 <tr class="table__row--no-border">
1483 <td class="cart-table__image dw-mod"></td>
1484 <td colspan="4">
1485 <div class="u-pull--left">
1486 <input class="u-w80px u-no-margin" id="Quantity_{{orderLineId}}" type="number" min="1" onchange="Cart.ChangeQuantity('@cartOrderlinesFeedPageId', '{{orderLineId}}', this.value)" name='QuantityOrderLine{{orderLineId}}' value="{{quantity}}">
1487 <span><button type="button" class="btn btn--clean btn--condensed u-no-margin" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&Redirect=Default.aspx%3FID%3D@(cartOrderlinesFeedPageId)', true);"><i class="fas fa-times"></i></button></span>
1488 </div>
1489 <div class="u-pull--right u-ta-right">
1490 {{#if pointsTotal}}
1491 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points")
1492 {{else}}
1493 <div>{{totalprice}}</div>
1494 {{/if}}
1495 {{#if canBePurchasedWithPoints}}
1496 <button type="button" onclick="Cart.BuyForPoints('@GetGlobalValue("Global:Page.ID")', '@cartOrderlinesFeedPageId', '{{orderLineId}}', '{{id}}', '{{variantId}}');" class="btn btn--loyalty-points dw-mod btn--sm u-no-margin" name="CartCmd" value="addWithPoints" title="@Translate("Use") {{pointPrice}} @Translate("points")"><i class="far fa-tag"></i> @Translate("Use") {{pointPrice}} @Translate("points")</button>
1497 {{/if}}
1498 </div>
1499 </td>
1500 </tr>
1501 {{/unless}}
1502 <tr class="{{hideBomItems}}">
1503 <td colspan="6" class="u-no-padding">
1504 <table class="u-no-margin u-color-light-gray--bg">
1505 <tbody>
1506 {{#BomItems}}
1507 <tr>
1508 <td class="cart-table__image u-hidden-xs u-hidden-xxs dw-mod"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=120&height=120&crop=5&Compression=75&image={{image}}" title="{{name}} {{variantname}}" alt="{{name}} {{variantname}}"></td>
1509 <td title="{{name}} {{variantname}}">
1510 <a href="{{link}}" title="{{name}} {{variantname}}">{{name}}</a>
1511 <div>#{{productnumber}}</div>
1512 {{#if variantname}}
1513 <div>{{variantname}}</div>
1514 {{/if}}
1515 {{#if unitname}}
1516 <div>{{unitname}}</div>
1517 {{/if}}
1518 </td>
1519 <td class="u-hidden-xs u-hidden-xxs"> </td>
1520 <td>{{quantity}}</td>
1521 <td> </td>
1522 <td class="cart-table__price u-ta-right dw-mod"> </td>
1523 </tr>
1524 {{/BomItems}}
1525 </tbody>
1526 </table>
1527 </td>
1528 </tr>
1529 </script>
1530
1531 <script id="CartOrderlineDiscount" type="text/x-template">
1532 <tr class="table__row--no-border">
1533 <td class="cart-table__image dw-mod"> </td>
1534 <td colspan="3">{{name}}</td>
1535 <td class="u-hidden-xs u-hidden-xxs"> </td>
1536 <td class="cart-table__price u-ta-right dw-mod">{{totalprice}}</td>
1537 </tr>
1538 </script>
1539 }
1540
1541 @helper RenderInlineAcceptance() {
1542 string termsPageIt = GetPageIdByNavigationTag("TermsAndConditions").ToString();
1543
1544 <div class="grid__cell u-padding--xs">
1545 @if (GetBoolean("Ecom:Cart.UseNewsletterSubscription"))
1546 {
1547 <div class="form__field-group u-margin-bottom dw-mod">
1548 <input type="hidden" name="EcomOrderSubscribeToNewsletter" />
1549 <input type="checkbox" name="EcomOrderSubscribeToNewsletter" id="EcomOrderSubscribeToNewsletter" class="form__control">
1550 <label for="EcomOrderSubscribeToNewsletter">
1551 @Translate("Subscribe to newsletter")
1552 </label>
1553 </div>
1554 }
1555 <div class="form__field-group dw-mod">
1556 <input type="checkbox" name="EcomOrderCustomerAccepted" id="EcomOrderCustomerAccepted" onchange="Cart.EnableCheckoutButton()" class="form__control">
1557 <label for="EcomOrderCustomerAccepted"></label>
1558 <a href="/Default.aspx?ID=@termsPageIt">@Translate("I accept the terms and conditions")</a>
1559 </div>
1560 <div class="field-error dw-mod">@GetString("Ecom:Cart.ValidationError.EcomOrderCustomerAccepted.ErrorMessage")</div>
1561 </div>
1562 }
1563
1564 @helper RenderReviewOrderFooter() {
1565 int quotesCartPageId = GetPageIdByNavigationTag("QuotesCartPage");
1566
1567 <div class="grid">
1568 <div class="grid__col-12 grid__col--line-top"></div>
1569 </div>
1570
1571 <div class="grid__cell-footer">
1572 <div class="grid__cell u-padding--xs">
1573 <div class="u-pull--right">
1574 <button type="submit" class="btn btn--primary btn--condensed dw-mod u-pull--right u-no-margin disabled" name="@GetString("CartV2.NextStepButtonName")" id="@GetString("CartV2.NextStepButtonName")" disabled>@Translate("Go to checkout")</button>
1575 </div>
1576 <div class="u-pull--left">
1577 <button type="button" class="btn btn--secondary btn--condensed dw-mod u-pull--left u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button>
1578 </div>
1579 @if (!Pageview.AreaSettings.GetItem("Ecommerce").GetItem("Checkout").GetBoolean("HideQuotesCartLink"))
1580 {
1581 <div class="u-pull--right">
1582 <a href="/Default.aspx?ID=@quotesCartPageId" class="btn btn--link btn--condensed dw-mod u-no-margin u-margin-right--lg u-no-margin--xs">@Translate("Create quote request")</a>
1583 </div>
1584 }
1585 </div>
1586 </div>
1587 }
1588
1589 @helper RenderReviewOrderFooterQuote() {
1590 <div class="grid">
1591 <div class="grid__col-12 grid__col--line-top"></div>
1592 </div>
1593
1594 <div class="grid__cell-footer">
1595 <div class="grid__cell u-padding--xs">
1596 <div class="u-pull--right">
1597 <button type="submit" class="btn btn--primary btn--condensed dw-mod u-pull--right u-no-margin" name="@GetString("CartV2.NextStepButtonName")" id="@GetString("CartV2.NextStepButtonName")">@Translate("Submit quote request")</button>
1598 </div>
1599 <div class="u-pull--left">
1600 <button type="button" class="btn btn--secondary btn--condensed dw-mod u-pull--left u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button>
1601 </div>
1602 </div>
1603 </div>
1604 }
1605
1606 @helper RenderOrderScripts() {
1607 if (!string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")))
1608 {
1609 <script>
1610 fbq('track', 'InitiateCheckout', {
1611 currency: '@GetString("Ecom:Order.Price.Currency.Code")',
1612 value: @GetDouble("Ecom:Order.Price.Price"),
1613 num_items: "@GetInteger("Ecom:Order.OrderLines.TotalProductQuantity")"
1614 });
1615 </script>
1616 }
1617 }
1618
1619
1620 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
1621 @using Dynamicweb.Core
1622 @using System
1623 @using System.Web
1624 @using System.Collections.Generic
1625 @using Dynamicweb.Rapido.Blocks
1626
1627 @{
1628 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID"));
1629
1630 BlocksPage googleImpressionsPage = BlocksPage.GetBlockPage("CheckoutPage");
1631
1632 Block googleImpressionsBlock = new Block()
1633 {
1634 Id = "GoogleImpressionsBlock",
1635 SortId = 10,
1636 Template = RenderScript()
1637 };
1638
1639 if (useGoogleTagManager)
1640 {
1641 googleImpressionsPage.Add("CheckoutBottomSnippets", googleImpressionsBlock);
1642 }
1643 }
1644
1645 @helper RenderScript() {
1646 <script>
1647 /**
1648 * A function to handle a click on a checkout button. This function uses the eventCallback
1649 * data layer variable to handle navigation after the ecommerce data has been sent to Google Analytics.
1650 */
1651 dataLayer.push({
1652 'event': 'checkout',
1653 'ecommerce': {
1654 'checkout': {
1655 'actionField': {'step': 1},
1656 'products': [
1657 @foreach (LoopItem orderline in GetLoop("OrderLines"))
1658 {
1659 var groupObject = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(orderline.GetString("Ecom:Product.PrimaryOrFirstGroupID"));
1660 <text>
1661 {
1662 'name': "@orderline.GetString("Ecom:Order:OrderLine.ProductName")",
1663 'id': "@orderline.GetString("Ecom:Product.ID")",
1664 'price': "@orderline.GetDouble("Ecom:Order:OrderLine.UnitPrice.Price")",
1665 'brand': "@orderline.GetString("Ecom:Product:Field.brand.Value")",
1666 'category': "@(groupObject != null ? groupObject.Name : "")",
1667 'variant': "@orderline.GetString("Ecom:Order:OrderLine.ProductVariantID")",
1668 'quantity': @orderline.GetInteger("Ecom:Order:OrderLine.Quantity")
1669 },
1670 </text>
1671 }
1672 ]
1673 }
1674 }
1675 });
1676 </script>
1677 }
1678 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
1679 @using Dynamicweb.Core
1680 @using System
1681 @using System.Web
1682 @using System.Collections.Generic
1683 @using Dynamicweb.Rapido.Blocks
1684
1685 @{
1686 BlocksPage snippetsCheckoutPage = BlocksPage.GetBlockPage("CheckoutPage");
1687 }
1688 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/eCom7/CartV2/Step/Blocks/Custom__Blocks.cshtml")))
1689 {
1690 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
1691 @using Dynamicweb.Core
1692 @using System
1693 @using System.Web
1694 @using System.Collections.Generic
1695 @using Dynamicweb.Rapido.Blocks
1696
1697 @{
1698 BlocksPage customBlocksPage = BlocksPage.GetBlockPage("CheckoutPage");
1699
1700 }</text>
1701 }
1702
1703
1704 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width">
1705 <div class="center-container center-container--with-background-image dw-mod">
1706 <div class="paragraph-container u-padding">
1707 <form name="ordersubmit" id="OrderSubmit" method="post" action="/Default.aspx?ID=@pageId" autocomplete="off">
1708 <div class="grid">
1709 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@
1710 @RenderBlockList(checkoutPage.BlocksRoot.BlocksList)
1711 </div>
1712 </form>
1713 </div>
1714 </div>
1715 </section>