06K500

Banjo Bridge 6mmx500mm

Error executing template "Designs/Swift/Paragraph/Swift_ProductCustomIframe.cshtml"
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
at CompiledRazorTemplates.Dynamic.RazorEngine_0f9f6aa674934cd9aaaaee8afc15fc41.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\hctswift.cloud.dynamicweb-cms.com\files\Templates\Designs\Swift\Paragraph\Swift_ProductCustomIframe.cshtml:line 32
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 Dynamicweb.Ecommerce.ProductCatalog 3 @using Dynamicweb.Frontend 4 @using System.IO 5 6 @{ 7 ProductViewModel product = null; 8 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 9 { 10 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 11 } 12 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 13 { 14 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 15 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 16 17 if (productList?.Products is object) 18 { 19 product = productList.Products[0]; 20 } 21 } 22 } 23 24 @{ 25 26 FieldValueViewModel customIframe; 27 28 product.ProductFields.TryGetValue("CustomIframe", out customIframe); 29 30 string customIframeCode = ""; 31 32 if ((customIframe != null && product.VariantInfo.VariantInfo.Count() < 2) || Model.Item.GetBoolean("ShowForAllProducts") ) 33 { 34 35 customIframeCode = customIframe?.Value != null ? customIframe.Value.ToString() : ""; 36 37 <div class="custom-iframe">@customIframeCode</div> 38 39 40 } 41 } 42

You may also like