{{EmailMarketing:Email.PreHeader.Clean}}
Click to view in browser
Logo
About the shop Contact and support
Error executing template "Designs/Swift/eCom/Order/Orderlines.cshtml"
System.OverflowException: Value was either too large or too small for an Int16.
   at System.Convert.ThrowInt16OverflowException()
   at System.Convert.ToInt16(Int32 value)
   at CompiledRazorTemplates.Dynamic.RazorEngine_e75673110aad48c6acd582f6ba9f0241.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 99
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb.Frontend 3 4 @functions { 5 private string GetFontStack() 6 { 7 return "font-family:initial,Arial,Helvetica Neue,Helvetica,sans-serif;"; 8 } 9 10 11 12 private string GetTableReset() 13 { 14 return "border:0;margin:0;outline:0;padding:0;"; 15 } 16 } 17 18 @{ 19 ParagraphViewModel currentParagraph = new ParagraphViewModel(); 20 if (Dynamicweb.Context.Current.Items.Contains("CurrentParagraph")) 21 { 22 currentParagraph = (ParagraphViewModel)Dynamicweb.Context.Current.Items["CurrentParagraph"]; 23 } 24 25 int currentPageId = 0; 26 if (Dynamicweb.Context.Current.Items.Contains("CurrentPageId")) 27 { 28 currentPageId = Convert.ToInt16(Dynamicweb.Context.Current.Items["CurrentPageId"]); 29 } 30 31 int currentGridRowId = 0; 32 if (Dynamicweb.Context.Current.Items.Contains("CurrentGridRowId")) 33 { 34 currentGridRowId = Convert.ToInt16(Dynamicweb.Context.Current.Items["CurrentGridRowId"]); 35 } 36 37 string textPrice = "font-variant-numeric: tabular-nums; white-space: nowrap;"; 38 39 var page = Dynamicweb.Content.Services.Pages.GetPage(currentPageId); 40 var settings = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(page?.Parent).Item; 41 var block = currentParagraph.Item; 42 43 var emailContentThemeId = settings.GetRawValueString("EmailContentTheme"); 44 var emailContentThemeParagraph = emailContentThemeId != null && emailContentThemeId != string.Empty ? Dynamicweb.Content.Services.Paragraphs.GetParagraph(Dynamicweb.Core.Converter.ToInt32(emailContentThemeId)) : null; 45 var emailContentTheme = emailContentThemeParagraph != null && Dynamicweb.Frontend.ContentViewModelFactory.CreateParagraphInfoViewModel(emailContentThemeParagraph).Item.GetString("CssClassName") != string.Empty ? Dynamicweb.Frontend.ContentViewModelFactory.CreateParagraphInfoViewModel(emailContentThemeParagraph)?.Item : null; 46 47 var rowId = currentGridRowId; 48 var row = Dynamicweb.Content.Services.Grids.GetGridRowById(rowId); 49 var rowItem = Dynamicweb.Content.Services.Items.GetItem(row.ItemType, row.ItemId); 50 var rowThemeId = Dynamicweb.Core.Converter.ToString(rowItem["ColumnBackground"]); 51 var rowThemeParagraph = rowThemeId != null && rowThemeId != string.Empty ? Dynamicweb.Content.Services.Paragraphs.GetParagraph(Dynamicweb.Core.Converter.ToInt32(rowThemeId)) : null; 52 var rowTheme = rowThemeParagraph != null && Dynamicweb.Frontend.ContentViewModelFactory.CreateParagraphInfoViewModel(rowThemeParagraph).Item.GetString("CssClassName") != string.Empty ? Dynamicweb.Frontend.ContentViewModelFactory.CreateParagraphInfoViewModel(rowThemeParagraph)?.Item : null; 53 54 var blockThemeId = block.GetRawValueString("Theme"); 55 var blockThemeParagraph = blockThemeId != null && blockThemeId != string.Empty ? Dynamicweb.Content.Services.Paragraphs.GetParagraph(Dynamicweb.Core.Converter.ToInt32(blockThemeId)) : null; 56 var blockTheme = blockThemeParagraph != null && Dynamicweb.Frontend.ContentViewModelFactory.CreateParagraphInfoViewModel(blockThemeParagraph).Item.GetString("CssClassName") != string.Empty ? Dynamicweb.Frontend.ContentViewModelFactory.CreateParagraphInfoViewModel(blockThemeParagraph)?.Item : rowTheme is object ? rowTheme : emailContentTheme; 57 58 string backgroundColor = blockTheme != null ? "background-color: " + blockTheme.GetString("BackgroundColor") + ";" : string.Empty; 59 string foregroundColor = blockTheme != null ? "color:" + blockTheme.GetString("ForegroundColor", "inherit") + ";" : string.Empty; 60 string borderColor = blockTheme != null ? blockTheme.GetString("BorderColor", "transparent") : string.Empty; 61 string borders = block.GetRawValueString("Borders", "none"); 62 string borderThicknes = block.GetRawValueString("BorderThicknes", "0") + "px"; 63 string borderClass = string.Empty; 64 65 switch (borders) 66 { 67 case "top": 68 borderClass = $"border-top:{borderThicknes} solid {borderColor};"; 69 break; 70 case "bottom": 71 borderClass = $"border-bottom:{borderThicknes} solid {borderColor};"; 72 break; 73 case "top-bottom": 74 borderClass = $"border-top:{borderThicknes} solid {borderColor}; border-bottom:{borderThicknes} solid {borderColor}; border-left:0;border-right:0;"; 75 break; 76 case "all": 77 borderClass = $"border:{borderThicknes} solid {borderColor};"; 78 break; 79 } 80 81 int padding = Dynamicweb.Core.Converter.ToInt32(block.GetRawValueString("Padding", "0")); 82 string align = block.GetRawValueString("Align", "left"); 83 string lineHeight = "line-height:" + (16 * Dynamicweb.Core.Converter.ToDouble(block.GetRawValueString("LineHeight", "1.5"))).ToString() + "px;"; 84 } 85 86 <tbody> 87 @foreach (LoopItem orderline in GetLoop("OrderLines")) 88 { 89 string name = orderline.GetString("Ecom:Order:OrderLine.ProductName"); 90 string image = "Admin/Public/GetImage.ashx?image=" + orderline.GetString("Ecom:Product.PrimaryImage") + "&width=100&height=100"; 91 var uri = Dynamicweb.Context.Current.Request.Url; 92 var hostname = uri.Scheme + Uri.SchemeDelimiter + uri.Host; 93 string imagePath = hostname + "/" + image; 94 string priceTotalWithDiscounts = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts.PriceFormatted")) ? orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts.PriceFormatted") : ""; 95 string unitPrice = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.UnitPrice.PriceFormatted")) ? orderline.GetString("Ecom:Order:OrderLine.UnitPrice.PriceFormatted") : ""; 96 string discountPrice = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.UnitPriceWithProductDiscount.PriceFormatted")) ? orderline.GetString("Ecom:Order:OrderLine.UnitPriceWithProductDiscount.PriceFormatted") : ""; 97 string discountTotal = !string.IsNullOrEmpty(orderline.GetString("Ecom:Order:OrderLine.TotalDiscount.PriceFormatted")) ? orderline.GetString("Ecom:Order:OrderLine.TotalDiscount.PriceFormatted") : ""; 98 string variantText = orderline.GetString("Ecom:Order:OrderLine.ProductVariantText"); 99 var quantity = orderline.GetDouble("Ecom:Order:OrderLine.Quantity"); 100 101 bool isProduct = orderline.GetBoolean("Ecom:Order:OrderLine.IsProduct"); 102 103 if (isProduct) 104 { 105 <tr style="@GetTableReset()"> 106 <td style="word-wrap:anywhere;mso-line-height-rule:exactly;mso-table-lspace:0pt;mso-table-rspace:0pt;@GetTableReset()@GetFontStack()text-align:left;@(backgroundColor)@(foregroundColor)@(lineHeight)word-break:break-word;padding:@(padding)px;@(borderClass)" width="132"> 107 @* Image *@ 108 <img src="@imagePath" alt="@name"> 109 </td> 110 <td style="word-wrap:anywhere;mso-line-height-rule:exactly;mso-table-lspace:0pt;mso-table-rspace:0pt;@GetTableReset()@GetFontStack()text-align:left;@(backgroundColor)@(foregroundColor)@(lineHeight)word-break:break-word;padding:@(padding)px;@(borderClass)"> 111 @* Title *@ 112 <h3> 113 @name 114 </h3> 115 @* Variants *@ 116 <p>@variantText</p> 117 <p> 118 @* Unit price *@ 119 @if (discountPrice == unitPrice) 120 { 121 <span style="@(textPrice)">@unitPrice</span> 122 } 123 else 124 { 125 <span style="@(textPrice)">@discountPrice</span> 126 <span style="@(textPrice) text-decoration: line-through;">@unitPrice</span>} 127 </p> 128 @* Quantity *@ 129 <p>@Translate("Quantity"): @quantity</p> 130 </td> 131 <td style="word-wrap:anywhere;mso-line-height-rule:exactly;mso-table-lspace:0pt;mso-table-rspace:0pt;@GetTableReset()@GetFontStack()text-align:right;@(backgroundColor)@(foregroundColor)@(lineHeight)word-break:break-word;padding:@(padding)px;@(borderClass)"> 132 @* Total *@ 133 <span style="@(textPrice)">@priceTotalWithDiscounts</span> 134 @if (orderline.GetDouble("Ecom:Order:OrderLine.TotalDiscount.Price.Value") != 0) 135 { 136 <span style="@(textPrice)">@discountTotal</span>} 137 </td> 138 </tr> 139 } 140 } 141 </tbody> 142
Facebook Twitter Website

@ Swift A/S

Bjørnholms Allé 30 | 8260 Viby J | Danmark

info@dynamicweb.dk 

Sign in Betingelser
Unsubsribe from emails
By clicking 'Accept All' you consent that we may collect information about you for various purposes, including: Statistics and Marketing
You control your data

We and our partners use technologies, including cookies, to collect information about you for various purposes, including:

  1. Functionaliteit
  2. Statistics
  3. Marketing

By clicking 'Accept All' you consent to all these purposes. You can also choose to indicate what purposes you will consent to using the custom selections and then click 'Accept selected'.