Branding Stylesheet || ProductId : PROD313 VariantId :

pdp - add to cart

Product detail configuration page

Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetName.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_51b3ff48464847f7b902989f690db164.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetName.cshtml:line 15
   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 6 @{ 7 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 8 9 ProductDetailWidgetName _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetName", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetName>() ?? new ProductDetailWidgetName(); 10 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj) Dynamicweb.Context.Current.Session["ProductAndVariants"]; 11 } 12 13 <div id="@paragraphID" class="pdp__ProductName @_data.CssClass"> 14 <h1 class="pdp-header__title"> 15 @if (_data.DisplayManufacturer && ProductAndVariants.Manufacturer != null) 16 { 17 <span class="pdp-header__manufacturer">@ProductAndVariants.Manufacturer.Name</span> 18 } 19 <span class="pdp-header__productname">@ProductAndVariants.ProductInfo.Name</span> 20 </h1> 21 </div> 22 23 <style> 24 25 .pdp__ProductName .pdp-header__productname { 26 color: var(--Color); 27 @_data.FontConfigurationProductName.InlineStyles 28 } 29 30 </style> 31
5 / 5 (2 reviews)
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_55956eeb0e104911b302bceb0b90ae02.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetImages.cshtml:line 21
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog; 3 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 5 @using System.Text.RegularExpressions; 6 7 8 @{ 9 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 10 ProductDetailWidgetImages _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetImages", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetImages>() ?? new ProductDetailWidgetImages(); 11 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj) Dynamicweb.Context.Current.Session["ProductAndVariants"]; 12 13 ProductViewModel product = new ProductViewModel(); 14 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 15 { 16 product = (ProductViewModel) Dynamicweb.Context.Current.Items["ProductDetails"]; 17 } 18 19 List<FieldOptionValueViewModel> productRibbons = null; 20 21 if (product.ProductFields["ProductRibbon"] != null) 22 { 23 productRibbons = (List<FieldOptionValueViewModel>)product.ProductFields["ProductRibbon"].Value; 24 } 25 26 //ProductObj ProductObj = (ProductObj)HttpContext.Current.Session["ProductDetails"]; 27 28 //ProductDetailObj DefaultProduct = ProductObj.Default[0]; 29 30 //ProductInfoObj DefaultProductInfo = DefaultProduct.ProductInfo; 31 32 //List<ProductAssetsObj> Assets = DefaultProduct.ProductImages.ProductAssets; 33 34 bool displayRibbon = _data.DisplayRibbon; 35 bool displayManufacturerLogo = _data.DisplayManufacturerLogo; 36 37 string videoUrl = ProductAndVariants?.ProductDetail?.YoutubeProductVideo ?? ""; 38 string videoId = ""; 39 string origin = Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain(); 40 41 if (!string.IsNullOrWhiteSpace(videoUrl)) 42 { 43 // regex for https://youtu.be/{videoid} 44 Regex regex = new Regex(@".be\/(.[^?]*)"); 45 Match match = regex.Match(videoUrl); 46 if (match.Success) 47 { 48 videoId = match.Groups[1].Value; 49 } 50 51 // regex for https://www.youtube.com/watch?v={videoid} 52 regex = new Regex(@"v=([^&]+)"); 53 match = regex.Match(videoUrl); 54 if (match.Success) 55 { 56 videoId = match.Groups[1].Value; 57 } 58 } 59 } 60 61 <div id="@paragraphID" class="pdp-paragraph w-full @_data.CssClass"> 62 63 @if (!string.IsNullOrWhiteSpace(ProductAndVariants.ProductDetail.ProductRibbon) && displayRibbon) 64 { 65 <p class="product-detailpage__ribbon product-detailpage__ribbon--big"><span>@ProductAndVariants.ProductDetail.ProductRibbon</span></p> 66 } 67 68 <section class="product-detailpage__images pdp__images-container"> 69 <section class="productimages pdp__images"> 70 71 <section class="productimages__wrapper"> 72 73 <div class="productimages__carousel-big hidden"> 74 75 <div class="productimages__item"> 76 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@ProductAndVariants.Images.Default&Format=webp&Quality=-1&width=800&height=800" alt="@ProductAndVariants.Images.Default" height="800" width="800" /> 77 </div> 78 79 @if (ProductAndVariants.Images.AssetImages != null) 80 { 81 foreach (Image Image in ProductAndVariants.Images.AssetImages) 82 { 83 <div class="productimages__item"> 84 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@Image.Value&Format=webp&Quality=-1&width=800&height=800" alt="@Image.Value" /> 85 </div> 86 } 87 88 } 89 90 @if (!string.IsNullOrWhiteSpace(videoId)) 91 { 92 <div class="productimages__item"> 93 <div class="productimages__carousel__video-container"> 94 <lite-youtube 95 videoid="@videoId" 96 params="controls=1&loop=0&playlist=@videoId&playsinline=1&modestbranding=1&mute=0&rel=0&enablejsapi=1&origin=@origin&disablekb=0"> 97 </lite-youtube> 98 </div> 99 </div> 100 } 101 102 </div> 103 </section> 104 105 <div class="productimages__carousel-thumbnails hidden"> 106 107 <div class="productimages__thumbnail"> 108 <img class="w-auto" src="/Admin/Public/GetImage.ashx?Image=@ProductAndVariants.Images.Default&Format=webp&Quality=-1&width=100&height=100" alt="@ProductAndVariants.Images.Default" height="100" width="100" /> 109 </div> 110 111 @if (ProductAndVariants.Images.AssetImages != null) 112 { 113 foreach (Image Thumb in ProductAndVariants.Images.AssetImages) 114 { 115 <div class="productimages__thumbnail"> 116 <img class="product-image" src="/Admin/Public/GetImage.ashx?Image=@Thumb.Value&Crop=7&Format=webp&Quality=90&Compression=80&width=100&height=100" alt="Thumbnail @Thumb.Value" width="100" height="100" /> 117 </div> 118 } 119 } 120 121 @if(!string.IsNullOrWhiteSpace(videoId)) 122 { 123 <div class="productimages__thumbnail productimages__thumbnail--video pin-t mr-4" aria-hidden="true"> 124 <img class="h-full" src="https://img.youtube.com/vi/@videoId/0.jpg" alt="Video preview" height="84" width="84"> 125 <span class="video-icon"> 126 <i class="fas fa-play"></i> 127 </span> 128 </div> 129 } 130 </div> 131 132 <section class="productimages__wrapper"> 133 @if (displayManufacturerLogo && ProductAndVariants.Manufacturer != null && ProductAndVariants.Manufacturer.Logo != "") 134 { 135 <img src="/Admin/Public/GetImage.ashx?Image=/Files/@ProductAndVariants.Manufacturer.Logo&Crop=7&Format=webp&Quality=90&Compression=80&width=150" class="manufacturer__logo" alt="Manufacturer" width="150" height="50" /> 136 } 137 </section> 138 139 </section> 140 </section> 141 </div> 142 143 <style> 144 .productimages__item { 145 height: 400px; 146 } 147 </style> 148
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_8cf7662a3d18414ba24df19476b215d2.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\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
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_e2529a3fc80c4e299db26af1b3609d4f.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\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.Services.Items.GetItem("ProductDetailWidgetPrice", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetPrice>() ?? new ProductDetailWidgetPrice(); 10 11 var master_configuration = Dynamicweb.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 96 <div id="@paragraphID" class="pdp-paragraph @_data.CssClass"> 97 @if (displayPrice && displayProductPrice) 98 { 99 <div class="pdp-price__container"> 100 @if (hasDiscount) 101 { 102 <p class="pdp-price--original">@priceBeforeDiscountFormatted</p> 103 <section class="pdp-price__subcontainer"> 104 <span class="pdp-price">@priceFormatted</span> 105 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 106 <span class="pdp-price__percentage">@discountPercentage%</span> 107 </section> 108 } 109 else 110 { 111 <section class="pdp-price__subcontainer"> 112 <span class="pdp-price">@priceFormatted</span> 113 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 114 </section> 115 } 116 @if (!string.IsNullOrWhiteSpace(retailPrice)) 117 { 118 <p class="pdp-price__retail-price"> 119 @String.Format(Translate("ProductBlockTitle.RetailPrice", "Retail price: {0}"), retailPrice) 120 </p> 121 } 122 @if (hasDiscount) 123 { 124 <p class="pdp-price__yourprofit"> 125 @Translate("Productdetail.YourProfitLabel", "Your profit:") @priceTotalDiscountFormatted 126 </p> 127 } 128 </div> 129 } 130 </div> 131
Error executing template "/Designs/ClientBase_generated/Paragraph/ProductDetailWidgetStock.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at Dynamicweb.Ecommerce.Products.ProductService.GetStockStatus(Product product, StockLocation stockLocation, String unitId)
   at CompiledRazorTemplates.Dynamic.RazorEngine_9e4612fa5d8a4ff98c57e6b32129468e.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetStock.cshtml:line 38
   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.Stocks; 5 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 6 7 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 8 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 9 10 @{ 11 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 12 13 var master_configuration = Dynamicweb.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 14 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 15 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 16 17 ProductViewModel product = new ProductViewModel(); 18 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 19 { 20 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 21 } 22 23 ProductAndVariantsObj _product = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 24 25 bool hideStockForGuests = EcommerceConfiguration.HideStockForGuests; 26 bool enableProductStock = hideStockForGuests ? Pageview.User != null : true; 27 string stockFormat = EcommerceConfiguration.StockFormat; 28 bool inStock = product.StockLevel > 0 || product.NeverOutOfstock; 29 string stockStateClass = inStock ? "pdp-stockstate--instock" : "pdp-stockstate--outofstock"; 30 } 31 32 <div id="@paragraphID" class="pdp-paragraph"> 33 @if(enableProductStock && !string.IsNullOrWhiteSpace(stockFormat)) 34 { 35 if(stockFormat == "text") { 36 StockLocation stockLocation = Dynamicweb.Ecommerce.Services.StockService.GetStockLocation(Pageview.Area.StockLocationID); 37 var currentProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, "", Pageview.Area.EcomLanguageId); 38 string stockText = Dynamicweb.Ecommerce.Services.Products.GetStockStatus(currentProduct, stockLocation, Pageview.Area.EcomLanguageId)?.Text; 39 40 if (!string.IsNullOrWhiteSpace(stockText)) 41 { 42 <p class="pdp-stockstate @stockStateClass">@string.Format(stockText, product.StockLevel)</p> 43 } 44 } 45 else 46 { 47 string translationTag = ""; 48 if(product.NeverOutOfstock) 49 { 50 translationTag = Translate("ProductBlockStockInfo.AmountInStock", "In stock"); 51 } 52 else if(product.StockLevel == 1) 53 { 54 translationTag = Translate("ProductBlockStockInfo.AmountInStockSingle", "{0} product in stock"); 55 } 56 else if(product.StockLevel > 1) 57 { 58 translationTag = Translate("ProductBlockStockInfo.AmountInStockMultiple", "{0} products in stock"); 59 } 60 else if(!inStock) 61 { 62 translationTag = Translate("ProductBlockStockInfo.AmountOutOfStock", "Out of stock"); 63 } 64 65 <p class="pdp-stockstate @stockStateClass">@string.Format(translationTag, product.StockLevel)</p> 66 } 67 } 68 </div> 69
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetAddToCart.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_7ae59b8fccc3461a953a36ae54fa58d1.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetAddToCart.cshtml:line 33
   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 Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 5 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 6 7 @using Bluedesk.DynamicWeb.ItemTypes.Configuration; 8 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 9 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 10 11 @{ 12 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 13 ProductDetailWidgetAddToCart _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetAddToCart", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetAddToCart>() ?? new ProductDetailWidgetAddToCart(); 14 15 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 16 17 var master_configuration = Dynamicweb.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 18 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 19 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 20 21 ProductViewModel product = new ProductViewModel(); 22 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 23 { 24 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 25 } 26 27 bool hideShoppingCartForGuests = EcommerceConfiguration.HideShoppingCartForGuests; 28 bool enableAddToCartForZeroPrices = EcommerceConfiguration.AddToCartAllowZeroPrices; 29 bool enableAddToCartForOutOfStock = EcommerceConfiguration.AddToCartAllowOutOfStock; 30 31 bool enableShoppingCart = hideShoppingCartForGuests && Pageview.User == null ? false : Pageview.Area.Item["ConfigModuleShoppingCart"] != null ? (bool)Pageview.Area.Item["ConfigModuleShoppingCart"] : false; 32 bool enableProductShoppingCart = enableShoppingCart; 33 if (!enableAddToCartForZeroPrices && product.Price.Price <= 0) 34 { 35 enableProductShoppingCart = false; 36 } 37 if (!enableAddToCartForOutOfStock && !(product.StockLevel > 0 || product.NeverOutOfstock)) 38 { 39 enableProductShoppingCart = false; 40 } 41 42 int QuotePageID = GetPageIdByNavigationTag("QuoteForm"); 43 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 44 45 bool isVariant = product.VariantId != ""; 46 int variantCount = product?.VariantInfo?.VariantInfo?.Count ?? 0; 47 bool hasVariants = !isVariant ? variantCount > 0 : false; 48 } 49 50 <div id="@paragraphID" class="pdp-paragraph @_data.CssClass"> 51 @if (!hasVariants) 52 { 53 if (enableShoppingCart && enableProductShoppingCart) 54 { 55 <div class="pdp-add-to-cart pdp-add-to-cart__container"> 56 <add-to-cart class="app-addtocart" 57 data-prodid="@product.Id" 58 data-variantid="@product.VariantId" 59 data-min-quantity="@product.PurchaseMinimumQuantity" 60 data-step="@product.PurchaseQuantityStep" 61 data-list-id="product_detail" 62 data-list-name="Product detail"> 63 </add-to-cart> 64 </div> 65 } 66 else 67 { 68 if (QuotePageID > 0) 69 { 70 ButtonConfiguration btnStyle = _data.ButtonConfiguration; 71 string btnStyleClass = btnStyle != null ? $"btn--{btnStyle.Id}" : ""; 72 73 string btnTarget = "javascript:void(0);"; 74 75 if (!string.IsNullOrWhiteSpace(_data.OffertePageId)) 76 { 77 btnTarget = $"/Default.aspx?ID={_data.OffertePageId}&ProdID={product.Id}"; 78 if (!string.IsNullOrWhiteSpace(product.VariantId)) 79 { 80 btnTarget = $"{btnTarget}&VarID={product.VariantId}"; 81 } 82 } 83 84 <style> 85 @if (btnStyle != null) 86 { 87 @btnStyle.GetButtonStylesheet() 88 } 89 </style> 90 <div class="pdp-quote-button"> 91 <a href="@btnTarget" class="btn default-btn @btnStyleClass"> 92 <span class="btn__text">@_data.ButtonText</span> 93 <i class="btn__icon @_data.ButtonIcon"></i> 94 </a> 95 </div> 96 } 97 } 98 } 99 </div> 100
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetPaymentLogos.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_8d0db658d54a4f758566c6a99a82f5e2.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetPaymentLogos.cshtml:line 18
   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 Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 5 6 @{ 7 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 8 var selectedPaymentLogos = Pageview.Area.Item["FooterPaymentLogos"]; 9 ProductDetailWidgetPaymentLogos _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetPaymentLogos", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetPaymentLogos>() ?? new ProductDetailWidgetPaymentLogos(); 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 18 @if (product.Price.Price > 0) 19 { 20 <div id="@paragraphID" class="pdp-paragraph @_data.CssClass"> 21 <section class="pdp-paymentlogos paymentlogos--small"> 22 <div class="footer-paymentoptions" data-paymentmethods="@selectedPaymentLogos"></div> 23 </section> 24 </div> 25 } 26
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetProductUsps.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_8600b78ff17147e48e1fd4f9cd04f1fe.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetProductUsps.cshtml:line 13
   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 6 @{ 7 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 8 ProductDetailWidgetProductUsps _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetProductUsps", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetProductUsps>() ?? new ProductDetailWidgetProductUsps(); 9 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 10 string uspIcon = _data.USPIcon; 11 12 var productUsps = new List<String>(); 13 if (ProductAndVariants.USP != null && !string.IsNullOrWhiteSpace(ProductAndVariants.USP.USP1)) { productUsps.Add(ProductAndVariants.USP.USP1.ToString()); } 14 if (ProductAndVariants.USP != null && !string.IsNullOrWhiteSpace(ProductAndVariants.USP.USP2)) { productUsps.Add(ProductAndVariants.USP.USP2); } 15 if (ProductAndVariants.USP != null && !string.IsNullOrWhiteSpace(ProductAndVariants.USP.USP3)) { productUsps.Add(ProductAndVariants.USP.USP3); } 16 if (ProductAndVariants.USP != null && !string.IsNullOrWhiteSpace(ProductAndVariants.USP.USP4)) { productUsps.Add(ProductAndVariants.USP.USP4); } 17 if (ProductAndVariants.USP != null && !string.IsNullOrWhiteSpace(ProductAndVariants.USP.USP5)) { productUsps.Add(ProductAndVariants.USP.USP5); } 18 19 /* 20 21 ProductViewModel product = new ProductViewModel(); 22 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 23 { 24 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 25 } 26 27 var productUsps = new List<String>(); 28 29 if (product.ProductFields != null && product.ProductFields.ContainsKey("ProductUSP1")) 30 { 31 productUsps.Add(product.ProductFields["ProductUSP1"].Value.ToString()); 32 } 33 if (product.ProductFields != null && product.ProductFields.ContainsKey("ProductUSP2")) 34 { 35 productUsps.Add(product.ProductFields["ProductUSP2"].Value.ToString()); 36 } 37 if (product.ProductFields != null && product.ProductFields.ContainsKey("ProductUSP3")) 38 { 39 productUsps.Add(product.ProductFields["ProductUSP3"].Value.ToString()); 40 } 41 if (product.ProductFields != null && product.ProductFields.ContainsKey("ProductUSP4")) 42 { 43 productUsps.Add(product.ProductFields["ProductUSP4"].Value.ToString()); 44 } 45 if (product.ProductFields != null && product.ProductFields.ContainsKey("ProductUSP5")) 46 { 47 productUsps.Add(product.ProductFields["ProductUSP5"].Value.ToString()); 48 } 49 50 */ 51 52 } 53 54 <div id="@paragraphID" class="pdp-paragraph @_data.CssClass"> 55 56 <ul class="pdp-usplist"> 57 @foreach (string usp in productUsps) 58 { 59 if (!string.IsNullOrWhiteSpace(usp)) 60 { 61 <li class="pdp-usplist__item"> 62 @if (!string.IsNullOrWhiteSpace(uspIcon)) 63 { 64 <i class="pdp-usplist__uspicon @uspIcon"></i> 65 } 66 <span>@usp</span> 67 </li> 68 } 69 } 70 </ul> 71 72 </div> 73
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetShortDescription.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_65280383fa324ae7aad92e01f5dc04e3.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetShortDescription.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 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 3 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 4 5 @{ 6 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 7 8 ProductDetailWidgetShortDescription _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetShortDescription", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetShortDescription>() ?? new ProductDetailWidgetShortDescription(); 9 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj) Dynamicweb.Context.Current.Session["ProductAndVariants"]; 10 11 string readMoreTarget = _data.ButtonTarget; 12 string shortDescription = ProductAndVariants.ProductInfo.ShortDescription; 13 } 14 15 <div id="@paragraphID" class="pdp-paragraph pdp-paragraph-short-description ProductShortDescription"> 16 @if(!string.IsNullOrWhiteSpace(shortDescription)) 17 { 18 <p class="pdp-header__productname">@shortDescription</p> 19 if(!string.IsNullOrWhiteSpace(readMoreTarget)) 20 { 21 <a href="@readMoreTarget" class="btn default-btn" target="_self"> 22 <span class="btn__text">@Translate("Productdetail.Readmore", "Read more")</span> 23 <i class="btn__icon fa-chevron-right"></i> 24 </a> 25 } 26 } 27 </div> 28
Benötigen Sie professionellen Rat?

Fragen Sie einen unserer Spezialisten.

Tel.: +31 (0)72 540 66 99

E-mail: info@koks.com

 

Rufen Sie mich zurück
  • Produktinformation
  • Spezifikationen
  • Reviews
  • Accessoires
  • Andere uitvoeringen
  • Optionen
  • Vorteile
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetLongDescription.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_3602415f3fad48fba66542b108497370.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetLongDescription.cshtml:line 41
   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; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Configuration.AdvancedGrid.Elements; 5 6 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 7 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 8 9 @{ 10 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 11 12 ProductDetailWidgetLongDescription _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetLongDescription", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetLongDescription>() ?? new ProductDetailWidgetLongDescription(); 13 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 14 15 bool IsNotContentManager = false; 16 bool isVisualEditor = Pageview.IsVisualEditorMode; 17 18 if (isVisualEditor) 19 { 20 System.Web.HttpContext.Current.Session["PreviousPage"] = Pageview.Page.ID; 21 IsNotContentManager = (Dynamicweb.Security.UserManagement.User.GetCurrentBackendUser()?.Groups?.All(g => g.Name != "Content managers") ?? true); 22 } 23 24 if (ProductAndVariants != null && ProductAndVariants.ProductInfo != null && ProductAndVariants.ProductInfo.LongDescription != null) 25 { 26 27 <div id="@paragraphID" class="ProductLongDescription @_data.CssClass"> 28 <div class="ProductLongDescription__header">@Translate("ProductDetailWidget.LongDescription.Header", "Productinformatie")</div> 29 30 <p>@ProductAndVariants.ProductInfo.LongDescription</p> 31 </div> 32 33 <style> 34 @_data.FontConfigurationProductName.InlineStyles 35 </style> 36 37 } 38 else 39 { 40 41 <script>console.dir(@ProductAndVariants.Template.Json)</script> 42 43 <placeholder id="@paragraphID" class="ProductLongDescription @_data.CssClass"></placeholder> 44 45 if (_data.HideTabWhenEmpty) 46 { 47 <script> 48 49 document.addEventListener('DOMContentLoaded', function () { 50 51 var Element = document.getElementById("@paragraphID"); 52 console.dir(Element); 53 var parentElement = Element.closest('.content-tab'); 54 console.dir(parentElement); 55 var TabElement = document.querySelector('[data-tab-target=' + parentElement.id + ']'); 56 console.dir(TabElement); 57 58 @{ 59 if (isVisualEditor && IsNotContentManager) 60 { 61 <text>TabElement.style.display = 'flex';</text> 62 } 63 else 64 { 65 <text>TabElement.style.display = 'none';</text> 66 } 67 } 68 69 }); 70 71 </script> 72 } 73 74 } 75 76 } 77
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetDownloadProductsheet.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c2a7bef162047dd9ef28e855e146192.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetDownloadProductsheet.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; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 5 6 @{ 7 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 8 ProductDetailWidgetDownloadProductsheet _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetDownloadProductsheet", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetDownloadProductsheet>() ?? new ProductDetailWidgetDownloadProductsheet(); 9 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 10 } 11 12 @if (!string.IsNullOrWhiteSpace(ProductAndVariants.ProductDetail.DownloadProductsheet)) 13 { 14 15 <nav id="@paragraphID" class="cta-paragraph__btn-navigation @_data.CssClass"> 16 <a href="/Files/Images/@ProductAndVariants.ProductDetail.DownloadProductsheet" class="btn default-btn btn--@paragraphID" target="_blank"> 17 <i class="btn__icon fa-download cta-paragraph__btn-icon"></i> 18 <span class="btn__text cta-paragraph__btn cta-paragraph__btn-label">@_data.Label</span> 19 </a> 20 </nav> 21 22 } 23
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetVideo.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_336c4f3656754e969ce6b68b7f8c8a07.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetVideo.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.Configuration.EcomConfiguration.ProductDetail.Widgets; 4 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 5 @using System.Text.RegularExpressions; 6 7 @{ 8 var paragraphID = Pageview.CurrentParagraph.ID; 9 ProductDetailWidgetVideo _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetVideo", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetVideo>() ?? new ProductDetailWidgetVideo(); 10 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 11 12 string videoUrl = ProductAndVariants.ProductDetail == null ? null : ProductAndVariants.ProductDetail.YoutubeProductVideo; 13 string videoId = ""; 14 string origin = Dynamicweb.Environment.Helpers.LinkHelper.GetHttpDomain(); 15 16 } 17 18 <div id="@paragraphID" class="pdp-paragraph w-full @_data.CssClass"> 19 @{ 20 if (!string.IsNullOrWhiteSpace(videoUrl)) 21 { 22 // Regex for https://youtu.be/{videoId} 23 Match match = new Regex(@".be\/(.[^?]*)").Match(videoUrl); 24 if (match.Success) 25 { 26 videoId = match.Groups[1].Value; 27 28 <div class="product-video"> 29 <iframe loading="lazy" data-video="@videoId" frameborder="0" allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" title="YouTube video player" src="https://www.youtube-nocookie.com/embed/@videoId?autoplay=0&controls=1&loop=0&playlist=@videoId&playsinline=1&modestbranding=0o&mute=1&rel=0&enablejsapi=1&origin=@origin&disablekb=1"></iframe> 30 </div> 31 } 32 33 // Regex for https://www.youtube.com/watch?v={videoId} 34 match = new Regex(@"v=([^&]+)").Match(videoUrl); 35 if (match.Success) 36 { 37 videoId = match.Groups[1].Value; 38 39 <div class="product-video"> 40 <iframe loading="lazy" data-video="@videoId" frameborder="0" allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" title="YouTube video player" src="https://www.youtube-nocookie.com/embed/@videoId?autoplay=0&controls=1&loop=0&playlist=@videoId&playsinline=1&modestbranding=0o&mute=1&rel=0&enablejsapi=1&origin=@origin&disablekb=1"></iframe> 41 </div> 42 } 43 44 // Regex for https://player.vimeo.com/video/{videoId} 45 match = new Regex("(?:http:|https:|)\\/\\/(?:player.|www.)?vimeo\\.com\\/(?:video\\/|embed\\/|watch\\?\\S*v=|v\\/)?(\\d*)", RegexOptions.IgnoreCase).Match(videoUrl); 46 if (match.Success) 47 { 48 videoId = match.Groups[1].Value; 49 50 <div class="product-video"> 51 <iframe loading="lazy" data-video="@videoId" frameborder="0" allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" title="Vimeo video player" src="https://player.vimeo.com/video/@videoId?title=0&byline=0&portrait=0&autoplay=0&controls=1&loop=0&muted=1"></iframe> 52 </div> 53 } 54 55 if (string.IsNullOrWhiteSpace(videoId)) 56 { 57 <div class="product-video"> 58 <iframe loading="lazy" data-video="@videoUrl" frameborder="0" allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" title="YouTube video player" src="https://www.youtube-nocookie.com/embed/@videoUrl?autoplay=0&controls=1&loop=0&playlist=@videoUrl&playsinline=1&modestbranding=0o&mute=1&rel=0&enablejsapi=1&origin=@origin&disablekb=1"></iframe> 59 </div> 60 } 61 } 62 } 63 </div> 64 65 <style> 66 .product-video iframe { 67 aspect-ratio: 16 / 9; 68 width: 50%; 69 height: auto; 70 min-width: 325px; 71 } 72 </style> 73 74 @{ 75 76 } 77
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetStandardSpecifications.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_2c73865399de4626a0709f254245d4d6.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetStandardSpecifications.cshtml:line 14
   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 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Configuration.EcomConfiguration.ProductDetail.Widgets; 5 @using Dynamicweb.Ecommerce.ProductCatalog; 6 7 @{ 8 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 9 10 ProductDetailWidgetStandardSpecifications _data = Dynamicweb.Services.Items.GetItem("ProductDetailWidgetStandardSpecifications", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetStandardSpecifications>() ?? new ProductDetailWidgetStandardSpecifications(); 11 12 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 13 14 var p = Dynamicweb.Ecommerce.Services.Products.GetProductById(ProductAndVariants.ProductId, ProductAndVariants.ProductVariantId, Pageview.Area.EcomLanguageId); 15 16 var product = new ProductViewModel 17 { 18 Number = p.Number 19 }; 20 21 string productNumber = product.Number; 22 string manufacturerName = ProductAndVariants?.Manufacturer?.Name ?? ""; 23 string productEan = ProductAndVariants?.ProductInfo?.EAN ?? ""; 24 } 25 26 @if (!string.IsNullOrWhiteSpace(manufacturerName) || !string.IsNullOrWhiteSpace(productNumber) || !string.IsNullOrWhiteSpace(productEan)) 27 { 28 <section id="@paragraphID" @_data.CssClass> 29 <h2>@Translate("Productdetail.Specifications", "Specificaties")</h2> 30 <section> 31 <div class="productdetail_specifications"> 32 @if (!string.IsNullOrEmpty(manufacturerName)) 33 { 34 <label>@Translate("Productdetail.Manufacturer", "Fabrikant: ") @manufacturerName</label> 35 } 36 @if (!string.IsNullOrEmpty(productNumber)) 37 { 38 <label>@Translate("Productdetail.ProductNumber", "Artikelnummer: ") @productNumber</label> 39 } 40 @if (!string.IsNullOrEmpty(productEan)) 41 { 42 <label>@Translate("Productdetail.EANCode", "EAN code: ") @productEan</label> 43 } 44 </div> 45 </section> 46 </section> 47 } 48 49 <style> 50 .productdetail_specifications { 51 flex-direction: column; 52 display: flex; 53 } 54 </style> 55

Vereinbaren Sie einen Beratungstermin mit einem unserer Spezialisten

 Lassen Sie sich von einem Spezialisten beraten  Lernen Sie uns und unsere Produkte kennen  Finden Sie heraus, welche Lösung am besten zu Ihnen passt

Reviews

5 / 5 (2 reviews)
5 / 5

Test

5 / 5

Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetSecondaryInfo.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_87b0af0446f04490adf135ad261051a1.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetSecondaryInfo.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 Dynamicweb.Ecommerce.Variants; 5 @using Dynamicweb.Ecommerce.Prices; 6 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 7 @using Newtonsoft.Json; 8 9 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 10 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 11 12 @{ 13 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 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 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 22 23 var master_configuration = Dynamicweb.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 24 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 25 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 26 27 bool isVariant = product.VariantId != ""; 28 int variantCount = product.VariantInfo?.VariantInfo?.Count ?? 0; 29 bool hasVariants = !isVariant ? variantCount > 0 : false; 30 31 string largeImage = product.DefaultImage.Value; 32 if (ProductAndVariants != null && ProductAndVariants.Images != null && ProductAndVariants.Images.Default != null) 33 { 34 largeImage = ProductAndVariants.Images.Default; 35 } 36 37 string productName = product.Name; 38 string productSubTitle = product.ProductFields["ProductDetailSubtitle"].Value.ToString(); 39 40 // Review 41 Dynamicweb.Content.Commenting.CommentCollection comments = Dynamicweb.Content.Commenting.Comment.GetComments("ecomProduct", product.Id, Pageview.Area.EcomLanguageId, true); 42 double? productRating = comments.GetRatingAverage(); 43 int productCommentCount = comments.GetTotalCount(); 44 45 // Stock 46 bool hideStockForGuests = EcommerceConfiguration.HideStockForGuests; 47 bool enableProductStock = hideStockForGuests ? Pageview.User != null : true; 48 string stockFormat = EcommerceConfiguration.StockFormat; 49 bool inStock = product.StockLevel > 0 || product.NeverOutOfstock; 50 string stockStateClass = inStock ? "pdp-stockstate--instock" : "pdp-stockstate--outofstock"; 51 52 // Tagline 53 string productTagline = product.ProductFields != null && product.ProductFields.ContainsKey("ProductTagline") ? product.ProductFields["ProductTagline"].Value.ToString() : ""; 54 bool isVisualEditor = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("VisualEdit")) ? Convert.ToBoolean(Dynamicweb.Context.Current.Request.QueryString.Get("VisualEdit")) : false; 55 string productDetailPageTagline = ""; 56 if (!isVisualEditor) 57 { 58 productDetailPageTagline = Pageview.Item["Tagline"].ToString(); 59 } 60 61 // Price 62 bool WithVATBool = Pageview.Area.EcomPricesWithVat == "True"; 63 bool pricesWithoutVatForUsers = EcommerceConfiguration.ShowPricesWithoutVatForUsers; 64 bool pricesWithoutVatForValidVat = EcommerceConfiguration.ShowPricesWithoutVatWhenValidVatNumber; 65 if(pricesWithoutVatForUsers && !pricesWithoutVatForValidVat && Pageview.User != null) { 66 WithVATBool = false; 67 } 68 if(pricesWithoutVatForValidVat && Pageview.User != null && !string.IsNullOrWhiteSpace(Pageview.User.VatRegNumber)) { 69 WithVATBool = false; 70 } 71 72 bool hidePricesForGuests = EcommerceConfiguration.HidePricesForGuests; 73 bool hideZeroPrices = EcommerceConfiguration.HideZeroPrices; 74 bool displayPrice = hidePricesForGuests ? Pageview.User != null : true; 75 bool pricezero = product.Price.Price <= 0; 76 77 bool displayProductPrice = displayPrice; 78 if (hideZeroPrices && pricezero) 79 { 80 displayProductPrice = false; 81 } 82 83 string ProductdetailPriceSuffixWithVAT = Translate("Productdetail.Price.Suffix.WithVAT", "Incl. VAT"); 84 string ProductdetailPriceSuffixWithoutVAT = Translate("Productdetail.Price.Suffix.WithoutVAT", "Excl. VAT"); 85 string ProductdetailPriceSuffix = WithVATBool ? ProductdetailPriceSuffixWithVAT : ProductdetailPriceSuffixWithoutVAT; 86 87 var gtmValue = WithVATBool ? product.Price.PriceWithVat : product.Price.PriceWithoutVat; 88 var priceFormatted = WithVATBool ? product.Price.PriceWithVatFormatted : product.Price.PriceWithoutVatFormatted; 89 var priceBeforeDiscount = WithVATBool ? product.PriceBeforeDiscount.PriceWithVat : product.PriceBeforeDiscount.PriceWithoutVat; 90 var priceBeforeDiscountFormatted = WithVATBool ? product.PriceBeforeDiscount.PriceWithVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; 91 var priceTotalDiscount = WithVATBool ? product.Discount.PriceWithVat : product.Discount.PriceWithoutVat; 92 var priceTotalDiscountFormatted = WithVATBool ? product.Discount.PriceWithVatFormatted : product.Discount.PriceWithoutVatFormatted; 93 double discountPercentage = Math.Round(((priceTotalDiscount / priceBeforeDiscount) * -100)); 94 bool hasDiscount = product.Discount.Price > 0; 95 96 string informativePrice = WithVATBool ? product.PriceInformative.PriceWithVatFormatted : product.PriceInformative.PriceWithoutVatFormatted; 97 if (EcommerceConfiguration.UseInformativePriceAsFromPrice && !string.IsNullOrWhiteSpace(informativePrice)) 98 { 99 double informativePriceValue = WithVATBool ? product.PriceInformative.PriceWithVat : product.PriceInformative.PriceWithoutVat; 100 hasDiscount = gtmValue < informativePriceValue; 101 if (hasDiscount) 102 { 103 priceBeforeDiscountFormatted = informativePrice; 104 discountPercentage = Math.Round((((gtmValue - informativePriceValue) / informativePriceValue) * 100)); 105 106 double yourProfitValue = informativePriceValue - gtmValue; 107 priceTotalDiscountFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = yourProfitValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = yourProfitValue }.PriceWithoutVATFormatted; 108 } 109 } 110 111 string retailPrice = ""; 112 bool displayRetailPrice = EcommerceConfiguration.DisplayRetailPrice; 113 if(EcommerceConfiguration.DisplayRetailPriceForUsers && Pageview.User == null) { 114 displayRetailPrice = false; 115 } 116 if(displayRetailPrice) { 117 string priceFieldName = EcommerceConfiguration.RetailPriceField; 118 if(EcommerceConfiguration.RetailPriceIsDbPrice) { 119 var p = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, Pageview.Area.EcomLanguageId); 120 PriceContext customerPriceContext = new PriceContext(Dynamicweb.Ecommerce.Common.Context.Currency, Dynamicweb.Ecommerce.Common.Context.Country, null, null, Dynamicweb.Ecommerce.Common.Context.ReverseChargeForVatEnabled, DateTime.Now); 121 var customerPrice = p?.GetPrice(customerPriceContext); 122 if(customerPrice.Price > 0) { 123 retailPrice = WithVATBool ? customerPrice.PriceWithVATFormatted : customerPrice.PriceWithoutVATFormatted; 124 } 125 } else if(!string.IsNullOrWhiteSpace(priceFieldName)) { 126 double customerPriceValue = 0.0; 127 if (product.ProductFields.TryGetValue(priceFieldName, out var fieldValue) && fieldValue.Value is double) { 128 customerPriceValue = (double)fieldValue.Value; 129 } 130 if(customerPriceValue > 0) { 131 retailPrice = WithVATBool ? new PriceInfo { PriceWithVAT = customerPriceValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = customerPriceValue }.PriceWithoutVATFormatted; 132 } 133 } 134 } 135 136 // Add to cart 137 bool hideShoppingCartForGuests = EcommerceConfiguration.HideShoppingCartForGuests; 138 bool enableAddToCartForZeroPrices = EcommerceConfiguration.AddToCartAllowZeroPrices; 139 bool enableAddToCartForOutOfStock = EcommerceConfiguration.AddToCartAllowOutOfStock; 140 bool enableShoppingCart = hideShoppingCartForGuests && Pageview.User == null ? false : Pageview.Area.Item["ConfigModuleShoppingCart"] != null ? (bool)Pageview.Area.Item["ConfigModuleShoppingCart"] : false; 141 bool enableProductShoppingCart = enableShoppingCart; 142 if (!enableAddToCartForZeroPrices && product.Price.Price <= 0) 143 { 144 enableProductShoppingCart = false; 145 } 146 if (!enableAddToCartForOutOfStock && !(product.StockLevel > 0 || product.NeverOutOfstock)) 147 { 148 enableProductShoppingCart = false; 149 } 150 151 int QuotePageID = GetPageIdByNavigationTag("QuoteForm"); 152 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 153 154 // Variant selector 155 int pageId = Model.PageID; 156 string variantSelection = product.VariantId.Replace(".", ","); 157 158 List<string[]> variantCombinationsIds = new List<string[]>(); 159 List<List<string>> variantGroupsOptionIds = new List<List<string>>(); 160 161 var variantCombinations = Dynamicweb.Ecommerce.Services.VariantCombinations.GetVariantCombinations(product.Id); 162 var variantGroups = Dynamicweb.Ecommerce.Services.VariantGroups.GetVariantGroupsByProductId(product.Id); 163 164 foreach (var combination in variantCombinations) 165 { 166 variantCombinationsIds.Add(combination.VariantId.Split('.')); 167 } 168 string variantCombinationsIdsJson = JsonConvert.SerializeObject(variantCombinationsIds).Replace("\"", "\'"); 169 170 foreach (var variantGroup in variantGroups) 171 { 172 var variantsObject = new List<string>(); 173 foreach (var variantOption in variantGroup.GetAllVariantOptions()) 174 { 175 variantsObject.Add(variantOption.Id); 176 } 177 variantGroupsOptionIds.Add(variantsObject); 178 } 179 string variantGroupsOptionIdsJson = JsonConvert.SerializeObject(variantGroupsOptionIds).Replace("\"", "\'"); 180 181 var selectedPaymentLogos = Pageview.Area.Item["FooterPaymentLogos"]; 182 } 183 <div id="@paragraphID" class="pdp-paragraph"> 184 <section class="pdp-secondary-info"> 185 <div class="container pdp-secondary-info__container"> 186 <div class="pdp-secondary-info__column"> 187 @if (!string.IsNullOrWhiteSpace(largeImage)) 188 { 189 <figure class="pdp-secondary-info__image-container"> 190 <img class="pdp-secondary-info__image" src="/Admin/Public/GetImage.ashx?Image=@largeImage&Crop=7&Format=webp&Quality=90&Compression=80&Height=400" alt="@productName" loading="lazy" height="400" width="600" /> 191 </figure> 192 } 193 </div> 194 <div class="pdp-secondary-info__column"> 195 @if (!string.IsNullOrWhiteSpace(productSubTitle)) 196 { 197 <h3 class="pdp-header__subtitle"> 198 <span class="pdp-header__subtitle-product">@productSubTitle</span> 199 </h3> 200 } 201 202 <h2 class="pdp-header__title"> 203 @if (product.Manufacturer != null) 204 { 205 <span class="pdp-header__manufacturer">@product.Manufacturer.Name</span> 206 } 207 <span class="pdp-header__productname"> 208 @productName 209 </span> 210 </h2> 211 212 @if (productCommentCount > 0) 213 { 214 <div class="pdp-review-indicator"> 215 @renderReviewIndicator("#86C440", productRating, productCommentCount) 216 </div> 217 } 218 219 @if (enableProductStock && !string.IsNullOrWhiteSpace(stockFormat)) 220 { 221 if (stockFormat == "text") 222 { 223 StockLocation stockLocation = Dynamicweb.Ecommerce.Services.StockService.GetStockLocation(Pageview.Area.StockLocationID); 224 var currentProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, "", Pageview.Area.EcomLanguageId); 225 string stockText = Dynamicweb.Ecommerce.Services.Products.GetStockStatus(currentProduct, stockLocation, Pageview.Area.EcomLanguageId)?.Text; 226 227 if (!string.IsNullOrWhiteSpace(stockText)) 228 { 229 <p class="pdp-stockstate @stockStateClass">@string.Format(stockText, product.StockLevel)</p> 230 } 231 } 232 else 233 { 234 string translationTag = ""; 235 if (product.NeverOutOfstock) 236 { 237 translationTag = Translate("ProductBlockStockInfo.AmountInStock", "In stock"); 238 } 239 else if (product.StockLevel == 1) 240 { 241 translationTag = Translate("ProductBlockStockInfo.AmountInStockSingle", "{0} product in stock"); 242 } 243 else if (product.StockLevel > 1) 244 { 245 translationTag = Translate("ProductBlockStockInfo.AmountInStockMultiple", "{0} products in stock"); 246 } 247 else if (!inStock) 248 { 249 translationTag = Translate("ProductBlockStockInfo.AmountOutOfStock", "Out of stock"); 250 } 251 252 <p class="pdp-stockstate @stockStateClass">@string.Format(translationTag, product.StockLevel)</p> 253 } 254 } 255 256 @if (!string.IsNullOrWhiteSpace(productDetailPageTagline)) 257 { 258 <div class="pdp-tagline__container"> 259 @if (!string.IsNullOrWhiteSpace(productDetailPageTagline)) 260 { 261 <p class="pdp-tagline"> 262 @productDetailPageTagline 263 </p> 264 } 265 </div> 266 } 267 </div> 268 <div class="pdp-secondary-info__column"> 269 270 @if (!string.IsNullOrWhiteSpace(product.Number)) 271 { 272 <p class="pdp-articlenumber"> 273 @Translate("Productdetail.ArticleNumber.Prefix", "Article number:") @product.Number 274 </p> 275 } 276 277 @if (displayPrice && displayProductPrice) 278 { 279 <div class="pdp-price__container"> 280 @if (hasDiscount) 281 { 282 <p class="pdp-price--original">@priceBeforeDiscountFormatted</p> 283 <section class="pdp-price__subcontainer"> 284 <span class="pdp-price">@priceFormatted</span> 285 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 286 <span class="pdp-price__percentage">@discountPercentage%</span> 287 </section> 288 } 289 else 290 { 291 <section class="pdp-price__subcontainer"> 292 <span class="pdp-price">@priceFormatted</span> 293 <span class="pdp-price--suffix">@ProductdetailPriceSuffix</span> 294 </section> 295 } 296 @if (!string.IsNullOrWhiteSpace(retailPrice)) 297 { 298 <p class="pdp-price__retail-price"> 299 @String.Format(Translate("ProductBlockTitle.RetailPrice", "Retail price: {0}"), retailPrice) 300 </p> 301 } 302 @if (hasDiscount) 303 { 304 <p class="pdp-price__yourprofit"> 305 @Translate("Productdetail.YourProfitLabel", "Your profit:") @priceTotalDiscountFormatted 306 </p> 307 } 308 </div> 309 } 310 311 @if (variantGroups.Any()) 312 { 313 <div class="product-variants__wrapper pdp-variants"> 314 <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"> 315 @foreach (var variantGroup in variantGroups) 316 { 317 bool containsImage = variantGroup.GetAllVariantOptions().Any(v => !string.IsNullOrEmpty(v.SmallImage)); 318 bool containsColor = variantGroup.GetAllVariantOptions().Any(v => !string.IsNullOrEmpty(v.Color)); 319 string variantGroupName = variantGroup.GetName(Pageview.Area.EcomLanguageId); 320 string variantGroupId = variantGroup.Id; 321 var variantGroupOptions = variantGroup.GetAllVariantOptions(); 322 323 if (containsImage || containsColor) 324 { 325 <p class="product-variants__title">@variantGroupName</p> 326 327 <div class="product-variants__options-wrapper"> 328 @foreach (VariantOption variantOption in variantGroupOptions) 329 { 330 string variantOptionName = variantOption.GetName(Pageview.Area.EcomLanguageId); 331 332 if (!string.IsNullOrEmpty(variantOption.SmallImage)) 333 { 334 string variantImage = "/Files/" + variantOption.SmallImage; 335 <div data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn product-variants__btn--image"> 336 <img src="@variantImage" alt="@variantOptionName" title="@variantOptionName" /> 337 </div> 338 } 339 else if (!string.IsNullOrEmpty(variantOption.Color)) 340 { 341 <div data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn product-variants__btn--color"> 342 <span title="@variantOptionName" style="--variant-color: @variantOption.Color;"></span> 343 </div> 344 } 345 else 346 { 347 <button type="button" data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__btn">@variantOptionName</button> 348 } 349 } 350 </div> 351 } 352 else 353 { 354 <p class="product-variants__title">@variantGroupName</p> 355 356 <div class="product-variants__dropdown"> 357 <div class="product-variants__dropdown-wrapper"> 358 359 <button class="product-variants__toggle"> 360 <span>@Translate(string.Format("VariantDropdown.Placeholder.{0}", variantGroupName), "Select your option")</span> 361 <i class="fal fa-chevron-down"></i> 362 </button> 363 364 <div class="product-variants__options-wrapper product-variants__options-wrapper--dropdown product-variants__dropdown-options-wrapper"> 365 @foreach (VariantOption variantOption in variantGroupOptions) 366 { 367 <button type="button" data-variant-id="@variantOption.Id" data-variant-group="@variantGroupId" class="js-variant-option product-variants__dropdown-btn"> 368 @variantOption.GetName(Pageview.Area.EcomLanguageId) 369 </button> 370 } 371 </div> 372 </div> 373 </div> 374 } 375 } 376 </div> 377 </div> 378 } 379 380 @if(!hasVariants) 381 { 382 if (enableShoppingCart && enableProductShoppingCart) 383 { 384 <div class="pdp-add-to-cart pdp-add-to-cart__container"> 385 <add-to-cart class="app-addtocart" 386 data-prodid="@product.Id" 387 data-variantid="@product.VariantId" 388 data-min-quantity="@product.PurchaseMinimumQuantity" 389 data-step="@product.PurchaseQuantityStep" 390 data-list-id="product_detail" 391 data-list-name="Product detail"> 392 </add-to-cart> 393 </div> 394 } 395 else 396 { 397 if (QuotePageID > 0) 398 { 399 <div class="pdp-request-quote__container"> 400 <a href="/Default.aspx?ID=@QuotePageID&ProdID=@product.Id&VarID=@product.VariantId" class="btn"> 401 <span class="btn__text">@Translate("ProductDetail.QuoteButton.Text", "Request quote")</span> 402 <i class="btn__icon @buttonIconClass"></i> 403 </a> 404 </div> 405 } 406 } 407 } 408 409 @* Snippet PdpPaymentLogos *@ 410 @if (displayPrice && displayProductPrice && selectedPaymentLogos != null) 411 { 412 <section class="pdp-paymentlogos paymentlogos--small"> 413 <div class="footer-paymentoptions" data-paymentmethods="@selectedPaymentLogos"></div> 414 </section> 415 } 416 417 </div> 418 </div> 419 </section> 420 </div> 421 422 @helper renderReviewIndicator(string progressbarColor, double? value, int commentCount = 0) 423 { 424 string ratingPercentage = ((100 / 5) * value).ToString() + "%"; 425 string reviewTranslationKey = Translate("Reviews.Amount.Multiple", "{0} reviews"); 426 if (commentCount == 1) 427 { 428 reviewTranslationKey = Translate("Reviews.Amount.Singular", "{0} review"); 429 } 430 431 <section style="display: flex; flex-direction: row; position: relative; align-items: center;"> 432 <div class="reviews__indicator" style="display: flex; flex-direction: row;"> 433 <div class="reviews__indicator-progressbar" style="width: @ratingPercentage; background-color: @progressbarColor;"></div> 434 <ul class="reviews__indicator-star-list"> 435 <li class="reviews__indicator-star-list-item"></li> 436 <li class="reviews__indicator-star-list-item"></li> 437 <li class="reviews__indicator-star-list-item"></li> 438 <li class="reviews__indicator-star-list-item"></li> 439 <li class="reviews__indicator-star-list-item"></li> 440 </ul> 441 </div> 442 <span style="display: flex; position: relative; font-size: 12px; line-height: initial;"> 443 @value / 5 444 <text>(@string.Format(reviewTranslationKey, commentCount))</text> 445 </span> 446 </section> 447 } 448
Error executing template "Designs/ClientBase_generated/Paragraph/ProductDetailWidgetStickyAddToCart.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_0bd08f74e1fa4f3ba4ccf5994072828f.Execute() in D:\dynamicweb.net\Solutions\Bluedesk\koksgroup.cloud.dynamicweb-cms.com\files\Templates\Designs\ClientBase_generated\Paragraph\ProductDetailWidgetStickyAddToCart.cshtml:line 32
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 3 @using Dynamicweb.Ecommerce.Prices; 4 @using Dynamicweb.Ecommerce.ProductCatalog; 5 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 6 @using Bluedesk.DynamicWeb.ItemTypes.Configuration; 7 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution; 8 @using Bluedesk.DynamicWeb.ItemTypes.BaseSolution.Frontend; 9 10 @{ 11 string paragraphID = Pageview.CurrentParagraph.ID.ToString(); 12 ProductDetailWidgetStickyAddToCart _data = Dynamicweb.Content.Services.Items.GetItem("ProductDetailWidgetStickyAddToCart", Model.ItemId).ToCodeFirstItem<ProductDetailWidgetStickyAddToCart>() ?? new ProductDetailWidgetStickyAddToCart(); 13 14 ProductAndVariantsObj ProductAndVariants = (ProductAndVariantsObj)Dynamicweb.Context.Current.Session["ProductAndVariants"]; 15 16 var master_configuration = Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 17 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 18 EcomConfig EcommerceConfiguration = mc.EcomConfiguration; 19 20 ProductViewModel product = new ProductViewModel(); 21 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 22 { 23 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 24 } 25 26 bool hideShoppingCartForGuests = EcommerceConfiguration.HideShoppingCartForGuests; 27 bool enableAddToCartForZeroPrices = EcommerceConfiguration.AddToCartAllowZeroPrices; 28 bool enableAddToCartForOutOfStock = EcommerceConfiguration.AddToCartAllowOutOfStock; 29 30 bool enableShoppingCart = hideShoppingCartForGuests && Pageview.User == null ? false : Pageview.Area.Item["ConfigModuleShoppingCart"] != null ? (bool)Pageview.Area.Item["ConfigModuleShoppingCart"] : false; 31 bool enableProductShoppingCart = enableShoppingCart; 32 if (!enableAddToCartForZeroPrices && product.Price.Price <= 0) 33 { 34 enableProductShoppingCart = false; 35 } 36 if (!enableAddToCartForOutOfStock && !(product.StockLevel > 0 || product.NeverOutOfstock)) 37 { 38 enableProductShoppingCart = false; 39 } 40 if (product.Discontinued) 41 { 42 enableProductShoppingCart = false; 43 } 44 45 bool WithVATBool = Pageview.Area.EcomPricesWithVat == "True"; 46 bool pricesWithoutVatForUsers = EcommerceConfiguration.ShowPricesWithoutVatForUsers; 47 bool pricesWithoutVatForValidVat = EcommerceConfiguration.ShowPricesWithoutVatWhenValidVatNumber; 48 if (pricesWithoutVatForUsers && !pricesWithoutVatForValidVat && Pageview.User != null) 49 { 50 WithVATBool = false; 51 } 52 if (pricesWithoutVatForValidVat && Pageview.User != null && !string.IsNullOrWhiteSpace(Pageview.User.VatRegNumber)) 53 { 54 WithVATBool = false; 55 } 56 57 bool hidePricesForGuests = EcommerceConfiguration.HidePricesForGuests; 58 bool hideZeroPrices = EcommerceConfiguration.HideZeroPrices; 59 bool displayPrice = hidePricesForGuests ? Pageview.User != null : true; 60 bool pricezero = product.Price.Price <= 0; 61 62 bool displayProductPrice = displayPrice; 63 if (hideZeroPrices && pricezero) 64 { 65 displayProductPrice = false; 66 } 67 68 string ProductdetailPriceSuffixWithVAT = Translate("Productdetail.Price.Suffix.WithVAT", "Incl. VAT"); 69 string ProductdetailPriceSuffixWithoutVAT = Translate("Productdetail.Price.Suffix.WithoutVAT", "Excl. VAT"); 70 string ProductdetailPriceSuffix = WithVATBool ? ProductdetailPriceSuffixWithVAT : ProductdetailPriceSuffixWithoutVAT; 71 72 var gtmValue = WithVATBool ? product.Price.PriceWithVat : product.Price.PriceWithoutVat; 73 var priceFormatted = WithVATBool ? product.Price.PriceWithVatFormatted : product.Price.PriceWithoutVatFormatted; 74 var priceBeforeDiscount = WithVATBool ? product.PriceBeforeDiscount.PriceWithVat : product.PriceBeforeDiscount.PriceWithoutVat; 75 var priceBeforeDiscountFormatted = WithVATBool ? product.PriceBeforeDiscount.PriceWithVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; 76 var priceTotalDiscount = WithVATBool ? product.Discount.PriceWithVat : product.Discount.PriceWithoutVat; 77 var priceTotalDiscountFormatted = WithVATBool ? product.Discount.PriceWithVatFormatted : product.Discount.PriceWithoutVatFormatted; 78 double discountPercentage = Math.Round(((priceTotalDiscount / priceBeforeDiscount) * -100)); 79 bool hasDiscount = product.Discount.Price > 0; 80 81 string informativePrice = WithVATBool ? product.PriceInformative.PriceWithVatFormatted : product.PriceInformative.PriceWithoutVatFormatted; 82 if (EcommerceConfiguration.UseInformativePriceAsFromPrice && !string.IsNullOrWhiteSpace(informativePrice)) 83 { 84 double informativePriceValue = WithVATBool ? product.PriceInformative.PriceWithVat : product.PriceInformative.PriceWithoutVat; 85 hasDiscount = gtmValue < informativePriceValue; 86 if (hasDiscount) 87 { 88 priceBeforeDiscountFormatted = informativePrice; 89 discountPercentage = Math.Round((((gtmValue - informativePriceValue) / informativePriceValue) * 100)); 90 91 double yourProfitValue = informativePriceValue - gtmValue; 92 priceTotalDiscountFormatted = WithVATBool ? new PriceInfo { PriceWithVAT = yourProfitValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = yourProfitValue }.PriceWithoutVATFormatted; 93 } 94 } 95 96 string retailPrice = ""; 97 bool displayRetailPrice = EcommerceConfiguration.DisplayRetailPrice; 98 if (EcommerceConfiguration.DisplayRetailPriceForUsers && Pageview.User == null) 99 { 100 displayRetailPrice = false; 101 } 102 if (displayRetailPrice) 103 { 104 string priceFieldName = EcommerceConfiguration.RetailPriceField; 105 if (EcommerceConfiguration.RetailPriceIsDbPrice) 106 { 107 var p = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, Pageview.Area.EcomLanguageId); 108 PriceContext customerPriceContext = new PriceContext(Dynamicweb.Ecommerce.Common.Context.Currency, Dynamicweb.Ecommerce.Common.Context.Country, null, null, Dynamicweb.Ecommerce.Common.Context.ReverseChargeForVatEnabled, DateTime.Now); 109 var customerPrice = p?.GetPrice(customerPriceContext); 110 if (customerPrice.Price > 0) 111 { 112 retailPrice = WithVATBool ? customerPrice.PriceWithVATFormatted : customerPrice.PriceWithoutVATFormatted; 113 } 114 } 115 else if (!string.IsNullOrWhiteSpace(priceFieldName)) 116 { 117 double customerPriceValue = 0.0; 118 if (product.ProductFields.TryGetValue(priceFieldName, out var fieldValue) && fieldValue.Value is double) 119 { 120 customerPriceValue = (double)fieldValue.Value; 121 } 122 if (customerPriceValue > 0) 123 { 124 retailPrice = WithVATBool ? new PriceInfo { PriceWithVAT = customerPriceValue }.PriceWithVATFormatted : new PriceInfo { PriceWithoutVAT = customerPriceValue }.PriceWithoutVATFormatted; 125 } 126 } 127 } 128 129 bool isVariant = product.VariantId != ""; 130 int variantCount = product?.VariantInfo?.VariantInfo?.Count ?? 0; 131 bool hasVariants = !isVariant ? variantCount > 0 : false; 132 133 var prod = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, Pageview.Area.EcomLanguageId); 134 string defaultImage = Dynamicweb.Ecommerce.Services.ProductImages.GetImagePath(prod); 135 136 int QuotePageID = GetPageIdByNavigationTag("QuoteForm"); 137 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 138 } 139 140 <!-- BEGIN Stickymenu --> 141 <section class="w-full stickymenu__replaceable__wrapper"> 142 <div class="container"> 143 <section class="stickymenu__replaceable"> 144 145 <div class="stickymenu_product-info-wrapper"> 146 @if (!string.IsNullOrWhiteSpace(defaultImage)) 147 { 148 <figure class="stickymenu__product-image"> 149 <img src="/Admin/Public/GetImage.ashx?Image=@defaultImage&Crop=5&Format=webp&Quality=90&Compression=80&Height=60&Width=60" alt="@product.Name" width="60" height="60"> 150 </figure> 151 } 152 <div class="stickymenu_product-info"> 153 <p class="stickymenu__product-name"> 154 @if (!string.IsNullOrWhiteSpace(product.Manufacturer.Name)) 155 { 156 <span class="stickymenu__product-name--manufacturer">@product.Manufacturer.Name</span> 157 } 158 <span class="stickymenu__product-name--product">@product.Name</span> 159 </p> 160 161 @if (displayPrice && displayProductPrice) 162 { 163 if (hasDiscount) 164 { 165 <div class="stickymenu_product__price__wrapper"> 166 <span class="stickymenu_product__price--old">@priceBeforeDiscountFormatted</span> 167 <span class="stickymenu_product__price--current">@priceFormatted</span> 168 <span class="stickymenu_product__price--suffix">@ProductdetailPriceSuffix</span> 169 <span class="stickymenu_product__price--profit">@Translate("Productdetail.YourProfitLabel", "Your profit:") @priceTotalDiscountFormatted</span> 170 </div> 171 } 172 else 173 { 174 <div class="stickymenu_product__price__wrapper"> 175 <span class="stickymenu_product__price--current">@priceFormatted</span> 176 <span class="stickymenu_product__price--suffix">@ProductdetailPriceSuffix</span> 177 </div> 178 } 179 } 180 181 </div> 182 </div> 183 184 @if(!hasVariants) 185 { 186 if (enableShoppingCart && enableProductShoppingCart) 187 { 188 <add-to-cart class="app-addtocart" 189 data-prodid="@product.Id" 190 data-variantid="@product.VariantId" 191 data-min-quantity="@product.PurchaseMinimumQuantity" 192 data-step="@product.PurchaseQuantityStep" 193 data-list-id="product_detail" 194 data-list-name="Product detail"> 195 </add-to-cart> 196 } 197 else 198 { 199 if (QuotePageID > 0) 200 { 201 <div class="py-4"> 202 <a href="/Default.aspx?ID=@QuotePageID&ProdID=@product.Id&VarID=@product.VariantId" class="btn product-detailpage__info-btn--request-quote"> 203 <span class="btn__text">@Translate("ProductDetail.StickyAddToCart.QuoteButton.Text", "Vraag een offerte aan")</span> 204 <i class="btn__icon @buttonIconClass"></i> 205 </a> 206 </div> 207 } 208 } 209 } 210 211 </section> 212 </div> 213 </section> 214 215 <script> 216 window.addEventListener('DOMContentLoaded', function (event) { 217 var stickyAddToCartEl = document.querySelector('.stickymenu__replaceable__wrapper'); 218 var pdpAddToCartElement = document.querySelector('.pdp-add-to-cart'); 219 var pdpQuoteButtonElement = document.querySelector('.pdp-quote-button'); 220 var scrollToTopEl = document.querySelector('#scroll-to-top'); 221 222 if(pdpAddToCartElement || pdpQuoteButtonElement) { 223 var observer = new IntersectionObserver((entries, observer) => { 224 entries.forEach(entry => { 225 if(entry.intersectionRatio != 1 && window.scrollY >= entry.boundingClientRect.top) { 226 // Out of view 227 stickyAddToCartEl.classList.add('stickymenu__replaceable__wrapper--active'); 228 scrollToTopEl.classList.add('scroll-to-top--shown--lg'); 229 scrollToTopEl.style.setProperty('--sticky-bottom-offset', stickyAddToCartEl.offsetHeight + 'px'); 230 document.body.style.paddingBottom = stickyAddToCartEl.offsetHeight + 'px'; 231 } else { 232 // In view 233 stickyAddToCartEl.classList.remove('stickymenu__replaceable__wrapper--active'); 234 scrollToTopEl.classList.remove('scroll-to-top--shown--lg'); 235 scrollToTopEl.style.setProperty('--sticky-bottom-offset', '0px'); 236 document.body.style.paddingBottom = null; 237 } 238 }); 239 }, { 240 threshold: 1 241 }); 242 243 if(pdpAddToCartElement) { 244 observer.observe(pdpAddToCartElement); 245 } else { 246 observer.observe(pdpQuoteButtonElement); 247 } 248 249 } 250 251 }); 252 </script> 253 <!-- END Stickymenu --> 254