
Sunlight Solcellslykta - 30 cm
1 299,00 kr
InStock
Error executing template "Designs/Swift/Paragraph/Swift_Group_SEO_Custom.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_6d5592cef1be4ea1afc146ba60f51ac7.Execute() in D:\dynamicweb.net\Solutions\twodayco3\evasolo.cloud.dynamicweb-cms.com\Files\Templates\Designs\Swift\Paragraph\Swift_Group_SEO_Custom.cshtml:line 49 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 Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Collections 3 @using Dynamicweb 4 @using Dynamicweb.Frontend.Navigation 5 @using Dynamicweb.Ecommerce.ProductCatalog 6 @using Dynamicweb.Ecommerce.Products.Categories 7 @using Dynamicweb.Environment 8 @using Dynamicweb.Frontend 9 10 @* CUSTOM TEMPLATE SUPPORTED BY SWIFT (v1.25.0) *@ 11 12 @{ 13 ProductListViewModel productList = new ProductListViewModel(); 14 15 ProductListViewModelSettings productSetting = new ProductListViewModelSettings 16 { 17 LanguageId = Dynamicweb.Ecommerce.Common.Context.LanguageID, 18 CurrencyCode = Dynamicweb.Ecommerce.Common.Context.Currency.Code, 19 CountryCode = Dynamicweb.Ecommerce.Common.Context.Country.Code2, 20 ShopId = Pageview.Area.EcomShopId 21 }; 22 23 if (Dynamicweb.Context.Current.Items.Contains("ProductList")) 24 { 25 productList = (ProductListViewModel)Dynamicweb.Context.Current.Items["ProductList"]; 26 } 27 else if (Pageview.Item["DummyProductGroup"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel groupList = pageViewModel.Item.GetValue("DummyProductGroup") != null ? pageViewModel.Item.GetValue("DummyProductGroup") as ProductListViewModel : new ProductListViewModel(); 31 32 if (groupList?.Group?.Id != null) 33 { 34 productList = ViewModelFactory.CreateView(productSetting, groupList.Group.Id); 35 Dynamicweb.Context.Current.Items.Add("ProductList", productList); 36 } 37 else 38 { 39 productList = ViewModelFactory.CreateView(productSetting, Dynamicweb.Ecommerce.Services.ProductGroups.GetGroups(Dynamicweb.Ecommerce.Common.Context.LanguageID).FirstOrDefault().Id); 40 Dynamicweb.Context.Current.Items.Add("ProductList", productList); 41 } 42 } 43 else if (Pageview.Item["DummyProductGroup"] == null) 44 { 45 productList = ViewModelFactory.CreateView(productSetting, Dynamicweb.Ecommerce.Services.ProductGroups.GetGroups(Dynamicweb.Ecommerce.Common.Context.LanguageID).FirstOrDefault().Id); 46 Dynamicweb.Context.Current.Items.Add("ProductList", productList); 47 } 48 49 if (productList.Group.Id != null) 50 { 51 <div class="productlist-seo-text col-12 col-lg-11"> 52 <h2 class="seo-heading">@productList.Group.GetGroup().GroupFields.Single(gf => gf.SystemName == "ProductGroupSEOHeadingCustom").Value</h2> 53 <span class="seo-text">@productList.Group.GetGroup().GroupFields.Single(gf => gf.SystemName == "ProductGroupSEOTextCustom").Value</span> 54 </div> 55 } 56 } 57