Error executing template "Designs/Rapido/_parsed/Newsletter.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at CompiledRazorTemplates.Dynamic.RazorEngine_0551241465044f8e8a0dbf0f6511fd85.Execute() in E:\Solutions\Thermex\Files\Templates\Designs\Rapido\_parsed\newsletter.parsed.cshtml:line 984
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.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits RazorTemplateBase<RazorTemplateModel<Template>>
2 @using Dynamicweb.Rendering;
3
4 @using Dynamicweb.Security.UserManagement
5
6 @functions {
7 public class Text
8 {
9 public string content {
10 get {
11 return string.Join("<br>", this.Lines.ToArray());
12 }
13 set {}
14 }
15 public List<string> Lines { get; set; }
16
17 public Text()
18 {
19 Lines = new List<string>();
20 }
21
22 public void Add(string textString)
23 {
24 Lines.Add(textString);
25 }
26 }
27
28 public class RowSettings
29 {
30 public string backgroundColor { get; set; }
31 public string smallScreenTable { get; set; }
32 public string background { get; set; }
33 public string padding { get; set; }
34
35 //Defaults
36 public RowSettings()
37 {
38 backgroundColor = "#FFFFFF";
39 background = "";
40 padding = "25";
41 }
42 }
43
44 public class Column
45 {
46 public string image { get; set; }
47 public string icon { get; set; }
48 public string imageSize { get; set; }
49 public string preheader { get; set; }
50 public string introheader { get; set; }
51 public string header { get; set; }
52 public string subheader { get; set; }
53 public Text text { get; set; }
54 public string textColor { get; set; }
55 public string introheaderTextColor { get; set; }
56 public string align { get; set; }
57 public string link { get; set; }
58 public string altText { get; set; }
59 public string linkText { get; set; }
60 public string buttonColor { get; set; }
61 public string buttonType { get; set; }
62 public string buttonAlign { get; set; }
63 public string width { get; set; }
64
65 //Defaults
66 public Column()
67 {
68 textColor = "#333";
69 introheaderTextColor = "#333";
70 align = "left";
71 buttonColor = "#EC683B";
72 buttonType = "Primary";
73 buttonAlign = "left";
74
75 //Initialize the text object
76 this.text = new Text();
77 }
78
79 public bool isEmpty()
80 {
81 return string.IsNullOrEmpty(this.image) &&
82 string.IsNullOrEmpty(this.preheader) &&
83 string.IsNullOrEmpty(this.introheader) &&
84 string.IsNullOrEmpty(this.header) &&
85 string.IsNullOrEmpty(this.subheader) &&
86 string.IsNullOrEmpty(this.text.content) &&
87 string.IsNullOrEmpty(this.link) &&
88 string.IsNullOrEmpty(this.linkText);
89 }
90 }
91
92 string emailBgColor = "#d3d3d3";
93 string emailTextColor = "color:#828282;";
94 string emailTableBorder = "border-top:1px solid #a8a8a8;";
95 string emailText = "font-family:Helvetica,Arial,sans-serif;font-size:13px;color:#828282;text-align:center;line-height:120%;";
96 string emailTextLarge = "font-family:Helvetica,Arial,sans-serif;font-size:15px;margin-bottom:0;line-height:135%;word-break: break-word;";
97 string emailTextSmall = "line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:10px;font-weight:normal;margin-top:0;margin-bottom:3px;";
98 string emailHeaderOneStyle = "text-transform:uppercase;line-height:135%;font-family:Helvetica,Arial,sans-serif;font-size:15px;font-weight:normal;margin-bottom:5px;";
99 string emailHeaderTwoStyle = "font-weight:normal;font-family:Helvetica,Arial,sans-serif;font-size:23px;margin-bottom:10px;line-height:135%;";
100 string emailHeaderThreeStyle = "line-height:125%;font-family:Helvetica,Arial,sans-serif;font-size:20px;font-weight:normal;margin-top:0;margin-bottom:3px;";
101 string emailTableFixedStyle = "table-layout: fixed;max-width:100% !important;width: 100% !important;min-width: 100% !important;";
102 string emailLinkStyle = "text-decoration:none;color:#828282;";
103 string emailLinkUnderlineStyle = "text-decoration:underline;color:#828282;";
104 string emailTableWidth = "500";
105 string emailTableMaxWidth = "max-width:100%;";
106 string emailFlexibleImage = "height: auto !important;max-width: 100% !important;display: block;";
107 string emailHiddenBlock = "display:none !important; mso-hide:all;";
108 string emailNoTopBottomInnerSpace = "padding-top:0px;padding-bottom:0px;";
109 string emailContent = "height:100% !important;margin:0;padding:0;width:100% !important;font-family:Helvetica, Arial,'Lucida Grande',sans-serif;";
110 }
111
112 @helper CreatePreheader(string viewInBrowserLink = "#")
113 {
114 <!-- EMAIL HEADER // -->
115 <!--
116 The table "emailBody" is the email's container.
117 Its width can be set to 100% for a color band
118 that spans the width of the page.
119 -->
120 <table class="content--bg" bgcolor="@emailBgColor" border="0" cellpadding="0" cellspacing="0" width="@emailTableWidth" id="emailHeader">
121
122 <!-- HEADER ROW // -->
123 <tr>
124 <td align="center" valign="top">
125 <!-- CENTERING TABLE // -->
126 <table border="0" cellpadding="0" cellspacing="0" width="100%">
127 <tr>
128 <td align="center" valign="top">
129 <!-- FLEXIBLE CONTAINER // -->
130 <table border="0" cellpadding="10" cellspacing="0" width="@emailTableWidth">
131 <tr>
132 <td valign="top" width="@emailTableWidth">
133
134 <!-- CONTENT TABLE // -->
135 <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
136 <tr>
137 <!--
138 The "invisibleIntroduction" is the text used for short preview
139 of the email before the user opens it (50 characters max). Sometimes,
140 you do not want to show this message depending on your design but this
141 text is highly recommended.
142
143 You do not have to worry if it is hidden, the next <td> will automatically
144 center and apply to the width 100% and also shrink to 50% if the first <td>
145 is visible.
146 -->
147 <td class="content--hidden" align="left" valign="middle" id="invisibleIntroduction" style="@emailHiddenBlock">
148 <table border="0" cellpadding="0" cellspacing="0" width="100%" style="@emailTableMaxWidth">
149 <tr>
150 <td align="left">
151 <div class="text" style="@emailText">
152
153 </div>
154 </td>
155 </tr>
156 </table>
157 </td>
158 <td align="right" valign="middle">
159 <table border="0" cellpadding="0" cellspacing="0" width="100%" style="@emailTableMaxWidth">
160 <tr>
161 <td align="left">
162 <!-- CONTENT // -->
163 <div class="text" style="@emailText">
164 @Translate("If you can't see this message")
165 @{
166 string title = Translate("View it in your browser");
167 }
168 <a href="@viewInBrowserLink" class="link" target="_blank" style="@emailLinkUnderlineStyle;" title="@title">
169 <span class="label" style="@emailTextColor">@Translate("view it in your browser")</span>
170 </a>.
171 </div>
172 </td>
173 </tr>
174 </table>
175 </td>
176 </tr>
177 </table>
178 </td>
179 </tr>
180 </table>
181 <!-- // FLEXIBLE CONTAINER -->
182 </td>
183 </tr>
184 </table>
185 <!-- // CENTERING TABLE -->
186 </td>
187 </tr>
188 <!-- // END -->
189
190 </table>
191 <!-- // END -->
192 }
193
194 @helper CreateSubscriptionFooter(string subscriptionLink = "#")
195 {
196 <!-- EMAIL FOOTER // -->
197 <!--
198 The table "emailBody" is the email's container.
199 Its width can be set to 100% for a color band
200 that spans the width of the page.
201 -->
202 <table class="content--bg" bgcolor="@emailBgColor" border="0" cellpadding="0" cellspacing="0" width="@emailTableWidth" id="emailFooter">
203
204 <!-- FOOTER ROW // -->
205 <!--
206 To move or duplicate any of the design patterns
207 in this email, simply move or copy the entire
208 MODULE ROW section for each content block.
209 -->
210 <tr>
211 <td align="center" valign="top">
212 <!-- CENTERING TABLE // -->
213 <table border="0" cellpadding="0" cellspacing="0" width="100%">
214 <tr>
215 <td align="center" valign="top">
216 <!-- FLEXIBLE CONTAINER // -->
217 <table border="0" cellpadding="0" cellspacing="0" width="@emailTableWidth">
218 <tr>
219 <td align="center" valign="top" width="@emailTableWidth">
220 <table border="0" cellpadding="30" cellspacing="0" width="100%">
221 <tr>
222 <td class="content--bg" valign="top" bgcolor="@emailBgColor">
223
224 <div class="text" style="@emailText">
225 <div>@Translate("Click here if you wish to") <a href="@subscriptionLink" class="link link--no-decoration" target="_blank" style="@emailLinkStyle;" title="@Translate(" unsubscribe")"=""><span class="label" style="@emailTextColor">@Translate("unsubscribe")</span></a>.</div>
226 </div>
227
228 </td>
229 </tr>
230 </table>
231 </td>
232 </tr>
233 </table>
234 <!-- // FLEXIBLE CONTAINER -->
235 </td>
236 </tr>
237 </table>
238 <!-- // CENTERING TABLE -->
239 </td>
240 </tr>
241 </table>
242 <!-- // END -->
243 }
244
245 @helper CreateRow(Column columnObjectOne, RowSettings rowSettings = null)
246 {
247 if (rowSettings == null)
248 {
249 rowSettings = new RowSettings();
250 }
251
252 if (string.IsNullOrEmpty(columnObjectOne.imageSize))
253 {
254 columnObjectOne.imageSize = "500";
255 }
256
257 if (string.IsNullOrEmpty(columnObjectOne.width))
258 {
259 columnObjectOne.width = "500";
260 }
261
262 if (string.IsNullOrEmpty(columnObjectOne.align))
263 {
264 columnObjectOne.align = "center";
265 }
266
267 @CreateOneColumn(columnObjectOne, rowSettings);
268 }
269
270 @helper CreateRow(Column columnObjectOne, Column columnObjectTwo, RowSettings rowSettings = null)
271 {
272 if (rowSettings == null)
273 {
274 rowSettings = new RowSettings();
275 }
276
277 if (string.IsNullOrEmpty(columnObjectOne.imageSize))
278 {
279 columnObjectOne.imageSize = "210";
280 }
281
282 if (string.IsNullOrEmpty(columnObjectTwo.imageSize))
283 {
284 columnObjectTwo.imageSize = "210";
285 }
286
287 if (string.IsNullOrEmpty(columnObjectOne.width))
288 {
289 columnObjectOne.width = "210";
290 }
291
292 if (string.IsNullOrEmpty(columnObjectTwo.width))
293 {
294 columnObjectTwo.width = "210";
295 }
296
297 @CreateTwoColumns(columnObjectOne, columnObjectTwo, rowSettings);
298 }
299
300 @helper CreateRow(Column columnObjectOne, Column columnObjectTwo, Column columnObjectThree, RowSettings rowSettings = null)
301 {
302 if (rowSettings == null)
303 {
304 rowSettings = new RowSettings();
305 }
306
307 if (string.IsNullOrEmpty(columnObjectOne.imageSize))
308 {
309 columnObjectOne.imageSize = "126";
310 }
311
312 if (string.IsNullOrEmpty(columnObjectTwo.imageSize))
313 {
314 columnObjectTwo.imageSize = "126";
315 }
316
317 if (string.IsNullOrEmpty(columnObjectThree.imageSize))
318 {
319 columnObjectThree.imageSize = "126";
320 }
321
322 if (string.IsNullOrEmpty(columnObjectOne.width))
323 {
324 columnObjectOne.width = "126";
325 }
326
327 if (string.IsNullOrEmpty(columnObjectTwo.width))
328 {
329 columnObjectTwo.width = "126";
330 }
331
332 if (string.IsNullOrEmpty(columnObjectThree.width))
333 {
334 columnObjectThree.width = "126";
335 }
336
337 @CreateThreeColumns(columnObjectOne, columnObjectTwo, columnObjectThree, rowSettings);
338 }
339
340 @helper CreateRowDivider()
341 {
342 <tr>
343 <td align="center" valign="top">
344 <table border="0" cellpadding="0" cellspacing="0" width="100%">
345 <tr>
346 <td align="center" valign="top">
347 <table border="0" cellpadding="0" cellspacing="0" width="@emailTableWidth">
348 <tr>
349 <td class="no-top-bottom-inner-space" align="center" valign="top" style="@emailNoTopBottomInnerSpace">
350 <table border="0" cellpadding="0" cellspacing="0" width="100%">
351 <tr>
352 <td class="table-content-border--top" align="center" valign="top" style="@emailTableBorder"></td>
353 </tr>
354 </table>
355 </td>
356 </tr>
357 </table>
358 </td>
359 </tr>
360 </table>
361 </td>
362 </tr>
363 }
364
365 @helper CreateOneColumn(Column columnObject, RowSettings rowSettings)
366 {
367 <tr>
368 <td align="center" valign="top">
369 <table border="0" cellpadding="0" cellspacing="0" width="500" style="color:@columnObject.textColor; background: @rowSettings.background;" bgcolor="@rowSettings.backgroundColor">
370 <tr>
371 <td align="center" valign="top">
372 <table border="0" cellpadding="0" cellspacing="0" width="@columnObject.width">
373 <tr>
374 <td align="@columnObject.align" valign="top" width="@emailTableWidth">
375 <table border="0" cellpadding="@rowSettings.padding" cellspacing="0" width="100%">
376 <tr>
377 <td align="@columnObject.align" style="text-align: @columnObject.align" valign="top">
378 @CreateColumnBlock(columnObject)
379 </td>
380 </tr>
381 </table>
382 </td>
383 </tr>
384 </table>
385 </td>
386 </tr>
387 </table>
388 </td>
389 </tr>
390 }
391
392 @helper CreateTwoColumns(Column columnObjectOne, Column columnObjectTwo, RowSettings rowSettings)
393 {
394 <tr mc:hideable="mc:hideable">
395 <td align="center" valign="top">
396 <table border="0" cellpadding="0" cellspacing="0" width="100%" style="color:@columnObjectOne.textColor" bgcolor="@rowSettings.backgroundColor">
397 <tr>
398 <td align="center" valign="top">
399 <table border="0" cellpadding="10" cellspacing="0" width="@emailTableWidth">
400 <tr>
401 <td valign="top" width="@emailTableWidth">
402 <table align="center" border="0" cellpadding="10" cellspacing="0" width="100%">
403 <tr>
404 <td align="left" valign="top">
405 <table border="0" cellpadding="0" cellspacing="0" width="@columnObjectOne.width" style="@emailTableMaxWidth">
406 <tr>
407 <td align="left">
408 @CreateColumnBlock(columnObjectOne)
409 </td>
410 </tr>
411 </table>
412 </td>
413 <td align="right" valign="top">
414 <table border="0" cellpadding="0" cellspacing="0" width="@columnObjectTwo.width" style="@emailTableMaxWidth">
415 <tr>
416 <td align="left">
417 @CreateColumnBlock(columnObjectTwo)
418 </td>
419 </tr>
420 </table>
421 </td>
422 </tr>
423 </table>
424 </td>
425 </tr>
426 </table>
427 </td>
428 </tr>
429 </table>
430 </td>
431 </tr>
432 }
433
434 @helper CreateThreeColumns(Column columnObjectOne, Column columnObjectTwo, Column columnObjectThree, RowSettings rowSettings)
435 {
436 <tr mc:hideable="mc:hideable">
437 <td align="center" valign="top">
438 <table border="0" cellpadding="0" cellspacing="0" width="100%" style="color:@columnObjectOne.textColor" bgcolor="@rowSettings.backgroundColor">
439 <tr>
440 <td align="center" valign="top">
441 <table border="0" cellpadding="10" cellspacing="0" width="@emailTableWidth">
442 <tr>
443 <td valign="top" width="@emailTableWidth">
444 <table align="left" border="0" cellpadding="10" cellspacing="0" width="100%">
445 <tr>
446 <td align="left" valign="top">
447 <table border="0" cellpadding="0" cellspacing="0" width="@columnObjectOne.width" style="@emailTableMaxWidth">
448 <tr>
449 <td align="left">
450 @CreateColumnBlock(columnObjectOne)
451 </td>
452 </tr>
453 </table>
454 </td>
455 <td align="center" valign="top">
456 <table border="0" cellpadding="0" cellspacing="0" width="@columnObjectTwo.width" style="@emailTableMaxWidth">
457 <tr>
458 <td align="left">
459 @CreateColumnBlock(columnObjectTwo)
460 </td>
461 </tr>
462 </table>
463 </td>
464 <td align="right" valign="top">
465 <table border="0" cellpadding="0" cellspacing="0" width="@columnObjectThree.width" style="@emailTableMaxWidth">
466 <tr>
467 <td align="left">
468 @CreateColumnBlock(columnObjectThree)
469 </td>
470 </tr>
471 </table>
472 </td>
473 </tr>
474 </table>
475 </td>
476 </tr>
477 </table>
478 </td>
479 </tr>
480 </table>
481 </td>
482 </tr>
483 }
484
485 @helper CreateColumnBlock(Column columnObject)
486 {
487 @CreateColumnBlockContent(columnObject)
488 }
489
490 @helper CreateColumnBlockContent(Column columnObject)
491 {
492 if (!String.IsNullOrEmpty(columnObject.preheader))
493 {
494 <small class="text text--small" style="color:@columnObject.textColor;text-align:@columnObject.align;@emailTextSmall;">@columnObject.preheader</small>
495 }
496
497 if (!string.IsNullOrEmpty(columnObject.image))
498 {
499 string image = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + GetGlobalValue("Global:Request.Host") + "/Admin/Public/GetImage.ashx?width=" + columnObject.imageSize + "&crop=1&image=" + columnObject.image;
500 string altText = !string.IsNullOrEmpty(columnObject.altText) ? columnObject.altText : columnObject.linkText;
501 if (!string.IsNullOrEmpty(columnObject.link) && !string.IsNullOrEmpty(altText))
502 {
503 <a href="@columnObject.link" style="display: inline-block" title="@altText">
504 <img src="@image" width="@columnObject.imageSize" class="flexibleImage" style="@emailFlexibleImage" alt="@altText">
505 </a>
506 }
507 else
508 {
509 <img src="@image" width="@columnObject.imageSize" class="flexibleImage" style="@emailFlexibleImage" alt="@altText">
510 }
511 }
512
513 if (!String.IsNullOrEmpty(columnObject.image) && (!String.IsNullOrEmpty(columnObject.introheader) || !String.IsNullOrEmpty(columnObject.header) || !String.IsNullOrEmpty(columnObject.text.content)))
514 {
515 <br>
516 }
517
518 if (!String.IsNullOrEmpty(columnObject.introheader))
519 {
520 <h1 style="color:@columnObject.introheaderTextColor;text-align:@columnObject.align;@emailHeaderOneStyle">@columnObject.introheader</h1>
521 }
522
523 if (!String.IsNullOrEmpty(columnObject.header))
524 {
525 <h2 style="color:@columnObject.textColor;text-align:@columnObject.align;@emailHeaderTwoStyle">
526 @if (!String.IsNullOrEmpty(columnObject.icon))
527 {
528 <img src="@columnObject.icon" class="flexibleImage" style="@emailFlexibleImage" alt="@columnObject.header">
529 }
530 @columnObject.header
531 </h2>
532 }
533
534 if (!String.IsNullOrEmpty(columnObject.subheader))
535 {
536 <h3 style="color:@columnObject.textColor;text-align:@columnObject.align;@emailHeaderThreeStyle">@columnObject.subheader</h3>
537 }
538
539 if (!String.IsNullOrEmpty(columnObject.text.content))
540 {
541 <div class="text text--large text--center" style="color:@columnObject.textColor;text-align:@columnObject.align;@emailTextLarge">@columnObject.text.content</div>
542 }
543
544 if (!String.IsNullOrEmpty(columnObject.link) && !String.IsNullOrEmpty(columnObject.linkText))
545 {
546 string bgColor = "#EC683B";
547 string borderColor = "#EC683B";
548 string fontColor = "#FFFFFF";
549 string fontSize = "17";
550 string fontWeight = "normal";
551 string buttonDesign = "";
552 string buttonDesignStyles = "";
553 string borderRadius = "";
554 string textAlignment = "center";
555
556 if (!String.IsNullOrEmpty(columnObject.buttonType))
557 {
558 string btnId;
559
560 switch (columnObject.buttonType)
561 {
562 case "Link":
563 btnId = null;
564 bgColor = "";
565 borderColor = "";
566 string linksColor = Dynamicweb.Core.Converter.ToString(Pageview.AreaSettings.GetItem("Layout").GetString("LinksColor"));
567 fontColor = !String.IsNullOrEmpty(linksColor) ? linksColor : "#333";
568 buttonDesignStyles = "background-color: transparent; text-decoration: underline; padding: 0;";
569 textAlignment = "left";
570 break;
571 case "Secondary":
572 btnId = "SecondaryButton";
573 break;
574 case "Tertiary":
575 btnId = "TertiaryButton";
576 break;
577 default:
578 btnId = "PrimaryButton";
579 break;
580 }
581
582 if (!String.IsNullOrEmpty(btnId))
583 {
584 var item = Pageview.AreaSettings.GetItem("Layout").GetItem(btnId);
585
586 if (item != null)
587 {
588 if (!String.IsNullOrEmpty(item.GetString("BackgroundColor")))
589 {
590 bgColor = item.GetString("BackgroundColor");
591 borderColor = item.GetString("BackgroundColor");
592 }
593 if (!String.IsNullOrEmpty(item.GetString("FontColor")))
594 {
595 fontColor = item.GetString("FontColor");
596 }
597 if (!String.IsNullOrEmpty(item.GetString("FontSize")))
598 {
599 fontSize = item.GetString("FontSize");
600 }
601 if (!String.IsNullOrEmpty(item.GetString("FontWeight")))
602 {
603 fontWeight = item.GetString("FontWeight");
604 }
605 if (!String.IsNullOrEmpty(item.GetString("ButtonDesign")))
606 {
607 buttonDesign = item.GetString("ButtonDesign");
608 }
609 }
610
611 switch (buttonDesign)
612 {
613 case "rounded":
614 borderRadius = "0.2rem";
615 buttonDesignStyles = "border: 1px " + borderColor + " solid; border-radius: " + borderRadius + "; background-color:" + bgColor + ";";
616 break;
617 case "round":
618 borderRadius = "200px";
619 buttonDesignStyles = "border: 1px " + borderColor + " solid; border-radius: " + borderRadius + "; background-color:" + bgColor + ";";
620 break;
621 case "outline-square":
622 borderRadius = "0";
623 bgColor = "transparent";
624 buttonDesignStyles = "border: 1px " + borderColor + " solid; border-radius: " + borderRadius + "; background-color:" + bgColor + ";";
625 break;
626 case "outline-rounded":
627 borderRadius = "0.2rem";
628 bgColor = "transparent";
629 buttonDesignStyles = "border: 1px " + borderColor + " solid; border-radius: " + borderRadius + "; background-color:" + bgColor + ";";
630 break;
631 case "outline-round":
632 borderRadius = "200px";
633 bgColor = "transparent";
634 buttonDesignStyles = "border: 1px " + borderColor + " solid; border-radius: " + borderRadius + "; background-color:" + bgColor + ";";
635 break;
636 default:
637 borderRadius = "0";
638 buttonDesignStyles = "border: 1px " + borderColor + " solid; border-radius: " + borderRadius + "; background-color:" + bgColor + ";";
639 break;
640 }
641 }
642 }
643
644 <table width="100%" border="0" cellspacing="0" cellpadding="0">
645 <tr>
646 <td>
647 <table align="@columnObject.buttonAlign" style="text-align: @columnObject.buttonAlign" border="0" cellspacing="0" cellpadding="0">
648 <tr>
649 <td align="@columnObject.buttonAlign" style="text-align: @columnObject.buttonAlign; border-radius: @borderRadius;" bgcolor="@bgColor">
650 <a href="@columnObject.link" style="display: inline-block;padding: 10px;text-align: center; text-decoration:none;font-family:Helvetica,Arial,sans-serif; color: @fontColor; font-size: @(Int32.Parse(fontSize) + 2)px; font-weight: @fontWeight; @buttonDesignStyles; width: inherit" target="_blank" title="@columnObject.linkText">
651 @columnObject.linkText
652 </a>
653 </td>
654 </tr>
655 </table>
656 </td>
657 </tr>
658 </table>
659 }
660 }
661
662 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
663 <html xmlns="http://www.w3.org/1999/xhtml">
664 <head>
665 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
666 <meta name="viewport" content="width=device-width, initial-scale=1.0">
667 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
668 <meta name="format-detection" content="telephone=no"> <!-- disable auto telephone linking in iOS -->
669 <title>@GetValue("Title")</title>
670 @GetValue("MetaTags")
671 @GetValue("CopyRightNotice")
672
673 <style type="text/css">
674
675 /* RESET STYLES */
676 html {
677 background-color: #d3d3d3;
678 margin: 0;
679 padding: 0;
680 }
681
682 table {
683 border-collapse: collapse;
684 }
685
686 img, a img {
687 border: 0;
688 outline: none;
689 text-decoration: none;
690 height: auto;
691 line-height: 100%;
692 }
693
694 a {
695 text-decoration: none !important;
696 border-bottom: none;
697 font-weight: normal;
698 }
699
700 /* Force Hotmail/Outlook.com to display line heights normally. */
701 table, td {
702 mso-table-lspace: 0pt;
703 mso-table-rspace: 0pt;
704 }
705
706 h1, h2, h3, h4, h5, h6 {
707 display: block;
708 margin-top: 0;
709 margin-right: 0;
710 margin-bottom: 5px;
711 margin-left: 0;
712 padding-top: 0;
713 padding-bottom: 0;
714 padding-left: 0;
715 padding-right: 0;
716 color: #5F5F5F;
717 font-weight: normal;
718 font-style: normal;
719 font-family: Helvetica,Arial,sans-serif;
720 line-height: 135%;
721 text-align: Left;
722 letter-spacing: normal;
723 }
724
725 h1 {
726 margin-bottom: 5px;
727 font-size: 15px;
728 text-transform: uppercase;
729 }
730
731 h2 {
732 margin-bottom: 10px;
733 font-size: 23px;
734 }
735
736 h3 {
737 margin-bottom: 3px;
738 font-size: 20px;
739 line-height: 125%;
740 }
741
742 h4 {
743 font-size: 18px;
744 font-style: italic;
745 line-height: 100%;
746 }
747
748 /* STYLES */
749
750 .table--fixed {
751 table-layout: fixed;
752 max-width: 100% !important;
753 width: 100% !important;
754 min-width: 100% !important;
755 }
756
757 .table-content-border--top {
758 border-top: 1px solid #a8a8a8;
759 }
760
761 .content {
762 height: 100% !important;
763 margin: 0;
764 padding: 0;
765 width: 100% !important;
766 font-family: Helvetica, Arial, "Lucida Grande", sans-serif;
767 }
768
769 .content--bg {
770 background-color: #d3d3d3;
771 }
772
773 .content--hidden {
774 display: none !important;
775 mso-hide: all;
776 }
777
778 .label {
779 color: #828282;
780 }
781
782 .text {
783 font-size: 13px;
784 line-height: 120%;
785 font-weight: normal;
786 color: #828282;
787 }
788
789 .text--small {
790 margin-top: 0;
791 margin-bottom: 3px;
792 font-size: 10px;
793 line-height: 125%;
794 }
795
796 .text--large {
797 margin-bottom: 0;
798 font-size: 15px;
799 line-height: 135%;
800 }
801
802 .text--center {
803 text-align: center;
804 }
805
806 .link {
807 color: #828282;
808 text-decoration: underline;
809 }
810
811 .link--no-decoration {
812 text-decoration: none;
813 }
814
815 .no-top-bottom-inner-space {
816 padding-top: 0px;
817 padding-bottom: 0px;
818 }
819
820 /* MOBILE STYLES */
821 @@media only screen and (max-width: 480px) {
822
823 .flexibleImage {
824 height: auto !important;
825 width: 100% !important;
826 max-width: 100% !important;
827 }
828 }
829
830 /* CONDITIONS FOR ANDROID DEVICES ONLY
831 * http://developer.android.com/guide/webapps/targeting.html
832 * http://pugetworks.com/2011/04/css-media-queries-for-targeting-different-mobile-devices/
833 */
834
835 @@media only screen and (-webkit-device-pixel-ratio:.75) {
836 /* Put CSS for low density (ldpi) Android layouts in here */
837 }
838
839 @@media only screen and (-webkit-device-pixel-ratio:1) {
840 /* Put CSS for medium density (mdpi) Android layouts in here */
841 }
842
843 @@media only screen and (-webkit-device-pixel-ratio:1.5) {
844 /* Put CSS for high density (hdpi) Android layouts in here */
845 }
846 /* end Android targeting */
847
848 /* CONDITIONS FOR IOS DEVICES ONLY
849 =====================================================*/
850 @@media only screen and (min-device-width : 320px) and (max-device-width:568px) {
851 }
852 /* end IOS targeting */
853 </style>
854
855 @GetValue("Stylesheets")
856 @GetValue("Javascripts")
857 </head>
858
859 @{
860 string emailBgColor = "#d3d3d3";
861 string emailContent = "height:100% !important;margin:0;padding:0;width:100% !important;font-family:Helvetica, Arial,'Lucida Grande',sans-serif;";
862 string emailTableFixedStyle = "table-layout: fixed;max-width:100% !important;width: 100% !important;min-width: 100% !important;";
863 }
864
865 <body class="content content--bg" bgcolor="@emailBgColor" style="@emailContent" marginwidth="0" marginheight="0" offset="0">
866 <center class="content--bg" bgcolor="@emailBgColor">
867 <table class="content table--fixed" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable" style="@(emailTableFixedStyle + emailContent)">
868 <tr>
869 <td class="content" align="center" valign="top" id="bodyCell" style="@emailContent">
870 @inherits RazorTemplateBase<RazorTemplateModel<Template>>
871 @using Dynamicweb.Rendering;
872 @using Dynamicweb.Extensibility
873 @using Dynamicweb.Content
874 @using Dynamicweb.Security;
875
876
877 @inherits RazorTemplateBase<RazorTemplateModel<Template>>
878 @using Dynamicweb.Rendering;
879 @using Dynamicweb.Core;
880 @using System.Linq;
881 @using Dynamicweb.Ecommerce.Orders;
882 @using Dynamicweb.Ecommerce.Orders.SalesDiscounts;
883 @using System.Text.RegularExpressions;
884 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
885 @using Custom.Thermex.Helpers;
886
887 @*
888 This is a temporary fallback for the DefaultImage. The image pattern MUST be set up like this:
889
890 ImageSmall = /{ProductNumber}.jpg
891 ImageMedium = /{ProductNumber}{VariantOptionLevel1}.jpg
892 ImageLarge = /{ProductNumber}{VariantComboName}.jpg
893
894 In addition to the ImageDefault setting
895 *@
896
897 @functions {
898 public string GetProductImage(LoopItem productObject = null)
899 {
900 string theImage = "";
901 string missingImage = "missing_image";
902
903 if (productObject == null)
904 {
905 theImage = GetString("Ecom:Product.ImageDefault.Default.Clean");
906 theImage = String.IsNullOrEmpty(theImage) ? GetString("Ecom:Product.ImageLarge.Clean") : theImage;
907 theImage = String.IsNullOrEmpty(theImage) ? GetString("Ecom:Product.ImageMedium.Clean") : theImage;
908 theImage = String.IsNullOrEmpty(theImage) ? GetString("Ecom:Product.ImageSmall.Clean") : theImage;
909 theImage = String.IsNullOrEmpty(theImage) ? GetString("Ecom:Product.ImageLarge.Default.Clean") : theImage;
910
911 if (String.IsNullOrWhiteSpace(theImage) || theImage.Contains(missingImage))
912 {
913 try
914 {
915 theImage = ImageHelper.GetFirstImage(Dynamicweb.Ecommerce.Services.Products.GetProductByNumber(GetString("Ecom:Product.Number"), true).GetProductFieldValue("ImagePaths").ToString());
916 if (string.IsNullOrEmpty(theImage))
917 {
918 theImage = "/Images/missing_image.jpg";
919 }
920 }
921 catch
922 {
923 // Do nothing
924 }
925 }
926 }
927 else
928 {
929 theImage = productObject.GetString("Ecom:Product.ImageDefault.Default.Clean");
930 theImage = String.IsNullOrEmpty(theImage) ? productObject.GetString("Ecom:Product.ImageLarge.Clean") : theImage;
931 theImage = String.IsNullOrEmpty(theImage) ? productObject.GetString("Ecom:Product.ImageMedium.Clean") : theImage;
932 theImage = String.IsNullOrEmpty(theImage) ? productObject.GetString("Ecom:Product.ImageSmall.Clean") : theImage;
933 theImage = String.IsNullOrEmpty(theImage) ? productObject.GetString("Ecom:Product.ImageLarge.Default.Clean") : theImage;
934
935 if (String.IsNullOrWhiteSpace(theImage) || theImage.Contains(missingImage))
936 {
937 try
938 {
939 theImage = ImageHelper.GetFirstImage(Dynamicweb.Ecommerce.Services.Products.GetProductByNumber(productObject.GetString("Ecom:Product.Number"), true).GetProductFieldValue("ImagePaths").ToString());
940 if (string.IsNullOrEmpty(theImage))
941 {
942 theImage = "/Images/missing_image.jpg";
943 }
944 }
945 catch
946 {
947 // Do nothing
948 }
949 }
950 }
951
952 return theImage;
953 }
954 }
955
956
957 @functions{
958 string logoimage;
959 string emailFontColor;
960 string emailBackgroundColor;
961 string emailLogoAlignment;
962 string emailFooterAlignment;
963
964 Column GetAddressColumn(string prefix, string type)
965 {
966 Column column = new Column();
967 column.text.Add(GetString("Ecom:" + prefix + "." + type + ".Company"));
968 column.text.Add(GetString("Ecom:" + prefix + "." + type + ".VatRegNumber"));
969 column.text.Add(GetString("Ecom:" + prefix + "." + type + ".Name"));
970 column.text.Add(GetString("Ecom:" + prefix + "." + type + ".Address"));
971 column.text.Add(GetString("Ecom:" + prefix + "." + type + ".Zip") + " " + GetString("Ecom:" + prefix + "." + type + ".City"));
972 column.text.Add(GetString("Ecom:" + prefix + "." + type + ".Region"));
973 column.text.Add(GetString("Ecom:" + prefix + "." + type + ".Country"));
974 column.text.Add("<a href='mailto:" + GetString("Ecom:" + prefix + "." + type + ".Email") + "' style='text-decoration: none ;pointer-events: none;' title='" + GetString("Ecom:" + prefix + "." + type + ".Email") + "'>" + GetString("Ecom:" + prefix + "." + type + ".Email") + "</a>");
975 column.text.Add("<a href='tel:" + GetString("Ecom:" + prefix + "." + type + ".Phone") + "' style='text-decoration: none; ;pointer-events: none;' title='" + GetString("Ecom:" + prefix + "." + type + ".Phone") + "'>" + GetString("Ecom:" + prefix + "." + type + ".Phone") + "</a>");
976 return column;
977 }
978 }
979
980 @{
981
982 if (Pageview != null && Pageview.AreaSettings != null)
983 {
984 logoimage = Converter.ToString(Pageview.AreaSettings.GetItem("Layout").GetItem("Emails").GetFile("LogoImage").PathUrlEncoded);
985 emailFontColor = Converter.ToString(Pageview.AreaSettings.GetItem("Layout").GetItem("Emails").GetString("HeaderAndFooterFontColor"));
986 emailFontColor = !string.IsNullOrEmpty(emailFontColor) ? emailFontColor : "#FFFFFF";
987 emailBackgroundColor = Converter.ToString(Pageview.AreaSettings.GetItem("Layout").GetItem("Emails").GetString("HeaderAndFooterBackgroundColor"));
988 emailBackgroundColor = !string.IsNullOrEmpty(emailBackgroundColor) ? emailBackgroundColor : "#14304A";
989 emailFooterAlignment = Converter.ToString(Pageview.AreaSettings.GetItem("Layout").GetItem("Emails").GetString("FooterAlignment"));
990 emailFooterAlignment = !string.IsNullOrEmpty(emailFooterAlignment) ? emailFooterAlignment : "right";
991 emailLogoAlignment = Converter.ToString(Pageview.AreaSettings.GetItem("Layout").GetItem("Emails").GetString("LogoAlignment"));
992 emailLogoAlignment = !string.IsNullOrEmpty(emailLogoAlignment) ? emailLogoAlignment : "center";
993 }
994 }
995
996 @helper RenderHeaderImage()
997 {
998 Column header = new Column();
999 header.image = logoimage;
1000 header.imageSize = "250";
1001 header.textColor = emailFontColor;
1002 header.align = emailLogoAlignment;
1003 header.altText = Translate("Go to frontpage");
1004 header.link = "/";
1005
1006 @CreateRow(header, new RowSettings { backgroundColor = emailBackgroundColor });
1007 }
1008
1009 @helper RenderFooterSection()
1010 {
1011 string footeremail = Converter.ToString(Pageview.AreaSettings.GetItem("Settings").GetString("ContactEmail"));
1012 string footerphone = Converter.ToString(Pageview.AreaSettings.GetItem("Settings").GetString("ContactNumber")).Replace(" ", "");
1013
1014 Column footerRight = new Column();
1015 footerRight.textColor = emailFontColor;
1016 footerRight.image = logoimage;
1017 footerRight.imageSize = "200";
1018 footerRight.altText = Translate("Logo");
1019 footerRight.align = emailFooterAlignment;
1020 footerRight.altText = Translate("Go to frontpage");
1021 footerRight.link = "/";
1022
1023 footerRight.text.Add("<p></p>");
1024 footerRight.text.Add("<a href='tel:" + footerphone + "' style='color: " + emailFontColor + "; text-decoration: none; border-bottom: 0;' title='" + footerphone + "'>" + footerphone + "</a>");
1025 footerRight.text.Add("<a href='mailto:" + footeremail + "' style='color: " + emailFontColor + "; text-decoration: none; border-bottom: 0;' title='" + footeremail + "'>" + footeremail + "</a>");
1026 footerRight.text.Add("");
1027
1028 string iconsHTML = "";
1029 var socialLinks = Pageview.AreaSettings.GetItem("Layout").GetItems("FooterSocialLinks");
1030 foreach (var socialitem in socialLinks)
1031 {
1032 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel;
1033 string socialIconClass = socialIcon.SelectedValue;
1034 string socialIconTitle = socialIcon.SelectedName;
1035 string socialLink = socialitem.GetString("Link");
1036 socialIconClass = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + GetGlobalValue("Global:Request.Host") + "/Admin/Public/GetImage.ashx?width=35&image=" + "/Files/Images/SocialIcons/" + socialIconClass + ".png";
1037
1038 iconsHTML += " <a href='" + socialLink + "' style='color: white; text-decoration: none; border-bottom: 0; display: inline-block; width: 35px; height: 35px; background-image:url(\"" + socialIconClass + "\")' title='" + socialIconTitle + "'></a>";
1039 }
1040 footerRight.text.Add(iconsHTML);
1041
1042 @CreateRow(footerRight, new RowSettings { backgroundColor = emailBackgroundColor });
1043 }
1044
1045 @helper RenderRecurringDetails()
1046 {
1047 if (GetBoolean("Ecom:Order.IsRecurringOrder"))
1048 {
1049 Column recurringInfo = new Column();
1050 recurringInfo.text.Add(Translate("You have placed a subscription. This is a confirmation of the subscription not the actual order receipt."));
1051 recurringInfo.align = "center";
1052
1053 @CreateRow(recurringInfo);
1054
1055 @CreateRowDivider();
1056 }
1057
1058 if (GetBoolean("Ecom:Order.IsBasedOnRecurringOrder"))
1059 {
1060 Column basedRecurringInfo = new Column();
1061 basedRecurringInfo.text.Add(Translate("Your subscription order"));
1062 basedRecurringInfo.align = "center";
1063
1064 @CreateRow(basedRecurringInfo);
1065
1066 @CreateRowDivider();
1067 }
1068 }
1069
1070 @helper RenderComments()
1071 {
1072 if (!string.IsNullOrWhiteSpace(GetString("Ecom:Order.Customer.Comment")))
1073 {
1074 Column comment = new Column();
1075 comment.subheader = Translate("Comment");
1076 comment.text.Add(GetString("Ecom:Order.Customer.Comment"));
1077
1078 @CreateRow(comment);
1079
1080 @CreateRowDivider();
1081 }
1082 }
1083
1084 @helper RenderAddresses(string billingTitle, string deliveryTitle, string prefix)
1085 {
1086 Column billingInfo = GetAddressColumn(prefix, "Customer");
1087 billingInfo.header = billingTitle;
1088 var fix = GetString("Ecom:Order.Delivery.Name"); //without this delivery tags will not be rendered :(
1089 Column shippingInfo = GetAddressColumn(prefix, !string.IsNullOrEmpty(GetString("Ecom:" + prefix + ".Delivery.Address")) ? "Delivery" : "Customer");
1090 shippingInfo.header = deliveryTitle;
1091 @CreateRow(billingInfo, shippingInfo, new RowSettings { backgroundColor = "#e4e4e4", smallScreenTable = "table-smallScreen" });
1092 }
1093
1094 @helper RenderPaymentAndShipping()
1095 {
1096 string businessName = Pageview.AreaSettings.GetItem("Settings").GetItem("Address").GetString("Name");
1097 string businessCountry = Pageview.AreaSettings.GetItem("Settings").GetItem("Address").GetString("Country");
1098 string businessCity = Pageview.AreaSettings.GetItem("Settings").GetItem("Address").GetString("City");
1099 string businessRegion = Pageview.AreaSettings.GetItem("Settings").GetItem("Address").GetString("Region");
1100 string businessZip = Pageview.AreaSettings.GetItem("Settings").GetItem("Address").GetString("PostalCode");
1101 string businessAddress = Pageview.AreaSettings.GetItem("Settings").GetItem("Address").GetString("StreetAddress");
1102 string businessCVR = Pageview.AreaSettings.GetItem("Settings").GetItem("Address").GetString("CVRNumber");
1103
1104 Column leftColumn = new Column();
1105 Column shopInfo = new Column();
1106
1107 leftColumn.header = Translate("Payment and shipping");
1108
1109 if (!string.IsNullOrEmpty(GetString("Ecom:Order.PaymentMethod")))
1110 {
1111 leftColumn.text.Add(Translate("Payment method") + ": " + Translate(GetString("Ecom:Order.PaymentMethod")));
1112 }
1113
1114 if (!string.IsNullOrEmpty(GetString("Ecom:Order.ShippingMethod")))
1115 {
1116 leftColumn.text.Add(Translate("Shipping method") + ": " + Translate(GetString("Ecom:Order.ShippingMethod")));
1117 }
1118
1119 if (!string.IsNullOrEmpty(GetString("Ecom:Order.TransactionCardNumber")))
1120 {
1121 leftColumn.text.Add(Translate("Card no") + ": " + GetString("Ecom:Order.TransactionCardNumber"));
1122 }
1123 if (!string.IsNullOrEmpty(GetString("Ecom:Order.TransactionNumber")))
1124 {
1125 leftColumn.text.Add(Translate("Transaction no") + ": " + GetString("Ecom:Order.TransactionNumber"));
1126 }
1127 if (!string.IsNullOrEmpty(GetString("Ecom:Order.TransactionStatus")))
1128 {
1129 leftColumn.text.Add(Translate("Transaction status") + ": " + GetString("Ecom:Order.TransactionStatus"));
1130 }
1131
1132 //Shop
1133 if (!string.IsNullOrEmpty(businessAddress))
1134 {
1135 shopInfo.header = Translate("Shop");
1136
1137 shopInfo.text.Add(businessName);
1138 shopInfo.text.Add(businessAddress);
1139
1140 if (!string.IsNullOrEmpty(businessRegion))
1141 {
1142 businessRegion += " "; //add space between region and country
1143 }
1144 shopInfo.text.Add(businessZip + " " + businessCity + ", " + businessRegion + businessCountry);
1145
1146 if (!string.IsNullOrEmpty(businessCVR))
1147 {
1148 shopInfo.text.Add(Translate("Business number") + ": " + businessCVR);
1149 }
1150 }
1151
1152 @CreateRow(leftColumn, shopInfo, new RowSettings { backgroundColor = "#e4e4e4" });
1153 }
1154
1155 @helper RenderOrderline(LoopItem orderline, bool showImage = true)
1156 {
1157 Column orderLineLeft = new Column();
1158
1159 Column orderLineCenter = new Column();
1160
1161 Column orderLineRight = new Column();
1162 orderLineRight.align = "right";
1163
1164 string orderLineType = orderline.GetString("Ecom:Order:OrderLine.Type");
1165 if (orderLineType == "1" || orderLineType == "3" || orderLineType == "4")
1166 {
1167 //Discount
1168 orderLineCenter.text.Add(orderline.GetString("Ecom:Order:OrderLine.ProductName"));
1169 orderLineRight.text.Add("<strong>" + orderline.GetString("Ecom:Order:OrderLine.TotalPrice") + "</strong>");
1170 @CreateRow(orderLineCenter, orderLineRight);
1171 }
1172 else
1173 {
1174 if (showImage)
1175 {
1176 orderLineLeft.image = GetProductImage(orderline);
1177 orderLineLeft.altText = orderline.GetString("Ecom:Order:OrderLine.ProductName");
1178 }
1179
1180 //Product
1181 orderLineCenter.text.Add(orderline.GetString("Ecom:Order:OrderLine.ProductName"));
1182 if (!string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.ProductNumber")))
1183 {
1184 orderLineCenter.text.Add("# " + orderline.GetString("Ecom:Order:OrderLine.ProductNumber"));
1185 }
1186 if (!string.IsNullOrWhiteSpace(orderline.GetString("Ecom:Order:OrderLine.ProductVariantText")))
1187 {
1188 orderLineCenter.text.Add(orderline.GetString("Ecom:Order:OrderLine.ProductVariantText"));
1189 }
1190
1191 orderLineCenter.text.Add(Translate("Qty") + ": " + orderline.GetString("Ecom:Order:OrderLine.Quantity"));
1192
1193 foreach (var olf in orderline.GetLoop("Order.OrderLineFields").Where(olf => olf.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") != "InvoiceCopy" && !String.IsNullOrEmpty(olf.GetString("Ecom:Order:OrderLine.OrderLineField.Value.Clean"))))
1194 {
1195 orderLineCenter.text.Add(Translate(olf.GetString("Ecom:Order:OrderLine.OrderLineField.Name")) + ": " + olf.GetString("Ecom:Order:OrderLine.OrderLineField.Value.Clean"));
1196 }
1197
1198 orderLineRight.text.Add(orderline.GetString("Ecom:Order:OrderLine.Price.PriceFormatted"));
1199
1200 if (orderline.GetBoolean("Ecom:Product:Field.WarrantyProduct.Value.Clean")) {
1201 var warrantyTermsAndConditions = Pageview.AreaSettings.GetItem("Ecommerce").GetString("WarrantyTermsAndConditions");
1202
1203 if (warrantyTermsAndConditions.IsNotNullOrEmpty())
1204 {
1205 string domainUrl = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host;
1206
1207 orderLineCenter.text.Add("");
1208 orderLineCenter.text.Add("<a target='_blank' href='" + domainUrl + warrantyTermsAndConditions + "'>" + Translate("Download terms and conditions") + "</a>");
1209 }
1210 }
1211
1212 if (showImage)
1213 {
1214 orderLineLeft.width = "105";
1215 orderLineLeft.imageSize = "105";
1216 orderLineCenter.width = "165";
1217 orderLineRight.width = "110";
1218 @CreateRow(orderLineLeft, orderLineCenter, orderLineRight);
1219 }
1220 else
1221 {
1222 orderLineCenter.width = "270";
1223 orderLineRight.width = "110";
1224 @CreateRow(orderLineCenter, orderLineRight);
1225 }
1226 //BOM Items
1227 foreach (LoopItem bomitem in orderline.GetLoop("BOMItems"))
1228 {
1229 var bomImage = GetProductImage(bomitem);
1230
1231 Column bomLineLeft = new Column();
1232 if (showImage)
1233 {
1234 bomLineLeft.image = bomImage;
1235 }
1236 Column bomLineCenter = new Column();
1237 bomLineCenter.text.Add(bomitem.GetString("Ecom:Order:OrderLine.ProductName"));
1238 bomLineCenter.text.Add("# " + bomitem.GetString("Ecom:Order:OrderLine.ProductNumber"));
1239 bomLineCenter.text.Add(Translate("Qty") + ": " + bomitem.GetString("Ecom:Order:OrderLine.Quantity"));
1240
1241 Column bomLineRight = new Column();
1242 bomLineRight.text.Add(bomitem.GetString("Ecom:Order:OrderLine.TotalPrice"));
1243 bomLineRight.align = "right";
1244
1245 if (showImage)
1246 {
1247 bomLineLeft.width = "105";
1248 bomLineLeft.imageSize = "105";
1249 bomLineCenter.width = "165";
1250 bomLineRight.width = "110";
1251 @CreateRow(bomLineLeft, bomLineCenter, bomLineRight, new RowSettings { backgroundColor = "#e4e4e4" });
1252 }
1253 else
1254 {
1255 bomLineCenter.width = "270";
1256 bomLineRight.width = "110";
1257 @CreateRow(bomLineCenter, bomLineRight, new RowSettings { backgroundColor = "#e4e4e4" });
1258 }
1259 }
1260
1261 orderLineCenter.text.Add("TEST: " + orderline.GetString("Ecom:Product:Field.WarrantyProduct.Value.Clean"));
1262 }
1263 @CreateRowDivider()
1264 }
1265
1266 @functions {
1267 public class ProductDesign
1268 {
1269 public string imagePosition { get; set; }
1270 public bool separationLines { get; set; }
1271 public string backgroundColor { get; set; }
1272 public string fontColor { get; set; }
1273 public bool showViewButton { get; set; }
1274 public string viewButtonText { get; set; }
1275
1276 //Defaults
1277 public ProductDesign()
1278 {
1279 imagePosition = "left";
1280 separationLines = true;
1281 backgroundColor = "#FFFFFF";
1282 fontColor = "#000000";
1283 showViewButton = true;
1284 viewButtonText = "View";
1285 }
1286 }
1287
1288 Column getProductColumn(LoopItem product, ProductDesign design)
1289 {
1290 Column productColumn = new Column
1291 {
1292 align = "center",
1293 image = GetProductImage(product),
1294 altText = product.GetString("Ecom:Product.Name"),
1295 textColor = design.fontColor,
1296 buttonAlign = "center"
1297 };
1298
1299 string variantId = !string.IsNullOrEmpty(product.GetString("Ecom:Product.VariantID")) ? product.GetString("Ecom:Product.VariantID") : product.GetString("Ecom:Product.VariantID.Extented");
1300 string link = link = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + GetGlobalValue("Global:Request.Host");
1301 link += "/" + product.GetString("Ecom:Product.LinkGroup.Clean") + (!string.IsNullOrWhiteSpace(variantId) ? "&VariantID=" + variantId : "");
1302 productColumn.link = link;
1303
1304 productColumn.text.Add(string.Format("<a href='{0}' title='{1}' style='{2}'><strong style='word-break: break-word;'>{1}</strong></a>", link, product.GetString("Ecom:Product.Name"), emailLinkStyle));
1305
1306 if (!string.IsNullOrWhiteSpace(product.GetString("Ecom:Product.VariantText")))
1307 {
1308 productColumn.text.Add(product.GetString("Ecom:Product.VariantText"));
1309 }
1310
1311 if (!string.IsNullOrEmpty(product.GetString("Ecom:Product.Number")))
1312 {
1313 productColumn.text.Add("# " + product.GetString("Ecom:Product.Number"));
1314 }
1315
1316 productColumn.text.Add("<br><strong>" + product.GetString("Ecom:Product.Price") + "</strong>");
1317
1318 if (design.showViewButton && !string.IsNullOrEmpty(design.viewButtonText))
1319 {
1320 productColumn.text.Add("<br>");
1321 productColumn.linkText = Translate(design.viewButtonText);
1322 }
1323
1324 return productColumn;
1325 }
1326 }
1327
1328 @helper RenderProduct(LoopItem product)
1329 {
1330 @RenderProduct(product, new ProductDesign());
1331 }
1332
1333 @helper RenderProduct(LoopItem product, ProductDesign design)
1334 {
1335 Column productImage = new Column
1336 {
1337 width = "105",
1338 imageSize = "105",
1339 textColor = design.fontColor,
1340 image = GetProductImage(product),
1341 altText = product.GetString("Ecom:Product.Name")
1342 };
1343
1344 Column productPrice = new Column
1345 {
1346 width = "110",
1347 align = design.imagePosition == "left" ? "right" : "left",
1348 textColor = design.fontColor
1349 };
1350 productPrice.text.Add("<strong>" + product.GetString("Ecom:Product.Price") + "</strong><br>");
1351
1352
1353 Column productInfo = new Column
1354 {
1355 width = "165",
1356 textColor = design.fontColor,
1357 buttonAlign = "left"
1358 };
1359
1360 string variantId = !string.IsNullOrEmpty(product.GetString("Ecom:Product.VariantID")) ? product.GetString("Ecom:Product.VariantID") : product.GetString("Ecom:Product.VariantID.Extented");
1361 string link = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + GetGlobalValue("Global:Request.Host");
1362 link += "/" + product.GetString("Ecom:Product.LinkGroup.Clean") + (!string.IsNullOrWhiteSpace(variantId) ? "&VariantID=" + variantId : "");
1363 productImage.link = link;
1364
1365 productInfo.text.Add(string.Format("<a href='{0}' title='{1}' style='{2}'><strong style='word-break: break-word;'>{1}</strong></a>", link, product.GetString("Ecom:Product.Name"), emailLinkStyle));
1366
1367 if (!string.IsNullOrWhiteSpace(product.GetString("Ecom:Product.VariantText")))
1368 {
1369 productInfo.text.Add(product.GetString("Ecom:Product.VariantText"));
1370 }
1371
1372 if (!string.IsNullOrEmpty(product.GetString("Ecom:Product.Number")))
1373 {
1374 productInfo.text.Add("# " + product.GetString("Ecom:Product.Number"));
1375 }
1376
1377 if (design.showViewButton && !string.IsNullOrEmpty(design.viewButtonText))
1378 {
1379 productInfo.text.Add("<br>");
1380 productInfo.link = link;
1381 productInfo.linkText = Translate(design.viewButtonText);
1382 }
1383
1384 if (design.imagePosition == "left")
1385 {
1386 @CreateRow(productImage, productInfo, productPrice, new RowSettings { backgroundColor = design.backgroundColor });
1387 }
1388 else if (design.imagePosition == "right")
1389 {
1390 @CreateRow(productPrice, productInfo, productImage, new RowSettings { backgroundColor = design.backgroundColor });
1391 }
1392 if (design.separationLines)
1393 {
1394 @CreateRowDivider()
1395 }
1396 }
1397
1398
1399 @helper RenderGiftcards()
1400 {
1401 if (!string.IsNullOrWhiteSpace(GetString("Ecom:Order.HasGiftCards")))
1402 {
1403 Column giftcardHeader = new Column();
1404 giftcardHeader.header = Translate("Giftcards bought on this order");
1405 giftcardHeader.align = "center";
1406
1407 @CreateRow(giftcardHeader);
1408
1409 @CreateRowDivider();
1410
1411 foreach (LoopItem giftcards in GetLoop("GiftCards"))
1412 {
1413 Column giftcardCode = new Column();
1414 giftcardCode.subheader = Translate("Gift card code") + ": " + giftcards.GetString("Ecom:Order.GiftCard.Code");
1415
1416 @CreateRow(giftcardCode);
1417
1418 Column giftcardLeft = new Column();
1419 giftcardLeft.text.Add("<strong>" + giftcards.GetString("Ecom:Order.GiftCard.Name") + "</strong>");
1420 giftcardLeft.text.Add(Translate("Expiry date") + ": " + giftcards.GetDate("Ecom:Order.GiftCard.ExpiryDate").ToString(Dynamicweb.Core.Helpers.DateHelper.DateFormatStringShort));
1421
1422 Column giftcardRight = new Column();
1423 giftcardRight.subheader = giftcards.GetString("Ecom:Order.GiftCard.Amount");
1424 giftcardRight.align = "right";
1425
1426 @CreateRow(giftcardLeft, giftcardRight);
1427
1428 @CreateRowDivider();
1429 }
1430 }
1431
1432 if (!string.IsNullOrWhiteSpace(GetString("Ecom:Order.HasUsedGiftCards")))
1433 {
1434 Column usedGiftcardHeader = new Column();
1435 usedGiftcardHeader.subheader = Translate("Order used gift cards");
1436 usedGiftcardHeader.align = "center";
1437
1438 @CreateRow(usedGiftcardHeader);
1439
1440 @CreateRowDivider();
1441
1442 foreach (LoopItem usedgiftcards in GetLoop("UsedGiftCards"))
1443 {
1444 Column giftcardLeft = new Column();
1445 giftcardLeft.subheader = usedgiftcards.GetString("Ecom:Order.UsedGiftCard.Code");
1446 giftcardLeft.text.Add(usedgiftcards.GetString("Ecom:Order.UsedGiftCard.Name"));
1447 giftcardLeft.text.Add(Translate("Expiry date") + " " + usedgiftcards.GetDate("Ecom:Order.UsedGiftCard.ExpiryDate").ToString(Dynamicweb.Core.Helpers.DateHelper.DateFormatStringShort));
1448
1449 Column giftcardRight = new Column();
1450 giftcardRight.subheader = usedgiftcards.GetString("Ecom:Order.UsedGiftCard.InitialAmount");
1451 giftcardRight.text.Add(usedgiftcards.GetString("Ecom:Order.UsedGiftCard.UsedAmountForTheOrder"));
1452 giftcardRight.text.Add(usedgiftcards.GetString("Ecom:Order.UsedGiftCard.RemainingBalance"));
1453 giftcardRight.align = "right";
1454
1455 @CreateRow(giftcardLeft, giftcardRight);
1456
1457 @CreateRowDivider();
1458 }
1459 }
1460 }
1461
1462
1463 @helper RenderVouchers()
1464 {
1465 string voucherCode = GetString("Ecom:Order.Customer.VoucherCode");
1466 if (!string.IsNullOrWhiteSpace(voucherCode))
1467 {
1468 Column vouchers = new Column();
1469 vouchers.header = Translate("Vouchers");
1470 vouchers.align = "center";
1471
1472 string orderId = GetString("Ecom:Order.ID");
1473 Order order = new OrderService().GetById(orderId);
1474
1475 IEnumerable<string> codes = new List<string>();
1476
1477 if (order.VoucherUseType.HasFlag(VoucherUseCategoryType.Discount))
1478 {
1479 codes = voucherCode.Split(new string[] { ",", ";", " " }, StringSplitOptions.RemoveEmptyEntries);
1480 }
1481 else
1482 {
1483 codes = new string[] { voucherCode.Trim() };
1484 }
1485
1486 bool hasUsedVouchers = false;
1487 foreach (string code in codes)
1488 {
1489 Voucher vouch = Voucher.GetVoucherByCode(code);
1490 if (vouch != null && vouch.DateUsed.HasValue && string.Equals(vouch.UsedOrderId, orderId, StringComparison.OrdinalIgnoreCase))
1491 {
1492 vouchers.text.Add(Translate("Voucher") + "<span style='font-weight:bold;'>" + code + "</span>" + Translate("has been used"));
1493 hasUsedVouchers = true;
1494 }
1495 }
1496
1497 if (hasUsedVouchers)
1498 {
1499 @CreateRow(vouchers);
1500 }
1501 }
1502 }
1503
1504 @helper RenderButton(string link, string text, string align = "left")
1505 {
1506 Column button = new Column();
1507 button.link = link;
1508 button.linkText = Translate(text);
1509 button.buttonAlign = align;
1510 @CreateRow(button);
1511 }
1512
1513 @CreatePreheader("/Default.aspx?ID=" + GetString("Global.PageId"))
1514 <table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" width="500" id="emailBody">
1515 @RenderHeaderImage()
1516 <tr><td><div id="mycontainer">@GetValue("DwContent(mycontainer)")</div></td></tr>
1517 @RenderFooterSection()
1518 </table>
1519
1520 @CreateSubscriptionFooter("{{EmailMarketing:Email.UnsubscribeLink.Clean}}")
1521 </td>
1522 </tr>
1523 </table>
1524 </center>
1525 </body>
1526 </html>