Commercial Models

3 products
BC IMPORT

Categories

No filters are available
Airpot lite
Airpot lite

Airpot lite

SP-SCM1008
Error executing template "Designs/Swift/Paragraph/Swift_ProductPrice.cshtml"
System.Net.Http.HttpRequestException: Unauthorized Response: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
 ---> System.Net.Http.HttpRequestException: Unauthorized
 ---> System.InvalidOperationException: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.SendRequest(HttpClient client, HttpRequestMessage msg) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 55
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.Execute(Endpoint endpoint, TimeSpan requestTimeout, String requestBody) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 33
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 525
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.HandleException(Exception ex, Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 661
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 531
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.Execute(Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 433
   at DynamicwebLiveIntegration3.EndpointManager.ExecuteEndpointRequest(String urlSuffix, Object requestBody)
   at DynamicwebLiveIntegration3.Caching.StockCache.FetchMissing(IEnumerable`1 keys)
   at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 317
   at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 274
   at DynamicwebLiveIntegration3.LiveIntegrationService.GetStock(ProductStockCacheKey productStockCacheKey, Boolean silent)
   at DynamicwebLiveIntegration3.Providers.ProductStockProvider.FindStockLevel(Product product, String unitId, StockLocation stockLocation)
   at Dynamicweb.Ecommerce.Stocks.StockLevelManager.FindStockLevel(Product product, String unitId, StockLocation stockLocation) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Stocks\StockLevelManager.cs:line 25
   at Dynamicweb.Ecommerce.Products.ProductExtentions.GetUnitStock(Product product, StockLocation stockLocation, String unitId) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Products\ProductExtentions.cs:line 202
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_1.<BulkCreateView>b__23() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 142
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_2.<BulkCreateView>b__24() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 143
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.ProductCatalog.ProductViewModel.get_StockLevel() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ProductViewModel.cs:line 170
   at CompiledRazorTemplates.Dynamic.RazorEngine_b00c56f50ed4428699530c9c6fee9664.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) { var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); if (productList?.Products is object) { product = productList.Products[0]; } } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHidePrices") && isErpConnectionDown; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; } @if (product is object && !hidePrice && !isDiscontinued) { bool showInformativePrice = Model.Item.GetBoolean("ShowInformativePrice"); string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : string.Empty; string priceFontSize = Model.Item.GetRawValueString("PriceSize", "fs-2"); string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); string layout = Model.Item.GetRawValueString("Layout", "horizontal"); string textAlign = horizontalAlign == "center" ? "text-center" : string.Empty; textAlign = horizontalAlign == "end" ? "text-end" : textAlign; horizontalAlign = horizontalAlign == "center" && layout == "horizontal" ? "justify-content-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" && layout == "horizontal" ? "justify-content-end" : horizontalAlign; horizontalAlign = horizontalAlign == "center" && layout == "vertical" ? "align-items-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" && layout == "vertical" ? "align-items-end" : horizontalAlign; string flexDirection = layout == "horizontal" ? string.Empty : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; theme = GetViewParameter("theme") != null ? GetViewParameterString("theme") : theme; string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); contentPadding = contentPadding == "none" ? "p-0" : contentPadding; contentPadding = contentPadding == "small" ? "p-1 px-md-2 py-md-1" : contentPadding; contentPadding = contentPadding == "large" ? "p-2 px-md-3 py-md-2" : contentPadding; string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); string priceMin = ""; string priceMax = ""; string liveInfoClass = ""; string productInfoFeed = ""; bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); if (isLazyLoadingForProductInfoEnabled) { if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) { productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); if (!string.IsNullOrEmpty(productInfoFeed)) { productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; } } liveInfoClass = "js-live-info"; } <div class="@textAlign @liveInfoClass item_@Model.Item.SystemName.ToLower()" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> @if (showInformativePrice && product.PriceInformative.Price != 0) { <div class="opacity-50"> <span>@Translate("RRP") </span> <span class="text-decoration-line-through text-price">@product.PriceInformative.PriceFormatted</span> </div> } <div class="@priceFontSize m-0 d-flex flex-wrap @flexDirection @flexGap @horizontalAlign" style="row-gap: 0 !important" itemprop="offers" itemscope itemtype="https://schema.org/Offer"> <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> @if (showPricesWithVat == "false" && !neverShowVat) { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span itemprop="price" content="" class="d-none"></span> <span class="text-decoration-line-through js-text-decoration-line-through opacity-75 me-3 text-price js-text-price d-none" data-show-if="LiveProductInfo.product.Price.Price != LiveProductInfo.product.PriceBeforeDiscount.Price"></span> } else { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceWithoutVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; <span itemprop="price" content="@product.Price.PriceWithoutVat" class="d-none"></span> if (product.Price.Price != product.PriceBeforeDiscount.Price) { <span class="text-decoration-line-through opacity-75 @order">@beforePrice</span> } } } else { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span itemprop="price" content="" class="d-none"></span> <span class="text-decoration-line-through js-text-decoration-line-through opacity-75 me-3 text-price js-text-price d-none" data-show-if="LiveProductInfo.product.Price.Price != LiveProductInfo.product.PriceBeforeDiscount.Price"></span> } else { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product.PriceBeforeDiscount.PriceFormatted; <span itemprop="price" content="@product.Price.Price" class="d-none"></span> if (product.Price.Price != product.PriceBeforeDiscount.Price) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } } } @if (showPricesWithVat == "false" && !neverShowVat) { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span class="text-price js-text-price"> <span class="spinner-border" role="status"></span> </span> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithoutVatFormatted : product.Price.PriceWithoutVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithoutVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithoutVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <span class="@theme @contentPadding"> <span class="text-price">@price</span> </span> } } else { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span class="text-price js-text-price"> <span class="spinner-border" role="status"></span> </span> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product.Price.PriceFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <span class="@theme @contentPadding"> <span class="text-price">@price</span> </span> } } @* Stock state for Schema.org, start *@ @{ Uri url = Dynamicweb.Context.Current.Request.Url; } <link itemprop="url" href="@url"> @{ bool IsNeverOutOfStock = product.NeverOutOfstock; } @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else { if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">InStock</span> } else { <span itemprop="availability" class="d-none">OutOfStock</span> } } @* Stock state for Schema.org, stop *@ </div> @if (showPricesWithVat == "false" && !neverShowVat) { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <small class="opacity-85 fst-normal js-text-price-with-vat d-none" data-suffix="@Translate("Incl. VAT")"></small> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <small class="opacity-85 fst-normal">@price @Translate("Incl. VAT")</small> } } </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Error executing template "Designs/Swift/Paragraph/Swift_ProductStock.cshtml"
System.Net.Http.HttpRequestException: Unauthorized Response: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
 ---> System.Net.Http.HttpRequestException: Unauthorized
 ---> System.InvalidOperationException: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.SendRequest(HttpClient client, HttpRequestMessage msg) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 55
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.Execute(Endpoint endpoint, TimeSpan requestTimeout, String requestBody) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 33
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 525
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.HandleException(Exception ex, Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 661
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 531
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.Execute(Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 433
   at DynamicwebLiveIntegration3.EndpointManager.ExecuteEndpointRequest(String urlSuffix, Object requestBody)
   at DynamicwebLiveIntegration3.Caching.StockCache.FetchMissing(IEnumerable`1 keys)
   at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 317
   at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 274
   at DynamicwebLiveIntegration3.LiveIntegrationService.GetStock(ProductStockCacheKey productStockCacheKey, Boolean silent)
   at DynamicwebLiveIntegration3.Providers.ProductStockProvider.FindStockLevel(Product product, String unitId, StockLocation stockLocation)
   at Dynamicweb.Ecommerce.Stocks.StockLevelManager.FindStockLevel(Product product, String unitId, StockLocation stockLocation) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Stocks\StockLevelManager.cs:line 25
   at Dynamicweb.Ecommerce.Products.ProductExtentions.GetUnitStock(Product product, StockLocation stockLocation, String unitId) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Products\ProductExtentions.cs:line 202
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_1.<BulkCreateView>b__23() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 142
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location ---
   at System.LazyHelper.ThrowException()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_2.<BulkCreateView>b__25() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 144
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.CreateValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_2.<BulkCreateView>b__27() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 146
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.CreateValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ProductViewModel.get_StockDeliveryText() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ProductViewModel.cs:line 215
   at CompiledRazorTemplates.Dynamic.RazorEngine_a7480fc9df1341b88e874af1f6db2f1c.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) { var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); if (productList?.Products is object) { product = productList.Products[0]; } } bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); bool hideStock = Model.Item.GetBoolean("HideStockState") || (Pageview.AreaSettings.GetBoolean("ErpDownHideStock") && isErpConnectionDown); } @if (product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock && !hideStock) { string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); horizontalAlign = horizontalAlign == "center" ? "text-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" ? "text-end" : horizontalAlign; bool hasExpectedDelivery = product.ExpectedDelivery != null && product.ExpectedDelivery > DateTime.Now; string expectedDeliveryDate = product.ExpectedDelivery?.ToShortDateString() ?? ""; string liveInfoClass = ""; string productInfoFeed = ""; bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); if (isLazyLoadingForProductInfoEnabled) { if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) { productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); if (!string.IsNullOrEmpty(productInfoFeed)) { productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; } } liveInfoClass = "js-live-info"; } if (!product.NeverOutOfstock) { string deliveryLabel = !string.IsNullOrEmpty(product.StockDeliveryText) ? $"{product.StockDeliveryText}" : ""; deliveryLabel += !string.IsNullOrEmpty(product.StockDeliveryValue) ? $" {product.StockDeliveryValue}" : ""; if (isLazyLoadingForProductInfoEnabled) { string inStockStateLabel = !string.IsNullOrEmpty(product.StockStatus) ? product.StockStatus : Translate("In stock"); string noStockStateLabel = !string.IsNullOrEmpty(product.StockStatus) ? product.StockStatus : Translate("Out of Stock"); <div class="js-stock-state @horizontalAlign item_@Model.Item.SystemName.ToLower() @liveInfoClass" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> <div class="js-stock-state spinner-border"> <div class="small d-none" data-show-if="LiveProductInfo.product.StockLevel > 0"> @if (!Model.Item.GetBoolean("HideInventory")) { <span class="text-success js-text-stock"></span> } <span class="text-success">@inStockStateLabel</span> <span class="opacity-75">@deliveryLabel</span> </div> <div class="small text-danger d-none" data-show-if="LiveProductInfo.product.StockLevel <= 0">@noStockStateLabel</div> <div class="d-none" data-show-if="LiveProductInfo.product.ExpectedDelivery != null && new Date(LiveProductInfo.product.ExpectedDelivery) > new Date()"> <span>@Translate("Expected back in stock"): </span> <span class="js-text-expected-delivery"></span> </div> </div> </div> } else { string firstUnitId = product?.UnitOptions?.FirstOrDefault() != null ? product.UnitOptions.FirstOrDefault().Id : ""; string defaultUnitId = !string.IsNullOrEmpty(product.DefaultUnitId) ? product.DefaultUnitId : firstUnitId; string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : defaultUnitId; double? currentStockLevel = product.StockLevel; string stockStateLabel = currentStockLevel > 0 ? Translate("In stock") : Translate("Out of stock"); stockStateLabel = !string.IsNullOrEmpty(product.StockStatus) ? product.StockStatus : stockStateLabel; string stockStateCss = currentStockLevel > 0 ? "text-success" : "text-danger"; string stockStateIconCss = currentStockLevel > 0 ? "bg-success" : "bg-danger"; <div class="js-stock-state @horizontalAlign item_@Model.Item.SystemName.ToLower()"> <div class="small"> @if (!Model.Item.GetBoolean("HideInventory") && currentStockLevel > 0) { <span class="@stockStateCss js-text-stock">@currentStockLevel</span> } <span class="@stockStateCss">@stockStateLabel</span> @if (!string.IsNullOrEmpty(deliveryLabel)) { <span class="opacity-75">@deliveryLabel</span> } </div> @if (hasExpectedDelivery) { <div> <span>@Translate("Expected in stock"): </span> <span>@expectedDeliveryDate</span> </div> } </div> } } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-info">@Translate("No products available")</div> } }
Airpot
Airpot

Airpot

SP-SCM1009
Error executing template "Designs/Swift/Paragraph/Swift_ProductPrice.cshtml"
System.Net.Http.HttpRequestException: Unauthorized Response: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
 ---> System.Net.Http.HttpRequestException: Unauthorized
 ---> System.InvalidOperationException: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.SendRequest(HttpClient client, HttpRequestMessage msg) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 55
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.Execute(Endpoint endpoint, TimeSpan requestTimeout, String requestBody) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 33
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 525
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.HandleException(Exception ex, Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 661
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 531
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.Execute(Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 433
   at DynamicwebLiveIntegration3.EndpointManager.ExecuteEndpointRequest(String urlSuffix, Object requestBody)
   at DynamicwebLiveIntegration3.Caching.StockCache.FetchMissing(IEnumerable`1 keys)
   at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 317
   at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 274
   at DynamicwebLiveIntegration3.LiveIntegrationService.GetStock(ProductStockCacheKey productStockCacheKey, Boolean silent)
   at DynamicwebLiveIntegration3.Providers.ProductStockProvider.FindStockLevel(Product product, String unitId, StockLocation stockLocation)
   at Dynamicweb.Ecommerce.Stocks.StockLevelManager.FindStockLevel(Product product, String unitId, StockLocation stockLocation) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Stocks\StockLevelManager.cs:line 25
   at Dynamicweb.Ecommerce.Products.ProductExtentions.GetUnitStock(Product product, StockLocation stockLocation, String unitId) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Products\ProductExtentions.cs:line 202
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_1.<BulkCreateView>b__23() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 142
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_2.<BulkCreateView>b__24() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 143
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.ProductCatalog.ProductViewModel.get_StockLevel() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ProductViewModel.cs:line 170
   at CompiledRazorTemplates.Dynamic.RazorEngine_b00c56f50ed4428699530c9c6fee9664.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) { var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); if (productList?.Products is object) { product = productList.Products[0]; } } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHidePrices") && isErpConnectionDown; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; } @if (product is object && !hidePrice && !isDiscontinued) { bool showInformativePrice = Model.Item.GetBoolean("ShowInformativePrice"); string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : string.Empty; string priceFontSize = Model.Item.GetRawValueString("PriceSize", "fs-2"); string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); string layout = Model.Item.GetRawValueString("Layout", "horizontal"); string textAlign = horizontalAlign == "center" ? "text-center" : string.Empty; textAlign = horizontalAlign == "end" ? "text-end" : textAlign; horizontalAlign = horizontalAlign == "center" && layout == "horizontal" ? "justify-content-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" && layout == "horizontal" ? "justify-content-end" : horizontalAlign; horizontalAlign = horizontalAlign == "center" && layout == "vertical" ? "align-items-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" && layout == "vertical" ? "align-items-end" : horizontalAlign; string flexDirection = layout == "horizontal" ? string.Empty : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; theme = GetViewParameter("theme") != null ? GetViewParameterString("theme") : theme; string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); contentPadding = contentPadding == "none" ? "p-0" : contentPadding; contentPadding = contentPadding == "small" ? "p-1 px-md-2 py-md-1" : contentPadding; contentPadding = contentPadding == "large" ? "p-2 px-md-3 py-md-2" : contentPadding; string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); string priceMin = ""; string priceMax = ""; string liveInfoClass = ""; string productInfoFeed = ""; bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); if (isLazyLoadingForProductInfoEnabled) { if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) { productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); if (!string.IsNullOrEmpty(productInfoFeed)) { productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; } } liveInfoClass = "js-live-info"; } <div class="@textAlign @liveInfoClass item_@Model.Item.SystemName.ToLower()" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> @if (showInformativePrice && product.PriceInformative.Price != 0) { <div class="opacity-50"> <span>@Translate("RRP") </span> <span class="text-decoration-line-through text-price">@product.PriceInformative.PriceFormatted</span> </div> } <div class="@priceFontSize m-0 d-flex flex-wrap @flexDirection @flexGap @horizontalAlign" style="row-gap: 0 !important" itemprop="offers" itemscope itemtype="https://schema.org/Offer"> <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> @if (showPricesWithVat == "false" && !neverShowVat) { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span itemprop="price" content="" class="d-none"></span> <span class="text-decoration-line-through js-text-decoration-line-through opacity-75 me-3 text-price js-text-price d-none" data-show-if="LiveProductInfo.product.Price.Price != LiveProductInfo.product.PriceBeforeDiscount.Price"></span> } else { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceWithoutVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; <span itemprop="price" content="@product.Price.PriceWithoutVat" class="d-none"></span> if (product.Price.Price != product.PriceBeforeDiscount.Price) { <span class="text-decoration-line-through opacity-75 @order">@beforePrice</span> } } } else { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span itemprop="price" content="" class="d-none"></span> <span class="text-decoration-line-through js-text-decoration-line-through opacity-75 me-3 text-price js-text-price d-none" data-show-if="LiveProductInfo.product.Price.Price != LiveProductInfo.product.PriceBeforeDiscount.Price"></span> } else { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product.PriceBeforeDiscount.PriceFormatted; <span itemprop="price" content="@product.Price.Price" class="d-none"></span> if (product.Price.Price != product.PriceBeforeDiscount.Price) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } } } @if (showPricesWithVat == "false" && !neverShowVat) { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span class="text-price js-text-price"> <span class="spinner-border" role="status"></span> </span> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithoutVatFormatted : product.Price.PriceWithoutVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithoutVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithoutVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <span class="@theme @contentPadding"> <span class="text-price">@price</span> </span> } } else { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span class="text-price js-text-price"> <span class="spinner-border" role="status"></span> </span> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product.Price.PriceFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <span class="@theme @contentPadding"> <span class="text-price">@price</span> </span> } } @* Stock state for Schema.org, start *@ @{ Uri url = Dynamicweb.Context.Current.Request.Url; } <link itemprop="url" href="@url"> @{ bool IsNeverOutOfStock = product.NeverOutOfstock; } @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else { if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">InStock</span> } else { <span itemprop="availability" class="d-none">OutOfStock</span> } } @* Stock state for Schema.org, stop *@ </div> @if (showPricesWithVat == "false" && !neverShowVat) { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <small class="opacity-85 fst-normal js-text-price-with-vat d-none" data-suffix="@Translate("Incl. VAT")"></small> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <small class="opacity-85 fst-normal">@price @Translate("Incl. VAT")</small> } } </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Error executing template "Designs/Swift/Paragraph/Swift_ProductStock.cshtml"
System.Net.Http.HttpRequestException: Unauthorized Response: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
 ---> System.Net.Http.HttpRequestException: Unauthorized
 ---> System.InvalidOperationException: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.SendRequest(HttpClient client, HttpRequestMessage msg) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 55
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.Execute(Endpoint endpoint, TimeSpan requestTimeout, String requestBody) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 33
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 525
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.HandleException(Exception ex, Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 661
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 531
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.Execute(Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 433
   at DynamicwebLiveIntegration3.EndpointManager.ExecuteEndpointRequest(String urlSuffix, Object requestBody)
   at DynamicwebLiveIntegration3.Caching.StockCache.FetchMissing(IEnumerable`1 keys)
   at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 317
   at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 274
   at DynamicwebLiveIntegration3.LiveIntegrationService.GetStock(ProductStockCacheKey productStockCacheKey, Boolean silent)
   at DynamicwebLiveIntegration3.Providers.ProductStockProvider.FindStockLevel(Product product, String unitId, StockLocation stockLocation)
   at Dynamicweb.Ecommerce.Stocks.StockLevelManager.FindStockLevel(Product product, String unitId, StockLocation stockLocation) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Stocks\StockLevelManager.cs:line 25
   at Dynamicweb.Ecommerce.Products.ProductExtentions.GetUnitStock(Product product, StockLocation stockLocation, String unitId) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Products\ProductExtentions.cs:line 202
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_1.<BulkCreateView>b__23() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 142
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location ---
   at System.LazyHelper.ThrowException()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_2.<BulkCreateView>b__25() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 144
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.CreateValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_2.<BulkCreateView>b__27() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 146
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.CreateValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ProductViewModel.get_StockDeliveryText() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ProductViewModel.cs:line 215
   at CompiledRazorTemplates.Dynamic.RazorEngine_a7480fc9df1341b88e874af1f6db2f1c.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) { var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); if (productList?.Products is object) { product = productList.Products[0]; } } bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); bool hideStock = Model.Item.GetBoolean("HideStockState") || (Pageview.AreaSettings.GetBoolean("ErpDownHideStock") && isErpConnectionDown); } @if (product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock && !hideStock) { string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); horizontalAlign = horizontalAlign == "center" ? "text-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" ? "text-end" : horizontalAlign; bool hasExpectedDelivery = product.ExpectedDelivery != null && product.ExpectedDelivery > DateTime.Now; string expectedDeliveryDate = product.ExpectedDelivery?.ToShortDateString() ?? ""; string liveInfoClass = ""; string productInfoFeed = ""; bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); if (isLazyLoadingForProductInfoEnabled) { if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) { productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); if (!string.IsNullOrEmpty(productInfoFeed)) { productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; } } liveInfoClass = "js-live-info"; } if (!product.NeverOutOfstock) { string deliveryLabel = !string.IsNullOrEmpty(product.StockDeliveryText) ? $"{product.StockDeliveryText}" : ""; deliveryLabel += !string.IsNullOrEmpty(product.StockDeliveryValue) ? $" {product.StockDeliveryValue}" : ""; if (isLazyLoadingForProductInfoEnabled) { string inStockStateLabel = !string.IsNullOrEmpty(product.StockStatus) ? product.StockStatus : Translate("In stock"); string noStockStateLabel = !string.IsNullOrEmpty(product.StockStatus) ? product.StockStatus : Translate("Out of Stock"); <div class="js-stock-state @horizontalAlign item_@Model.Item.SystemName.ToLower() @liveInfoClass" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> <div class="js-stock-state spinner-border"> <div class="small d-none" data-show-if="LiveProductInfo.product.StockLevel > 0"> @if (!Model.Item.GetBoolean("HideInventory")) { <span class="text-success js-text-stock"></span> } <span class="text-success">@inStockStateLabel</span> <span class="opacity-75">@deliveryLabel</span> </div> <div class="small text-danger d-none" data-show-if="LiveProductInfo.product.StockLevel <= 0">@noStockStateLabel</div> <div class="d-none" data-show-if="LiveProductInfo.product.ExpectedDelivery != null && new Date(LiveProductInfo.product.ExpectedDelivery) > new Date()"> <span>@Translate("Expected back in stock"): </span> <span class="js-text-expected-delivery"></span> </div> </div> </div> } else { string firstUnitId = product?.UnitOptions?.FirstOrDefault() != null ? product.UnitOptions.FirstOrDefault().Id : ""; string defaultUnitId = !string.IsNullOrEmpty(product.DefaultUnitId) ? product.DefaultUnitId : firstUnitId; string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : defaultUnitId; double? currentStockLevel = product.StockLevel; string stockStateLabel = currentStockLevel > 0 ? Translate("In stock") : Translate("Out of stock"); stockStateLabel = !string.IsNullOrEmpty(product.StockStatus) ? product.StockStatus : stockStateLabel; string stockStateCss = currentStockLevel > 0 ? "text-success" : "text-danger"; string stockStateIconCss = currentStockLevel > 0 ? "bg-success" : "bg-danger"; <div class="js-stock-state @horizontalAlign item_@Model.Item.SystemName.ToLower()"> <div class="small"> @if (!Model.Item.GetBoolean("HideInventory") && currentStockLevel > 0) { <span class="@stockStateCss js-text-stock">@currentStockLevel</span> } <span class="@stockStateCss">@stockStateLabel</span> @if (!string.IsNullOrEmpty(deliveryLabel)) { <span class="opacity-75">@deliveryLabel</span> } </div> @if (hasExpectedDelivery) { <div> <span>@Translate("Expected in stock"): </span> <span>@expectedDeliveryDate</span> </div> } </div> } } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-info">@Translate("No products available")</div> } }
Airpot Duo
Airpot Duo

Airpot Duo

SP-SCM1011
Error executing template "Designs/Swift/Paragraph/Swift_ProductPrice.cshtml"
System.Net.Http.HttpRequestException: Unauthorized Response: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
 ---> System.Net.Http.HttpRequestException: Unauthorized
 ---> System.InvalidOperationException: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.SendRequest(HttpClient client, HttpRequestMessage msg) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 55
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.Execute(Endpoint endpoint, TimeSpan requestTimeout, String requestBody) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 33
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 525
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.HandleException(Exception ex, Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 661
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 531
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.Execute(Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 433
   at DynamicwebLiveIntegration3.EndpointManager.ExecuteEndpointRequest(String urlSuffix, Object requestBody)
   at DynamicwebLiveIntegration3.Caching.StockCache.FetchMissing(IEnumerable`1 keys)
   at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 317
   at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 274
   at DynamicwebLiveIntegration3.LiveIntegrationService.GetStock(ProductStockCacheKey productStockCacheKey, Boolean silent)
   at DynamicwebLiveIntegration3.Providers.ProductStockProvider.FindStockLevel(Product product, String unitId, StockLocation stockLocation)
   at Dynamicweb.Ecommerce.Stocks.StockLevelManager.FindStockLevel(Product product, String unitId, StockLocation stockLocation) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Stocks\StockLevelManager.cs:line 25
   at Dynamicweb.Ecommerce.Products.ProductExtentions.GetUnitStock(Product product, StockLocation stockLocation, String unitId) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Products\ProductExtentions.cs:line 202
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_1.<BulkCreateView>b__23() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 142
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_2.<BulkCreateView>b__24() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 143
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.ProductCatalog.ProductViewModel.get_StockLevel() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ProductViewModel.cs:line 170
   at CompiledRazorTemplates.Dynamic.RazorEngine_b00c56f50ed4428699530c9c6fee9664.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) { var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); if (productList?.Products is object) { product = productList.Products[0]; } } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHidePrices") && isErpConnectionDown; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; } @if (product is object && !hidePrice && !isDiscontinued) { bool showInformativePrice = Model.Item.GetBoolean("ShowInformativePrice"); string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : string.Empty; string priceFontSize = Model.Item.GetRawValueString("PriceSize", "fs-2"); string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); string layout = Model.Item.GetRawValueString("Layout", "horizontal"); string textAlign = horizontalAlign == "center" ? "text-center" : string.Empty; textAlign = horizontalAlign == "end" ? "text-end" : textAlign; horizontalAlign = horizontalAlign == "center" && layout == "horizontal" ? "justify-content-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" && layout == "horizontal" ? "justify-content-end" : horizontalAlign; horizontalAlign = horizontalAlign == "center" && layout == "vertical" ? "align-items-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" && layout == "vertical" ? "align-items-end" : horizontalAlign; string flexDirection = layout == "horizontal" ? string.Empty : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; theme = GetViewParameter("theme") != null ? GetViewParameterString("theme") : theme; string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); contentPadding = contentPadding == "none" ? "p-0" : contentPadding; contentPadding = contentPadding == "small" ? "p-1 px-md-2 py-md-1" : contentPadding; contentPadding = contentPadding == "large" ? "p-2 px-md-3 py-md-2" : contentPadding; string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); string priceMin = ""; string priceMax = ""; string liveInfoClass = ""; string productInfoFeed = ""; bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); if (isLazyLoadingForProductInfoEnabled) { if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) { productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); if (!string.IsNullOrEmpty(productInfoFeed)) { productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; } } liveInfoClass = "js-live-info"; } <div class="@textAlign @liveInfoClass item_@Model.Item.SystemName.ToLower()" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> @if (showInformativePrice && product.PriceInformative.Price != 0) { <div class="opacity-50"> <span>@Translate("RRP") </span> <span class="text-decoration-line-through text-price">@product.PriceInformative.PriceFormatted</span> </div> } <div class="@priceFontSize m-0 d-flex flex-wrap @flexDirection @flexGap @horizontalAlign" style="row-gap: 0 !important" itemprop="offers" itemscope itemtype="https://schema.org/Offer"> <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> @if (showPricesWithVat == "false" && !neverShowVat) { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span itemprop="price" content="" class="d-none"></span> <span class="text-decoration-line-through js-text-decoration-line-through opacity-75 me-3 text-price js-text-price d-none" data-show-if="LiveProductInfo.product.Price.Price != LiveProductInfo.product.PriceBeforeDiscount.Price"></span> } else { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceWithoutVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; <span itemprop="price" content="@product.Price.PriceWithoutVat" class="d-none"></span> if (product.Price.Price != product.PriceBeforeDiscount.Price) { <span class="text-decoration-line-through opacity-75 @order">@beforePrice</span> } } } else { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span itemprop="price" content="" class="d-none"></span> <span class="text-decoration-line-through js-text-decoration-line-through opacity-75 me-3 text-price js-text-price d-none" data-show-if="LiveProductInfo.product.Price.Price != LiveProductInfo.product.PriceBeforeDiscount.Price"></span> } else { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product.PriceBeforeDiscount.PriceFormatted; <span itemprop="price" content="@product.Price.Price" class="d-none"></span> if (product.Price.Price != product.PriceBeforeDiscount.Price) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } } } @if (showPricesWithVat == "false" && !neverShowVat) { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span class="text-price js-text-price"> <span class="spinner-border" role="status"></span> </span> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithoutVatFormatted : product.Price.PriceWithoutVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithoutVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithoutVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <span class="@theme @contentPadding"> <span class="text-price">@price</span> </span> } } else { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <span class="text-price js-text-price"> <span class="spinner-border" role="status"></span> </span> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product.Price.PriceFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <span class="@theme @contentPadding"> <span class="text-price">@price</span> </span> } } @* Stock state for Schema.org, start *@ @{ Uri url = Dynamicweb.Context.Current.Request.Url; } <link itemprop="url" href="@url"> @{ bool IsNeverOutOfStock = product.NeverOutOfstock; } @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else { if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">InStock</span> } else { <span itemprop="availability" class="d-none">OutOfStock</span> } } @* Stock state for Schema.org, stop *@ </div> @if (showPricesWithVat == "false" && !neverShowVat) { if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) { <small class="opacity-85 fst-normal js-text-price-with-vat d-none" data-suffix="@Translate("Incl. VAT")"></small> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <small class="opacity-85 fst-normal">@price @Translate("Incl. VAT")</small> } } </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Error executing template "Designs/Swift/Paragraph/Swift_ProductStock.cshtml"
System.Net.Http.HttpRequestException: Unauthorized Response: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
 ---> System.Net.Http.HttpRequestException: Unauthorized
 ---> System.InvalidOperationException: <error xmlns="http://docs.oasis-open.org/odata/ns/metadata"><code>Unauthorized</code><message>The credentials provided are incorrect</message></error>
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.SendRequest(HttpClient client, HttpRequestMessage msg) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 55
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointHttpClient.Execute(Endpoint endpoint, TimeSpan requestTimeout, String requestBody) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointHttpClient.cs:line 33
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 525
   --- End of inner exception stack trace ---
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.HandleException(Exception ex, Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 661
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.GetResponse(Endpoint endpoint, String requestBody, TimeSpan requestTimeout) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 531
   at Dynamicweb.DataIntegration.EndpointManagement.EndpointService.Execute(Endpoint endpoint) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\DataIntegration\Dynamicweb.DataIntegration\EndpointManagement\EndpointService.cs:line 433
   at DynamicwebLiveIntegration3.EndpointManager.ExecuteEndpointRequest(String urlSuffix, Object requestBody)
   at DynamicwebLiveIntegration3.Caching.StockCache.FetchMissing(IEnumerable`1 keys)
   at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 317
   at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Caching\ServiceCache.cs:line 274
   at DynamicwebLiveIntegration3.LiveIntegrationService.GetStock(ProductStockCacheKey productStockCacheKey, Boolean silent)
   at DynamicwebLiveIntegration3.Providers.ProductStockProvider.FindStockLevel(Product product, String unitId, StockLocation stockLocation)
   at Dynamicweb.Ecommerce.Stocks.StockLevelManager.FindStockLevel(Product product, String unitId, StockLocation stockLocation) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Stocks\StockLevelManager.cs:line 25
   at Dynamicweb.Ecommerce.Products.ProductExtentions.GetUnitStock(Product product, StockLocation stockLocation, String unitId) in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\Products\ProductExtentions.cs:line 202
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_1.<BulkCreateView>b__23() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 142
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location ---
   at System.LazyHelper.ThrowException()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_2.<BulkCreateView>b__25() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 144
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.CreateValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ViewEngine.<>c__DisplayClass15_2.<BulkCreateView>b__27() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ViewEngine.cs:line 146
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.CreateValue()
   at Dynamicweb.Ecommerce.ProductCatalog.ProductViewModel.get_StockDeliveryText() in C:\Users\frn\source\repos\Dynamicweb10\src\Features\Ecommerce\Dynamicweb.Ecommerce\ProductCatalog\ProductViewModel.cs:line 215
   at CompiledRazorTemplates.Dynamic.RazorEngine_a7480fc9df1341b88e874af1f6db2f1c.ExecuteAsync()
   at RazorEngine.Templating.TemplateBase.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass23_0.<Run>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.Run(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) in /_/src/Application/Providers/Dynamicweb.Rendering.Providers.NetCore/Razor/RazorTemplateRenderingProvider.cs:line 68
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\TemplateRenderingService.cs:line 14
   at Dynamicweb.Rendering.Template.RenderRazorTemplate() in C:\Users\frn\source\repos\Dynamicweb10\src\Core\Dynamicweb.Core\Rendering\Template.cs:line 805

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) { var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); if (productList?.Products is object) { product = productList.Products[0]; } } bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); bool hideStock = Model.Item.GetBoolean("HideStockState") || (Pageview.AreaSettings.GetBoolean("ErpDownHideStock") && isErpConnectionDown); } @if (product is object && product.ProductType == Dynamicweb.Ecommerce.Products.ProductType.Stock && !hideStock) { string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); horizontalAlign = horizontalAlign == "center" ? "text-center" : horizontalAlign; horizontalAlign = horizontalAlign == "end" ? "text-end" : horizontalAlign; bool hasExpectedDelivery = product.ExpectedDelivery != null && product.ExpectedDelivery > DateTime.Now; string expectedDeliveryDate = product.ExpectedDelivery?.ToShortDateString() ?? ""; string liveInfoClass = ""; string productInfoFeed = ""; bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); if (isLazyLoadingForProductInfoEnabled) { if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) { productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); if (!string.IsNullOrEmpty(productInfoFeed)) { productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; } } liveInfoClass = "js-live-info"; } if (!product.NeverOutOfstock) { string deliveryLabel = !string.IsNullOrEmpty(product.StockDeliveryText) ? $"{product.StockDeliveryText}" : ""; deliveryLabel += !string.IsNullOrEmpty(product.StockDeliveryValue) ? $" {product.StockDeliveryValue}" : ""; if (isLazyLoadingForProductInfoEnabled) { string inStockStateLabel = !string.IsNullOrEmpty(product.StockStatus) ? product.StockStatus : Translate("In stock"); string noStockStateLabel = !string.IsNullOrEmpty(product.StockStatus) ? product.StockStatus : Translate("Out of Stock"); <div class="js-stock-state @horizontalAlign item_@Model.Item.SystemName.ToLower() @liveInfoClass" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> <div class="js-stock-state spinner-border"> <div class="small d-none" data-show-if="LiveProductInfo.product.StockLevel > 0"> @if (!Model.Item.GetBoolean("HideInventory")) { <span class="text-success js-text-stock"></span> } <span class="text-success">@inStockStateLabel</span> <span class="opacity-75">@deliveryLabel</span> </div> <div class="small text-danger d-none" data-show-if="LiveProductInfo.product.StockLevel <= 0">@noStockStateLabel</div> <div class="d-none" data-show-if="LiveProductInfo.product.ExpectedDelivery != null && new Date(LiveProductInfo.product.ExpectedDelivery) > new Date()"> <span>@Translate("Expected back in stock"): </span> <span class="js-text-expected-delivery"></span> </div> </div> </div> } else { string firstUnitId = product?.UnitOptions?.FirstOrDefault() != null ? product.UnitOptions.FirstOrDefault().Id : ""; string defaultUnitId = !string.IsNullOrEmpty(product.DefaultUnitId) ? product.DefaultUnitId : firstUnitId; string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : defaultUnitId; double? currentStockLevel = product.StockLevel; string stockStateLabel = currentStockLevel > 0 ? Translate("In stock") : Translate("Out of stock"); stockStateLabel = !string.IsNullOrEmpty(product.StockStatus) ? product.StockStatus : stockStateLabel; string stockStateCss = currentStockLevel > 0 ? "text-success" : "text-danger"; string stockStateIconCss = currentStockLevel > 0 ? "bg-success" : "bg-danger"; <div class="js-stock-state @horizontalAlign item_@Model.Item.SystemName.ToLower()"> <div class="small"> @if (!Model.Item.GetBoolean("HideInventory") && currentStockLevel > 0) { <span class="@stockStateCss js-text-stock">@currentStockLevel</span> } <span class="@stockStateCss">@stockStateLabel</span> @if (!string.IsNullOrEmpty(deliveryLabel)) { <span class="opacity-75">@deliveryLabel</span> } </div> @if (hasExpectedDelivery) { <div> <span>@Translate("Expected in stock"): </span> <span>@expectedDeliveryDate</span> </div> } </div> } } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-info">@Translate("No products available")</div> } }
3 out of 3 products
By clicking 'Accept All' you consent that we may collect information about you for various purposes, including: Statistics and Marketing