Fav mærker

ALLE DANMARKS FAVORITMÆRKER

Levering

GRATIS LEVERING OG RETURNERING*

100 dage

100 DAGES RETURRET

Error executing template "Designs/Swift-v2/Paragraph/Swift-v2_ProductCatalogDetailsApp.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_3b7bbe9a94af469eb6df6b37b20f5f60.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @{ //Set default product data for use in Visual Editor if (Pageview.IsVisualEditorMode) { ProductViewModelSettings productSetting = new ProductViewModelSettings { LanguageId = Dynamicweb.Ecommerce.Common.Context.LanguageID, CurrencyCode = Dynamicweb.Ecommerce.Common.Context.Currency.Code, CountryCode = Dynamicweb.Ecommerce.Common.Context.Country.Code2, ShopId = Pageview.Area.EcomShopId }; } else if (!Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { ProductViewModel product = new ProductViewModel(); Dynamicweb.Context.Current.Items.Add("ProductDetails", product); } } @if (Pageview.IsVisualEditorMode) { <div class="alert alert-info" role="alert"> <span>@Translate("Product catalog App: Edit this column to configure. (Product catalog app must be attached this paragraph)")</span> </div> } <div class="item_@Model.Item.SystemName.ToLower()"> @Model.GetModuleOutput() </div>
Error executing template "Designs/Swift-v2/Paragraph/Swift-v2_BackInStockNotification.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_92454f16f06147ffac359d3ca0e5f610.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using System.Linq @using Dynamicweb.Ecommerce @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @using Dynamicweb.Ecommerce.Stocks @functions { private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) { if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); double unitStock = productObject.GetUnitStock(stockLocation, unitId); return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); } } @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } } @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) { bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; if (!productInStock) { string notifiedMessage = Model.Item.GetString("NotifiedMessage"); string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> @notifiedMessage </div> @if (!notificationRegisteredForUser) { string notifyIcon = Model.Item.GetString("Icon"); string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; notifyLabel += " " + Translate("Notify me when available"); string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; <div class="d-flex @horizontalAlign @fullWidth js-input-group"> <div class="input-group input-primary-button-group flex-nowrap"> <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> @notifyLabel </span> </button> </div> </div> <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> <div class="modal-dialog pt-8"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> </div> <div class="modal-body"> <form name="@product.Id" id="@formId" method="post" action="@productPage"> <input type="hidden" name="ProductID" value="@product.Id" /> <input type="hidden" name="VariantID" value="@product.VariantId" /> <input type="hidden" name="LanguageID" value="@product.LanguageId" /> <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> <div class="m-2"> @Translate("Send me an email when the product is in stock.") </div> <div class="form-floating m-2"> <input class="form-control" type="text" id="NotificationEmail" value="@(Pageview.User != null ? Pageview.User.Email : "")" name="NotificationEmail" placeholder="@Translate("Email")" required="required" aria-required="aria-required" /> <label for="NotificationEmail" class="form-label">@Translate("Email")</label> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> </div> </div> </div> </div> } </div> } } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> }
Error executing template "Designs/Swift-v2/Paragraph/Swift-v2_BackInStockNotification.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_92454f16f06147ffac359d3ca0e5f610.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using System.Linq @using Dynamicweb.Ecommerce @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @using Dynamicweb.Ecommerce.Stocks @functions { private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) { if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); double unitStock = productObject.GetUnitStock(stockLocation, unitId); return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); } } @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } } @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) { bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; if (!productInStock) { string notifiedMessage = Model.Item.GetString("NotifiedMessage"); string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> @notifiedMessage </div> @if (!notificationRegisteredForUser) { string notifyIcon = Model.Item.GetString("Icon"); string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; notifyLabel += " " + Translate("Notify me when available"); string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; <div class="d-flex @horizontalAlign @fullWidth js-input-group"> <div class="input-group input-primary-button-group flex-nowrap"> <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> @notifyLabel </span> </button> </div> </div> <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> <div class="modal-dialog pt-8"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> </div> <div class="modal-body"> <form name="@product.Id" id="@formId" method="post" action="@productPage"> <input type="hidden" name="ProductID" value="@product.Id" /> <input type="hidden" name="VariantID" value="@product.VariantId" /> <input type="hidden" name="LanguageID" value="@product.LanguageId" /> <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> <div class="m-2"> @Translate("Send me an email when the product is in stock.") </div> <div class="form-floating m-2"> <input class="form-control" type="text" id="NotificationEmail" value="@(Pageview.User != null ? Pageview.User.Email : "")" name="NotificationEmail" placeholder="@Translate("Email")" required="required" aria-required="aria-required" /> <label for="NotificationEmail" class="form-label">@Translate("Email")</label> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> </div> </div> </div> </div> } </div> } } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> }
Error executing template "Designs/Swift-v2/Paragraph/Swift-v2_BackInStockNotification.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_92454f16f06147ffac359d3ca0e5f610.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using System.Linq @using Dynamicweb.Ecommerce @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @using Dynamicweb.Ecommerce.Stocks @functions { private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) { if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); double unitStock = productObject.GetUnitStock(stockLocation, unitId); return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); } } @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } } @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) { bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; if (!productInStock) { string notifiedMessage = Model.Item.GetString("NotifiedMessage"); string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> @notifiedMessage </div> @if (!notificationRegisteredForUser) { string notifyIcon = Model.Item.GetString("Icon"); string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; notifyLabel += " " + Translate("Notify me when available"); string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; <div class="d-flex @horizontalAlign @fullWidth js-input-group"> <div class="input-group input-primary-button-group flex-nowrap"> <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> @notifyLabel </span> </button> </div> </div> <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> <div class="modal-dialog pt-8"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> </div> <div class="modal-body"> <form name="@product.Id" id="@formId" method="post" action="@productPage"> <input type="hidden" name="ProductID" value="@product.Id" /> <input type="hidden" name="VariantID" value="@product.VariantId" /> <input type="hidden" name="LanguageID" value="@product.LanguageId" /> <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> <div class="m-2"> @Translate("Send me an email when the product is in stock.") </div> <div class="form-floating m-2"> <input class="form-control" type="text" id="NotificationEmail" value="@(Pageview.User != null ? Pageview.User.Email : "")" name="NotificationEmail" placeholder="@Translate("Email")" required="required" aria-required="aria-required" /> <label for="NotificationEmail" class="form-label">@Translate("Email")</label> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> </div> </div> </div> </div> } </div> } } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> }
Error executing template "Designs/Swift-v2/Paragraph/Swift-v2_BackInStockNotification.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_92454f16f06147ffac359d3ca0e5f610.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using System.Linq @using Dynamicweb.Ecommerce @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @using Dynamicweb.Ecommerce.Stocks @functions { private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) { if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); double unitStock = productObject.GetUnitStock(stockLocation, unitId); return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); } } @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } } @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) { bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; if (!productInStock) { string notifiedMessage = Model.Item.GetString("NotifiedMessage"); string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> @notifiedMessage </div> @if (!notificationRegisteredForUser) { string notifyIcon = Model.Item.GetString("Icon"); string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; notifyLabel += " " + Translate("Notify me when available"); string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; <div class="d-flex @horizontalAlign @fullWidth js-input-group"> <div class="input-group input-primary-button-group flex-nowrap"> <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> @notifyLabel </span> </button> </div> </div> <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> <div class="modal-dialog pt-8"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> </div> <div class="modal-body"> <form name="@product.Id" id="@formId" method="post" action="@productPage"> <input type="hidden" name="ProductID" value="@product.Id" /> <input type="hidden" name="VariantID" value="@product.VariantId" /> <input type="hidden" name="LanguageID" value="@product.LanguageId" /> <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> <div class="m-2"> @Translate("Send me an email when the product is in stock.") </div> <div class="form-floating m-2"> <input class="form-control" type="text" id="NotificationEmail" value="@(Pageview.User != null ? Pageview.User.Email : "")" name="NotificationEmail" placeholder="@Translate("Email")" required="required" aria-required="aria-required" /> <label for="NotificationEmail" class="form-label">@Translate("Email")</label> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> </div> </div> </div> </div> } </div> } } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> }
Error executing template "Designs/Swift-v2/Paragraph/Swift-v2_ProductComponentSlider.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_dbf6349755df40a8bb7f939dfdd4e00f.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\dw10agent2\_w\3\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Core @using Dynamicweb.Ecommerce.ProductCatalog @{ AddScript("/Files/Templates/Designs/Swift-v2/Assets/lib/swiffy-slider/dist/js/swiffy-slider.min.js"); AddStylesheet("/Files/Templates/Designs/Swift-v2/Assets/lib/swiffy-slider/dist/css/swiffy-slider.min.css"); ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } string layout = Model.Item.GetRawValueString("Layout") == "slider" ? "ProductSliderComponent" : "ProductGridComponent"; string lazyHeight = Model.Item.GetBoolean("SetMinHeightForLazyLoading") ? "min-height: 360px" : ""; //Link generation string pageId = Model.Item.GetLink("ProductSliderServicePage") != null ? Model.Item.GetLink("ProductSliderServicePage").PageId.ToString() : ""; string servicePageByNavigationTag = GetPageIdByNavigationTag("ProductSliderService") != 0 ? GetPageIdByNavigationTag("ProductSliderService").ToString() : ""; pageId = pageId == "" ? servicePageByNavigationTag : pageId; string url = "/Default.aspx?ID=" + pageId; if (Pageview.IsVisualEditorMode) { url += "&VisualEdit=True"; } url += $"&ProductListPartial={layout}"; //Use this to render either a slider or a grid //Source type string sourceType = Model.Item.GetRawValueString("RelationType", "trending"); IList<string> relateFromProductIds = new List<string> { }; IList<string> relateFromProductVariantIds = new List<string> { }; IList<string> relateFromGroupIds = new List<string> { }; bool hasVariants = false; ProductListViewModel relateToViewModel = Model.Item.GetValue<ProductListViewModel>("RelateTo"); //--- PRODUCTS --- if (sourceType == "variants" || sourceType == "frequently" || sourceType == "selected") { if (relateToViewModel?.Products != null) { hasVariants = relateToViewModel.Products.Any(p => !string.IsNullOrEmpty(p.VariantId)); foreach (var fromProduct in relateToViewModel.Products) { if (hasVariants) { if (!string.IsNullOrEmpty(fromProduct.VariantId)) { relateFromProductVariantIds.Add($"{fromProduct.Id} {fromProduct.VariantId}"); } else { relateFromProductVariantIds.Add($"{fromProduct.Id}"); } } relateFromProductIds.Add($"{fromProduct.Id}"); } } } //--- GROUPS --- if (sourceType == "most-sold" || sourceType == "trending" || sourceType == "latest" || sourceType == "custom") { var groupsToRelateTo = Model.Item.GetList("RelateTo")?.GetRawValue().OfType<string>().ToList(); if (groupsToRelateTo != null) { foreach (var fromGroup in groupsToRelateTo) { var groupId = fromGroup.Length > 2 ? fromGroup.Remove(0, 2) : fromGroup; if (!fromGroup.Contains("p_")) { relateFromGroupIds.Add(groupId); } } } if (relateToViewModel?.Products != null) { foreach (var fromProduct in relateToViewModel.Products) { var groupId = fromProduct.PrimaryOrDefaultGroup.Id; relateFromGroupIds.Add(groupId); } } } string relationGroupId = Model.Item.GetRawValueString("RelationGroup", string.Empty); //--- RELATED GROUP --- if (sourceType == "related") { if (relateToViewModel?.Products != null) { product = relateToViewModel.Products.FirstOrDefault(); } if (product?.RelatedGroups != null) { foreach (var relationGroup in product.RelatedGroups) { if (relationGroup.Id == relationGroupId) { hasVariants = relationGroup.Products.Any(p => !string.IsNullOrEmpty(p.VariantId)); foreach (var fromProduct in relationGroup.Products) { if (hasVariants) { if (!string.IsNullOrEmpty(fromProduct.VariantId)) { relateFromProductVariantIds.Add($"{fromProduct.ProductId} {fromProduct.VariantId}"); } else { relateFromProductVariantIds.Add($"{fromProduct.ProductId}"); } } relateFromProductIds.Add($"{fromProduct.ProductId}"); } } } } } //Create group id collection and products id collection strings string productIds = relateFromProductIds.Count > 0 ? string.Join(",", relateFromProductIds) : ""; string productVariantIds = relateFromProductVariantIds.Count > 0 ? string.Join(",", relateFromProductVariantIds) : ""; string groupIds = relateFromGroupIds.Count > 0 ? string.Join(",", relateFromGroupIds) : ""; if (product is object) { if (string.IsNullOrEmpty(productIds) && (sourceType == "variants" || sourceType == "frequently" || sourceType == "selected" || sourceType == "custom")) { productIds = product.Id; } if (string.IsNullOrEmpty(groupIds) && (sourceType == "most-sold" || sourceType == "trending" || sourceType == "latest")) { groupIds = product.PrimaryOrDefaultGroup.Id; } } } @*Container element for the request*@ @if (!string.IsNullOrEmpty(productIds) || !string.IsNullOrEmpty(groupIds) || (string.IsNullOrEmpty(productIds) && string.IsNullOrEmpty(groupIds) && sourceType != "related")) { <form method="post" action="@url" id="ComponentSliderProductsForm_@Model.ID" data-response-target-element="ComponentSliderProducts_@Model.ID" data-preloader="inline" data-update-url="false" class="item_@Model.Item.SystemName.ToLower()"> <input type="hidden" name="ParagraphId" value="@Model.ID" /> <input type="hidden" name="SortOrder" value="DESC"> <input type="hidden" name="SourceType" value="@sourceType"> @if (!string.IsNullOrEmpty(groupIds)) { <input type="hidden" name="GroupId" value="@groupIds"> } @if (sourceType != "frequently" && sourceType != "variants" && !string.IsNullOrEmpty(productIds) && !hasVariants) { <input type="hidden" name="MainProductId" value="@productIds"> } @if (sourceType != "frequently" && hasVariants) { <input type="hidden" name="ProductVariantId" value="@productVariantIds"> } @if (Model.Item.GetInt32("ProductsCount") != 0) { <input type="hidden" name="PageSize" value="@Model.Item.GetInt32("ProductsCount")"> } @if (sourceType == "variants") { <input type="hidden" name="MasterProductID" value="@productIds"> <input type="hidden" name="isVariant" value="true"> } @if (sourceType == "most-sold") { <input type="hidden" name="SortBy" value="OrderCount"> } @if (sourceType == "trending") { <input type="hidden" name="SortBy" value="OrderCountGrowth"> } @if (sourceType == "frequently" && !string.IsNullOrEmpty(productIds)) { <input type="hidden" name="BoughtWithProductIds" value="[@productIds]"> } @if (sourceType == "latest") { <input type="hidden" name="SortBy" value="Created"> } </form> <div class="w-100 h-100" data-dw-colorscheme="@Model.ColorScheme?.Id"> <div id="ComponentSliderProducts_@Model.ID" class="h-100" style="@lazyHeight"></div> </div> <script type="module"> const productSliderContainer = document.querySelector("#ComponentSliderProducts_@Model.ID"); const productSliderForm = document.querySelector("#ComponentSliderProductsForm_@Model.ID"); swift.PageUpdater.Update(productSliderForm); productSliderForm.addEventListener("updated.swift.pageupdater", function(e){ if (e.detail.html === "") { productSliderContainer.closest("[data-col-size]").classList.add("d-none"); } }); </script> } else if (Pageview.IsVisualEditorMode == true) { <div class="alert alert-dark" role="alert"> <span>@Translate("Product component slider: The slider will be rendered here, if there is anything to show")</span> </div> }