Ulltrøye herre
549,00 NOK
OutOfStock
Error executing template "/Designs/Swift-v2/Paragraph/Swift-v2_ProductListGroupPoster_PR.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_0aa022568d6041588e3aca137ef805d4.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) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Frontend.Navigation 3 @using Dynamicweb.Ecommerce.ProductCatalog 4 @using Dynamicweb.Environment 5 @using Dynamicweb.Frontend 6 7 @functions 8 { 9 public string GetGroupFieldValue(string systemName, IList<FieldValueViewModel> groupFields) 10 { 11 if (groupFields is null) 12 { 13 return string.Empty; 14 } 15 return groupFields.FirstOrDefault(field => field.SystemName == systemName)?.Value.ToString() ?? string.Empty; 16 } 17 } 18 19 @{ 20 ProductListViewModel productList = null; 21 if (Dynamicweb.Context.Current.Items.Contains("ProductList")) 22 { 23 productList = (ProductListViewModel)Dynamicweb.Context.Current.Items["ProductList"]; 24 } 25 else if (Pageview.Page.Item["DummyProductGroup"] != null && Pageview.IsVisualEditorMode) 26 { 27 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 28 ProductListViewModel groupList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 29 30 if (groupList?.Products is object) 31 { 32 productList = groupList; 33 } 34 } 35 } 36 37 @if (productList is object) 38 { 39 string layout = Model.Item.GetRawValueString("Layout", "align-middle-center-text-center"); 40 string alignment = ""; 41 42 string searchParameter = Dynamicweb.Context.Current.Request.GetString("q"); 43 44 bool hideTitle = Model.Item.GetBoolean("HideGroupTitle"); 45 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-4"); 46 47 string groupName = productList?.Group?.Name != null ? productList.Group.Name : ""; 48 string headerName = searchParameter != "" ? Translate("Search results for") + ": " + searchParameter : groupName; 49 50 bool hideDescription = Model.Item.GetBoolean("HideGroupDescription"); 51 string groupDescription = productList?.Group?.Description != null ? productList.Group.Description : ""; 52 string descriptionFontSize = Model.Item.GetRawValueString("DescriptionFontSize", "fs-6"); 53 54 string groupImage = productList?.Group?.Assets != null ? productList.Group.Assets.FirstOrDefault(x => x.Name == "LargeImage").Value : ""; 55 if (groupImage.StartsWith("/") && !groupImage.StartsWith("/Files", StringComparison.OrdinalIgnoreCase)) 56 { 57 groupImage = $"/Files{groupImage}"; 58 } 59 60 string posterHeight = Model.Item.GetRawValueString("PosterHeight", ""); 61 posterHeight = posterHeight == "small" ? "min-vh-25" : posterHeight; 62 posterHeight = posterHeight == "medium" ? "min-vh-50" : posterHeight; 63 posterHeight = posterHeight == "large" ? "min-vh-75" : posterHeight; 64 65 string maxWidth = Model.Item.GetRawValueString("TextReadability", "max-width-on"); 66 maxWidth = maxWidth == "max-width-on" ? " mw-75ch" : maxWidth; 67 maxWidth = maxWidth == "max-width-off" ? "" : maxWidth; 68 69 string titleColor = ""; 70 if (productList?.Group?.Id != null) 71 { 72 var productGroup = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productList.Group.Id); 73 var groupViewModel = Dynamicweb.Ecommerce.ProductCatalog.ViewModelFactory.CreateView(new ProductGroupViewModelSettings(), productGroup); 74 string groupPosterHexColor = GetGroupFieldValue("GroupPosterHexColor", groupViewModel?.GroupFields); 75 titleColor = groupPosterHexColor; 76 } 77 78 if (!string.IsNullOrEmpty(groupImage)) 79 { 80 var parms = new Dictionary<string, object>(); 81 parms.Add("cssClass", "h-100 w-100"); 82 parms.Add("columns", Model.GridRowColumnCount); 83 84 switch (layout) 85 { 86 case "align-top-left-text-left": 87 alignment = "text-start justify-content-start align-items-start"; 88 break; 89 case "align-top-center-text-center": 90 alignment = "text-center justify-content-center align-items-start"; 91 break; 92 case "align-top-right-text-right": 93 alignment = "text-end justify-content-end align-items-start"; 94 break; 95 case "align-middle-left-text-left": 96 alignment = "text-start justify-content-start align-items-center"; 97 break; 98 case "align-middle-center-text-center": 99 alignment = "text-center justify-content-center align-items-center"; 100 break; 101 case "align-middle-right-text-right": 102 alignment = "text-end justify-content-end align-items-center"; 103 break; 104 case "align-bottom-left-text-left": 105 alignment = "text-start justify-content-start align-items-end"; 106 break; 107 case "align-bottom-center-text-center": 108 alignment = "text-center justify-content-center align-items-end"; 109 break; 110 case "align-bottom-right-text-right": 111 alignment = "text-end justify-content-end align-items-end"; 112 break; 113 } 114 115 <div class="position-relative h-100 @(posterHeight) item_@Model.Item.SystemName.ToLower()" data-dw-colorscheme="@Model.ColorScheme?.Id"> 116 @if (!string.IsNullOrEmpty(groupImage)) 117 { 118 string imageFilter = Model.Item.GetRawValueString("ImageFilter", ""); 119 imageFilter = imageFilter == "no-filter" ? "" : imageFilter; 120 imageFilter = imageFilter == "filter" ? " image-filter" : imageFilter; 121 122 <div class="position-absolute top-0 bottom-0 end-0 start-0@(imageFilter)"> 123 @RenderPartial("Components/Image.cshtml", new FileViewModel { Path = groupImage }, parms) 124 </div> 125 } 126 127 @if (!hideTitle || !hideDescription) 128 { 129 <div data-swift-container class="h-100"> 130 <div class="h-100 w-100 position-relative d-flex @(alignment)"> 131 <div class="@(maxWidth)"> 132 @if (!hideTitle) 133 { 134 <h1 class="@titleFontSize" @(!string.IsNullOrEmpty(titleColor) ? $"style=\"color: {titleColor}\"" : "")>@headerName</h1> 135 } 136 137 @if (!hideDescription && !string.IsNullOrEmpty(groupDescription)) 138 { 139 <div class="@descriptionFontSize mb-0-last-child"> 140 @groupDescription 141 </div> 142 } 143 </div> 144 </div> 145 </div> 146 } 147 148 </div> 149 } 150 else if (Pageview.IsVisualEditorMode) 151 { 152 <div class="alert alert-dark m-0" role="alert"> 153 <span>@Translate("Product group poster: The poster paragraph will be shown here, if any")</span> 154 </div> 155 } 156 } 157 else if (Pageview.IsVisualEditorMode) 158 { 159 <div class="alert alert-dark m-0" role="alert"> 160 <span>@Translate("Product group poster: The poster paragraph will be shown here, if any")</span> 161 </div> 162 } 163
Truser skal være både fine og behagelige å gå med. Undertøy bør nemlig gi deg selvtilit, og sitte så bra at du glemmer at du har det på deg.