Advies & Technische ondersteuning:+32 (0) 3 880 07 60
0
0
Error executing template "Designs/ClientBase_generated/eCom/ProductCatalog/pdp_config.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend.EcomFrontendServices.RenderProductAndVariants(String ProductId, String VariantId, String GroupId, String LangId, PageView PageView) in C:\vso\Mavom\BluedeskBaseSolution\ClientBase\ItemTypes\Bluedesk.DynamicWeb.ItemTypes.BaseSolution\Frontend\ProductAndVariants.cs:line 197
at CompiledRazorTemplates.Dynamic.RazorEngine_cbde1ca7f10941c8b0ae7e1268aef753.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\viba.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\eCom\ProductCatalog\pdp_config.cshtml:line 16
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 ViewModelTemplate<ProductViewModel> 2 3 @using Dynamicweb; 4 @using Dynamicweb.Rendering; 5 @using Dynamicweb.Caching; 6 @using Dynamicweb.Content; 7 @using Dynamicweb.Content.Items; 8 @using Dynamicweb.Ecommerce.ProductCatalog 9 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 10 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 11 12 13 @{ 14 EcomFrontendServices EcomFrontendServices = new EcomFrontendServices(); 15 16 ProductAndVariantsObj ProductAndVariantsObj = EcomFrontendServices.RenderProductAndVariants(Model.Id, Model.VariantId, Model.PrimaryOrDefaultGroup.Id, Pageview.Area.EcomLanguageId, Pageview); 17 Dynamicweb.Context.Current.Session["ProductAndVariants"] = ProductAndVariantsObj; 18 19 int ProductDetailConfigurationPageID = ProductAndVariantsObj.Template.ProductDetailConfigurationPagePageId; 20 int FooProductDetailLayoutID = 0; 21 22 string minWidth = ""; 23 string maxWidth = ""; 24 25 string groupid = Model.PrimaryOrDefaultGroup.Id; 26 27 string canonical = $"Default.aspx?ID={Pageview.Page.ID}"; 28 if (!string.IsNullOrWhiteSpace(groupid)) 29 { 30 canonical = $"{canonical}&GroupID={groupid}"; 31 } 32 if (!string.IsNullOrWhiteSpace(Model.Id)) 33 { 34 canonical = $"{canonical}&ProductID={Model.Id}"; 35 } 36 if (!string.IsNullOrWhiteSpace(Model.VariantId)) 37 { 38 canonical = $"{canonical}&VariantID={Model.VariantId}"; 39 } 40 41 string basedomain = Dynamicweb.Context.Current.Request.Url.DnsSafeHost; 42 if (!string.IsNullOrEmpty(Pageview.Area.DomainLock)) 43 { 44 basedomain = Pageview.Area.DomainLock; 45 } 46 47 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(canonical); 48 string href = $"{Dynamicweb.Context.Current.Request.Url.Scheme}://{basedomain}{friendlyUrl}"; 49 50 Pageview.Meta.AddTag("customCan", string.Format("<link rel=\"canonical\" href=\"{0}\">", href)); 51 52 if (ProductAndVariantsObj != null) 53 { 54 foreach (GridRow g in Dynamicweb.Services.Grids.GetGridRowsByPageId(ProductDetailConfigurationPageID)) 55 { 56 ProductDetailPageBreakpointRow _data = ItemManager.Storage.GetById<ProductDetailPageBreakpointRow>(g.ItemId.ToString()); 57 58 // minWidth = _data.Device.minWidth != 0 ? " and (min-width: " + _data.Device.minWidth + "px)" : ""; 59 // maxWidth = _data.Device.maxWidth != 0 ? " and (max-width: " + _data.Device.maxWidth + "px)" : ""; 60 61 FooProductDetailLayoutID = Dynamicweb.Services.Pages.GetPageForItem("ProductDetailPage", _data.ProductDetailConfiguration.Id).ID; 62 63 <section class="productDetail productDetail--@Model.Id.ToString()"> 64 @RenderGrid(FooProductDetailLayoutID) 65 </section> 66 67 List<AdvancedGrid> AdvancedGrids = FrontendServices.RenderAdvancedGrid(Pageview, FooProductDetailLayoutID.ToString()); 68 69 <style> 70 @if (AdvancedGrids != null && AdvancedGrids.Count > 0) 71 { 72 foreach (AdvancedGrid AdvancedGrid in AdvancedGrids) 73 { 74 @AdvancedGrid.InlineStyles 75 } 76 } 77 </style> 78 } 79 } 80 81 if(Dynamicweb.Context.Current.Session["YouHaveSeenTheseProductsList"] == null) { 82 var emptyArray = new List<string>(); 83 Dynamicweb.Context.Current.Session["YouHaveSeenTheseProductsList"] = emptyArray.ToArray(); 84 } 85 86 var productIds = ((string[])Dynamicweb.Context.Current.Session["YouHaveSeenTheseProductsList"]).ToList(); 87 string prodId = Model.Id; 88 if(!string.IsNullOrWhiteSpace(Model.VariantId)) 89 { 90 prodId = $"{prodId};{Model.VariantId}"; 91 } 92 if (productIds.Contains(prodId)) 93 { 94 productIds.Remove(prodId); 95 } 96 productIds.Insert(0, prodId); 97 Dynamicweb.Context.Current.Session["YouHaveSeenTheseProductsList"] = productIds.ToArray(); 98 } 99
Naar boven