Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetImages.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_e9d4e0ddbdfe4224870ed90eebae62b4.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetImages.cshtml:line 21 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 Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 5 @using System.Text.RegularExpressions; 6 7 8 @{ 9 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 10 ProductDetailWidgetImages _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetImages", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetImages>() ?? new ProductDetailWidgetImages(); 11 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj) Dynamicweb.Context.Current.Session["ProductAndVariants"]; 12 13 ProductViewModel product = new ProductViewModel(); 14 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 15 { 16 product = (ProductViewModel) Dynamicweb.Context.Current.Items["ProductDetails"]; 17 } 18 19 List<FieldOptionValueViewModel> productRibbons = null; 20 21 if (product.ProductFields["ProductRibbon"] != null) 22 { 23 productRibbons = (List<FieldOptionValueViewModel>)product.ProductFields["ProductRibbon"].Value; 24 } 25 26 //ProductObj ProductObj = (ProductObj)HttpContext.Current.Session["ProductDetails"]; 27 28 //ProductDetailObj DefaultProduct = ProductObj.Default[0]; 29 30 //ProductInfoObj DefaultProductInfo = DefaultProduct.ProductInfo; 31 32 //List<ProductAssetsObj> Assets = DefaultProduct.ProductImages.ProductAssets; 33 34 bool displayRibbon = _data.DisplayRibbon; 35 bool displayManufacturerLogo = _data.DisplayManufacturerLogo; 36 37 string videoUrl = ProductAndVariants?.ProductDetail?.YoutubeProductVideo ?? ""; 38 string videoId = ""; 39 string origin = Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain(); 40 41 if (!string.IsNullOrWhiteSpace(videoUrl)) 42 { 43 // regex for https://youtu.be/{videoid} 44 Regex regex = new Regex(@".be\/(.[^?]*)"); 45 Match match = regex.Match(videoUrl); 46 if (match.Success) 47 { 48 videoId = match.Groups[1].Value; 49 } 50 51 // regex for https://www.youtube.com/watch?v={videoid} 52 regex = new Regex(@"v=([^&]+)"); 53 match = regex.Match(videoUrl); 54 if (match.Success) 55 { 56 videoId = match.Groups[1].Value; 57 } 58 } 59 } 60 61 <div id="@paragraphID" class="pdp-paragraph w-full @_data.CssClass"> 62 63 @if (!string.IsNullOrWhiteSpace(ProductAndVariants.ProductDetail.ProductRibbon) && displayRibbon) 64 { 65 <p class="product-detailpage__ribbon product-detailpage__ribbon--big"><span>@ProductAndVariants.ProductDetail.ProductRibbon</span></p> 66 } 67 68 <section class="product-detailpage__images pdp__images-container"> 69 <section class="productimages pdp__images"> 70 71 <section class="productimages__wrapper"> 72 73 <div class="productimages__carousel-big hidden"> 74 75 <div class="productimages__item"> 76 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@ProductAndVariants.Images.Default&Format=webp&Quality=-1&width=800&height=800" alt="@ProductAndVariants.Images.Default" height="800" width="800" /> 77 </div> 78 79 @if (ProductAndVariants.Images.AssetImages != null) 80 { 81 foreach (Image Image in ProductAndVariants.Images.AssetImages) 82 { 83 <div class="productimages__item"> 84 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@Image.Value&Format=webp&Quality=-1&width=800&height=800" alt="@Image.Value" /> 85 </div> 86 } 87 88 } 89 90 @if (!string.IsNullOrWhiteSpace(videoId)) 91 { 92 <div class="productimages__item"> 93 <div class="productimages__carousel__video-container"> 94 <lite-youtube 95 videoid="@videoId" 96 params="controls=1&loop=0&playlist=@videoId&playsinline=1&modestbranding=1&mute=0&rel=0&enablejsapi=1&origin=@origin&disablekb=0"> 97 </lite-youtube> 98 </div> 99 </div> 100 } 101 102 </div> 103 </section> 104 105 <div class="productimages__carousel-thumbnails hidden"> 106 107 <div class="productimages__thumbnail"> 108 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@ProductAndVariants.Images.Default&Format=webp&Quality=-1&width=100&height=100" alt="@ProductAndVariants.Images.Default" height="100" width="100" /> 109 </div> 110 111 @if (ProductAndVariants.Images.AssetImages != null) 112 { 113 foreach (Image Thumb in ProductAndVariants.Images.AssetImages) 114 { 115 <div class="productimages__thumbnail"> 116 <img class="product-image" src="/Admin/Public/GetImage.ashx?Image=@Thumb.Value&Crop=7&Format=webp&Quality=90&Compression=80&width=100&height=100" alt="Thumbnail @Thumb.Value" width="100" height="100" /> 117 </div> 118 } 119 } 120 121 @if(!string.IsNullOrWhiteSpace(videoId)) 122 { 123 <div class="productimages__thumbnail productimages__thumbnail--video pin-t mr-4" aria-hidden="true"> 124 <img class="h-full" src="https://img.youtube.com/vi/@videoId/0.jpg" alt="Video preview" height="84" width="84"> 125 <span class="video-icon"> 126 <i class="fas fa-play"></i> 127 </span> 128 </div> 129 } 130 </div> 131 132 <section class="productimages__wrapper"> 133 @if (displayManufacturerLogo && ProductAndVariants.Manufacturer != null && ProductAndVariants.Manufacturer.Logo != "") 134 { 135 <img src="/Admin/Public/GetImage.ashx?Image=/Files/@ProductAndVariants.Manufacturer.Logo&Crop=7&Format=webp&Quality=90&Compression=80&width=150" class="manufacturer__logo" alt="Manufacturer" width="150" height="50" /> 136 } 137 </section> 138 139 </section> 140 </section> 141 </div> 142 143 <style> 144 .productimages__item { 145 height: 400px; 146 } 147 </style> 148
Met deze, CE gekeurde, veiligheidsbroek en veiligheidsjas van TST Sweden bent u het best beschermd tijdens het werken met ultra hogedruk.
Meer weten? Lees hieronder verder of neem contact met ons op via +31 (0)72 540 66 99 of via info@koks.com.
Přečtěte si víceError executing template "Designs/ClientBase_generated/Paragraph/AdvancedGridTabImport.cshtml" System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at CompiledRazorTemplates.Dynamic.RazorEngine_36b5e143768a42bdb8ab0301c65df9f1.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\AdvancedGridTabImport.cshtml:line 60 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 3 @using System.Data; 4 @using System.Data.SqlClient; 5 @using Bluedesk.Tools.DynamicWeb.DataAccess; 6 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 7 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 8 9 @{ 10 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 11 // AdvancedGridTabImport _data = Dynamicweb.Services.Items.GetItem("AdvancedGridTabImport", Model.ItemId).ToCodeFirstItem<AdvancedGridTabImport>() ?? new AdvancedGridTabImport(); 12 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj) Dynamicweb.Context.Current.Session["ProductAndVariants"]; 13 14 bool IsNotContentManager = false; 15 bool isVisualEditor = Pageview.IsVisualEditorMode; 16 17 DataTable InfoBlockDataTable = null; 18 // DataTable AdvancedGridStylesDataTable = null; 19 20 // int AreaId = Pageview.AreaID; 21 string Query = $@" 22 23 SELECT 24 P.PageId 25 FROM 26 [dbo].[ItemType_AdvancedGridTabImport] AS TabsImportBlock 27 LEFT JOIN [dbo].Paragraph AS Paragraph ON Paragraph.ParagraphItemId = TabsImportBlock.Id AND Paragraph.ParagraphItemType = 'AdvancedGridTabImport' 28 LEFT JOIN [dbo].[ItemType_AdvancedGridTabsPage] AS PDPI ON PDPI.Id = TabsImportBlock.AdvancedGridTabsPageID 29 LEFT JOIN [dbo].[Page] AS P ON P.PageItemId = PDPI.Id AND P.PageItemType = 'AdvancedGridTabsPage' 30 WHERE 31 Paragraph.ParagraphId = @ParagraphID; 32 33 "; 34 35 InfoBlockDataTable = DynamicwebData.Query(Query, new SqlParameter("ParagraphID", paragraphID)); 36 37 //AdvancedGridStylesDataTable = DynamicwebData.Query($@" 38 39 // SELECT 40 // InlineStyles AS Styles 41 42 // FROM 43 // [dbo].[ItemType_AdvancedGridConfiguration] AS AGC 44 // LEFT JOIN [dbo].[GridRow] AS GR ON GR.GridRowItemId = AGC.Id 45 46 // WHERE 47 // GR.GridRowPageId = @PageId; 48 49 // ", new SqlParameter("PageId", InfoBlockDataTable.Rows[0]["PageId"].ToString())); 50 } 51 52 <section id="@paragraphID" class="pdp__ProductName" style="position: relative"> 53 54 55 @if (isVisualEditor && IsNotContentManager) 56 { 57 <a href="/Default.aspx?ID=@InfoBlockDataTable.Rows[0]["PageId"].ToString()" class="visual-editor__button"><i class="fa-thin fa-table-layout visual-editor__button-icon"></i> Go to Info page</a> 58 } 59 60 @RenderGrid(int.Parse(InfoBlockDataTable.Rows[0]["PageId"].ToString())) 61 62 </section> 63 64 @*<style> 65 @if(AdvancedGridStylesDataTable != null && AdvancedGridStylesDataTable.Rows.Count > 0) 66 { 67 for (int i = 0; i < AdvancedGridStylesDataTable.Rows.Count; i++) 68 { 69 @AdvancedGridStylesDataTable.Rows[i]["Styles"].ToString(); 70 } 71 } 72 </style>*@ 73
Nechte si poradit od specialisty
Seznamte se s námi a našimi produkty
Získejte přehled o tom, které řešení vám nejlépe vyhovuje