Error executing template "Designs/Pillivuyt/eCom/Productlist/ProductList.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at ThuesenJensen.Logic.Search.ProductCategoryParams.IsTopGorup(String groupId)
   at CompiledRazorTemplates.Dynamic.RazorEngine_f300ca8921574323b1e4618e839b4e8f.Execute() in E:\Dynamicweb.net\SolutionsCustom\pillivuyt.net.dynamicweb-cms.com\Files\Templates\Designs\Pillivuyt\eCom\Productlist\ProductList.cshtml:line 12
   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 @using Dynamicweb.Rendering; 2 @using Newtonsoft.Json 3 @using ThuesenJensen.Logic.Helpers 4 @using ThuesenJensen.Logic.JSON.Net_settings 5 @using ThuesenJensen.Logic.Search; 6 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 7 8 @{ 9 var languageId = Dynamicweb.Ecommerce.Common.Context.LanguageID; 10 var productCategoryParams = new ProductCategoryParams(); 11 var groupId = GetString("Ecom:ProductList:Page.GroupID"); 12 var isTopGroup = productCategoryParams.IsTopGorup(GetString("Ecom:ProductList:Page.GroupID")); 13 var parentGroupName = productCategoryParams.GetParentGroupName(groupId); 14 var typeOptions = productCategoryParams.GetCategories(parentGroupName, groupId, isTopGroup, languageId); 15 var groupOptions = productCategoryParams.GetGroups(parentGroupName, groupId, isTopGroup, languageId); 16 17 // Handle additional params 18 Dictionary<string, object> additionalParams = new Dictionary<string, object>(); 19 additionalParams.Add("isTopGroup", isTopGroup); 20 additionalParams.Add("parentGroupName", parentGroupName); 21 additionalParams.Add("groupId", groupId); 22 additionalParams.Add("LanguageId", languageId); 23 24 var additionalParamsJson = JsonConvert.SerializeObject(additionalParams, Formatting.None, new JsonSerializerSettings 25 { 26 ContractResolver = new LowercaseContractResolver() 27 }); 28 29 Dictionary<string, string> sortOptions = new Dictionary<string, string>(); 30 if (!isTopGroup) 31 { 32 sortOptions.Add("Sort_" + groupId + ",asc", Translate("Editor favorites", "Vores favoritter")); 33 } 34 sortOptions.Add("ProductName,desc", Translate("Name, descending", "Navn, faldende")); 35 sortOptions.Add("ProductName,asc", Translate("Name, ascending", "Navn, stigende")); 36 sortOptions.Add("Price,asc", Translate("Price, ascending", "Pris, laveste først")); 37 sortOptions.Add("Price,desc", Translate("Price, descending", "Pris, højeste først")); 38 39 var sortOptionsJson = JsonConvert.SerializeObject(sortOptions, Formatting.None, new JsonSerializerSettings 40 { 41 ContractResolver = new LowercaseContractResolver() 42 }); 43 } 44 45 @if (!string.IsNullOrEmpty(GetString("Ecom:Group:Field.top_banner_image.Clean"))) 46 { 47 <section class="topbanner topbanner--@(GetString("Ecom:Group:Field.top_banner_text_black.Value.Clean") == "True" ? "black" : "white")"> 48 <h1>@GetString("Ecom:Group.Name")</h1> 49 <div class="topbanner__background bg-imagehandler" 50 data-src-xs="@ImageHelper.GetImage(GetString("Ecom:Group:Field.top_banner_image.Clean"), 768, 192)" 51 data-src-md="@ImageHelper.GetImage(GetString("Ecom:Group:Field.top_banner_image.Clean"), 1024, 256)" 52 data-src-lg="@ImageHelper.GetImage(GetString("Ecom:Group:Field.top_banner_image.Clean"), 1280, 320)"> 53 </div> 54 </section> 55 } 56 57 58 @if (!GetBoolean("Ecom:Group:Field.showchildgroups.Value.Clean")) 59 { 60 <plv-product-filter-settings data-sort-by-options='@sortOptionsJson' 61 data-type-options='@typeOptions' 62 data-group-options='@groupOptions' 63 data-additional-params='@additionalParamsJson' 64 parent-group-id="@groupId" 65 data-currency-symbol="@Dynamicweb.Ecommerce.Common.Context.Currency.Code"> 66 <div class="text-center"> 67 <img src="Files/Templates/Designs/Pillivuyt/static/dist/img/ajaxload-md-w.gif" alt="@Translate("(ProductList) Loading","Indlæser...")" /> 68 </div> 69 </plv-product-filter-settings> 70 } 71 72 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 73 @using Dynamicweb.Rendering; 74 75 76 @{ 77 78 if (Pageview.Area.Item["Webshop"].ToString() == "True") 79 { 80 <div class="row text-almost-medium text-center padding-top padding-bottom"> 81 <div class="col-sm-4"> 82 @Pageview.Area.Item["DeliveryTime"] 83 </div> 84 <div class="col-sm-4"> 85 @Pageview.Area.Item["DeliveryFreeFrom"] 86 </div> 87 <div class="col-sm-4"> 88 @Pageview.Area.Item["DeliveryReturnTerms"] 89 </div> 90 </div> 91 } 92 } 93 94 95 96 @if (GetBoolean("Ecom:Group:Field.showchildgroups.Value.Clean")) 97 { 98 <div class="service-overview"> 99 @foreach (var group in GetLoop("Childgroups")) 100 { 101 string image = string.Empty; 102 try 103 { 104 var imagePathDefault = group.GetString("Ecom:Group.SmallImage"); 105 bool imageExists = System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath(imagePathDefault)); 106 image = imageExists ? ImageHelper.GetImage(imagePathDefault, 760, 400, "png") : ImageHelper.GetImage("/Files/Images/product_images/" + "no_product_pictures.png", 760, 400); 107 } 108 catch (Exception) 109 { 110 image = ImageHelper.GetImage("/Files/Images/product_images/" + "no_product_pictures.png", 760, 400); 111 } 112 113 <a href="/@group.GetString("Ecom:Group.Link.Clean")" class="service-link"> 114 <h5>@group.GetString("Ecom:Group.Name")</h5> 115 <div class="service-link__image"> 116 <span class="imagehandler" data-src-xs="@image" data-alt="@group.GetString("Ecom:Group.Name")"> 117 <noscript> 118 <img src="@image" alt="@group.GetString("Ecom:Group.Name")" /> 119 </noscript> 120 </span> 121 </div> 122 </a> 123 } 124 </div> 125 } 126 else 127 { 128 <plv-product-filter-results> 129 <div class="text-center"> 130 <img src="Files/Templates/Designs/Pillivuyt/static/dist/img/ajaxload-md-w.gif" alt="@Translate("(ProductList) Loading","Indlæser...")" /> 131 </div> 132 </plv-product-filter-results> 133 }