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_4221672b82f444bc8196148607b81036.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 4 @{ 5 //Set default product data for use in Visual Editor 6 if (Pageview.IsVisualEditorMode) 7 { 8 ProductViewModelSettings productSetting = new ProductViewModelSettings 9 { 10 LanguageId = Dynamicweb.Ecommerce.Common.Context.LanguageID, 11 CurrencyCode = Dynamicweb.Ecommerce.Common.Context.Currency.Code, 12 CountryCode = Dynamicweb.Ecommerce.Common.Context.Country.Code2, 13 ShopId = Pageview.Area.EcomShopId 14 }; 15 16 string selectedDummyProduct = "PROD1"; 17 var list = new ProductListViewModel(); 18 if (Model.Item.GetValue("DummyProduct") != null) 19 { 20 list = Model.Item.GetValue("DummyProduct") as ProductListViewModel; 21 22 foreach (var product in list.Products) 23 { 24 selectedDummyProduct = product.Id; 25 } 26 27 ProductViewModel dummyProduct = ViewModelFactory.CreateView(productSetting, selectedDummyProduct); 28 29 if (!Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 30 { 31 Dynamicweb.Context.Current.Items.Add("ProductDetails", dummyProduct); 32 } 33 } 34 else 35 { 36 <div class="alert alert-danger" role="alert"> 37 <span>@Translate("Please select a Dummy product on this paragraph")</span> 38 </div> 39 } 40 } 41 else if (!Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 42 { 43 ProductViewModel dummyProduct = new ProductViewModel(); 44 Dynamicweb.Context.Current.Items.Add("ProductDetails", dummyProduct); 45 } 46 } 47 48 @if (Pageview.IsVisualEditorMode) 49 { 50 <div class="alert alert-info" role="alert"> 51 <span>@Translate("Product catalog App: Edit this column to configure. (Product catalog app must be attached this paragraph)")</span> 52 </div> 53 } 54 55 <div class="item_@Model.Item.SystemName.ToLower()"> 56 @Model.GetModuleOutput() 57 </div> 58
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
Overview
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
FREE U.S. shippingFREE nationwide shipping directly from the factory. Additional shipping costs may apply for: HI, AK, PR.
First “crush” guaranteeWe will work with you to hone your setup until your machine starts producing the material you need.
Manufacturer warrantyOur equipment comes with a standard 3 yrs / 3000 hrs warranty - whichever comes first.
Spare parts built inA spare part package is included with every piece of equipment when you buy with Machinery Partner.
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
Buy directSource equipment from manufacturers around the world, not just the ones you can drive to.
Expert adviceOur experts help you select the right equipment, and teach you how to get the most out of your setup.
Local service techniciansOur team sources and trains local technicians to service and repair your equipment.
Flexible financingWork with our special lender network to get the best rate possible or bring your own bank.
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
Text
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
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_432bcd25c271441baa7310926b12c41a.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 99 at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 21 at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\A10\_w\2\s\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 749
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using System.Linq 3 @using Dynamicweb.Ecommerce 4 @using Dynamicweb.Ecommerce.ProductCatalog 5 @using Dynamicweb.Ecommerce.Products 6 @using Dynamicweb.Ecommerce.Stocks 7 8 @functions 9 { 10 private static bool BackInStockRegisteredForUser(ProductViewModel product, string unitId = "", long stocklocationId = 0) 11 { 12 if (!Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn()) return false; 13 14 Product productObject = Services.Products.GetProductById(product.Id, product.VariantId, product.LanguageId); 15 StockLocation stockLocation = Services.StockService.GetStockLocation(stocklocationId); 16 double unitStock = productObject.GetUnitStock(stockLocation, unitId); 17 return unitStock <= 0d && ProductBackInStockNotification.BackInStockNotificationExists(productObject, unitId); 18 } 19 } 20 21 @{ 22 ProductViewModel product = null; 23 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 24 { 25 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 26 } 27 else if (Pageview.Page.Item["DummyProduct"] != null) 28 { 29 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 30 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 31 32 if (productList?.Products is object) 33 { 34 product = productList.Products[0]; 35 } 36 } 37 } 38 39 @if ((product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock)) 40 { 41 bool productInStock = product.StockLevel > 0 || product.NeverOutOfstock; 42 43 if (!productInStock) 44 { 45 string notifiedMessage = Model.Item.GetString("NotifiedMessage"); 46 string notifiedMessageId = $"NotifiedMessage_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 47 48 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 49 horizontalAlign = horizontalAlign == "center" ? "justify-content-center" : horizontalAlign; 50 horizontalAlign = horizontalAlign == "end" ? "justify-content-end" : horizontalAlign; 51 horizontalAlign = horizontalAlign == "full" ? "" : horizontalAlign; 52 53 string flexFill = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "flex-fill" : ""; 54 string fullWidth = Model.Item.GetRawValueString("HorizontalAlignment", "") == "full" ? "w-100" : ""; 55 56 bool notificationRegisteredForUser = BackInStockRegisteredForUser(product); 57 58 <div class="d-flex flex-row w-100 @horizontalAlign @fullWidth item_@Model.Item.SystemName.ToLower()"> 59 <div class="@horizontalAlign @fullWidth @(notificationRegisteredForUser ? "" : "d-none")" id="@notifiedMessageId"> 60 @notifiedMessage 61 </div> 62 63 @if (!notificationRegisteredForUser) 64 { 65 66 string notifyIcon = Model.Item.GetString("Icon"); 67 string notifyLabel = !notifyIcon.Contains("_none") ? "<span class=\"icon-2\">" + ReadFile(notifyIcon) + "</span>" : ""; 68 notifyLabel += " " + Translate("Notify me when available"); 69 70 string modalId = $"modal_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 71 string formId = $"NotificationForm_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 72 string notificationButtonId = $"NotificationButton_item_{Model.Item.SystemName.ToLower()}_{product.Id}_{product.VariantId.Replace(".", "_")}"; 73 string notificationOnClick = !Pageview.IsVisualEditorMode ? $"swift.BackInStockNotification.SubmitNotification('{formId}', '{modalId}', '{notifiedMessageId}', '{notificationButtonId}')" : ""; 74 75 string productPage = $"Default.aspx?ID={GetPageIdByNavigationTag("ProductDetailPage")}"; 76 77 <div class="d-flex @horizontalAlign @fullWidth js-input-group"> 78 <div class="input-group input-primary-button-group flex-nowrap"> 79 <button type="button" class="btn btn-primary @flexFill" data-dw-button="primary" id="@notificationButtonId" data-bs-toggle="modal" data-bs-target="#@modalId"> 80 <span class="text-nowrap d-flex align-items-center justify-content-center gap-2"> 81 @notifyLabel 82 </span> 83 </button> 84 </div> 85 </div> 86 87 <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="label_@modalId" aria-hidden="true"> 88 <div class="modal-dialog pt-8"> 89 <div class="modal-content"> 90 <div class="modal-header"> 91 <h5 class="modal-title" id="label_@modalId">@Translate("Back in stock")</h5> 92 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="@Translate("Close")"></button> 93 </div> 94 <div class="modal-body"> 95 <form name="@product.Id" id="@formId" method="post" action="@productPage"> 96 <input type="hidden" name="ProductID" value="@product.Id" /> 97 <input type="hidden" name="VariantID" value="@product.VariantId" /> 98 <input type="hidden" name="LanguageID" value="@product.LanguageId" /> 99 <input type="hidden" name="CartCmd" value="createnotificationforthisproduct" /> 100 <div class="m-2"> 101 @Translate("Send me an email when the product is in stock.") 102 </div> 103 <div class="form-floating m-2"> 104 <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" /> 105 <label for="NotificationEmail" class="form-label">@Translate("Email")</label> 106 </div> 107 </form> 108 </div> 109 <div class="modal-footer"> 110 <button type="button" class="btn btn-primary" data-dw-button="primary" onclick="@notificationOnClick">@Translate("Submit")</button> 111 </div> 112 </div> 113 </div> 114 </div> 115 } 116 </div> 117 } 118 } 119 else if (Pageview.IsVisualEditorMode) 120 { 121 <div class="alert alert-dark m-0">@Translate("Back in stock notification will be shown here")</div> 122 } 123
Call Us (24/7)+44 020 1235 1235
Get a callback (24/7)Let us call you