webbanner
Error executing template "Designs/Tefcold/eCom/ProductCatalog/basic_ListView.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at Tefcold.Web.CustomCode.Extensions.GroupExtension.ShortDescription(Group group)
   at CompiledRazorTemplates.Dynamic.RazorEngine_cb07c5f0e93f44f0af4aa0b21046eb64.Execute() in E:\Solutions\Live\Tefcold.Web\Files\Templates\Designs\Tefcold\eCom\ProductCatalog\basic_ListView.cshtml:line 87
   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.Admin.dk.dynamicweb.templates 2 @using Dynamicweb.Ecommerce 3 @using Dynamicweb.Rendering 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Newtonsoft.Json.Linq 6 @using NLWI.Platforms.Dynamicweb9.Specs.ViewModels 7 @using NORRIQ.Common8.Razor 8 @using NORRIQ.Universal.Extensions 9 @using Tefcold.Web.CustomCode.AsyncProductList 10 @using Tefcold.Web.CustomCode.AsyncProductList.Models 11 @using Tefcold.Web.CustomCode.Extensions 12 @using Tefcold.Web.CustomCode.Razor 13 @inherits ViewModelTemplate<ProductListViewModel> 14 @{ 15 var modelPageSize = Model.PageSize; 16 string basicListViewPrefix = "PLP "; 17 Model.PrepareSpecifications(); 18 var group = Dynamicweb.Context.Current.Request["GroupID"] != null 19 ? Services.ProductGroups.GetGroup(Dynamicweb.Context.Current.Request["GroupID"]) 20 : null; 21 var url = System.Web.HttpContext.Current.Request.Url; 22 } 23 24 @if (ProductPageFeedObserver.IsJsonFeed()) 25 { 26 @*@jsonProductList.ToString();*@ 27 var plp = new ProductListPage(Model, new HashSet<string> { "BulletPoints", "PrimaryImage", "WebPrimaryImage", "ExternalDimension", "GrossNetVolume", "ExternalDimensionWeb", "Stickers", "EnergyArrow", "EnergyLabel" }); 28 @plp.ToJSON() 29 } 30 else if (group?.ParentGroups.Count == 0 || (group?.ParentGroups.Count == 1 && group.ParentGroups.FirstOrDefault()?.Id == "25996-at-SHOP1")) 31 { 32 <section class="basic_listview basic_listview-groups"> 33 <header> 34 <h1>@group.Name</h1> 35 <p>@group.Description</p> 36 </header> 37 <div class="basic_listview-grid"> 38 @foreach (var subgroup in group.Subgroups) 39 { 40 <article> 41 <a href="@url.SetQuery("GroupID",subgroup.Id).PathAndQuery" itemprop="url"> 42 <figure style="min-height:1px;"> 43 @if (!string.IsNullOrEmpty(subgroup?.SmallImage)) 44 { 45 <img class="img-fluid" alt="@subgroup.GetDisplayName()" src="/Admin/Public/GetImage.ashx?Width=427&amp;Compression=85&amp;Crop=5&amp;Image=@subgroup.SmallImage" /> 46 } 47 else 48 { 49 <img class="img-fluid" alt="@subgroup.GetDisplayName()" src="/Admin/Public/GetImage.ashx?Width=427&amp;Compression=85&amp;Crop=5&amp;Image=/Files/Images/default.jpg" /> 50 } 51 52 </figure> 53 </a> 54 <header> 55 <h1 itemprop="name">@subgroup.GetDisplayName() @*<small>(@subgroup.ProductCount)</small>*@</h1> 56 </header> 57 </article> 58 } 59 </div> 60 </section> 61 62 } 63 else 64 { 65 66 var pdpLink = NORRIQ.Common8.Razor.Navigation.GetUrlByNavigationTag("plp"); 67 var query = Dynamicweb.Context.Current.Request["productsearch"]; 68 var groupName = group != null ? group.Name : Pageview.CurrentParagraph.Header; 69 70 <productlist-basic-listview default-grid-class="basic_listview-list" inline-template> 71 <div class="basic_listview" v-bind:class="{'initialized': initialized }"> 72 <template v-if="!queryLoading || pagination"> 73 <basic-facet-filter :facet-filters="facetFilter" v-if="facetFilter.length > 0"></basic-facet-filter> 74 <section> 75 <header> 76 <h1> 77 @if (query == null) 78 { 79 @groupName 80 } 81 else 82 { 83 @Translate(basicListViewPrefix + "Searchresult", "Searchresult") 84 <small>@query</small> 85 } 86 </h1> 87 @if (query == null && group != null && !string.IsNullOrEmpty(group.MegamenuImageTop()) || !string.IsNullOrEmpty(group.ShortDescription())) 88 { 89 <div class="plp-description"> 90 @if (!string.IsNullOrEmpty(group.MegamenuImageTop())) 91 { 92 <figure class="is-transparent"> 93 <img src="/Admin/Public/GetImage.ashx?Width=400&amp;Height=400&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@group.MegamenuImageTop()" class="img-fluid" alt="@groupName" /> 94 </figure> 95 } 96 @if (!string.IsNullOrEmpty(group.ShortDescription())) 97 { 98 99 @group.ShortDescription() 100 101 } 102 </div> 103 } 104 </header> 105 <template v-if="productList.length > 0"> 106 <div class="basic_listview-controls"> 107 <div class="basic_listview-toggle"> 108 <div class="basic_listview-layout"> 109 <button v-on:click="setPlpGridClass('basic_listview-grid')" v-bind:class="plpGridClass == 'basic_listview-grid' ? 'active' : ''"> 110 <svg> 111 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/files/dist/icons/icons.svg#th"> 112 </use> 113 </svg> 114 <span class="sr-only">@Translate(basicListViewPrefix + "Grid", "Grid")</span> 115 </button> 116 <button v-on:click="setPlpGridClass('basic_listview-list')" v-bind:class="plpGridClass == 'basic_listview-list' ? 'active' : ''"> 117 <svg> 118 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/files/dist/icons/icons.svg#align-justify"> 119 </use> 120 </svg> 121 <span class="sr-only">@Translate(basicListViewPrefix + "List", "List")</span> 122 </button> 123 </div> 124 <button type="button" 125 class="btn-toggle" 126 v-b-toggle.sidebar-filter.sidebar-overlay 127 aria-label="@Translate(basicListViewPrefix + "Open filter", "Open filter")" 128 v-if="facetFilter.length > 0"> 129 @Translate(basicListViewPrefix + "Filter", "Filter") 130 <span></span> 131 </button> 132 </div> 133 </div> 134 </template> 135 <template v-if="!queryLoading && productList.length == 0"> 136 <p>@Translate(basicListViewPrefix + "No products", "No products in this category")</p> 137 </template> 138 139 <div :class="plpGridClass" id="plp" :key="forceRerender"> 140 <template> 141 <product v-for="(product, index) in getProductList" :initial-product="product" :plp-class="plpGridClass" :key="index"></product> 142 </template> 143 </div> 144 145 <footer> 146 <pagination v-if="pagination && ShowPagination && pagination.totalPages > '1'" :pagination="pagination" :threshold="3"></pagination> 147 @if (query == null && group != null && !string.IsNullOrEmpty(group.MegamenuImageBottom()) || !string.IsNullOrEmpty(group.MegamenuHeaderBottom()) || !string.IsNullOrEmpty(group.MegamenuHeaderBottom2()) || !string.IsNullOrEmpty(group.MegamenuTextBottom()) || !string.IsNullOrEmpty(group.MegamenuTextBottom2())) 148 { 149 <div class="plp-description"> 150 @if (!string.IsNullOrEmpty(group.MegamenuImageBottom())) 151 { 152 <figure class="is-right"> 153 <img src="/Admin/Public/GetImage.ashx?Width=400&amp;Compression=85&amp;Crop=5&amp;Image=@group.MegamenuImageBottom()" class="img-fluid" alt="@groupName" /> 154 </figure> 155 } 156 @if (!string.IsNullOrEmpty(group.MegamenuHeaderBottom()) || !string.IsNullOrEmpty(group.MegamenuHeaderBottom2()) || !string.IsNullOrEmpty(group.MegamenuTextBottom()) || !string.IsNullOrEmpty(group.MegamenuTextBottom2())) 157 { 158 159 if (!string.IsNullOrEmpty(group.MegamenuHeaderBottom())) 160 { 161 <h2>@group.MegamenuHeaderBottom()</h2> 162 } 163 if (!string.IsNullOrEmpty(group.MegamenuTextBottom())) 164 { 165 @group.MegamenuTextBottom() 166 } 167 if (!string.IsNullOrEmpty(group.MegamenuHeaderBottom2())) 168 { 169 <h3> 170 @group.MegamenuHeaderBottom2() 171 </h3> 172 } 173 if (!string.IsNullOrEmpty(group.MegamenuTextBottom2())) 174 { 175 @group.MegamenuTextBottom2() 176 } 177 178 } 179 </div> 180 } 181 </footer> 182 </section> 183 </template> 184 <div class="basic_listview-overlay" v-bind:class="queryLoading && pagination ? 'active' : ''"> 185 <span class="spinner-xl-light"></span> 186 </div> 187 <template v-if="queryLoading && !pagination"> 188 <div class="basic_listview-loader text-center"> 189 <span class="spinner-xl-default"></span> 190 </div> 191 </template> 192 193 </div> 194 </productlist-basic-listview> 195 }