Branding Stylesheet || ProductId : PROD24 VariantId :

Product detail page

Product detail configuration page

Button knop 2
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_abade1ae35d44f2d90f43dbf7f847cd9.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetImages.cshtml:line 56
   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 Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 5 @using System.Text.RegularExpressions; 6 7 @using Dynamicweb.Content.Items; 8 @using Dynamicweb.Content.Items.Annotations; 9 @using Dynamicweb.Content.Items.Activation; 10 @using Dynamicweb.Content.Items.Editors; 11 @using Dynamicweb.Content.Items.Metadata; 12 @using System.Collections.Generic; 13 @using System.Linq; 14 @using Bluedesk.DynamicWeb.ItemTypes.Extensions; 15 @using Dynamicweb.Ecommerce.ProductCatalog; 16 17 @{ 18 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 19 ProductDetailWidgetImages _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetImages", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetImages>() ?? new ProductDetailWidgetImages(); 20 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 21 22 ProductViewModel product = new ProductViewModel(); 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 28 bool displayRibbon = _data.DisplayRibbon; 29 bool displayManufacturerLogo = _data.DisplayManufacturerLogo; 30 31 string videoUrl = ProductAndVariants?.ProductDetail?.YoutubeProductVideo ?? ""; 32 string videoId = ""; 33 string origin = Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain(); 34 35 if (!string.IsNullOrWhiteSpace(videoUrl)) 36 { 37 // regex for https://youtu.be/{videoid} 38 Regex regex = new Regex(@".be\/(.[^?]*)"); 39 Match match = regex.Match(videoUrl); 40 if (match.Success) 41 { 42 videoId = match.Groups[1].Value; 43 } 44 45 // regex for https://www.youtube.com/watch?v={videoid} 46 regex = new Regex(@"v=([^&]+)"); 47 match = regex.Match(videoUrl); 48 if (match.Success) 49 { 50 videoId = match.Groups[1].Value; 51 } 52 } 53 54 var prod = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, Pageview.Area.EcomLanguageId); 55 string defaultImage = Dynamicweb.Ecommerce.Services.ProductImages.GetImagePath(prod); 56 var imageLoop = ProductAndVariants.Images?.AssetImages?.Where(x => x.Value != defaultImage).ToList() ?? new List<Image>(); 57 bool hasMultipleImages = imageLoop.Count > 0; 58 } 59 60 <div id="@paragraphID" class="pdp-paragraph w-full @_data.CssClass"> 61 62 <section class="product-detailpage__images pdp__images-container"> 63 <section class="productimages pdp__images"> 64 65 @if (!string.IsNullOrWhiteSpace(defaultImage)) 66 { 67 string colorCode = "color:" + _data.ColorPaginationArrows.GetColorCode(Pageview.AreaID) ?? "transparent"; 68 string displayThumbnails = _data.DisplayThumbnails == false ? "display: none;" : ""; 69 string productRibbon = ProductAndVariants?.ProductDetail?.ProductRibbon ?? ""; 70 71 <section class="productimages__wrapper"> 72 73 @if (displayManufacturerLogo && ProductAndVariants.Manufacturer != null && ProductAndVariants.Manufacturer.Logo != "") 74 { 75 <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" /> 76 } 77 78 @if (!string.IsNullOrWhiteSpace(productRibbon) && displayRibbon) 79 { 80 <p class="product-detailpage__ribbon product-detailpage__ribbon--big"><span>@productRibbon</span></p> 81 } 82 83 <div class="swiper product-swiper" thumbs-swiper=".thumbnails-swiper"> 84 <div class="swiper-wrapper"> 85 <div class="swiper-slide"> 86 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@defaultImage&Format=webp&Quality=-1&width=800&height=800" alt="@product.Name" height="800" width="800" /> 87 </div> 88 89 @if(hasMultipleImages) 90 { 91 foreach (Image Image in imageLoop) 92 { 93 <div class="swiper-slide"> 94 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@Image.Value&Format=webp&Quality=-1&width=800&height=800" alt="@product.Name" /> 95 </div> 96 } 97 } 98 99 @if (!string.IsNullOrWhiteSpace(videoId)) 100 { 101 <div class="swiper-slide"> 102 <div> 103 <lite-youtube videoid="@videoId" params="controls=1&loop=0&playlist=@videoId&playsinline=1&modestbranding=1&mute=0&rel=0&enablejsapi=1&origin=@origin&disablekb=0"></lite-youtube> 104 </div> 105 </div> 106 } 107 </div> 108 109 @if (_data.DisplayPaginationDots) 110 { 111 <div class="swiper-pagination"></div> 112 } 113 114 @if (_data.DisplayImageArrows) 115 { 116 <div class="swiper-button-prev" style="@colorCode"></div> 117 <div class="swiper-button-next" style="@colorCode"></div> 118 } 119 </div> 120 121 </section> 122 123 if (_data.ThumbnailQuantity == 0) 124 { 125 _data.ThumbnailQuantity = 3; 126 } 127 128 if(hasMultipleImages || !string.IsNullOrWhiteSpace(videoId)) 129 { 130 <div class="swiper thumbnails-swiper" style="@displayThumbnails" data-previewnumber="@_data.ThumbnailQuantity"> 131 <div class="swiper-wrapper"> 132 @if (_data.ThumbnailWidth == 0) 133 { 134 _data.ThumbnailWidth = 200; 135 } 136 @if (_data.ThumbnailHeight == 0) 137 { 138 _data.ThumbnailHeight = 200; 139 } 140 141 <div class="swiper-slide"> 142 <img class="product-image" src="/Admin/Public/GetImage.ashx?Image=@defaultImage&Format=webp&Quality=-1&width=@_data.ThumbnailWidth&height=@_data.ThumbnailHeight" alt="@product.Name" height="@_data.ThumbnailHeight" width="@_data.ThumbnailWidth" /> 143 </div> 144 145 146 @if(hasMultipleImages) 147 { 148 foreach (Image Thumb in imageLoop) 149 { 150 <div class="swiper-slide"> 151 <img class="product-image" src="/Admin/Public/GetImage.ashx?Image=@Thumb.Value&Crop=7&Format=webp&Quality=90&Compression=80&width=@_data.ThumbnailWidth&height=@_data.ThumbnailHeight" alt="Thumbnail @product.Name" width="@_data.ThumbnailWidth" height="@_data.ThumbnailHeight" /> 152 </div> 153 } 154 } 155 156 @if (!string.IsNullOrWhiteSpace(videoId)) 157 { 158 string thumbnailWidth = "width:" + _data.ThumbnailWidth + "px;"; 159 string thumbnailHeight = "height:" + _data.ThumbnailHeight + "px;"; 160 string iconPositionWidth = "left:" + (_data.ThumbnailWidth / 2 - 12).ToString() + "px;"; 161 string iconPositionHeight = "top:" + (_data.ThumbnailHeight / 2 - 12).ToString() + "px;"; 162 163 <div class="swiper-slide"> 164 <div class="productimages__thumbnail productimages__thumbnail--video" style="@thumbnailWidth @thumbnailHeight"> 165 <img class="h-full" src="https://i.ytimg.com/vi_webp/@videoId/hqdefault.webp" alt="Video preview @ProductAndVariants.ProductInfo.Name" /> 166 <span class="video-icon" style="@iconPositionWidth @iconPositionHeight"> 167 <i class="fas fa-play"></i> 168 </span> 169 </div> 170 </div> 171 } 172 173 </div> 174 175 @if (_data.DisplayThumbnailArrows) 176 { 177 <div class="swiper-button-prev" style="@colorCode"></div> 178 <div class="swiper-button-next" style="@colorCode"></div> 179 } 180 </div> 181 } 182 } 183 </section> 184 </section> 185 </div> 186 187
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetPrice.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_13c5e04c34ce40bc8d194bfd88049191.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetPrice.cshtml:line 34
   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.Prices; 3 @using Dynamicweb.Ecommerce.ProductCatalog; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 5 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 6 7 @{ 8 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 9 ProductDetailWidgetPrice _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetPrice", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetPrice>() ?? new ProductDetailWidgetPrice(); 10 11 var master_configuration = Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 12 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 13 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 14 15 ProductViewModel product = new ProductViewModel(); 16 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 17 { 18 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 19 } 20 21 bool WithVATBool = Pageview.Area.EcomPricesWithVat == "True"; 22 bool pricesWithoutVatForUsers = EcommerceConfiguration.ShowPricesWithoutVatForUsers; 23 bool pricesWithoutVatForValidVat = EcommerceConfiguration.ShowPricesWithoutVatWhenValidVatNumber; 24 if(pricesWithoutVatForUsers && !pricesWithoutVatForValidVat && Pageview.User != null) { 25 WithVATBool = false; 26 } 27 if(pricesWithoutVatForValidVat && Pageview.User != null && !string.IsNullOrWhiteSpace(Pageview.User.VatRegNumber)) { 28 WithVATBool = false; 29 } 30 31 bool hidePricesForGuests = EcommerceConfiguration.HidePricesForGuests; 32 bool hideZeroPrices = EcommerceConfiguration.HideZeroPrices; 33 bool displayPrice = hidePricesForGuests ? Pageview.User != null : true; 34 bool pricezero = product.Price.Price <= 0; 35 36 bool displayProductPrice = displayPrice; 37 if (hideZeroPrices && pricezero) 38 { 39 displayProductPrice = false; 40 } 41 42 string ProductdetailPriceSuffixWithVAT = Translate("Productdetail.Price.Suffix.WithVAT", "Incl. VAT"); 43 string ProductdetailPriceSuffixWithoutVAT = Translate("Productdetail.Price.Suffix.WithoutVAT", "Excl. VAT"); 44 string ProductdetailPriceSuffix = WithVATBool ? ProductdetailPriceSuffixWithVAT : ProductdetailPriceSuffixWithoutVAT; 45 46 var gtmValue = WithVATBool ? product.Price.PriceWithVat : product.Price.PriceWithoutVat; 47 var priceFormatted = WithVATBool ? product.Price.PriceWithVatFormatted : product.Price.PriceWithoutVatFormatted; 48 var priceBeforeDiscount = WithVATBool ? product.PriceBeforeDiscount.PriceWithVat : product.PriceBeforeDiscount.PriceWithoutVat; 49 var priceBeforeDiscountFormatted = WithVATBool ? product.PriceBeforeDiscount.PriceWithVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; 50 var priceTotalDiscount = WithVATBool ? product.Discount.PriceWithVat : product.Discount.PriceWithoutVat; 51 var priceTotalDiscountFormatted = WithVATBool ? product.Discount.PriceWithVatFormatted : product.Discount.PriceWithoutVatFormatted; 52 double discountPercentage = Math.Round(((priceTotalDiscount / priceBeforeDiscount) * -100)); 53 bool hasDiscount = product.Discount.Price > 0; 54 55 string informativePrice = WithVATBool ? product.PriceInformative.PriceWithVatFormatted : product.PriceInformative.PriceWithoutVatFormatted; 56 if (EcommerceConfiguration.UseInformativePriceAsFromPrice && !string.IsNullOrWhiteSpace(informativePrice)) 57 { 58 double informativePriceValue = WithVATBool ? product.PriceInformative.PriceWithVat : product.PriceInformative.PriceWithoutVat; 59 hasDiscount = gtmValue < informativePriceValue; 60 if (hasDiscount) 61 { 62 priceBeforeDiscountFormatted = informativePrice; 63 discountPercentage = Math.Round((((gtmValue - informativePriceValue) / informativePriceValue) * 100)); 64 65 double yourProfitValue = informativePriceValue - gtmValue; 66 priceTotalDiscountFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = yourProfitValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = yourProfitValue }.PriceWithoutVATFormatted; 67 } 68 } 69 70 string retailPrice = ""; 71 bool displayRetailPrice = EcommerceConfiguration.DisplayRetailPrice; 72 if(EcommerceConfiguration.DisplayRetailPriceForUsers && Pageview.User == null) { 73 displayRetailPrice = false; 74 } 75 if(displayRetailPrice) { 76 string priceFieldName = EcommerceConfiguration.RetailPriceField; 77 if(EcommerceConfiguration.RetailPriceIsDbPrice) { 78 var p = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, Pageview.Area.EcomLanguageId); 79 PriceContext customerPriceContext = new PriceContext(Dynamicweb.Ecommerce.Common.Context.Currency, Dynamicweb.Ecommerce.Common.Context.Country, null, null, Dynamicweb.Ecommerce.Common.Context.ReverseChargeForVatEnabled, DateTime.Now); 80 var customerPrice = p?.GetPrice(customerPriceContext); 81 if(customerPrice.Price > 0) { 82 retailPrice = WithVATBool ? customerPrice.PriceWithVATFormatted : customerPrice.PriceWithoutVATFormatted; 83 } 84 } else if(!string.IsNullOrWhiteSpace(priceFieldName)) { 85 double customerPriceValue = 0.0; 86 if (product.ProductFields.TryGetValue(priceFieldName, out var fieldValue) && fieldValue.Value is double) { 87 customerPriceValue = (double)fieldValue.Value; 88 } 89 if(customerPriceValue > 0) { 90 retailPrice = WithVATBool ? new PriceInfo { PriceWithVAT = customerPriceValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = customerPriceValue }.PriceWithoutVATFormatted; 91 } 92 } 93 } 94 95 bool isVariant = product.VariantId != ""; 96 int variantCount = product?.VariantInfo?.VariantInfo?.Count ?? 0; 97 bool hasVariants = !isVariant ? variantCount > 0 : false; 98 } 99 100 <div id="@paragraphID" class="pdp-paragraph @_data.CssClass"> 101 @if (displayPrice && displayProductPrice) 102 { 103 <div class="pdp-price__container"> 104 @if(!isVariant && hasVariants) 105 { 106 string minPrice = WithVATBool ? product.VariantInfo.PriceMin.PriceWithVatFormatted : product.VariantInfo.PriceMin.PriceWithoutVatFormatted; 107 string maxPrice = WithVATBool ? product.VariantInfo.PriceMax.PriceWithVatFormatted : product.VariantInfo.PriceMax.PriceWithoutVatFormatted; 108 109 <section class="pdp-price__subcontainer"> 110 @if(minPrice != maxPrice) 111 { 112 <span class="pdp-price">@minPrice - @maxPrice</span> 113 } 114 else 115 { 116 <span class="pdp-price">@minPrice</span> 117 } 118 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 119 </section> 120 } 121 else 122 { 123 if (hasDiscount) 124 { 125 <p class="pdp-price--original">@priceBeforeDiscountFormatted</p> 126 <section class="pdp-price__subcontainer"> 127 <span class="pdp-price">@priceFormatted</span> 128 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 129 <span class="pdp-price__percentage">@discountPercentage%</span> 130 </section> 131 } 132 else 133 { 134 <section class="pdp-price__subcontainer"> 135 <span class="pdp-price">@priceFormatted</span> 136 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 137 </section> 138 } 139 if (!string.IsNullOrWhiteSpace(retailPrice)) 140 { 141 <p class="pdp-price__retail-price"> 142 @String.Format(Translate("ProductBlockTitle.RetailPrice", "Retail price: {0}"), retailPrice) 143 </p> 144 } 145 if (hasDiscount) 146 { 147 <p class="pdp-price__yourprofit"> 148 @Translate("Productdetail.YourProfitLabel", "Your profit:") @priceTotalDiscountFormatted 149 </p> 150 } 151 } 152 </div> 153 154 if(displayPrice && displayProductPrice && product.Prices.Any()) { 155 var priceList = new List<object>(); 156 var loopIndex = 1; 157 158 foreach (var volumePrice in product.Prices) 159 { 160 double volumePriceQuantity = volumePrice.Quantity; 161 162 if (volumePriceQuantity > 1) 163 { 164 double newVolumePriceVal = WithVATBool ? volumePrice.Price.PriceWithVat : volumePrice.Price.PriceWithoutVat; 165 double productPriceVal = WithVATBool ? product.Price.PriceWithVat : product.Price.PriceWithoutVat; 166 167 double newVolumePrice = Math.Round(newVolumePriceVal * volumePrice.Quantity, 2); 168 string newVolumePriceFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = newVolumePrice }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = newVolumePrice }.PriceWithoutVATFormatted; 169 170 double diffVolumePrice = Math.Round((productPriceVal - newVolumePriceVal) * volumePrice.Quantity, 2); 171 string diffVolumePriceFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = diffVolumePrice }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = diffVolumePrice }.PriceWithoutVATFormatted; 172 173 var priceObj = new 174 { 175 discountId = loopIndex, 176 newVolumePriceFormatted = newVolumePriceFormatted, 177 diffVolumePriceFormatted = diffVolumePriceFormatted, 178 unitPriceFormatted = WithVATBool ? volumePrice.Price.PriceWithVatFormatted : volumePrice.Price.PriceWithoutVatFormatted, 179 quantity = volumePriceQuantity 180 }; 181 priceList.Add(priceObj); 182 } 183 loopIndex++; 184 } 185 186 string pricesJson = Newtonsoft.Json.JsonConvert.SerializeObject(priceList); 187 188 <div class="app-volumeprices" data-price-list='@pricesJson'></div> 189 } 190 } 191 </div> 192
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetStock.cshtml"
System.InvalidOperationException: Nullable object must have a value.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Nullable`1.get_Value()
   at CompiledRazorTemplates.Dynamic.RazorEngine_7584b63361034ca4b1e4ba95a0850cbc.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetStock.cshtml:line 31
   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.Ecommerce.Stocks; 4 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 5 @using System.Globalization; 6 7 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 8 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 9 10 @{ 11 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 12 ProductDetailWidgetStock _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetStock", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetStock>() ?? new ProductDetailWidgetStock(); 13 14 var master_configuration = Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 15 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 16 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 17 18 ProductViewModel product = new ProductViewModel(); 19 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 20 { 21 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 22 } 23 24 bool isVariant = product.VariantId != ""; 25 int variantCount = product?.VariantInfo?.VariantInfo?.Count ?? 0; 26 bool hasVariants = !isVariant ? variantCount > 0 : false; 27 28 bool hideStockForGuests = EcommerceConfiguration.HideStockForGuests; 29 bool enableProductStock = hideStockForGuests ? Pageview.User != null : true; 30 31 double stockAmount = (double)product.StockLevel; 32 string stock = stockAmount.ToString(stockAmount % 1 == 0 ? "N0" : "N2", CultureInfo.GetCultureInfo(Pageview.Area.CultureInfo.TwoLetterISOLanguageName)) ?? ""; 33 string stockFormat = EcommerceConfiguration.StockFormat; 34 bool inStock = stockAmount > 0 || product.NeverOutOfstock; 35 string stockStateClass = inStock ? "pdp-stockstate--instock" : "pdp-stockstate--outofstock"; 36 } 37 38 <div id="@paragraphID" class="pdp-paragraph"> 39 @if(enableProductStock && !string.IsNullOrWhiteSpace(stockFormat)) 40 { 41 <div class="pdp-stockstate__wrapper"> 42 <div> 43 @if(stockFormat == "text") { 44 StockLocation stockLocation = Dynamicweb.Ecommerce.Services.StockService.GetStockLocation(Pageview.Area.StockLocationID); 45 var currentProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, "", Pageview.Area.EcomLanguageId); 46 string stockText = Dynamicweb.Ecommerce.Services.Products.GetStockStatus(currentProduct, stockLocation, Pageview.Area.EcomLanguageId)?.Text; 47 48 if (!string.IsNullOrWhiteSpace(stockText)) 49 { 50 <span class="pdp-stockstate @stockStateClass">@string.Format(stockText, stock)</span> 51 } 52 } 53 else 54 { 55 string translationTag = ""; 56 if(product.NeverOutOfstock) 57 { 58 translationTag = Translate("ProductBlockStockInfo.AmountInStock", "In stock"); 59 } 60 else if(stockAmount == 1) 61 { 62 translationTag = Translate("ProductBlockStockInfo.AmountInStockSingle", "{0} product in stock"); 63 } 64 else if(stockAmount > 1) 65 { 66 translationTag = Translate("ProductBlockStockInfo.AmountInStockMultiple", "{0} products in stock"); 67 } 68 else if(!inStock) 69 { 70 translationTag = Translate("ProductBlockStockInfo.AmountOutOfStock", "Out of stock"); 71 } 72 73 <span class="pdp-stockstate @stockStateClass">@string.Format(translationTag, stock)</span> 74 } 75 @if(!string.IsNullOrWhiteSpace(_data.Suffix)) 76 { 77 <span class="pdp-stockstate__suffix">@_data.Suffix</span> 78 } 79 </div> 80 @if(!string.IsNullOrWhiteSpace(_data.Subline)) 81 { 82 <p class="pdp-stockstate__subline">@_data.Subline</p> 83 } 84 </div> 85 } 86 </div> 87
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetVariantSelector.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_5596cfddf9e7483ea775863fe9c72e83.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetVariantSelector.cshtml:line 17
   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 Dynamicweb.Ecommerce.ProductCatalog; 4 @using Dynamicweb.Ecommerce.Variants; 5 @using Newtonsoft.Json; 6 7 @{ 8 int pageId = Pageview.ID; 9 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 10 11 ProductViewModel product = new ProductViewModel(); 12 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 13 { 14 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 15 } 16 17 string variantSelection = product.VariantId.Replace(".", ","); 18 string[] variantSelectionArr = variantSelection.Split(','); 19 20 List<string[]> variantCombinationsIds = new List<string[]>(); 21 List<List<string>> variantGroupsOptionIds = new List<List<string>>(); 22 23 var variantCombinations = Dynamicweb.Ecommerce.Services.VariantCombinations.GetVariantCombinations(product.Id); 24 var variantGroups = Dynamicweb.Ecommerce.Services.VariantGroups.GetVariantGroupsByProductId(product.Id); 25 26 foreach (var combination in variantCombinations) 27 { 28 variantCombinationsIds.Add(combination.VariantId.Split('.')); 29 } 30 string variantCombinationsIdsJson = JsonConvert.SerializeObject(variantCombinationsIds).Replace("\"", "\'"); 31 32 foreach (var variantGroup in variantGroups) 33 { 34 var variantsObject = new List<string>(); 35 foreach (var variantOption in variantGroup.GetAllVariantOptions()) 36 { 37 if (variantCombinationsIds.Any(ids => ids.Contains(variantOption.Id))) 38 { 39 variantsObject.Add(variantOption.Id); 40 } 41 } 42 if (variantsObject.Count > 0) 43 { 44 variantGroupsOptionIds.Add(variantsObject); 45 } 46 } 47 string variantGroupsOptionIdsJson = JsonConvert.SerializeObject(variantGroupsOptionIds).Replace("\"", "\'"); 48 } 49 50 <div id="@paragraphID" class="pdp-paragraph"> 51 @if(variantGroups.Any()) { 52 <div class="product-variants__wrapper pdp-variants"> 53 <div class="js-variants" data-total-variant-groups="@variantGroups.Count" data-combinations="@variantCombinationsIdsJson" data-variants="@variantGroupsOptionIdsJson" data-current-page-variant="@variantSelection" data-variant-selections="@variantSelection" data-page-id="@pageId" data-product-id="@product.Id" data-group-id="@product.PrimaryOrDefaultGroup.Id"> 54 @foreach (var variantGroup in variantGroups) 55 { 56 bool containsImage = variantGroup.GetAllVariantOptions().Any(v => !string.IsNullOrEmpty(v.SmallImage)); 57 bool containsColor = variantGroup.GetAllVariantOptions().Any(v => !string.IsNullOrEmpty(v.Color)); 58 string variantGroupName = variantGroup.GetName(Pageview.Area.EcomLanguageId); 59 string variantGroupId = variantGroup.Id; 60 var variantGroupOptions = variantGroup.GetAllVariantOptions().Where(o => variantCombinationsIds.Any(ids => ids.Contains(o.Id))); 61 62 <div class="product-variants__block product-variants__block--@variantGroupId"> 63 @if (containsImage || containsColor) 64 { 65 if(!string.IsNullOrWhiteSpace(variantGroupName)) 66 { 67 <p class="product-variants__title">@variantGroupName</p> 68 } 69 70 <div class="product-variants__options-wrapper"> 71 @foreach (VariantOption variantOption in variantGroupOptions) 72 { 73 string variantOptionName = Translate(string.Format("VariantOption.{0}.{1}", variantGroupId, variantOption.Id), variantOption.GetName(Pageview.Area.EcomLanguageId)); 74 string selected = variantSelectionArr.Contains(variantOption.Id) ? "product-variants__btn--checked" : ""; 75 76 if (!string.IsNullOrEmpty(variantOption.SmallImage)) 77 { 78 string variantImage = "/Files/" + variantOption.SmallImage; 79 <div data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn product-variants__btn--image @selected"> 80 <img src="@variantImage" alt="@variantOptionName" title="@variantOptionName" /> 81 </div> 82 } 83 else if (!string.IsNullOrEmpty(variantOption.Color)) 84 { 85 <div data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn product-variants__btn--color @selected"> 86 <span title="@variantOptionName" style="--variant-color: @variantOption.Color;"></span> 87 </div> 88 } 89 else 90 { 91 <button type="button" data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn @selected">@variantOptionName</button> 92 } 93 } 94 </div> 95 } 96 else 97 { 98 if(!string.IsNullOrWhiteSpace(variantGroupName)) 99 { 100 <p class="product-variants__title">@variantGroupName</p> 101 } 102 103 <div class="product-variants__dropdown"> 104 <div class="product-variants__dropdown-wrapper"> 105 106 <button class="product-variants__toggle"> 107 <span data-original="@Translate(string.Format("VariantDropdown.Placeholder.{0}", variantGroupName), "Select your option")">@Translate(string.Format("VariantDropdown.Placeholder.{0}", variantGroupName), "Select your option")</span> 108 <i class="fal fa-chevron-down"></i> 109 </button> 110 111 <div class="product-variants__options-wrapper product-variants__options-wrapper--dropdown product-variants__dropdown-options-wrapper"> 112 @foreach (VariantOption variantOption in variantGroupOptions) 113 { 114 string selected = variantSelectionArr.Contains(variantOption.Id) ? "product-variants__btn--checked" : ""; 115 116 <button type="button" data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn--dropdown @selected"> 117 @Translate(string.Format("VariantOption.{0}.{1}", variantGroupId, variantOption.Id), variantOption.GetName(Pageview.Area.EcomLanguageId)) 118 </button> 119 } 120 </div> 121 </div> 122 </div> 123 } 124 </div> 125 } 126 </div> 127 </div> 128 } 129 </div> 130

Email me when back in stock

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_abade1ae35d44f2d90f43dbf7f847cd9.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetImages.cshtml:line 56
   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 Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 5 @using System.Text.RegularExpressions; 6 7 @using Dynamicweb.Content.Items; 8 @using Dynamicweb.Content.Items.Annotations; 9 @using Dynamicweb.Content.Items.Activation; 10 @using Dynamicweb.Content.Items.Editors; 11 @using Dynamicweb.Content.Items.Metadata; 12 @using System.Collections.Generic; 13 @using System.Linq; 14 @using Bluedesk.DynamicWeb.ItemTypes.Extensions; 15 @using Dynamicweb.Ecommerce.ProductCatalog; 16 17 @{ 18 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 19 ProductDetailWidgetImages _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetImages", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetImages>() ?? new ProductDetailWidgetImages(); 20 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 21 22 ProductViewModel product = new ProductViewModel(); 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 28 bool displayRibbon = _data.DisplayRibbon; 29 bool displayManufacturerLogo = _data.DisplayManufacturerLogo; 30 31 string videoUrl = ProductAndVariants?.ProductDetail?.YoutubeProductVideo ?? ""; 32 string videoId = ""; 33 string origin = Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain(); 34 35 if (!string.IsNullOrWhiteSpace(videoUrl)) 36 { 37 // regex for https://youtu.be/{videoid} 38 Regex regex = new Regex(@".be\/(.[^?]*)"); 39 Match match = regex.Match(videoUrl); 40 if (match.Success) 41 { 42 videoId = match.Groups[1].Value; 43 } 44 45 // regex for https://www.youtube.com/watch?v={videoid} 46 regex = new Regex(@"v=([^&]+)"); 47 match = regex.Match(videoUrl); 48 if (match.Success) 49 { 50 videoId = match.Groups[1].Value; 51 } 52 } 53 54 var prod = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, Pageview.Area.EcomLanguageId); 55 string defaultImage = Dynamicweb.Ecommerce.Services.ProductImages.GetImagePath(prod); 56 var imageLoop = ProductAndVariants.Images?.AssetImages?.Where(x => x.Value != defaultImage).ToList() ?? new List<Image>(); 57 bool hasMultipleImages = imageLoop.Count > 0; 58 } 59 60 <div id="@paragraphID" class="pdp-paragraph w-full @_data.CssClass"> 61 62 <section class="product-detailpage__images pdp__images-container"> 63 <section class="productimages pdp__images"> 64 65 @if (!string.IsNullOrWhiteSpace(defaultImage)) 66 { 67 string colorCode = "color:" + _data.ColorPaginationArrows.GetColorCode(Pageview.AreaID) ?? "transparent"; 68 string displayThumbnails = _data.DisplayThumbnails == false ? "display: none;" : ""; 69 string productRibbon = ProductAndVariants?.ProductDetail?.ProductRibbon ?? ""; 70 71 <section class="productimages__wrapper"> 72 73 @if (displayManufacturerLogo && ProductAndVariants.Manufacturer != null && ProductAndVariants.Manufacturer.Logo != "") 74 { 75 <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" /> 76 } 77 78 @if (!string.IsNullOrWhiteSpace(productRibbon) && displayRibbon) 79 { 80 <p class="product-detailpage__ribbon product-detailpage__ribbon--big"><span>@productRibbon</span></p> 81 } 82 83 <div class="swiper product-swiper" thumbs-swiper=".thumbnails-swiper"> 84 <div class="swiper-wrapper"> 85 <div class="swiper-slide"> 86 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@defaultImage&Format=webp&Quality=-1&width=800&height=800" alt="@product.Name" height="800" width="800" /> 87 </div> 88 89 @if(hasMultipleImages) 90 { 91 foreach (Image Image in imageLoop) 92 { 93 <div class="swiper-slide"> 94 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@Image.Value&Format=webp&Quality=-1&width=800&height=800" alt="@product.Name" /> 95 </div> 96 } 97 } 98 99 @if (!string.IsNullOrWhiteSpace(videoId)) 100 { 101 <div class="swiper-slide"> 102 <div> 103 <lite-youtube videoid="@videoId" params="controls=1&loop=0&playlist=@videoId&playsinline=1&modestbranding=1&mute=0&rel=0&enablejsapi=1&origin=@origin&disablekb=0"></lite-youtube> 104 </div> 105 </div> 106 } 107 </div> 108 109 @if (_data.DisplayPaginationDots) 110 { 111 <div class="swiper-pagination"></div> 112 } 113 114 @if (_data.DisplayImageArrows) 115 { 116 <div class="swiper-button-prev" style="@colorCode"></div> 117 <div class="swiper-button-next" style="@colorCode"></div> 118 } 119 </div> 120 121 </section> 122 123 if (_data.ThumbnailQuantity == 0) 124 { 125 _data.ThumbnailQuantity = 3; 126 } 127 128 if(hasMultipleImages || !string.IsNullOrWhiteSpace(videoId)) 129 { 130 <div class="swiper thumbnails-swiper" style="@displayThumbnails" data-previewnumber="@_data.ThumbnailQuantity"> 131 <div class="swiper-wrapper"> 132 @if (_data.ThumbnailWidth == 0) 133 { 134 _data.ThumbnailWidth = 200; 135 } 136 @if (_data.ThumbnailHeight == 0) 137 { 138 _data.ThumbnailHeight = 200; 139 } 140 141 <div class="swiper-slide"> 142 <img class="product-image" src="/Admin/Public/GetImage.ashx?Image=@defaultImage&Format=webp&Quality=-1&width=@_data.ThumbnailWidth&height=@_data.ThumbnailHeight" alt="@product.Name" height="@_data.ThumbnailHeight" width="@_data.ThumbnailWidth" /> 143 </div> 144 145 146 @if(hasMultipleImages) 147 { 148 foreach (Image Thumb in imageLoop) 149 { 150 <div class="swiper-slide"> 151 <img class="product-image" src="/Admin/Public/GetImage.ashx?Image=@Thumb.Value&Crop=7&Format=webp&Quality=90&Compression=80&width=@_data.ThumbnailWidth&height=@_data.ThumbnailHeight" alt="Thumbnail @product.Name" width="@_data.ThumbnailWidth" height="@_data.ThumbnailHeight" /> 152 </div> 153 } 154 } 155 156 @if (!string.IsNullOrWhiteSpace(videoId)) 157 { 158 string thumbnailWidth = "width:" + _data.ThumbnailWidth + "px;"; 159 string thumbnailHeight = "height:" + _data.ThumbnailHeight + "px;"; 160 string iconPositionWidth = "left:" + (_data.ThumbnailWidth / 2 - 12).ToString() + "px;"; 161 string iconPositionHeight = "top:" + (_data.ThumbnailHeight / 2 - 12).ToString() + "px;"; 162 163 <div class="swiper-slide"> 164 <div class="productimages__thumbnail productimages__thumbnail--video" style="@thumbnailWidth @thumbnailHeight"> 165 <img class="h-full" src="https://i.ytimg.com/vi_webp/@videoId/hqdefault.webp" alt="Video preview @ProductAndVariants.ProductInfo.Name" /> 166 <span class="video-icon" style="@iconPositionWidth @iconPositionHeight"> 167 <i class="fas fa-play"></i> 168 </span> 169 </div> 170 </div> 171 } 172 173 </div> 174 175 @if (_data.DisplayThumbnailArrows) 176 { 177 <div class="swiper-button-prev" style="@colorCode"></div> 178 <div class="swiper-button-next" style="@colorCode"></div> 179 } 180 </div> 181 } 182 } 183 </section> 184 </section> 185 </div> 186 187

Dit is een header

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque consequat est sed nunc vulputate, ac venenatis mauris faucibus. Nulla sollicitudin nisi varius, sollicitudin tellus vel, ultricies elit. Nunc malesuada sagittis ante, vel blandit odio bibendum sit amet. Aliquam erat volutpat. In eros tellus, gravida sed erat eu, dignissim semper urna. Aenean vulputate tempor fringilla. Suspendisse molestie dictum enim eu dapibus. Mauris id lorem convallis, dictum nibh at, maximus odio. Duis sem arcu, sollicitudin a fermentum ac, elementum aliquet augue. Morbi eget nunc magna. Vivamus lacus nunc, laoreet at venenatis et, rhoncus et est. Duis aliquam condimentum lorem, at convallis massa rhoncus at.

Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetReviews.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f54be2b316ac4f8f88ae5a8b25e9466d.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetReviews.cshtml:line 34
   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 Dynamicweb.Content.Commenting; 4 @using Dynamicweb.Ecommerce.ProductCatalog; 5 6 @using Dynamicweb; 7 @using System; 8 @using Dynamicweb.Rendering 9 @using System.Collections.Generic; 10 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 11 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 12 @using System.Linq; 13 @using Dynamicweb.Content; 14 @using Dynamicweb.Ecommerce.Prices; 15 @using System.Text.RegularExpressions; 16 17 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 18 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 19 20 @{ 21 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 22 ProductDetailWidgetReviews _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetReviews", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetReviews>() ?? new ProductDetailWidgetReviews(); 23 ProductAndVariantsObj _product = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 24 25 ProductViewModel product = new ProductViewModel(); 26 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 27 { 28 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 29 } 30 31 CommentCollection comments = Comment.GetComments("ecomProduct", product.Id, Pageview.Area.EcomLanguageId); 32 33 string reviewTranslationKey = Translate("Reviews.Amount.Multiple", "{0} reviews"); 34 if (_product.ProductInfo.ReviewCount == 1) 35 { 36 reviewTranslationKey = Translate("Reviews.Amount.Singular", "{0} review"); 37 } 38 39 // bool displayCommentCount = _data.DisplayCommentCount; 40 } 41 @if (_product.ProductInfo.ReviewCount > 0) { 42 43 <div id="PdpReviewModule" class="review-paragraph"> 44 <div class="container review-paragraph__container"> 45 <div class="review-paragraph__summary"> 46 47 <div class="review-summary__column"> 48 <h2 class="review-summary__title">@Translate("Reviews.Title", "Customer reviews")</h2> 49 <div class="review-summary__container"> 50 <div class="review-summary__indicator GeneralIndicator"> 51 @renderReviewIndicator("var(--BaseColorSecondary)", _product.ProductInfo.Rating, "row", true, _product.ProductInfo.ReviewCount) 52 </div> 53 </div> 54 </div> 55 56 @{ 57 if (_product.ProductInfo.CommentsAndReviews != null) 58 { 59 60 <div class="review-paragraph__comments"> 61 62 @foreach (Comments Comment in _product.ProductInfo.CommentsAndReviews) 63 { 64 <section class="review-comment__list-item"> 65 <div class="review-comment__header"> 66 <div class="review-comment__rating-wrapper"> 67 @renderReviewIndicator("var(--BaseColorContrast)", Comment.CommentRating, "row", false, 0) 68 <label class="review-comment__name">@Comment.CommentName</label> 69 </div> 70 </div> 71 <div class="review-comment__message"> 72 <p>@Comment.CommentText</p> 73 </div> 74 <p class="review-comment__meta"> 75 @if (_data.ShowCreateDate) {<text> - @Comment.CommentCreatedDate</text>} 76 </p> 77 </section> 78 } 79 80 </div> 81 82 } 83 } 84 85 @*<div class="review-summary__column"> 86 @if (Dynamicweb.Context.Current.Request["reviewcmd"] != null && Dynamicweb.Context.Current.Request["reviewcmd"] == "created") 87 { 88 <h2 class="review-summary__title">@Translate("Reviews.Submitted.Title", "Thanks for your review")</h2> 89 <p>@Translate("Reviews.Submitted.Text", "Thank you for submitting your review.")</p> 90 } 91 else 92 { 93 <h2 class="review-summary__title">@Translate("Reviews.Create.Text", "Write a review")</h2> 94 <p>@Translate("Reviews.Create.Text", "Share your thoughts about this product with other customers.")</p> 95 <div class="review-summary__btn-wrapper"> 96 <a href="#" class="btn btn__primary toggle-of-canvas-menu" data-offcanvas-target="reviewcreate"> 97 <span class="btn__text">@Translate("Reviews.Create.Button", "Write a review")</span> 98 <i class="btn__icon fal fa-plus"></i> 99 </a> 100 </div> 101 } 102 </div>*@ 103 </div> 104 105 </div> 106 </div> 107 108 } 109 110 @functions{ 111 112 public string renderReviewIndicator(string progressbarColor, float value, string flexDirection, bool boolReviews, int CommentCount) 113 { 114 115 float ratingPercentage = (100 / 5) * value; 116 string CommentCountString = boolReviews == true ? $"({CommentCount} reviews)" : ""; 117 118 string Template = $@" 119 <section style='display: flex; flex-direction: {flexDirection}; position: relative; align - items: center;'> 120 <div class='reviews__indicator' style='display: flex; flex-direction: row;'> 121 <div class='reviews__indicator-progressbar' style='width: {ratingPercentage.ToString()}%; background-color: {progressbarColor};' ></div> 122 <ul class='reviews__indicator-star-list'> 123 <li class='reviews__indicator-star-list-item'></li> 124 <li class='reviews__indicator-star-list-item'></li> 125 <li class='reviews__indicator-star-list-item'></li> 126 <li class='reviews__indicator-star-list-item'></li> 127 <li class='reviews__indicator-star-list-item'></li> 128 </ul> 129 </div> 130 <span class='CommentCountString' style='display: flex; position: relative; font-size: 12px; line-height: initial;'> 131 {value} / 5 {CommentCountString} 132 </span> 133 </section> 134 "; 135 136 return Template; 137 } 138 139 } 140

Dit is een header

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque consequat est sed nunc vulputate, ac venenatis mauris faucibus. Nulla sollicitudin nisi varius, sollicitudin tellus vel, ultricies elit. Nunc malesuada sagittis ante, vel blandit odio bibendum sit amet. Aliquam erat volutpat. In eros tellus, gravida sed erat eu, dignissim semper urna. Aenean vulputate tempor fringilla. Suspendisse molestie dictum enim eu dapibus. Mauris id lorem convallis, dictum nibh at, maximus odio. Duis sem arcu, sollicitudin a fermentum ac, elementum aliquet augue. Morbi eget nunc magna. Vivamus lacus nunc, laoreet at venenatis et, rhoncus et est. Duis aliquam condimentum lorem, at convallis massa rhoncus at.

Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetReviews.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f54be2b316ac4f8f88ae5a8b25e9466d.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetReviews.cshtml:line 34
   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 Dynamicweb.Content.Commenting; 4 @using Dynamicweb.Ecommerce.ProductCatalog; 5 6 @using Dynamicweb; 7 @using System; 8 @using Dynamicweb.Rendering 9 @using System.Collections.Generic; 10 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 11 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 12 @using System.Linq; 13 @using Dynamicweb.Content; 14 @using Dynamicweb.Ecommerce.Prices; 15 @using System.Text.RegularExpressions; 16 17 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 18 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 19 20 @{ 21 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 22 ProductDetailWidgetReviews _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetReviews", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetReviews>() ?? new ProductDetailWidgetReviews(); 23 ProductAndVariantsObj _product = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 24 25 ProductViewModel product = new ProductViewModel(); 26 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 27 { 28 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 29 } 30 31 CommentCollection comments = Comment.GetComments("ecomProduct", product.Id, Pageview.Area.EcomLanguageId); 32 33 string reviewTranslationKey = Translate("Reviews.Amount.Multiple", "{0} reviews"); 34 if (_product.ProductInfo.ReviewCount == 1) 35 { 36 reviewTranslationKey = Translate("Reviews.Amount.Singular", "{0} review"); 37 } 38 39 // bool displayCommentCount = _data.DisplayCommentCount; 40 } 41 @if (_product.ProductInfo.ReviewCount > 0) { 42 43 <div id="PdpReviewModule" class="review-paragraph"> 44 <div class="container review-paragraph__container"> 45 <div class="review-paragraph__summary"> 46 47 <div class="review-summary__column"> 48 <h2 class="review-summary__title">@Translate("Reviews.Title", "Customer reviews")</h2> 49 <div class="review-summary__container"> 50 <div class="review-summary__indicator GeneralIndicator"> 51 @renderReviewIndicator("var(--BaseColorSecondary)", _product.ProductInfo.Rating, "row", true, _product.ProductInfo.ReviewCount) 52 </div> 53 </div> 54 </div> 55 56 @{ 57 if (_product.ProductInfo.CommentsAndReviews != null) 58 { 59 60 <div class="review-paragraph__comments"> 61 62 @foreach (Comments Comment in _product.ProductInfo.CommentsAndReviews) 63 { 64 <section class="review-comment__list-item"> 65 <div class="review-comment__header"> 66 <div class="review-comment__rating-wrapper"> 67 @renderReviewIndicator("var(--BaseColorContrast)", Comment.CommentRating, "row", false, 0) 68 <label class="review-comment__name">@Comment.CommentName</label> 69 </div> 70 </div> 71 <div class="review-comment__message"> 72 <p>@Comment.CommentText</p> 73 </div> 74 <p class="review-comment__meta"> 75 @if (_data.ShowCreateDate) {<text> - @Comment.CommentCreatedDate</text>} 76 </p> 77 </section> 78 } 79 80 </div> 81 82 } 83 } 84 85 @*<div class="review-summary__column"> 86 @if (Dynamicweb.Context.Current.Request["reviewcmd"] != null && Dynamicweb.Context.Current.Request["reviewcmd"] == "created") 87 { 88 <h2 class="review-summary__title">@Translate("Reviews.Submitted.Title", "Thanks for your review")</h2> 89 <p>@Translate("Reviews.Submitted.Text", "Thank you for submitting your review.")</p> 90 } 91 else 92 { 93 <h2 class="review-summary__title">@Translate("Reviews.Create.Text", "Write a review")</h2> 94 <p>@Translate("Reviews.Create.Text", "Share your thoughts about this product with other customers.")</p> 95 <div class="review-summary__btn-wrapper"> 96 <a href="#" class="btn btn__primary toggle-of-canvas-menu" data-offcanvas-target="reviewcreate"> 97 <span class="btn__text">@Translate("Reviews.Create.Button", "Write a review")</span> 98 <i class="btn__icon fal fa-plus"></i> 99 </a> 100 </div> 101 } 102 </div>*@ 103 </div> 104 105 </div> 106 </div> 107 108 } 109 110 @functions{ 111 112 public string renderReviewIndicator(string progressbarColor, float value, string flexDirection, bool boolReviews, int CommentCount) 113 { 114 115 float ratingPercentage = (100 / 5) * value; 116 string CommentCountString = boolReviews == true ? $"({CommentCount} reviews)" : ""; 117 118 string Template = $@" 119 <section style='display: flex; flex-direction: {flexDirection}; position: relative; align - items: center;'> 120 <div class='reviews__indicator' style='display: flex; flex-direction: row;'> 121 <div class='reviews__indicator-progressbar' style='width: {ratingPercentage.ToString()}%; background-color: {progressbarColor};' ></div> 122 <ul class='reviews__indicator-star-list'> 123 <li class='reviews__indicator-star-list-item'></li> 124 <li class='reviews__indicator-star-list-item'></li> 125 <li class='reviews__indicator-star-list-item'></li> 126 <li class='reviews__indicator-star-list-item'></li> 127 <li class='reviews__indicator-star-list-item'></li> 128 </ul> 129 </div> 130 <span class='CommentCountString' style='display: flex; position: relative; font-size: 12px; line-height: initial;'> 131 {value} / 5 {CommentCountString} 132 </span> 133 </section> 134 "; 135 136 return Template; 137 } 138 139 } 140
Error compiling template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetProductCarousel.cshtml"
Line 61: The type or namespace name 'ProductDetailWidgetProductCarousel' could not be found (are you missing a using directive or an assembly reference?)
Line 61: 'Services' is obsolete: 'Use Dynamicweb.Content.Services instead.'
Line 61: 'Services.Items' is obsolete: 'Use Dynamicweb.Content.Services.Items instead.'
Line 61: The type or namespace name 'ProductDetailWidgetProductCarousel' could not be found (are you missing a using directive or an assembly reference?)
Line 61: The type or namespace name 'ProductDetailWidgetProductCarousel' could not be found (are you missing a using directive or an assembly reference?)

1 //------------------------------------------------------------------------------ 2 // <auto-generated> 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319.42000 5 // 6 // Changes to this file may cause incorrect behavior and will be lost if 7 // the code is regenerated. 8 // </auto-generated> 9 //------------------------------------------------------------------------------ 10 11 namespace CompiledRazorTemplates.Dynamic { 12 using System; 13 using System.Collections.Generic; 14 using System.Linq; 15 16 #line 3 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 17 using Dynamicweb.Ecommerce.ProductCatalog; 18 19 #line default 20 #line hidden 21 22 #line 4 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 23 using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 24 25 #line default 26 #line hidden 27 28 #line 5 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 29 using Dynamicweb.Ecommerce.Extensibility.Provider; 30 31 #line default 32 #line hidden 33 34 #line 6 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 35 using Dynamicweb.Ecommerce.Products; 36 37 #line default 38 #line hidden 39 40 #line 7 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 41 using Dynamicweb.Ecommerce.Specialized.RelatedProductListProviders; 42 43 #line default 44 #line hidden 45 46 47 public class RazorEngine_4147587c4aa147eca89c9394f80054a7 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> { 48 49 #line hidden 50 51 public RazorEngine_4147587c4aa147eca89c9394f80054a7() { 52 } 53 54 public override void Execute() { 55 WriteLiteral("\r\n"); 56 57 58 #line 9 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 59 60 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 61 ProductDetailWidgetProductCarousel _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetProductCarousel", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetProductCarousel>() ?? new ProductDetailWidgetProductCarousel(); 62 63 ProductViewModel product = new ProductViewModel(); 64 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 65 { 66 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 67 } 68 69 string urlParams = ""; 70 string groupOption = _data.GroupOption; 71 IList<string> relatedProductIds = new List<string> { }; 72 urlParams += "&SortOrder=DESC"; 73 urlParams += $"&PageSize={_data.ProductAmount}"; 74 75 if(groupOption == "popular") 76 { 77 urlParams += "&SortBy=OrderCountGrowth"; 78 } 79 80 if(groupOption == "most-sold") 81 { 82 urlParams += "&SortBy=OrderCount"; 83 } 84 85 if(groupOption == "recently-viewed") 86 { 87 List<Product> YouHaveSeenTheseProductsList = new YouHaveSeenTheseProductsList().GetCollection(new RelatedProductListProviderEventArgs()).Reverse().Take(_data.ProductAmount).ToList(); 88 if(YouHaveSeenTheseProductsList.Any()) 89 { 90 foreach (Product recentProduct in YouHaveSeenTheseProductsList) 91 { 92 relatedProductIds.Add(recentProduct.Id); 93 } 94 string productIds = string.Join(",", relatedProductIds); 95 urlParams += !string.IsNullOrEmpty(productIds) ? "&ProductIDs=" + productIds : ""; 96 } 97 } 98 99 if(groupOption == "related" && product.RelatedGroups != null) 100 { 101 var relatedGroup = product.RelatedGroups.Where(g => g.Id == _data.RelatedGroupID).First(); 102 foreach (var relatedProduct in relatedGroup.Products) 103 { 104 relatedProductIds.Add(relatedProduct.ProductId); 105 } 106 string productIds = string.Join(",", relatedProductIds); 107 urlParams += !string.IsNullOrEmpty(productIds) ? "&ProductIDs=" + productIds : ""; 108 } 109 110 string link = "/Default.aspx?ID=1718&LayoutTemplate=VisualEditorPageAPI.cshtml" + urlParams; 111 string relatedGroupName = _data.Header; 112 113 114 115 #line default 116 #line hidden 117 WriteLiteral("\r\n\r\n<div"); 118 119 WriteAttribute("id", Tuple.Create(" id=\"", 2387), Tuple.Create("\"", 2404) 120 121 #line 65 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 122 , Tuple.Create(Tuple.Create("", 2392), Tuple.Create<System.Object, System.Int32>(paragraphID 123 124 #line default 125 #line hidden 126 , 2392), false) 127 ); 128 129 WriteAttribute("class", Tuple.Create(" class=\"", 2405), Tuple.Create("\"", 2454) 130 , Tuple.Create(Tuple.Create("", 2413), Tuple.Create("pdp-paragraph", 2413), true) 131 , Tuple.Create(Tuple.Create(" ", 2426), Tuple.Create("pdp-paragraph__", 2427), true) 132 133 #line 65 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 134 , Tuple.Create(Tuple.Create("", 2442), Tuple.Create<System.Object, System.Int32>(paragraphID 135 136 #line default 137 #line hidden 138 , 2442), false) 139 ); 140 141 WriteLiteral(">\r\n\t<section"); 142 143 WriteLiteral(" class=\"products-module__container\""); 144 145 WriteLiteral(">\r\n\t\t<div"); 146 147 WriteLiteral(" class=\"container\""); 148 149 WriteLiteral(">\r\n\t\t\t\r\n"); 150 151 152 #line 69 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 153 154 155 #line default 156 #line hidden 157 158 #line 69 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 159 if(!string.IsNullOrWhiteSpace(relatedGroupName)) 160 { 161 162 163 #line default 164 #line hidden 165 WriteLiteral("\t\t\t\t<header"); 166 167 WriteLiteral(" class=\"products-module__header\""); 168 169 WriteLiteral(">\r\n\t\t\t\t\t<h2"); 170 171 WriteLiteral(" class=\"products-module__title\""); 172 173 WriteLiteral(">"); 174 175 176 #line 72 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 177 Write(relatedGroupName); 178 179 180 #line default 181 #line hidden 182 WriteLiteral("</h2>\r\n\t\t\t\t</header>\r\n"); 183 184 185 #line 74 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 186 } 187 188 189 #line default 190 #line hidden 191 WriteLiteral("\r\n\t\t\t<div"); 192 193 WriteLiteral(" class=\"product-carousel\""); 194 195 WriteLiteral(" data-url=\""); 196 197 198 #line 76 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 199 Write(link); 200 201 202 #line default 203 #line hidden 204 WriteLiteral("\""); 205 206 WriteLiteral(" data-id=\""); 207 208 209 #line 76 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 210 Write(paragraphID); 211 212 213 #line default 214 #line hidden 215 WriteLiteral("\""); 216 217 WriteLiteral("></div>\r\n\t\t\r\n\t\t</div>\r\n\t</section>\r\n</div>\r\n\r\n<script"); 218 219 WriteLiteral(" type=\"module\""); 220 221 WriteLiteral(" src=\"https://unpkg.com/flickity@2/dist/flickity.pkgd.min.js\""); 222 223 WriteLiteral("></script>\r\n<script"); 224 225 WriteLiteral(" type=\"module\""); 226 227 WriteLiteral(">\r\n\r\n\tdocument.addEventListener(\'initCarousel__"); 228 229 230 #line 85 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 231 Write(paragraphID); 232 233 234 #line default 235 #line hidden 236 WriteLiteral("\', function () {\r\n\t\tvar carousel = document.querySelector(\".pdp-paragraph__"); 237 238 239 #line 86 "C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductCarousel.cshtml" 240 Write(paragraphID); 241 242 243 #line default 244 #line hidden 245 WriteLiteral(" .products-module__container--carousel\");\r\n\r\n\t\tif(carousel) {\r\n\t\t\tvar flkty = new" + 246 " Flickity(carousel, {\r\n\t\t\t\tcellAlign: \'left\',\r\n\t\t\t\tcontain: true,\r\n\t\t\t\tpageDots:" + 247 " false\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n</script>\r\n"); 248 249 } 250 } 251 } 252

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 3 @using Dynamicweb.Ecommerce.ProductCatalog; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 5 @using Dynamicweb.Ecommerce.Extensibility.Provider; 6 @using Dynamicweb.Ecommerce.Products; 7 @using Dynamicweb.Ecommerce.Specialized.RelatedProductListProviders; 8 9 @{ 10 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 11 ProductDetailWidgetProductCarousel _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetProductCarousel", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetProductCarousel>() ?? new ProductDetailWidgetProductCarousel(); 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 string urlParams = ""; 20 string groupOption = _data.GroupOption; 21 IList<string> relatedProductIds = new List<string> { }; 22 urlParams += "&SortOrder=DESC"; 23 urlParams += $"&PageSize={_data.ProductAmount}"; 24 25 if(groupOption == "popular") 26 { 27 urlParams += "&SortBy=OrderCountGrowth"; 28 } 29 30 if(groupOption == "most-sold") 31 { 32 urlParams += "&SortBy=OrderCount"; 33 } 34 35 if(groupOption == "recently-viewed") 36 { 37 List<Product> YouHaveSeenTheseProductsList = new YouHaveSeenTheseProductsList().GetCollection(new RelatedProductListProviderEventArgs()).Reverse().Take(_data.ProductAmount).ToList(); 38 if(YouHaveSeenTheseProductsList.Any()) 39 { 40 foreach (Product recentProduct in YouHaveSeenTheseProductsList) 41 { 42 relatedProductIds.Add(recentProduct.Id); 43 } 44 string productIds = string.Join(",", relatedProductIds); 45 urlParams += !string.IsNullOrEmpty(productIds) ? "&ProductIDs=" + productIds : ""; 46 } 47 } 48 49 if(groupOption == "related" && product.RelatedGroups != null) 50 { 51 var relatedGroup = product.RelatedGroups.Where(g => g.Id == _data.RelatedGroupID).First(); 52 foreach (var relatedProduct in relatedGroup.Products) 53 { 54 relatedProductIds.Add(relatedProduct.ProductId); 55 } 56 string productIds = string.Join(",", relatedProductIds); 57 urlParams += !string.IsNullOrEmpty(productIds) ? "&ProductIDs=" + productIds : ""; 58 } 59 60 string link = "/Default.aspx?ID=1718&LayoutTemplate=VisualEditorPageAPI.cshtml" + urlParams; 61 string relatedGroupName = _data.Header; 62 63 } 64 65 <div id="@paragraphID" class="pdp-paragraph pdp-paragraph__@paragraphID"> 66 <section class="products-module__container"> 67 <div class="container"> 68 69 @if(!string.IsNullOrWhiteSpace(relatedGroupName)) 70 { 71 <header class="products-module__header"> 72 <h2 class="products-module__title">@relatedGroupName</h2> 73 </header> 74 } 75 76 <div class="product-carousel" data-url="@link" data-id="@paragraphID"></div> 77 78 </div> 79 </section> 80 </div> 81 82 <script type="module" src="https://unpkg.com/flickity@2/dist/flickity.pkgd.min.js"></script> 83 <script type="module"> 84 85 document.addEventListener('initCarousel__@paragraphID', function () { 86 var carousel = document.querySelector(".pdp-paragraph__@paragraphID .products-module__container--carousel"); 87 88 if(carousel) { 89 var flkty = new Flickity(carousel, { 90 cellAlign: 'left', 91 contain: true, 92 pageDots: false 93 }); 94 } 95 }); 96 97 </script> 98
Template file not found (in RenderRazorTemplate()): C:\home\site\wwwroot\files\Templates\Paragraph\ProductDetailWidgetRelatedProductsBasic.cshtml
Button 1 Button 2
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetPrice.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_13c5e04c34ce40bc8d194bfd88049191.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetPrice.cshtml:line 34
   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.Prices; 3 @using Dynamicweb.Ecommerce.ProductCatalog; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 5 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 6 7 @{ 8 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 9 ProductDetailWidgetPrice _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetPrice", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetPrice>() ?? new ProductDetailWidgetPrice(); 10 11 var master_configuration = Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 12 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 13 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 14 15 ProductViewModel product = new ProductViewModel(); 16 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 17 { 18 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 19 } 20 21 bool WithVATBool = Pageview.Area.EcomPricesWithVat == "True"; 22 bool pricesWithoutVatForUsers = EcommerceConfiguration.ShowPricesWithoutVatForUsers; 23 bool pricesWithoutVatForValidVat = EcommerceConfiguration.ShowPricesWithoutVatWhenValidVatNumber; 24 if(pricesWithoutVatForUsers && !pricesWithoutVatForValidVat && Pageview.User != null) { 25 WithVATBool = false; 26 } 27 if(pricesWithoutVatForValidVat && Pageview.User != null && !string.IsNullOrWhiteSpace(Pageview.User.VatRegNumber)) { 28 WithVATBool = false; 29 } 30 31 bool hidePricesForGuests = EcommerceConfiguration.HidePricesForGuests; 32 bool hideZeroPrices = EcommerceConfiguration.HideZeroPrices; 33 bool displayPrice = hidePricesForGuests ? Pageview.User != null : true; 34 bool pricezero = product.Price.Price <= 0; 35 36 bool displayProductPrice = displayPrice; 37 if (hideZeroPrices && pricezero) 38 { 39 displayProductPrice = false; 40 } 41 42 string ProductdetailPriceSuffixWithVAT = Translate("Productdetail.Price.Suffix.WithVAT", "Incl. VAT"); 43 string ProductdetailPriceSuffixWithoutVAT = Translate("Productdetail.Price.Suffix.WithoutVAT", "Excl. VAT"); 44 string ProductdetailPriceSuffix = WithVATBool ? ProductdetailPriceSuffixWithVAT : ProductdetailPriceSuffixWithoutVAT; 45 46 var gtmValue = WithVATBool ? product.Price.PriceWithVat : product.Price.PriceWithoutVat; 47 var priceFormatted = WithVATBool ? product.Price.PriceWithVatFormatted : product.Price.PriceWithoutVatFormatted; 48 var priceBeforeDiscount = WithVATBool ? product.PriceBeforeDiscount.PriceWithVat : product.PriceBeforeDiscount.PriceWithoutVat; 49 var priceBeforeDiscountFormatted = WithVATBool ? product.PriceBeforeDiscount.PriceWithVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; 50 var priceTotalDiscount = WithVATBool ? product.Discount.PriceWithVat : product.Discount.PriceWithoutVat; 51 var priceTotalDiscountFormatted = WithVATBool ? product.Discount.PriceWithVatFormatted : product.Discount.PriceWithoutVatFormatted; 52 double discountPercentage = Math.Round(((priceTotalDiscount / priceBeforeDiscount) * -100)); 53 bool hasDiscount = product.Discount.Price > 0; 54 55 string informativePrice = WithVATBool ? product.PriceInformative.PriceWithVatFormatted : product.PriceInformative.PriceWithoutVatFormatted; 56 if (EcommerceConfiguration.UseInformativePriceAsFromPrice && !string.IsNullOrWhiteSpace(informativePrice)) 57 { 58 double informativePriceValue = WithVATBool ? product.PriceInformative.PriceWithVat : product.PriceInformative.PriceWithoutVat; 59 hasDiscount = gtmValue < informativePriceValue; 60 if (hasDiscount) 61 { 62 priceBeforeDiscountFormatted = informativePrice; 63 discountPercentage = Math.Round((((gtmValue - informativePriceValue) / informativePriceValue) * 100)); 64 65 double yourProfitValue = informativePriceValue - gtmValue; 66 priceTotalDiscountFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = yourProfitValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = yourProfitValue }.PriceWithoutVATFormatted; 67 } 68 } 69 70 string retailPrice = ""; 71 bool displayRetailPrice = EcommerceConfiguration.DisplayRetailPrice; 72 if(EcommerceConfiguration.DisplayRetailPriceForUsers && Pageview.User == null) { 73 displayRetailPrice = false; 74 } 75 if(displayRetailPrice) { 76 string priceFieldName = EcommerceConfiguration.RetailPriceField; 77 if(EcommerceConfiguration.RetailPriceIsDbPrice) { 78 var p = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, Pageview.Area.EcomLanguageId); 79 PriceContext customerPriceContext = new PriceContext(Dynamicweb.Ecommerce.Common.Context.Currency, Dynamicweb.Ecommerce.Common.Context.Country, null, null, Dynamicweb.Ecommerce.Common.Context.ReverseChargeForVatEnabled, DateTime.Now); 80 var customerPrice = p?.GetPrice(customerPriceContext); 81 if(customerPrice.Price > 0) { 82 retailPrice = WithVATBool ? customerPrice.PriceWithVATFormatted : customerPrice.PriceWithoutVATFormatted; 83 } 84 } else if(!string.IsNullOrWhiteSpace(priceFieldName)) { 85 double customerPriceValue = 0.0; 86 if (product.ProductFields.TryGetValue(priceFieldName, out var fieldValue) && fieldValue.Value is double) { 87 customerPriceValue = (double)fieldValue.Value; 88 } 89 if(customerPriceValue > 0) { 90 retailPrice = WithVATBool ? new PriceInfo { PriceWithVAT = customerPriceValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = customerPriceValue }.PriceWithoutVATFormatted; 91 } 92 } 93 } 94 95 bool isVariant = product.VariantId != ""; 96 int variantCount = product?.VariantInfo?.VariantInfo?.Count ?? 0; 97 bool hasVariants = !isVariant ? variantCount > 0 : false; 98 } 99 100 <div id="@paragraphID" class="pdp-paragraph @_data.CssClass"> 101 @if (displayPrice && displayProductPrice) 102 { 103 <div class="pdp-price__container"> 104 @if(!isVariant && hasVariants) 105 { 106 string minPrice = WithVATBool ? product.VariantInfo.PriceMin.PriceWithVatFormatted : product.VariantInfo.PriceMin.PriceWithoutVatFormatted; 107 string maxPrice = WithVATBool ? product.VariantInfo.PriceMax.PriceWithVatFormatted : product.VariantInfo.PriceMax.PriceWithoutVatFormatted; 108 109 <section class="pdp-price__subcontainer"> 110 @if(minPrice != maxPrice) 111 { 112 <span class="pdp-price">@minPrice - @maxPrice</span> 113 } 114 else 115 { 116 <span class="pdp-price">@minPrice</span> 117 } 118 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 119 </section> 120 } 121 else 122 { 123 if (hasDiscount) 124 { 125 <p class="pdp-price--original">@priceBeforeDiscountFormatted</p> 126 <section class="pdp-price__subcontainer"> 127 <span class="pdp-price">@priceFormatted</span> 128 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 129 <span class="pdp-price__percentage">@discountPercentage%</span> 130 </section> 131 } 132 else 133 { 134 <section class="pdp-price__subcontainer"> 135 <span class="pdp-price">@priceFormatted</span> 136 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 137 </section> 138 } 139 if (!string.IsNullOrWhiteSpace(retailPrice)) 140 { 141 <p class="pdp-price__retail-price"> 142 @String.Format(Translate("ProductBlockTitle.RetailPrice", "Retail price: {0}"), retailPrice) 143 </p> 144 } 145 if (hasDiscount) 146 { 147 <p class="pdp-price__yourprofit"> 148 @Translate("Productdetail.YourProfitLabel", "Your profit:") @priceTotalDiscountFormatted 149 </p> 150 } 151 } 152 </div> 153 154 if(displayPrice && displayProductPrice && product.Prices.Any()) { 155 var priceList = new List<object>(); 156 var loopIndex = 1; 157 158 foreach (var volumePrice in product.Prices) 159 { 160 double volumePriceQuantity = volumePrice.Quantity; 161 162 if (volumePriceQuantity > 1) 163 { 164 double newVolumePriceVal = WithVATBool ? volumePrice.Price.PriceWithVat : volumePrice.Price.PriceWithoutVat; 165 double productPriceVal = WithVATBool ? product.Price.PriceWithVat : product.Price.PriceWithoutVat; 166 167 double newVolumePrice = Math.Round(newVolumePriceVal * volumePrice.Quantity, 2); 168 string newVolumePriceFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = newVolumePrice }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = newVolumePrice }.PriceWithoutVATFormatted; 169 170 double diffVolumePrice = Math.Round((productPriceVal - newVolumePriceVal) * volumePrice.Quantity, 2); 171 string diffVolumePriceFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = diffVolumePrice }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = diffVolumePrice }.PriceWithoutVATFormatted; 172 173 var priceObj = new 174 { 175 discountId = loopIndex, 176 newVolumePriceFormatted = newVolumePriceFormatted, 177 diffVolumePriceFormatted = diffVolumePriceFormatted, 178 unitPriceFormatted = WithVATBool ? volumePrice.Price.PriceWithVatFormatted : volumePrice.Price.PriceWithoutVatFormatted, 179 quantity = volumePriceQuantity 180 }; 181 priceList.Add(priceObj); 182 } 183 loopIndex++; 184 } 185 186 string pricesJson = Newtonsoft.Json.JsonConvert.SerializeObject(priceList); 187 188 <div class="app-volumeprices" data-price-list='@pricesJson'></div> 189 } 190 } 191 </div> 192
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetStock.cshtml"
System.InvalidOperationException: Nullable object must have a value.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Nullable`1.get_Value()
   at CompiledRazorTemplates.Dynamic.RazorEngine_7584b63361034ca4b1e4ba95a0850cbc.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetStock.cshtml:line 31
   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.Ecommerce.Stocks; 4 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 5 @using System.Globalization; 6 7 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 8 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 9 10 @{ 11 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 12 ProductDetailWidgetStock _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetStock", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetStock>() ?? new ProductDetailWidgetStock(); 13 14 var master_configuration = Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 15 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 16 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 17 18 ProductViewModel product = new ProductViewModel(); 19 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 20 { 21 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 22 } 23 24 bool isVariant = product.VariantId != ""; 25 int variantCount = product?.VariantInfo?.VariantInfo?.Count ?? 0; 26 bool hasVariants = !isVariant ? variantCount > 0 : false; 27 28 bool hideStockForGuests = EcommerceConfiguration.HideStockForGuests; 29 bool enableProductStock = hideStockForGuests ? Pageview.User != null : true; 30 31 double stockAmount = (double)product.StockLevel; 32 string stock = stockAmount.ToString(stockAmount % 1 == 0 ? "N0" : "N2", CultureInfo.GetCultureInfo(Pageview.Area.CultureInfo.TwoLetterISOLanguageName)) ?? ""; 33 string stockFormat = EcommerceConfiguration.StockFormat; 34 bool inStock = stockAmount > 0 || product.NeverOutOfstock; 35 string stockStateClass = inStock ? "pdp-stockstate--instock" : "pdp-stockstate--outofstock"; 36 } 37 38 <div id="@paragraphID" class="pdp-paragraph"> 39 @if(enableProductStock && !string.IsNullOrWhiteSpace(stockFormat)) 40 { 41 <div class="pdp-stockstate__wrapper"> 42 <div> 43 @if(stockFormat == "text") { 44 StockLocation stockLocation = Dynamicweb.Ecommerce.Services.StockService.GetStockLocation(Pageview.Area.StockLocationID); 45 var currentProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, "", Pageview.Area.EcomLanguageId); 46 string stockText = Dynamicweb.Ecommerce.Services.Products.GetStockStatus(currentProduct, stockLocation, Pageview.Area.EcomLanguageId)?.Text; 47 48 if (!string.IsNullOrWhiteSpace(stockText)) 49 { 50 <span class="pdp-stockstate @stockStateClass">@string.Format(stockText, stock)</span> 51 } 52 } 53 else 54 { 55 string translationTag = ""; 56 if(product.NeverOutOfstock) 57 { 58 translationTag = Translate("ProductBlockStockInfo.AmountInStock", "In stock"); 59 } 60 else if(stockAmount == 1) 61 { 62 translationTag = Translate("ProductBlockStockInfo.AmountInStockSingle", "{0} product in stock"); 63 } 64 else if(stockAmount > 1) 65 { 66 translationTag = Translate("ProductBlockStockInfo.AmountInStockMultiple", "{0} products in stock"); 67 } 68 else if(!inStock) 69 { 70 translationTag = Translate("ProductBlockStockInfo.AmountOutOfStock", "Out of stock"); 71 } 72 73 <span class="pdp-stockstate @stockStateClass">@string.Format(translationTag, stock)</span> 74 } 75 @if(!string.IsNullOrWhiteSpace(_data.Suffix)) 76 { 77 <span class="pdp-stockstate__suffix">@_data.Suffix</span> 78 } 79 </div> 80 @if(!string.IsNullOrWhiteSpace(_data.Subline)) 81 { 82 <p class="pdp-stockstate__subline">@_data.Subline</p> 83 } 84 </div> 85 } 86 </div> 87
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetVariantSelector.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_5596cfddf9e7483ea775863fe9c72e83.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetVariantSelector.cshtml:line 17
   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 Dynamicweb.Ecommerce.ProductCatalog; 4 @using Dynamicweb.Ecommerce.Variants; 5 @using Newtonsoft.Json; 6 7 @{ 8 int pageId = Pageview.ID; 9 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 10 11 ProductViewModel product = new ProductViewModel(); 12 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 13 { 14 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 15 } 16 17 string variantSelection = product.VariantId.Replace(".", ","); 18 string[] variantSelectionArr = variantSelection.Split(','); 19 20 List<string[]> variantCombinationsIds = new List<string[]>(); 21 List<List<string>> variantGroupsOptionIds = new List<List<string>>(); 22 23 var variantCombinations = Dynamicweb.Ecommerce.Services.VariantCombinations.GetVariantCombinations(product.Id); 24 var variantGroups = Dynamicweb.Ecommerce.Services.VariantGroups.GetVariantGroupsByProductId(product.Id); 25 26 foreach (var combination in variantCombinations) 27 { 28 variantCombinationsIds.Add(combination.VariantId.Split('.')); 29 } 30 string variantCombinationsIdsJson = JsonConvert.SerializeObject(variantCombinationsIds).Replace("\"", "\'"); 31 32 foreach (var variantGroup in variantGroups) 33 { 34 var variantsObject = new List<string>(); 35 foreach (var variantOption in variantGroup.GetAllVariantOptions()) 36 { 37 if (variantCombinationsIds.Any(ids => ids.Contains(variantOption.Id))) 38 { 39 variantsObject.Add(variantOption.Id); 40 } 41 } 42 if (variantsObject.Count > 0) 43 { 44 variantGroupsOptionIds.Add(variantsObject); 45 } 46 } 47 string variantGroupsOptionIdsJson = JsonConvert.SerializeObject(variantGroupsOptionIds).Replace("\"", "\'"); 48 } 49 50 <div id="@paragraphID" class="pdp-paragraph"> 51 @if(variantGroups.Any()) { 52 <div class="product-variants__wrapper pdp-variants"> 53 <div class="js-variants" data-total-variant-groups="@variantGroups.Count" data-combinations="@variantCombinationsIdsJson" data-variants="@variantGroupsOptionIdsJson" data-current-page-variant="@variantSelection" data-variant-selections="@variantSelection" data-page-id="@pageId" data-product-id="@product.Id" data-group-id="@product.PrimaryOrDefaultGroup.Id"> 54 @foreach (var variantGroup in variantGroups) 55 { 56 bool containsImage = variantGroup.GetAllVariantOptions().Any(v => !string.IsNullOrEmpty(v.SmallImage)); 57 bool containsColor = variantGroup.GetAllVariantOptions().Any(v => !string.IsNullOrEmpty(v.Color)); 58 string variantGroupName = variantGroup.GetName(Pageview.Area.EcomLanguageId); 59 string variantGroupId = variantGroup.Id; 60 var variantGroupOptions = variantGroup.GetAllVariantOptions().Where(o => variantCombinationsIds.Any(ids => ids.Contains(o.Id))); 61 62 <div class="product-variants__block product-variants__block--@variantGroupId"> 63 @if (containsImage || containsColor) 64 { 65 if(!string.IsNullOrWhiteSpace(variantGroupName)) 66 { 67 <p class="product-variants__title">@variantGroupName</p> 68 } 69 70 <div class="product-variants__options-wrapper"> 71 @foreach (VariantOption variantOption in variantGroupOptions) 72 { 73 string variantOptionName = Translate(string.Format("VariantOption.{0}.{1}", variantGroupId, variantOption.Id), variantOption.GetName(Pageview.Area.EcomLanguageId)); 74 string selected = variantSelectionArr.Contains(variantOption.Id) ? "product-variants__btn--checked" : ""; 75 76 if (!string.IsNullOrEmpty(variantOption.SmallImage)) 77 { 78 string variantImage = "/Files/" + variantOption.SmallImage; 79 <div data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn product-variants__btn--image @selected"> 80 <img src="@variantImage" alt="@variantOptionName" title="@variantOptionName" /> 81 </div> 82 } 83 else if (!string.IsNullOrEmpty(variantOption.Color)) 84 { 85 <div data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn product-variants__btn--color @selected"> 86 <span title="@variantOptionName" style="--variant-color: @variantOption.Color;"></span> 87 </div> 88 } 89 else 90 { 91 <button type="button" data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn @selected">@variantOptionName</button> 92 } 93 } 94 </div> 95 } 96 else 97 { 98 if(!string.IsNullOrWhiteSpace(variantGroupName)) 99 { 100 <p class="product-variants__title">@variantGroupName</p> 101 } 102 103 <div class="product-variants__dropdown"> 104 <div class="product-variants__dropdown-wrapper"> 105 106 <button class="product-variants__toggle"> 107 <span data-original="@Translate(string.Format("VariantDropdown.Placeholder.{0}", variantGroupName), "Select your option")">@Translate(string.Format("VariantDropdown.Placeholder.{0}", variantGroupName), "Select your option")</span> 108 <i class="fal fa-chevron-down"></i> 109 </button> 110 111 <div class="product-variants__options-wrapper product-variants__options-wrapper--dropdown product-variants__dropdown-options-wrapper"> 112 @foreach (VariantOption variantOption in variantGroupOptions) 113 { 114 string selected = variantSelectionArr.Contains(variantOption.Id) ? "product-variants__btn--checked" : ""; 115 116 <button type="button" data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn--dropdown @selected"> 117 @Translate(string.Format("VariantOption.{0}.{1}", variantGroupId, variantOption.Id), variantOption.GetName(Pageview.Area.EcomLanguageId)) 118 </button> 119 } 120 </div> 121 </div> 122 </div> 123 } 124 </div> 125 } 126 </div> 127 </div> 128 } 129 </div> 130

Email me when back in stock

Nieuwe serie Polaris Elements kralen in 4 en 6 mm met glanzende of matte coating. Verwerk de kralen in een trendy armband of in statement oorbellen. Door de kralen op dun artistic wire te wikkelen om dikker om dikker artistic wire, ontwerp je stijlvolle oorbellen!

Nieuwe serie Polaris Elements kralen in 4 en 6 mm met glanzende of matte coating. Verwerk de kralen in een trendy armband of in statement oorbellen. Door de kralen op dun artistic wire te wikkelen om dikker om dikker artistic wire, ontwerp je stijlvolle oorbellen!

Dit is een header

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque consequat est sed nunc vulputate, ac venenatis mauris faucibus. Nulla sollicitudin nisi varius, sollicitudin tellus vel, ultricies elit. Nunc malesuada sagittis ante, vel blandit odio bibendum sit amet. Aliquam erat volutpat. In eros tellus, gravida sed erat eu, dignissim semper urna. Aenean vulputate tempor fringilla. Suspendisse molestie dictum enim eu dapibus. Mauris id lorem convallis, dictum nibh at, maximus odio. Duis sem arcu, sollicitudin a fermentum ac, elementum aliquet augue. Morbi eget nunc magna. Vivamus lacus nunc, laoreet at venenatis et, rhoncus et est. Duis aliquam condimentum lorem, at convallis massa rhoncus at.

Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetReviews.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f54be2b316ac4f8f88ae5a8b25e9466d.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetReviews.cshtml:line 34
   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 Dynamicweb.Content.Commenting; 4 @using Dynamicweb.Ecommerce.ProductCatalog; 5 6 @using Dynamicweb; 7 @using System; 8 @using Dynamicweb.Rendering 9 @using System.Collections.Generic; 10 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 11 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 12 @using System.Linq; 13 @using Dynamicweb.Content; 14 @using Dynamicweb.Ecommerce.Prices; 15 @using System.Text.RegularExpressions; 16 17 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 18 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 19 20 @{ 21 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 22 ProductDetailWidgetReviews _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetReviews", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetReviews>() ?? new ProductDetailWidgetReviews(); 23 ProductAndVariantsObj _product = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 24 25 ProductViewModel product = new ProductViewModel(); 26 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 27 { 28 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 29 } 30 31 CommentCollection comments = Comment.GetComments("ecomProduct", product.Id, Pageview.Area.EcomLanguageId); 32 33 string reviewTranslationKey = Translate("Reviews.Amount.Multiple", "{0} reviews"); 34 if (_product.ProductInfo.ReviewCount == 1) 35 { 36 reviewTranslationKey = Translate("Reviews.Amount.Singular", "{0} review"); 37 } 38 39 // bool displayCommentCount = _data.DisplayCommentCount; 40 } 41 @if (_product.ProductInfo.ReviewCount > 0) { 42 43 <div id="PdpReviewModule" class="review-paragraph"> 44 <div class="container review-paragraph__container"> 45 <div class="review-paragraph__summary"> 46 47 <div class="review-summary__column"> 48 <h2 class="review-summary__title">@Translate("Reviews.Title", "Customer reviews")</h2> 49 <div class="review-summary__container"> 50 <div class="review-summary__indicator GeneralIndicator"> 51 @renderReviewIndicator("var(--BaseColorSecondary)", _product.ProductInfo.Rating, "row", true, _product.ProductInfo.ReviewCount) 52 </div> 53 </div> 54 </div> 55 56 @{ 57 if (_product.ProductInfo.CommentsAndReviews != null) 58 { 59 60 <div class="review-paragraph__comments"> 61 62 @foreach (Comments Comment in _product.ProductInfo.CommentsAndReviews) 63 { 64 <section class="review-comment__list-item"> 65 <div class="review-comment__header"> 66 <div class="review-comment__rating-wrapper"> 67 @renderReviewIndicator("var(--BaseColorContrast)", Comment.CommentRating, "row", false, 0) 68 <label class="review-comment__name">@Comment.CommentName</label> 69 </div> 70 </div> 71 <div class="review-comment__message"> 72 <p>@Comment.CommentText</p> 73 </div> 74 <p class="review-comment__meta"> 75 @if (_data.ShowCreateDate) {<text> - @Comment.CommentCreatedDate</text>} 76 </p> 77 </section> 78 } 79 80 </div> 81 82 } 83 } 84 85 @*<div class="review-summary__column"> 86 @if (Dynamicweb.Context.Current.Request["reviewcmd"] != null && Dynamicweb.Context.Current.Request["reviewcmd"] == "created") 87 { 88 <h2 class="review-summary__title">@Translate("Reviews.Submitted.Title", "Thanks for your review")</h2> 89 <p>@Translate("Reviews.Submitted.Text", "Thank you for submitting your review.")</p> 90 } 91 else 92 { 93 <h2 class="review-summary__title">@Translate("Reviews.Create.Text", "Write a review")</h2> 94 <p>@Translate("Reviews.Create.Text", "Share your thoughts about this product with other customers.")</p> 95 <div class="review-summary__btn-wrapper"> 96 <a href="#" class="btn btn__primary toggle-of-canvas-menu" data-offcanvas-target="reviewcreate"> 97 <span class="btn__text">@Translate("Reviews.Create.Button", "Write a review")</span> 98 <i class="btn__icon fal fa-plus"></i> 99 </a> 100 </div> 101 } 102 </div>*@ 103 </div> 104 105 </div> 106 </div> 107 108 } 109 110 @functions{ 111 112 public string renderReviewIndicator(string progressbarColor, float value, string flexDirection, bool boolReviews, int CommentCount) 113 { 114 115 float ratingPercentage = (100 / 5) * value; 116 string CommentCountString = boolReviews == true ? $"({CommentCount} reviews)" : ""; 117 118 string Template = $@" 119 <section style='display: flex; flex-direction: {flexDirection}; position: relative; align - items: center;'> 120 <div class='reviews__indicator' style='display: flex; flex-direction: row;'> 121 <div class='reviews__indicator-progressbar' style='width: {ratingPercentage.ToString()}%; background-color: {progressbarColor};' ></div> 122 <ul class='reviews__indicator-star-list'> 123 <li class='reviews__indicator-star-list-item'></li> 124 <li class='reviews__indicator-star-list-item'></li> 125 <li class='reviews__indicator-star-list-item'></li> 126 <li class='reviews__indicator-star-list-item'></li> 127 <li class='reviews__indicator-star-list-item'></li> 128 </ul> 129 </div> 130 <span class='CommentCountString' style='display: flex; position: relative; font-size: 12px; line-height: initial;'> 131 {value} / 5 {CommentCountString} 132 </span> 133 </section> 134 "; 135 136 return Template; 137 } 138 139 } 140

Header

Heel verhaal...

Dit is een header

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque consequat est sed nunc vulputate, ac venenatis mauris faucibus. Nulla sollicitudin nisi varius, sollicitudin tellus vel, ultricies elit. Nunc malesuada sagittis ante, vel blandit odio bibendum sit amet. Aliquam erat volutpat. In eros tellus, gravida sed erat eu, dignissim semper urna. Aenean vulputate tempor fringilla. Suspendisse molestie dictum enim eu dapibus. Mauris id lorem convallis, dictum nibh at, maximus odio. Duis sem arcu, sollicitudin a fermentum ac, elementum aliquet augue. Morbi eget nunc magna. Vivamus lacus nunc, laoreet at venenatis et, rhoncus et est. Duis aliquam condimentum lorem, at convallis massa rhoncus at.

Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetReviews.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f54be2b316ac4f8f88ae5a8b25e9466d.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetReviews.cshtml:line 34
   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 Dynamicweb.Content.Commenting; 4 @using Dynamicweb.Ecommerce.ProductCatalog; 5 6 @using Dynamicweb; 7 @using System; 8 @using Dynamicweb.Rendering 9 @using System.Collections.Generic; 10 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 11 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 12 @using System.Linq; 13 @using Dynamicweb.Content; 14 @using Dynamicweb.Ecommerce.Prices; 15 @using System.Text.RegularExpressions; 16 17 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 18 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 19 20 @{ 21 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 22 ProductDetailWidgetReviews _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetReviews", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetReviews>() ?? new ProductDetailWidgetReviews(); 23 ProductAndVariantsObj _product = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 24 25 ProductViewModel product = new ProductViewModel(); 26 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 27 { 28 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 29 } 30 31 CommentCollection comments = Comment.GetComments("ecomProduct", product.Id, Pageview.Area.EcomLanguageId); 32 33 string reviewTranslationKey = Translate("Reviews.Amount.Multiple", "{0} reviews"); 34 if (_product.ProductInfo.ReviewCount == 1) 35 { 36 reviewTranslationKey = Translate("Reviews.Amount.Singular", "{0} review"); 37 } 38 39 // bool displayCommentCount = _data.DisplayCommentCount; 40 } 41 @if (_product.ProductInfo.ReviewCount > 0) { 42 43 <div id="PdpReviewModule" class="review-paragraph"> 44 <div class="container review-paragraph__container"> 45 <div class="review-paragraph__summary"> 46 47 <div class="review-summary__column"> 48 <h2 class="review-summary__title">@Translate("Reviews.Title", "Customer reviews")</h2> 49 <div class="review-summary__container"> 50 <div class="review-summary__indicator GeneralIndicator"> 51 @renderReviewIndicator("var(--BaseColorSecondary)", _product.ProductInfo.Rating, "row", true, _product.ProductInfo.ReviewCount) 52 </div> 53 </div> 54 </div> 55 56 @{ 57 if (_product.ProductInfo.CommentsAndReviews != null) 58 { 59 60 <div class="review-paragraph__comments"> 61 62 @foreach (Comments Comment in _product.ProductInfo.CommentsAndReviews) 63 { 64 <section class="review-comment__list-item"> 65 <div class="review-comment__header"> 66 <div class="review-comment__rating-wrapper"> 67 @renderReviewIndicator("var(--BaseColorContrast)", Comment.CommentRating, "row", false, 0) 68 <label class="review-comment__name">@Comment.CommentName</label> 69 </div> 70 </div> 71 <div class="review-comment__message"> 72 <p>@Comment.CommentText</p> 73 </div> 74 <p class="review-comment__meta"> 75 @if (_data.ShowCreateDate) {<text> - @Comment.CommentCreatedDate</text>} 76 </p> 77 </section> 78 } 79 80 </div> 81 82 } 83 } 84 85 @*<div class="review-summary__column"> 86 @if (Dynamicweb.Context.Current.Request["reviewcmd"] != null && Dynamicweb.Context.Current.Request["reviewcmd"] == "created") 87 { 88 <h2 class="review-summary__title">@Translate("Reviews.Submitted.Title", "Thanks for your review")</h2> 89 <p>@Translate("Reviews.Submitted.Text", "Thank you for submitting your review.")</p> 90 } 91 else 92 { 93 <h2 class="review-summary__title">@Translate("Reviews.Create.Text", "Write a review")</h2> 94 <p>@Translate("Reviews.Create.Text", "Share your thoughts about this product with other customers.")</p> 95 <div class="review-summary__btn-wrapper"> 96 <a href="#" class="btn btn__primary toggle-of-canvas-menu" data-offcanvas-target="reviewcreate"> 97 <span class="btn__text">@Translate("Reviews.Create.Button", "Write a review")</span> 98 <i class="btn__icon fal fa-plus"></i> 99 </a> 100 </div> 101 } 102 </div>*@ 103 </div> 104 105 </div> 106 </div> 107 108 } 109 110 @functions{ 111 112 public string renderReviewIndicator(string progressbarColor, float value, string flexDirection, bool boolReviews, int CommentCount) 113 { 114 115 float ratingPercentage = (100 / 5) * value; 116 string CommentCountString = boolReviews == true ? $"({CommentCount} reviews)" : ""; 117 118 string Template = $@" 119 <section style='display: flex; flex-direction: {flexDirection}; position: relative; align - items: center;'> 120 <div class='reviews__indicator' style='display: flex; flex-direction: row;'> 121 <div class='reviews__indicator-progressbar' style='width: {ratingPercentage.ToString()}%; background-color: {progressbarColor};' ></div> 122 <ul class='reviews__indicator-star-list'> 123 <li class='reviews__indicator-star-list-item'></li> 124 <li class='reviews__indicator-star-list-item'></li> 125 <li class='reviews__indicator-star-list-item'></li> 126 <li class='reviews__indicator-star-list-item'></li> 127 <li class='reviews__indicator-star-list-item'></li> 128 </ul> 129 </div> 130 <span class='CommentCountString' style='display: flex; position: relative; font-size: 12px; line-height: initial;'> 131 {value} / 5 {CommentCountString} 132 </span> 133 </section> 134 "; 135 136 return Template; 137 } 138 139 } 140

Voeg snel artikelen toe aan de winkelmand door een bestand in XSLX formaat te uploaden.
Een voorbeeldbestand download u hier: Voorbeeld bestand XSLX upload

Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetVariants.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_00c6021f3c31474f86757e045111c347.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetVariants.cshtml:line 12
   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 Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 4 5 @{ 6 int pageId = Model.PageID; 7 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 8 9 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj) Dynamicweb.Context.Current.Session["ProductAndVariants"]; 10 } 11 12 @if (ProductAndVariants.Variants != null) 13 { 14 <section class="pdp__block pdp-widget__variants"> 15 16 <article class="pdp__block-item"> 17 <header> 18 <h2>Variants</h2> 19 </header> 20 <div class="pdp__block-item-content"> 21 22 @foreach (ProductAndVariantsObj Variant in ProductAndVariants.Variants) 23 { 24 <a href="@($"default.aspx?ID={Pageview.Page.ID}&ProductID={Variant.ProductInfo.Id}&VariantID={Variant.ProductVariantId}")"> 25 <section class="pdp__block-item-content-element"> 26 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=Files/@Variant.Images.Default&Format=webp&Quality=-1&width=150&height=150" /> 27 <div>@Variant.ProductInfo.Name</div> 28 <div>@Variant.Manufacturer.Name</div> 29 </section> 30 </a> 31 } 32 </div> 33 </article> 34 35 </section> 36 } 37 38 <style> 39 .pdp__block { 40 display: flex; 41 flex-direction: row; 42 padding: 25px; 43 margin: 25px; 44 border: 1px solid #CCC; 45 } 46 47 .pdp__block-item { 48 display: flex; 49 flex-direction: column; 50 flex-grow: 0; 51 flex-basis: 25; 52 } 53 54 .pdp__block-item-content { 55 display: flex; 56 flex-direction: row; 57 flex-grow: 0; 58 flex-basis: 25; 59 } 60 61 .pdp__block-item-content-element { 62 border: 1px solid #CCC; 63 margin: 25px; 64 padding: 25px; 65 } 66 </style> 67
Error executing template "/Designs/ClientBase_generated/Paragraph/ProductDetailWidgetProductItems.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_09dab9ce88e24c2e87bb02200c981762.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductItems.cshtml:line 10
   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 Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 4 5 @{ 6 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj) Dynamicweb.Context.Current.Session["ProductAndVariants"]; 7 } 8 9 10 @if (ProductAndVariants.Items != null) 11 { 12 13 <h2>This set includes the following products</h2> 14 <section class="pdp__product-items"> 15 16 17 @foreach (ProductAndVariantsObj ProductItem in ProductAndVariants.Items) 18 { 19 <text> 20 <div class="pdp__block"> 21 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=Files/@ProductItem.Images.Default&Format=webp&Quality=-1&width=150& height: 150px;" /><br /> 22 <ul> 23 <li>@ProductItem.ProductInfo.Name</li> 24 <li>@ProductItem.ProductInfo.Id</li> 25 <li>@ProductItem.Quantity</li> 26 </ul> 27 </div> 28 </text> 29 } 30 31 </section> 32 33 <style> 34 35 .pdp__block { 36 display: flex; 37 flex-direction: column; 38 padding: 10px; 39 margin: 10px; 40 border: 1px solid #CCC; 41 -webkit-box-shadow: 2px 2px 5px 5px rgba(0,0,0,0.2); 42 -moz-box-shadow: 2px 2px 5px 5px rgba(0,0,0,0.2); 43 box-shadow: 2px 2px 5px 5px rgba(0,0,0,0.2); 44 } 45 46 .pdp__product-items { 47 display: flex; 48 flex-direction: row; 49 flex-basis: 20%; 50 } 51 </style> 52 53 } 54
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetReplacementProduct.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_faeab1368399415f909ca65c32d2fd4b.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetReplacementProduct.cshtml:line 8
   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 Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 4 5 @{ 6 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj) Dynamicweb.Context.Current.Session["ProductAndVariants"]; 7 8 if (ProductAndVariants.ReplacementProduct != null) 9 { 10 11 if (ProductAndVariants.ProductInfo.Stock <= 0) 12 { 13 ProductAndVariantsObj ReplacementProduct = ProductAndVariants.ReplacementProduct[0]; 14 15 <section class="pdp__block pdp-widget__replacementproduct"> 16 17 <article class="pdp__block-item"> 18 <header class="pdp-widget__replacementproduct-header"> 19 <h2>Replacement product</h2> 20 </header> 21 <div class="pdp__block-item-content"> 22 <a href="@($"default.aspx?ID={Pageview.Page.ID}&ProductID={ReplacementProduct.ProductInfo.Id}&VariantID={ReplacementProduct.ProductVariantId}")"> 23 <section class="pdp__block-item-content-element"> 24 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=Files/@ReplacementProduct.Images.Default&Format=webp&Quality=-1&width=150&height=150" /> 25 <div>@ReplacementProduct.ProductInfo.Name</div> 26 </section> 27 </a> 28 </div> 29 </article> 30 31 </section> 32 } 33 34 } 35 } 36 37 <style> 38 .pdp__block { 39 display: flex; 40 flex-direction: row; 41 padding: 25px; 42 margin: 25px; 43 border: 1px solid #CCC; 44 } 45 46 .pdp__block-item { 47 display: flex; 48 flex-direction: column; 49 flex-grow: 0; 50 flex-basis: 25; 51 } 52 53 .pdp__block-item-content { 54 display: flex; 55 flex-direction: row; 56 flex-grow: 0; 57 flex-basis: 25; 58 } 59 60 .pdp__block-item-content-element { 61 border: 1px solid #CCC; 62 margin: 25px; 63 padding: 25px; 64 } 65 </style> 66

DIt is een subheader

Dit is een header

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tincidunt mauris elit, eget iaculis risus egestas eget. Etiam iaculis vehicula tortor ut viverra. Mauris venenatis lectus diam, eget ultricies arcu volutpat at. Suspendisse ac dolor varius, consectetur nisl id, tristique ipsum. Maecenas sed nunc in sapien posuere semper.

Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetReviews.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f54be2b316ac4f8f88ae5a8b25e9466d.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetReviews.cshtml:line 34
   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 Dynamicweb.Content.Commenting; 4 @using Dynamicweb.Ecommerce.ProductCatalog; 5 6 @using Dynamicweb; 7 @using System; 8 @using Dynamicweb.Rendering 9 @using System.Collections.Generic; 10 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 11 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 12 @using System.Linq; 13 @using Dynamicweb.Content; 14 @using Dynamicweb.Ecommerce.Prices; 15 @using System.Text.RegularExpressions; 16 17 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 18 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 19 20 @{ 21 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 22 ProductDetailWidgetReviews _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetReviews", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetReviews>() ?? new ProductDetailWidgetReviews(); 23 ProductAndVariantsObj _product = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 24 25 ProductViewModel product = new ProductViewModel(); 26 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 27 { 28 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 29 } 30 31 CommentCollection comments = Comment.GetComments("ecomProduct", product.Id, Pageview.Area.EcomLanguageId); 32 33 string reviewTranslationKey = Translate("Reviews.Amount.Multiple", "{0} reviews"); 34 if (_product.ProductInfo.ReviewCount == 1) 35 { 36 reviewTranslationKey = Translate("Reviews.Amount.Singular", "{0} review"); 37 } 38 39 // bool displayCommentCount = _data.DisplayCommentCount; 40 } 41 @if (_product.ProductInfo.ReviewCount > 0) { 42 43 <div id="PdpReviewModule" class="review-paragraph"> 44 <div class="container review-paragraph__container"> 45 <div class="review-paragraph__summary"> 46 47 <div class="review-summary__column"> 48 <h2 class="review-summary__title">@Translate("Reviews.Title", "Customer reviews")</h2> 49 <div class="review-summary__container"> 50 <div class="review-summary__indicator GeneralIndicator"> 51 @renderReviewIndicator("var(--BaseColorSecondary)", _product.ProductInfo.Rating, "row", true, _product.ProductInfo.ReviewCount) 52 </div> 53 </div> 54 </div> 55 56 @{ 57 if (_product.ProductInfo.CommentsAndReviews != null) 58 { 59 60 <div class="review-paragraph__comments"> 61 62 @foreach (Comments Comment in _product.ProductInfo.CommentsAndReviews) 63 { 64 <section class="review-comment__list-item"> 65 <div class="review-comment__header"> 66 <div class="review-comment__rating-wrapper"> 67 @renderReviewIndicator("var(--BaseColorContrast)", Comment.CommentRating, "row", false, 0) 68 <label class="review-comment__name">@Comment.CommentName</label> 69 </div> 70 </div> 71 <div class="review-comment__message"> 72 <p>@Comment.CommentText</p> 73 </div> 74 <p class="review-comment__meta"> 75 @if (_data.ShowCreateDate) {<text> - @Comment.CommentCreatedDate</text>} 76 </p> 77 </section> 78 } 79 80 </div> 81 82 } 83 } 84 85 @*<div class="review-summary__column"> 86 @if (Dynamicweb.Context.Current.Request["reviewcmd"] != null && Dynamicweb.Context.Current.Request["reviewcmd"] == "created") 87 { 88 <h2 class="review-summary__title">@Translate("Reviews.Submitted.Title", "Thanks for your review")</h2> 89 <p>@Translate("Reviews.Submitted.Text", "Thank you for submitting your review.")</p> 90 } 91 else 92 { 93 <h2 class="review-summary__title">@Translate("Reviews.Create.Text", "Write a review")</h2> 94 <p>@Translate("Reviews.Create.Text", "Share your thoughts about this product with other customers.")</p> 95 <div class="review-summary__btn-wrapper"> 96 <a href="#" class="btn btn__primary toggle-of-canvas-menu" data-offcanvas-target="reviewcreate"> 97 <span class="btn__text">@Translate("Reviews.Create.Button", "Write a review")</span> 98 <i class="btn__icon fal fa-plus"></i> 99 </a> 100 </div> 101 } 102 </div>*@ 103 </div> 104 105 </div> 106 </div> 107 108 } 109 110 @functions{ 111 112 public string renderReviewIndicator(string progressbarColor, float value, string flexDirection, bool boolReviews, int CommentCount) 113 { 114 115 float ratingPercentage = (100 / 5) * value; 116 string CommentCountString = boolReviews == true ? $"({CommentCount} reviews)" : ""; 117 118 string Template = $@" 119 <section style='display: flex; flex-direction: {flexDirection}; position: relative; align - items: center;'> 120 <div class='reviews__indicator' style='display: flex; flex-direction: row;'> 121 <div class='reviews__indicator-progressbar' style='width: {ratingPercentage.ToString()}%; background-color: {progressbarColor};' ></div> 122 <ul class='reviews__indicator-star-list'> 123 <li class='reviews__indicator-star-list-item'></li> 124 <li class='reviews__indicator-star-list-item'></li> 125 <li class='reviews__indicator-star-list-item'></li> 126 <li class='reviews__indicator-star-list-item'></li> 127 <li class='reviews__indicator-star-list-item'></li> 128 </ul> 129 </div> 130 <span class='CommentCountString' style='display: flex; position: relative; font-size: 12px; line-height: initial;'> 131 {value} / 5 {CommentCountString} 132 </span> 133 </section> 134 "; 135 136 return Template; 137 } 138 139 } 140
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetPrice.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_13c5e04c34ce40bc8d194bfd88049191.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetPrice.cshtml:line 34
   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.Prices; 3 @using Dynamicweb.Ecommerce.ProductCatalog; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 5 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 6 7 @{ 8 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 9 ProductDetailWidgetPrice _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetPrice", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetPrice>() ?? new ProductDetailWidgetPrice(); 10 11 var master_configuration = Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 12 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 13 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 14 15 ProductViewModel product = new ProductViewModel(); 16 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 17 { 18 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 19 } 20 21 bool WithVATBool = Pageview.Area.EcomPricesWithVat == "True"; 22 bool pricesWithoutVatForUsers = EcommerceConfiguration.ShowPricesWithoutVatForUsers; 23 bool pricesWithoutVatForValidVat = EcommerceConfiguration.ShowPricesWithoutVatWhenValidVatNumber; 24 if(pricesWithoutVatForUsers && !pricesWithoutVatForValidVat && Pageview.User != null) { 25 WithVATBool = false; 26 } 27 if(pricesWithoutVatForValidVat && Pageview.User != null && !string.IsNullOrWhiteSpace(Pageview.User.VatRegNumber)) { 28 WithVATBool = false; 29 } 30 31 bool hidePricesForGuests = EcommerceConfiguration.HidePricesForGuests; 32 bool hideZeroPrices = EcommerceConfiguration.HideZeroPrices; 33 bool displayPrice = hidePricesForGuests ? Pageview.User != null : true; 34 bool pricezero = product.Price.Price <= 0; 35 36 bool displayProductPrice = displayPrice; 37 if (hideZeroPrices && pricezero) 38 { 39 displayProductPrice = false; 40 } 41 42 string ProductdetailPriceSuffixWithVAT = Translate("Productdetail.Price.Suffix.WithVAT", "Incl. VAT"); 43 string ProductdetailPriceSuffixWithoutVAT = Translate("Productdetail.Price.Suffix.WithoutVAT", "Excl. VAT"); 44 string ProductdetailPriceSuffix = WithVATBool ? ProductdetailPriceSuffixWithVAT : ProductdetailPriceSuffixWithoutVAT; 45 46 var gtmValue = WithVATBool ? product.Price.PriceWithVat : product.Price.PriceWithoutVat; 47 var priceFormatted = WithVATBool ? product.Price.PriceWithVatFormatted : product.Price.PriceWithoutVatFormatted; 48 var priceBeforeDiscount = WithVATBool ? product.PriceBeforeDiscount.PriceWithVat : product.PriceBeforeDiscount.PriceWithoutVat; 49 var priceBeforeDiscountFormatted = WithVATBool ? product.PriceBeforeDiscount.PriceWithVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; 50 var priceTotalDiscount = WithVATBool ? product.Discount.PriceWithVat : product.Discount.PriceWithoutVat; 51 var priceTotalDiscountFormatted = WithVATBool ? product.Discount.PriceWithVatFormatted : product.Discount.PriceWithoutVatFormatted; 52 double discountPercentage = Math.Round(((priceTotalDiscount / priceBeforeDiscount) * -100)); 53 bool hasDiscount = product.Discount.Price > 0; 54 55 string informativePrice = WithVATBool ? product.PriceInformative.PriceWithVatFormatted : product.PriceInformative.PriceWithoutVatFormatted; 56 if (EcommerceConfiguration.UseInformativePriceAsFromPrice && !string.IsNullOrWhiteSpace(informativePrice)) 57 { 58 double informativePriceValue = WithVATBool ? product.PriceInformative.PriceWithVat : product.PriceInformative.PriceWithoutVat; 59 hasDiscount = gtmValue < informativePriceValue; 60 if (hasDiscount) 61 { 62 priceBeforeDiscountFormatted = informativePrice; 63 discountPercentage = Math.Round((((gtmValue - informativePriceValue) / informativePriceValue) * 100)); 64 65 double yourProfitValue = informativePriceValue - gtmValue; 66 priceTotalDiscountFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = yourProfitValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = yourProfitValue }.PriceWithoutVATFormatted; 67 } 68 } 69 70 string retailPrice = ""; 71 bool displayRetailPrice = EcommerceConfiguration.DisplayRetailPrice; 72 if(EcommerceConfiguration.DisplayRetailPriceForUsers && Pageview.User == null) { 73 displayRetailPrice = false; 74 } 75 if(displayRetailPrice) { 76 string priceFieldName = EcommerceConfiguration.RetailPriceField; 77 if(EcommerceConfiguration.RetailPriceIsDbPrice) { 78 var p = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, Pageview.Area.EcomLanguageId); 79 PriceContext customerPriceContext = new PriceContext(Dynamicweb.Ecommerce.Common.Context.Currency, Dynamicweb.Ecommerce.Common.Context.Country, null, null, Dynamicweb.Ecommerce.Common.Context.ReverseChargeForVatEnabled, DateTime.Now); 80 var customerPrice = p?.GetPrice(customerPriceContext); 81 if(customerPrice.Price > 0) { 82 retailPrice = WithVATBool ? customerPrice.PriceWithVATFormatted : customerPrice.PriceWithoutVATFormatted; 83 } 84 } else if(!string.IsNullOrWhiteSpace(priceFieldName)) { 85 double customerPriceValue = 0.0; 86 if (product.ProductFields.TryGetValue(priceFieldName, out var fieldValue) && fieldValue.Value is double) { 87 customerPriceValue = (double)fieldValue.Value; 88 } 89 if(customerPriceValue > 0) { 90 retailPrice = WithVATBool ? new PriceInfo { PriceWithVAT = customerPriceValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = customerPriceValue }.PriceWithoutVATFormatted; 91 } 92 } 93 } 94 95 bool isVariant = product.VariantId != ""; 96 int variantCount = product?.VariantInfo?.VariantInfo?.Count ?? 0; 97 bool hasVariants = !isVariant ? variantCount > 0 : false; 98 } 99 100 <div id="@paragraphID" class="pdp-paragraph @_data.CssClass"> 101 @if (displayPrice && displayProductPrice) 102 { 103 <div class="pdp-price__container"> 104 @if(!isVariant && hasVariants) 105 { 106 string minPrice = WithVATBool ? product.VariantInfo.PriceMin.PriceWithVatFormatted : product.VariantInfo.PriceMin.PriceWithoutVatFormatted; 107 string maxPrice = WithVATBool ? product.VariantInfo.PriceMax.PriceWithVatFormatted : product.VariantInfo.PriceMax.PriceWithoutVatFormatted; 108 109 <section class="pdp-price__subcontainer"> 110 @if(minPrice != maxPrice) 111 { 112 <span class="pdp-price">@minPrice - @maxPrice</span> 113 } 114 else 115 { 116 <span class="pdp-price">@minPrice</span> 117 } 118 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 119 </section> 120 } 121 else 122 { 123 if (hasDiscount) 124 { 125 <p class="pdp-price--original">@priceBeforeDiscountFormatted</p> 126 <section class="pdp-price__subcontainer"> 127 <span class="pdp-price">@priceFormatted</span> 128 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 129 <span class="pdp-price__percentage">@discountPercentage%</span> 130 </section> 131 } 132 else 133 { 134 <section class="pdp-price__subcontainer"> 135 <span class="pdp-price">@priceFormatted</span> 136 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 137 </section> 138 } 139 if (!string.IsNullOrWhiteSpace(retailPrice)) 140 { 141 <p class="pdp-price__retail-price"> 142 @String.Format(Translate("ProductBlockTitle.RetailPrice", "Retail price: {0}"), retailPrice) 143 </p> 144 } 145 if (hasDiscount) 146 { 147 <p class="pdp-price__yourprofit"> 148 @Translate("Productdetail.YourProfitLabel", "Your profit:") @priceTotalDiscountFormatted 149 </p> 150 } 151 } 152 </div> 153 154 if(displayPrice && displayProductPrice && product.Prices.Any()) { 155 var priceList = new List<object>(); 156 var loopIndex = 1; 157 158 foreach (var volumePrice in product.Prices) 159 { 160 double volumePriceQuantity = volumePrice.Quantity; 161 162 if (volumePriceQuantity > 1) 163 { 164 double newVolumePriceVal = WithVATBool ? volumePrice.Price.PriceWithVat : volumePrice.Price.PriceWithoutVat; 165 double productPriceVal = WithVATBool ? product.Price.PriceWithVat : product.Price.PriceWithoutVat; 166 167 double newVolumePrice = Math.Round(newVolumePriceVal * volumePrice.Quantity, 2); 168 string newVolumePriceFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = newVolumePrice }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = newVolumePrice }.PriceWithoutVATFormatted; 169 170 double diffVolumePrice = Math.Round((productPriceVal - newVolumePriceVal) * volumePrice.Quantity, 2); 171 string diffVolumePriceFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = diffVolumePrice }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = diffVolumePrice }.PriceWithoutVATFormatted; 172 173 var priceObj = new 174 { 175 discountId = loopIndex, 176 newVolumePriceFormatted = newVolumePriceFormatted, 177 diffVolumePriceFormatted = diffVolumePriceFormatted, 178 unitPriceFormatted = WithVATBool ? volumePrice.Price.PriceWithVatFormatted : volumePrice.Price.PriceWithoutVatFormatted, 179 quantity = volumePriceQuantity 180 }; 181 priceList.Add(priceObj); 182 } 183 loopIndex++; 184 } 185 186 string pricesJson = Newtonsoft.Json.JsonConvert.SerializeObject(priceList); 187 188 <div class="app-volumeprices" data-price-list='@pricesJson'></div> 189 } 190 } 191 </div> 192
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetStock.cshtml"
System.InvalidOperationException: Nullable object must have a value.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Nullable`1.get_Value()
   at CompiledRazorTemplates.Dynamic.RazorEngine_7584b63361034ca4b1e4ba95a0850cbc.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetStock.cshtml:line 31
   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.Ecommerce.Stocks; 4 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 5 @using System.Globalization; 6 7 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 8 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 9 10 @{ 11 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 12 ProductDetailWidgetStock _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetStock", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetStock>() ?? new ProductDetailWidgetStock(); 13 14 var master_configuration = Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 15 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 16 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 17 18 ProductViewModel product = new ProductViewModel(); 19 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 20 { 21 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 22 } 23 24 bool isVariant = product.VariantId != ""; 25 int variantCount = product?.VariantInfo?.VariantInfo?.Count ?? 0; 26 bool hasVariants = !isVariant ? variantCount > 0 : false; 27 28 bool hideStockForGuests = EcommerceConfiguration.HideStockForGuests; 29 bool enableProductStock = hideStockForGuests ? Pageview.User != null : true; 30 31 double stockAmount = (double)product.StockLevel; 32 string stock = stockAmount.ToString(stockAmount % 1 == 0 ? "N0" : "N2", CultureInfo.GetCultureInfo(Pageview.Area.CultureInfo.TwoLetterISOLanguageName)) ?? ""; 33 string stockFormat = EcommerceConfiguration.StockFormat; 34 bool inStock = stockAmount > 0 || product.NeverOutOfstock; 35 string stockStateClass = inStock ? "pdp-stockstate--instock" : "pdp-stockstate--outofstock"; 36 } 37 38 <div id="@paragraphID" class="pdp-paragraph"> 39 @if(enableProductStock && !string.IsNullOrWhiteSpace(stockFormat)) 40 { 41 <div class="pdp-stockstate__wrapper"> 42 <div> 43 @if(stockFormat == "text") { 44 StockLocation stockLocation = Dynamicweb.Ecommerce.Services.StockService.GetStockLocation(Pageview.Area.StockLocationID); 45 var currentProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, "", Pageview.Area.EcomLanguageId); 46 string stockText = Dynamicweb.Ecommerce.Services.Products.GetStockStatus(currentProduct, stockLocation, Pageview.Area.EcomLanguageId)?.Text; 47 48 if (!string.IsNullOrWhiteSpace(stockText)) 49 { 50 <span class="pdp-stockstate @stockStateClass">@string.Format(stockText, stock)</span> 51 } 52 } 53 else 54 { 55 string translationTag = ""; 56 if(product.NeverOutOfstock) 57 { 58 translationTag = Translate("ProductBlockStockInfo.AmountInStock", "In stock"); 59 } 60 else if(stockAmount == 1) 61 { 62 translationTag = Translate("ProductBlockStockInfo.AmountInStockSingle", "{0} product in stock"); 63 } 64 else if(stockAmount > 1) 65 { 66 translationTag = Translate("ProductBlockStockInfo.AmountInStockMultiple", "{0} products in stock"); 67 } 68 else if(!inStock) 69 { 70 translationTag = Translate("ProductBlockStockInfo.AmountOutOfStock", "Out of stock"); 71 } 72 73 <span class="pdp-stockstate @stockStateClass">@string.Format(translationTag, stock)</span> 74 } 75 @if(!string.IsNullOrWhiteSpace(_data.Suffix)) 76 { 77 <span class="pdp-stockstate__suffix">@_data.Suffix</span> 78 } 79 </div> 80 @if(!string.IsNullOrWhiteSpace(_data.Subline)) 81 { 82 <p class="pdp-stockstate__subline">@_data.Subline</p> 83 } 84 </div> 85 } 86 </div> 87
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetVariantSelector.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_5596cfddf9e7483ea775863fe9c72e83.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetVariantSelector.cshtml:line 17
   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 Dynamicweb.Ecommerce.ProductCatalog; 4 @using Dynamicweb.Ecommerce.Variants; 5 @using Newtonsoft.Json; 6 7 @{ 8 int pageId = Pageview.ID; 9 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 10 11 ProductViewModel product = new ProductViewModel(); 12 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 13 { 14 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 15 } 16 17 string variantSelection = product.VariantId.Replace(".", ","); 18 string[] variantSelectionArr = variantSelection.Split(','); 19 20 List<string[]> variantCombinationsIds = new List<string[]>(); 21 List<List<string>> variantGroupsOptionIds = new List<List<string>>(); 22 23 var variantCombinations = Dynamicweb.Ecommerce.Services.VariantCombinations.GetVariantCombinations(product.Id); 24 var variantGroups = Dynamicweb.Ecommerce.Services.VariantGroups.GetVariantGroupsByProductId(product.Id); 25 26 foreach (var combination in variantCombinations) 27 { 28 variantCombinationsIds.Add(combination.VariantId.Split('.')); 29 } 30 string variantCombinationsIdsJson = JsonConvert.SerializeObject(variantCombinationsIds).Replace("\"", "\'"); 31 32 foreach (var variantGroup in variantGroups) 33 { 34 var variantsObject = new List<string>(); 35 foreach (var variantOption in variantGroup.GetAllVariantOptions()) 36 { 37 if (variantCombinationsIds.Any(ids => ids.Contains(variantOption.Id))) 38 { 39 variantsObject.Add(variantOption.Id); 40 } 41 } 42 if (variantsObject.Count > 0) 43 { 44 variantGroupsOptionIds.Add(variantsObject); 45 } 46 } 47 string variantGroupsOptionIdsJson = JsonConvert.SerializeObject(variantGroupsOptionIds).Replace("\"", "\'"); 48 } 49 50 <div id="@paragraphID" class="pdp-paragraph"> 51 @if(variantGroups.Any()) { 52 <div class="product-variants__wrapper pdp-variants"> 53 <div class="js-variants" data-total-variant-groups="@variantGroups.Count" data-combinations="@variantCombinationsIdsJson" data-variants="@variantGroupsOptionIdsJson" data-current-page-variant="@variantSelection" data-variant-selections="@variantSelection" data-page-id="@pageId" data-product-id="@product.Id" data-group-id="@product.PrimaryOrDefaultGroup.Id"> 54 @foreach (var variantGroup in variantGroups) 55 { 56 bool containsImage = variantGroup.GetAllVariantOptions().Any(v => !string.IsNullOrEmpty(v.SmallImage)); 57 bool containsColor = variantGroup.GetAllVariantOptions().Any(v => !string.IsNullOrEmpty(v.Color)); 58 string variantGroupName = variantGroup.GetName(Pageview.Area.EcomLanguageId); 59 string variantGroupId = variantGroup.Id; 60 var variantGroupOptions = variantGroup.GetAllVariantOptions().Where(o => variantCombinationsIds.Any(ids => ids.Contains(o.Id))); 61 62 <div class="product-variants__block product-variants__block--@variantGroupId"> 63 @if (containsImage || containsColor) 64 { 65 if(!string.IsNullOrWhiteSpace(variantGroupName)) 66 { 67 <p class="product-variants__title">@variantGroupName</p> 68 } 69 70 <div class="product-variants__options-wrapper"> 71 @foreach (VariantOption variantOption in variantGroupOptions) 72 { 73 string variantOptionName = Translate(string.Format("VariantOption.{0}.{1}", variantGroupId, variantOption.Id), variantOption.GetName(Pageview.Area.EcomLanguageId)); 74 string selected = variantSelectionArr.Contains(variantOption.Id) ? "product-variants__btn--checked" : ""; 75 76 if (!string.IsNullOrEmpty(variantOption.SmallImage)) 77 { 78 string variantImage = "/Files/" + variantOption.SmallImage; 79 <div data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn product-variants__btn--image @selected"> 80 <img src="@variantImage" alt="@variantOptionName" title="@variantOptionName" /> 81 </div> 82 } 83 else if (!string.IsNullOrEmpty(variantOption.Color)) 84 { 85 <div data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn product-variants__btn--color @selected"> 86 <span title="@variantOptionName" style="--variant-color: @variantOption.Color;"></span> 87 </div> 88 } 89 else 90 { 91 <button type="button" data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn @selected">@variantOptionName</button> 92 } 93 } 94 </div> 95 } 96 else 97 { 98 if(!string.IsNullOrWhiteSpace(variantGroupName)) 99 { 100 <p class="product-variants__title">@variantGroupName</p> 101 } 102 103 <div class="product-variants__dropdown"> 104 <div class="product-variants__dropdown-wrapper"> 105 106 <button class="product-variants__toggle"> 107 <span data-original="@Translate(string.Format("VariantDropdown.Placeholder.{0}", variantGroupName), "Select your option")">@Translate(string.Format("VariantDropdown.Placeholder.{0}", variantGroupName), "Select your option")</span> 108 <i class="fal fa-chevron-down"></i> 109 </button> 110 111 <div class="product-variants__options-wrapper product-variants__options-wrapper--dropdown product-variants__dropdown-options-wrapper"> 112 @foreach (VariantOption variantOption in variantGroupOptions) 113 { 114 string selected = variantSelectionArr.Contains(variantOption.Id) ? "product-variants__btn--checked" : ""; 115 116 <button type="button" data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn--dropdown @selected"> 117 @Translate(string.Format("VariantOption.{0}.{1}", variantGroupId, variantOption.Id), variantOption.GetName(Pageview.Area.EcomLanguageId)) 118 </button> 119 } 120 </div> 121 </div> 122 </div> 123 } 124 </div> 125 } 126 </div> 127 </div> 128 } 129 </div> 130

Email me when back in stock

Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetProductItems.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_09dab9ce88e24c2e87bb02200c981762.Execute() in C:\home\site\wwwroot\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductItems.cshtml:line 10
   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 Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 4 5 @{ 6 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj) Dynamicweb.Context.Current.Session["ProductAndVariants"]; 7 } 8 9 10 @if (ProductAndVariants.Items != null) 11 { 12 13 <h2>This set includes the following products</h2> 14 <section class="pdp__product-items"> 15 16 17 @foreach (ProductAndVariantsObj ProductItem in ProductAndVariants.Items) 18 { 19 <text> 20 <div class="pdp__block"> 21 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=Files/@ProductItem.Images.Default&Format=webp&Quality=-1&width=150& height: 150px;" /><br /> 22 <ul> 23 <li>@ProductItem.ProductInfo.Name</li> 24 <li>@ProductItem.ProductInfo.Id</li> 25 <li>@ProductItem.Quantity</li> 26 </ul> 27 </div> 28 </text> 29 } 30 31 </section> 32 33 <style> 34 35 .pdp__block { 36 display: flex; 37 flex-direction: column; 38 padding: 10px; 39 margin: 10px; 40 border: 1px solid #CCC; 41 -webkit-box-shadow: 2px 2px 5px 5px rgba(0,0,0,0.2); 42 -moz-box-shadow: 2px 2px 5px 5px rgba(0,0,0,0.2); 43 box-shadow: 2px 2px 5px 5px rgba(0,0,0,0.2); 44 } 45 46 .pdp__product-items { 47 display: flex; 48 flex-direction: row; 49 flex-basis: 20%; 50 } 51 </style> 52 53 } 54

Voor 12:00 uur besteld, morgen in huis