Swift

Accessories

Wald Lift-Off Basket

Wald Lift-Off Basket

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_d9aa2fd901194f9e947cceacce79c0b0 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Sunlite Willow Classic Basket

Sunlite Willow Classic Basket

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_da72d6bb97194334b6db2e98bea03aa6 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Blackburn EX-1 Expedition Rack

Blackburn EX-1 Expedition Rack

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_2a6596620dff4a29a934b6cc57c950c9 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Ascent Jet Set Head/Taillight Combo

Ascent Jet Set Head/Taillight Combo

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_67eb04c6086a4c19bdd28ca4fdf485d5 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Lightweights See Red Reflectors

Lightweights See Red Reflectors

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_4d1b078e273440b9a597ab2e8cdf076b : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Bell Bellistic Helmet

Bell Bellistic Helmet

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_e055805dc1e044fb8ca34abc9e630471 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Bell Alchera Euro Road Helmet

Bell Alchera Euro Road Helmet

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_02418c35b2634867a905100b896f7c45 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Bell Triton Sport Helmet

Bell Triton Sport Helmet

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_f7b7e7a5ee194321ba4d2034a6642a1d : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Performance Vector Multi-Lens

Performance Vector Multi-Lens

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_91978daaac4f40b9b586bf756c20ddff : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
NiteRider Classic Halogen Headlight

NiteRider Classic Halogen Headlight

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_6c526ee0583d4cf9bfa4f0c5f43002ed : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Cat Eye Compact Safety Taillight

Cat Eye Compact Safety Taillight

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_c6f453f07ad34bba87c6bd2264bf825c : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
Lock DIGITS Cable Lock

Lock DIGITS Cable Lock

Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductPrice.cshtml"
Line 84: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 85: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 148: 'PriceViewModel' does not contain a definition for 'TryGetVatLabel' and no accessible extension method 'TryGetVatLabel' accepting a first argument of type 'PriceViewModel' could be found (are you missing a using directive or an assembly reference?)

1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using Dynamicweb.Ecommerce.Products; 12 internal class RazorEngine_cf96187479c34a4b8bbb42e49a43d5f8 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 13 { 14 #pragma warning disable 1998 15 public async override global::System.Threading.Tasks.Task ExecuteAsync() 16 { 17 WriteLiteral("\n"); 18 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } WriteLiteral("\n"); 19 if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\t<div"); 20 BeginWriteAttribute("class", " class=\"", 4037, "\"", 4095, 3); 21 WriteAttributeValue("", 4045, textAlign, 4045, 10, false); 22 WriteAttributeValue(" ", 4055, "item_", 4056, 6, true); 23 WriteAttributeValue("", 4061, Model.Item?.SystemName?.ToLower(), 4061, 34, false); 24 EndWriteAttribute(); 25 WriteLiteral(" data-product-id=\""); 26 Write(product?.Id); 27 WriteLiteral("\" data-variant-id=\""); 28 Write(product?.VariantId); 29 WriteLiteral("\">\n"); 30 if (showInformativePrice && product?.PriceInformative.Price != 0) { WriteLiteral("\t\t\t<div class=\"opacity-50\">\n\t\t\t\t<span>"); 31 Write(Translate("RRP")); 32 WriteLiteral(" </span>\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 33 Write(product?.PriceInformative.PriceFormatted); 34 WriteLiteral("</span>\n\t\t\t</div>\n"); 35 } WriteLiteral("\t\t<div"); 36 BeginWriteAttribute("class", " class=\"", 4431, "\"", 4515, 7); 37 WriteAttributeValue("", 4439, priceFontSize, 4439, 14, false); 38 WriteAttributeValue(" ", 4453, "m-0", 4454, 4, true); 39 WriteAttributeValue(" ", 4457, "d-flex", 4458, 7, true); 40 WriteAttributeValue(" ", 4464, "flex-wrap", 4465, 10, true); 41 WriteAttributeValue(" ", 4474, flexDirection, 4475, 14, false); 42 WriteAttributeValue(" ", 4489, flexGap, 4490, 8, false); 43 WriteAttributeValue(" ", 4498, horizontalAlign, 4499, 16, false); 44 EndWriteAttribute(); 45 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n\t\t\t<span itemprop=\"priceCurrency\""); 46 BeginWriteAttribute("content", " content=\"", 4645, "\"", 4683, 1); 47 WriteAttributeValue("", 4655, product?.Price.CurrencyCode, 4655, 28, false); 48 EndWriteAttribute(); 49 WriteLiteral(" class=\"d-none\"></span>\n\t\t\t<span itemprop=\"price\""); 50 BeginWriteAttribute("content", " content=\"", 4733, "\"", 4764, 1); 51 WriteAttributeValue("", 4743, product?.Price.Price, 4743, 21, false); 52 EndWriteAttribute(); 53 WriteLiteral(" class=\"d-none\"></span>\n\n"); 54 if (product.HasDiscount()) { WriteLiteral("\t\t\t\t<span"); 55 BeginWriteAttribute("class", " class=\"", 4835, "\"", 4889, 3); 56 WriteAttributeValue("", 4843, "text-decoration-line-through", 4843, 28, true); 57 WriteAttributeValue(" ", 4871, "opacity-75", 4872, 11, true); 58 WriteAttributeValue(" ", 4882, order, 4883, 6, false); 59 EndWriteAttribute(); 60 WriteLiteral(">\n\t\t\t\t\t<span class=\"text-price\">"); 61 Write(beforePrice); 62 WriteLiteral("</span>\n\t\t\t\t</span>\n"); 63 } WriteLiteral("\t\t\t\n\t\t\t<span class=\"text-price\">"); 64 Write(price); 65 WriteLiteral("</span>\n"); 66 if (product.Price.TryGetVatLabel(out string vatLabel)) { WriteLiteral("\t\t\t\t<small class=\"opacity-85 fst-normal order-3\">"); 67 Write(Translate(vatLabel)); 68 WriteLiteral("</small>\n"); 69 } WriteLiteral("\t\t\t<link itemprop=\"url\""); 70 BeginWriteAttribute("href", " href=\"", 5216, "\"", 5227, 1); 71 WriteAttributeValue("", 5223, url, 5223, 4, false); 72 EndWriteAttribute(); 73 WriteLiteral(">\n\n"); 74 if (IsNeverOutOfStock) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 75 Write(Translate("Available in stock")); 76 WriteLiteral("</span>\n"); 77 } else if (product.StockLevel > 0) { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 78 Write(Translate("In stock")); 79 WriteLiteral("</span>\n"); 80 } else { WriteLiteral("\t\t\t\t<span itemprop=\"availability\" class=\"d-none\">"); 81 Write(Translate("Out of stock")); 82 WriteLiteral("</span>\n"); 83 } WriteLiteral("\t\t</div>\n\t</div>\n"); 84 } else if (Pageview.IsVisualEditorMode) { WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\n\t\t<span>"); 85 Write(Translate("No products available")); 86 WriteLiteral("</span>\n\t</div>\n"); 87 } } 88 #pragma warning restore 1998 89 } 90 } 91 #pragma warning restore 1591 92

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (Pageview.IsVisualEditorMode) { product = new ProductViewModel(); product.Price = new PriceViewModel() { Price = 99, PriceFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 99, PriceWithoutVatFormatted = "99 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 99, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; product.PriceInformative = new PriceViewModel() { Price = 49, PriceFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 49, PriceWithoutVatFormatted = "49 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 49, PriceWithVatFormatted = "49 " + Pageview.Area.EcomCurrencyId }; product.PriceBeforeDiscount = new PriceViewModel() { Price = 199, PriceFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = 199, PriceWithoutVatFormatted = "199 " + Pageview.Area.EcomCurrencyId, PriceWithVat = 199, PriceWithVatFormatted = "99 " + Pageview.Area.EcomCurrencyId }; } string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); bool anonymousUser = Pageview.User == null; bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser; bool productIsDiscontinued = product is object && product.Discontinued; bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower(); } } @if (product is object && !hidePrice && !isDiscontinued && priceType != "fixedprice") { 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" ? "align-items-end" : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted; string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted; string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted; price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price; string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product?.PriceBeforeDiscount.PriceFormatted; Uri url = Dynamicweb.Context.Current.Request.Url; bool IsNeverOutOfStock = product.NeverOutOfstock; <div class="@textAlign item_@Model.Item?.SystemName?.ToLower()" data-product-id="@product?.Id" data-variant-id="@product?.VariantId"> @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> <span itemprop="price" content="@product?.Price.Price" class="d-none"></span> @if (product.HasDiscount()) { <span class="text-decoration-line-through opacity-75 @order"> <span class="text-price">@beforePrice</span> </span> } <span class="text-price">@price</span> @if (product.Price.TryGetVatLabel(out string vatLabel)) { <small class="opacity-85 fst-normal order-3">@Translate(vatLabel)</small> } @* Stock state for Schema.org, start *@ <link itemprop="url" href="@url"> @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">@Translate("In stock")</span> } else { <span itemprop="availability" class="d-none">@Translate("Out of stock")</span> } @* Stock state for Schema.org, stop *@ </div> </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }
12 out of 18 products
Load more products

Accessories

Customize your bike with our range of accessories, designed for comfort, style, and performance. Find everything from helmets and lights to racks and locks, all crafted to enhance your cycling experience.