Eggen Filmklodser, 100 stk.
Varenr.
4627
Beskrivelse
Filmklodser til Eggen filmholdere, hvid plast, til engangsbrug, kan ikke autoklaveres.
Producent
Eggen
Mængde
100 stk.
Error compiling template "/Designs/Swift-v2/Paragraph/Custom_Swift-v2_ProductPrice.cshtml" Line 122: ; expected Line 120: The type or namespace name 'Pageview' could not be found (are you missing a using directive or an assembly reference?) Line 122: The name 'productService' does not exist in the current context Line 123: The name 'productService' does not exist in the current context Line 144: Cannot convert type 'Dynamicweb.Ecommerce.ProductCatalog.FieldValueViewModel' to 'string' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion Line 145: Cannot convert type 'Dynamicweb.Ecommerce.ProductCatalog.FieldValueViewModel' to 'string' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion Line 146: Cannot convert type 'Dynamicweb.Ecommerce.ProductCatalog.FieldValueViewModel' to 'string' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion Line 148: Cannot convert type 'Dynamicweb.Ecommerce.ProductCatalog.FieldValueViewModel' to 'string' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion Line 149: Cannot convert type 'Dynamicweb.Ecommerce.ProductCatalog.FieldValueViewModel' to 'string' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion Line 122: The variable 'ProductService' is declared but never used
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 using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Products; 13 internal class RazorEngine_76913a583fb949fe9591e2abd9b9d644 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 14 { 15 #pragma warning disable 1998 16 public async override global::System.Threading.Tasks.Task ExecuteAsync() 17 { 18 WriteLiteral("\n"); 19 ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (!string.IsNullOrEmpty(Pageview.Page.Item["DummyProduct"]?.ToString()) && Pageview.IsVisualEditorMode) { var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); if (productList?.Products is object) { product = productList.Products[0]; } } 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 != null ? Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued") : false; var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"] != null ? Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower() : string.Empty; } string title = Model?.Item != null ? (Model.Item.GetString("Title") ?? "") : ""; bool showEcoLabelPlp = title == "Product list page price"; bool showEcoLabelPdp = title == "Product details page price"; string ecoLayoutClass = showEcoLabelPdp ? "flex-column" : ""; string ecoAlignClass = showEcoLabelPdp ? "" : "align-items-center"; bool hasEcoLabel = true; string[] ecoLabelKeys = { "EcoLabelShoppingWithCare1", "EcoLabelShoppingWithCare2", "EcoLabelShoppingWithCare3", "EcoLabelShoppingWithCare4", "EcoLabelShoppingWithCare5" }; string[] ecoLabelKeys2 = { "EcoLabelPictureName1", "EcoLabelPictureName2", "EcoLabelPictureName3", "EcoLabelPictureName4", "EcoLabelPictureName5" }; if (!Pageview.IsVisualEditorMode) { hasEcoLabel = ecoLabelKeys.Any(key => product?.ProductFields != null && product.ProductFields.TryGetValue(key, out var field) && field?.Value?.ToString() == "1" ); } if (Pageview.User != null && Pageview.User.ID > 0 && !Pageview.IsVisualEditorMode) { PriceViewModel actualPrice = product.Price; Pageview.User ProductService productService = new ProductService(); var priceInfo = ProductManager.GetProductInfo(productService.GetProductById(product.Id, "", product.LanguageId), Dynamicweb.Security.UserManagement.UserContext.Current.User, ""); FieldValueViewModel defaultCustomerPrice; bool hasDefaultCustomerPrice = product.ProductFields.TryGetValue("DefaultCustomerPrice", out defaultCustomerPrice); FieldValueViewModel defaultPrice; bool hasDefaultPrice = product.ProductFields.TryGetValue("DefaultPrice", out defaultPrice); FieldValueViewModel discount; bool hasDiscount = product.ProductFields.TryGetValue("Discount", out discount); //new // object defaultCustomerPrice; // bool hasDefaultCustomerPrice = priceInfo.TryGetValue("DefaultCustomerPrice", out defaultCustomerPrice); // object defaultPrice; // bool hasDefaultPrice = priceInfo.TryGetValue("DefaultPrice", out defaultPrice); // object discount; // bool hasDiscount = priceInfo.TryGetValue("Discount", out discount); //new end string basePrice = hasDefaultCustomerPrice && !string.IsNullOrEmpty(defaultCustomerPrice as string) ? defaultCustomerPrice as string : (hasDefaultPrice ? defaultPrice as string : "0"); string discountedPrice = hasDefaultCustomerPrice && !string.IsNullOrEmpty(defaultCustomerPrice as string) ? defaultCustomerPrice as string : actualPrice.Price.ToString(); product.Price = new PriceViewModel() { Price = double.TryParse(basePrice, out var priceValue) ? priceValue : actualPrice.Price, PriceFormatted = basePrice + " " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = double.TryParse(basePrice, out var PriceWithoutVat) ? PriceWithoutVat : actualPrice.PriceWithoutVat, PriceWithoutVatFormatted = basePrice + " " + Pageview.Area.EcomCurrencyId, PriceWithVat = double.TryParse(basePrice, out var PriceWithVat) ? PriceWithVat : actualPrice.PriceWithVat, PriceWithVatFormatted = basePrice + " " + Pageview.Area.EcomCurrencyId }; if (hasDefaultPrice && hasDefaultCustomerPrice && defaultPrice != null && defaultCustomerPrice != null && defaultPrice.ToString() == defaultCustomerPrice.ToString()) { product.PriceBeforeDiscount = new PriceViewModel() { Price = double.TryParse(discountedPrice, out var beforeDisc) ? beforeDisc : 0, PriceFormatted = discountedPrice + " " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = double.TryParse(discountedPrice, out var discountedPriceWithoutVat) ? discountedPriceWithoutVat : 0, PriceWithoutVatFormatted = discountedPrice + " " + Pageview.Area.EcomCurrencyId, PriceWithVat = double.TryParse(discountedPrice, out var discountedPriceWithVat) ? discountedPriceWithVat : 0, PriceWithVatFormatted = discountedPrice + " " + Pageview.Area.EcomCurrencyId }; } //this Should be moved to Product detail page FieldValueViewModel annualContractPrice; bool hasAnnualContractPrice = product.ProductFields.TryGetValue("BonusPrice", out annualContractPrice); //uptil here } var user = Pageview.User; var punchoutField = user?.CustomFieldValues != null ? user.CustomFieldValues.Find(x => x.CustomField.SystemName == "AccessUser_IsPunchoutUser") : null; // bool isPunchoutUser = punchoutField?.Value != null && punchoutField.Value.ToString().ToLower() == "true" ? true : false; FieldValueViewModel specPriceField = null; bool hasSpecPriceField = false; if (product is object && product.ProductFields != null) { hasSpecPriceField = product.ProductFields.TryGetValue("SpecPrice", out specPriceField); } bool isSpecPrice = hasSpecPriceField && specPriceField?.Value != null && (specPriceField.Value.ToString() == "1" || specPriceField.Value.ToString().ToLower() == "true"); // string MarkedItem = isSpecPrice && isPunchoutUser ? "markedItemtext" : ""; string markedItem = string.Empty; bool isPunchoutUser = false; FieldValueViewModel specPrice; bool hasSpecPrice = false; if (!Pageview.IsVisualEditorMode && Pageview.User != null) { isPunchoutUser = Pageview.User.CustomFieldValues.SingleOrDefault(x => x.CustomField.SystemName == "AccessUser_IsPunchoutUser").Value.ToString().Equals("True"); hasSpecPrice = product.ProductFields.TryGetValue("SpecPrice", out specPrice); markedItem = specPrice != null && specPrice.Value.ToString() == "yes" && isPunchoutUser ? "markeditem" : ""; } WriteLiteral("\n"); 20 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" ? string.Empty : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string showPricesWithVat = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat.ToString(); bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); string priceMin = ""; string priceMax = ""; WriteLiteral(" <div"); 21 BeginWriteAttribute("class", " class=\"", 11016, "\"", 11140, 8); 22 WriteAttributeValue("", 11024, textAlign, 11024, 10, false); 23 WriteAttributeValue(" ", 11034, "item_", 11035, 6, true); 24 WriteAttributeValue("", 11040, Model.Item.SystemName.ToLower(), 11040, 32, false); 25 WriteAttributeValue(" ", 11072, "d-flex", 11073, 7, true); 26 WriteAttributeValue(" ", 11079, ecoAlignClass, 11080, 14, false); 27 WriteAttributeValue(" ", 11094, ecoLayoutClass, 11095, 15, false); 28 WriteAttributeValue(" ", 11110, "custom-price-", 11111, 14, true); 29 WriteAttributeValue("", 11124, Pageview.AreaID, 11124, 16, false); 30 EndWriteAttribute(); 31 WriteLiteral(" data-product-id=\""); 32 Write(product.Id); 33 WriteLiteral("\" data-variant-id=\""); 34 Write(product.VariantId); 35 WriteLiteral("\">\n <div class=\"d-flex my-2\">\n"); 36 if (!Pageview.IsVisualEditorMode && product is object) { if (showEcoLabelPlp && hasEcoLabel) { WriteLiteral(" <img class=\"eco-label me-3\" src=\"/Files/Images/EcoLabel/EcoLabel.png\" alt=\"EcoLable\" />\n"); 37 } foreach (var ecoKey in ecoLabelKeys2) { FieldValueViewModel ecoField = null; bool hasEcoField = product?.ProductFields != null && product.ProductFields.TryGetValue(ecoKey, out ecoField); string ecoValue = hasEcoField && ecoField?.Value != null ? ecoField.Value.ToString() : ""; if (!string.IsNullOrWhiteSpace(ecoValue) && ecoValue != "0") { string ecoSrc = ecoValue.Contains("/") ? ecoValue : ("/Files/Images/EcoLabel/" + ecoValue); if (showEcoLabelPdp) { WriteLiteral(" <img class=\"eco-label me-2\""); 38 BeginWriteAttribute("src", " src=\"", 12241, "\"", 12254, 1); 39 WriteAttributeValue("", 12247, ecoSrc, 12247, 7, false); 40 EndWriteAttribute(); 41 BeginWriteAttribute("alt", " alt=\"", 12255, "\"", 12268, 1); 42 WriteAttributeValue("", 12261, ecoKey, 12261, 7, false); 43 EndWriteAttribute(); 44 WriteLiteral(" />\n"); 45 } } } } WriteLiteral(" </div>\n"); 46 if (showInformativePrice && product.PriceInformative.Price != 0) { WriteLiteral(" <div class=\"opacity-50\">\n <span>"); 47 Write(Translate("RRP")); 48 WriteLiteral(" </span>\n <span class=\"text-decoration-line-through text-price\">"); 49 Write(product.PriceInformative.PriceFormatted); 50 WriteLiteral("</span>\n </div>\n"); 51 } WriteLiteral(" <div"); 52 BeginWriteAttribute("class", " class=\"", 12696, "\"", 12784, 7); 53 WriteAttributeValue("", 12704, priceFontSize, 12704, 14, false); 54 WriteAttributeValue(" ", 12718, "my-2", 12719, 5, true); 55 WriteAttributeValue(" ", 12723, "d-flex", 12724, 7, true); 56 WriteAttributeValue(" ", 12730, "flex-column", 12731, 12, true); 57 WriteAttributeValue(" ", 12742, flexDirection, 12744, 14, false); 58 WriteAttributeValue(" ", 12758, flexGap, 12759, 8, false); 59 WriteAttributeValue(" ", 12767, horizontalAlign, 12768, 16, false); 60 EndWriteAttribute(); 61 WriteLiteral(" style=\"row-gap: 0 !important\" itemprop=\"offers\" itemscope itemtype=\"https://schema.org/Offer\">\n <span itemprop=\"priceCurrency\""); 62 BeginWriteAttribute("content", " content=\"", 12923, "\"", 12960, 1); 63 WriteAttributeValue("", 12933, product.Price.CurrencyCode, 12933, 27, false); 64 EndWriteAttribute(); 65 WriteLiteral(" class=\"d-none\"></span>\n\n"); 66 if (showPricesWithVat == "False" && !neverShowVat) { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithoutVatFormatted : product.Price.PriceWithoutVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithoutVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithoutVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } WriteLiteral(" <span"); 67 BeginWriteAttribute("class", " class=\"", 13798, "\"", 13836, 3); 68 WriteAttributeValue("", 13806, "text-price", 13806, 10, true); 69 WriteAttributeValue(" ", 13816, "fw-bold", 13817, 8, true); 70 WriteAttributeValue(" ", 13824, markedItem, 13825, 11, false); 71 EndWriteAttribute(); 72 WriteLiteral(">\n "); 73 Write(price); 74 WriteLiteral("\n <small class=\"opacity-85 fst-normal\">"); 75 Write(Translate("excl. VAT")); 76 WriteLiteral(" </small>\n </span>\n"); 77 } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product.Price.Price.ToString(); if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } WriteLiteral(" <span"); 78 BeginWriteAttribute("class", " class=\"", 14701, "\"", 14739, 3); 79 WriteAttributeValue("", 14709, "text-price", 14709, 10, true); 80 WriteAttributeValue(" ", 14719, "fw-bold", 14720, 8, true); 81 WriteAttributeValue(" ", 14727, markedItem, 14728, 11, false); 82 EndWriteAttribute(); 83 WriteLiteral(">\n "); 84 Write(price); 85 WriteLiteral("\n <small class=\"opacity-85 fst-normal\">"); 86 Write(Translate("Incl. VAT")); 87 WriteLiteral("</small>\n </span>\n"); 88 } if (showPricesWithVat == "false" && !neverShowVat) { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceWithoutVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; WriteLiteral(" <span itemprop=\"price\""); 89 BeginWriteAttribute("content", " content=\"", 15208, "\"", 15248, 1); 90 WriteAttributeValue("", 15218, product.Price.PriceWithoutVat, 15218, 30, false); 91 EndWriteAttribute(); 92 WriteLiteral(" class=\"d-none\"></span>\n"); 93 if (product.Price.Price != product.PriceBeforeDiscount.Price) { WriteLiteral(" <span"); 94 BeginWriteAttribute("class", " class=\"", 15394, "\"", 15448, 3); 95 WriteAttributeValue("", 15402, "text-decoration-line-through", 15402, 28, true); 96 WriteAttributeValue(" ", 15430, "opacity-75", 15431, 11, true); 97 WriteAttributeValue(" ", 15441, order, 15442, 6, false); 98 EndWriteAttribute(); 99 WriteLiteral(">"); 100 Write(beforePrice); 101 WriteLiteral("</span>\n"); 102 } } else { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; WriteLiteral(" <span itemprop=\"price\""); 103 BeginWriteAttribute("content", " content=\"", 15757, "\"", 15787, 1); 104 WriteAttributeValue("", 15767, product.Price.Price, 15767, 20, false); 105 EndWriteAttribute(); 106 WriteLiteral(" class=\"d-none\"></span>\n"); 107 if (product.Price.Price != product.PriceBeforeDiscount.Price) { WriteLiteral(" <span"); 108 BeginWriteAttribute("class", " class=\"", 15934, "\"", 15988, 3); 109 WriteAttributeValue("", 15942, "text-decoration-line-through", 15942, 28, true); 110 WriteAttributeValue(" ", 15970, "opacity-75", 15971, 11, true); 111 WriteAttributeValue(" ", 15981, order, 15982, 6, false); 112 EndWriteAttribute(); 113 WriteLiteral(" style=\"color: #a8a8a8\">\n <span class=\"text-price fw-bold\">"); 114 Write(beforePrice); 115 WriteLiteral("</span>\n </span>\n"); 116 } } WriteLiteral("\n\n\n"); 117 Uri url = Dynamicweb.Context.Current.Request.Url; WriteLiteral("\n <link itemprop=\"url\""); 118 BeginWriteAttribute("href", " href=\"", 16334, "\"", 16345, 1); 119 WriteAttributeValue("", 16341, url, 16341, 4, false); 120 EndWriteAttribute(); 121 WriteLiteral(">\n\n"); 122 bool IsNeverOutOfStock = product.NeverOutOfstock; WriteLiteral("\n"); 123 if (IsNeverOutOfStock) { WriteLiteral(" <span itemprop=\"availability\" class=\"d-none\">"); 124 Write(Translate("Available in stock")); 125 WriteLiteral("</span>\n"); 126 } else { if (product.StockLevel > 0) { WriteLiteral(" <span itemprop=\"availability\" class=\"d-none\">InStock</span>\n"); 127 } else { WriteLiteral(" <span itemprop=\"availability\" class=\"d-none\">OutOfStock</span>\n"); 128 } } WriteLiteral("\n </div>\n\n"); 129 if (showPricesWithVat == "false" && !neverShowVat) { if (!Pageview.IsVisualEditorMode) { WriteLiteral(" <small class=\"opacity-85 fst-normal js-text-price-with-vat d-none\" data-suffix=\""); 130 Write(Translate("Incl. VAT")); 131 WriteLiteral("\"></small>\n"); 132 } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } WriteLiteral(" <small class=\"opacity-85 fst-normal\">"); 133 Write(price); 134 WriteLiteral(" "); 135 Write(Translate("Incl. VAT")); 136 WriteLiteral("</small>\n"); 137 } } WriteLiteral(" </div>\n"); 138 } else if (Pageview.IsVisualEditorMode) { WriteLiteral(" <div class=\"alert alert-dark m-0\" role=\"alert\">\n <span>"); 139 Write(Translate("No products available")); 140 WriteLiteral("</span>\n </div>\n"); 141 } } 142 #pragma warning restore 1998 143 } 144 } 145 #pragma warning restore 1591 146
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using Dynamicweb.Ecommerce.Products @using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Products @{ ProductViewModel product = null; if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) { product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; } else if (!string.IsNullOrEmpty(Pageview.Page.Item["DummyProduct"]?.ToString()) && Pageview.IsVisualEditorMode) { var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); if (productList?.Products is object) { product = productList.Products[0]; } } 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 != null ? Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued") : false; var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; string priceType = string.Empty; if (Dynamicweb.Context.Current.Items.Contains("PriceType")) { priceType = Dynamicweb.Context.Current.Items["PriceType"] != null ? Dynamicweb.Context.Current.Items["PriceType"].ToString().ToLower() : string.Empty; } string title = Model?.Item != null ? (Model.Item.GetString("Title") ?? "") : ""; bool showEcoLabelPlp = title == "Product list page price"; bool showEcoLabelPdp = title == "Product details page price"; string ecoLayoutClass = showEcoLabelPdp ? "flex-column" : ""; string ecoAlignClass = showEcoLabelPdp ? "" : "align-items-center"; bool hasEcoLabel = true; string[] ecoLabelKeys = { "EcoLabelShoppingWithCare1", "EcoLabelShoppingWithCare2", "EcoLabelShoppingWithCare3", "EcoLabelShoppingWithCare4", "EcoLabelShoppingWithCare5" }; string[] ecoLabelKeys2 = { "EcoLabelPictureName1", "EcoLabelPictureName2", "EcoLabelPictureName3", "EcoLabelPictureName4", "EcoLabelPictureName5" }; if (!Pageview.IsVisualEditorMode) { hasEcoLabel = ecoLabelKeys.Any(key => product?.ProductFields != null && product.ProductFields.TryGetValue(key, out var field) && field?.Value?.ToString() == "1" ); } if (Pageview.User != null && Pageview.User.ID > 0 && !Pageview.IsVisualEditorMode) { PriceViewModel actualPrice = product.Price; Pageview.User ProductService productService = new ProductService(); var priceInfo = ProductManager.GetProductInfo(productService.GetProductById(product.Id, "", product.LanguageId), Dynamicweb.Security.UserManagement.UserContext.Current.User, ""); FieldValueViewModel defaultCustomerPrice; bool hasDefaultCustomerPrice = product.ProductFields.TryGetValue("DefaultCustomerPrice", out defaultCustomerPrice); FieldValueViewModel defaultPrice; bool hasDefaultPrice = product.ProductFields.TryGetValue("DefaultPrice", out defaultPrice); FieldValueViewModel discount; bool hasDiscount = product.ProductFields.TryGetValue("Discount", out discount); //new // object defaultCustomerPrice; // bool hasDefaultCustomerPrice = priceInfo.TryGetValue("DefaultCustomerPrice", out defaultCustomerPrice); // object defaultPrice; // bool hasDefaultPrice = priceInfo.TryGetValue("DefaultPrice", out defaultPrice); // object discount; // bool hasDiscount = priceInfo.TryGetValue("Discount", out discount); //new end string basePrice = hasDefaultCustomerPrice && !string.IsNullOrEmpty(defaultCustomerPrice as string) ? defaultCustomerPrice as string : (hasDefaultPrice ? defaultPrice as string : "0"); string discountedPrice = hasDefaultCustomerPrice && !string.IsNullOrEmpty(defaultCustomerPrice as string) ? defaultCustomerPrice as string : actualPrice.Price.ToString(); product.Price = new PriceViewModel() { Price = double.TryParse(basePrice, out var priceValue) ? priceValue : actualPrice.Price, PriceFormatted = basePrice + " " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = double.TryParse(basePrice, out var PriceWithoutVat) ? PriceWithoutVat : actualPrice.PriceWithoutVat, PriceWithoutVatFormatted = basePrice + " " + Pageview.Area.EcomCurrencyId, PriceWithVat = double.TryParse(basePrice, out var PriceWithVat) ? PriceWithVat : actualPrice.PriceWithVat, PriceWithVatFormatted = basePrice + " " + Pageview.Area.EcomCurrencyId }; if (hasDefaultPrice && hasDefaultCustomerPrice && defaultPrice != null && defaultCustomerPrice != null && defaultPrice.ToString() == defaultCustomerPrice.ToString()) { product.PriceBeforeDiscount = new PriceViewModel() { Price = double.TryParse(discountedPrice, out var beforeDisc) ? beforeDisc : 0, PriceFormatted = discountedPrice + " " + Pageview.Area.EcomCurrencyId, PriceWithoutVat = double.TryParse(discountedPrice, out var discountedPriceWithoutVat) ? discountedPriceWithoutVat : 0, PriceWithoutVatFormatted = discountedPrice + " " + Pageview.Area.EcomCurrencyId, PriceWithVat = double.TryParse(discountedPrice, out var discountedPriceWithVat) ? discountedPriceWithVat : 0, PriceWithVatFormatted = discountedPrice + " " + Pageview.Area.EcomCurrencyId }; } //this Should be moved to Product detail page FieldValueViewModel annualContractPrice; bool hasAnnualContractPrice = product.ProductFields.TryGetValue("BonusPrice", out annualContractPrice); //uptil here } var user = Pageview.User; var punchoutField = user?.CustomFieldValues != null ? user.CustomFieldValues.Find(x => x.CustomField.SystemName == "AccessUser_IsPunchoutUser") : null; // bool isPunchoutUser = punchoutField?.Value != null && punchoutField.Value.ToString().ToLower() == "true" ? true : false; FieldValueViewModel specPriceField = null; bool hasSpecPriceField = false; if (product is object && product.ProductFields != null) { hasSpecPriceField = product.ProductFields.TryGetValue("SpecPrice", out specPriceField); } bool isSpecPrice = hasSpecPriceField && specPriceField?.Value != null && (specPriceField.Value.ToString() == "1" || specPriceField.Value.ToString().ToLower() == "true"); // string MarkedItem = isSpecPrice && isPunchoutUser ? "markedItemtext" : ""; string markedItem = string.Empty; bool isPunchoutUser = false; FieldValueViewModel specPrice; bool hasSpecPrice = false; if (!Pageview.IsVisualEditorMode && Pageview.User != null) { isPunchoutUser = Pageview.User.CustomFieldValues.SingleOrDefault(x => x.CustomField.SystemName == "AccessUser_IsPunchoutUser").Value.ToString().Equals("True"); hasSpecPrice = product.ProductFields.TryGetValue("SpecPrice", out specPrice); markedItem = specPrice != null && specPrice.Value.ToString() == "yes" && isPunchoutUser ? "markeditem" : ""; } } @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" ? string.Empty : "flex-column"; string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; string order = layout == "horizontal" ? string.Empty : "order-2"; string showPricesWithVat = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat.ToString(); bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); string priceMin = ""; string priceMax = ""; <div class="@textAlign item_@Model.Item.SystemName.ToLower() d-flex @ecoAlignClass @ecoLayoutClass custom-price-@Pageview.AreaID" data-product-id="@product.Id" data-variant-id="@product.VariantId"> <div class="d-flex my-2"> @if (!Pageview.IsVisualEditorMode && product is object) { if (showEcoLabelPlp && hasEcoLabel) { <img class="eco-label me-3" src="/Files/Images/EcoLabel/EcoLabel.png" alt="EcoLable" /> } foreach (var ecoKey in ecoLabelKeys2) { FieldValueViewModel ecoField = null; bool hasEcoField = product?.ProductFields != null && product.ProductFields.TryGetValue(ecoKey, out ecoField); string ecoValue = hasEcoField && ecoField?.Value != null ? ecoField.Value.ToString() : ""; if (!string.IsNullOrWhiteSpace(ecoValue) && ecoValue != "0") { string ecoSrc = ecoValue.Contains("/") ? ecoValue : ("/Files/Images/EcoLabel/" + ecoValue); if (showEcoLabelPdp) { <img class="eco-label me-2" src="@ecoSrc" alt="@ecoKey" /> } } } } </div> @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 my-2 d-flex flex-column @flexDirection @flexGap @horizontalAlign" style="row-gap: 0 !important" itemprop="offers" itemscope itemtype="https://schema.org/Offer"> <span itemprop="priceCurrency" content="@product.Price.CurrencyCode" class="d-none"></span> @if (showPricesWithVat == "False" && !neverShowVat) { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithoutVatFormatted : product.Price.PriceWithoutVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithoutVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithoutVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithoutVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <span class="text-price fw-bold @markedItem"> @price <small class="opacity-85 fst-normal">@Translate("excl. VAT") </small> </span> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product.Price.Price.ToString(); if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted != null ? product.VariantInfo.PriceMin.PriceFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted != null ? product.VariantInfo.PriceMax.PriceFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <span class="text-price fw-bold @markedItem"> @price <small class="opacity-85 fst-normal">@Translate("Incl. VAT")</small> </span> } @if (showPricesWithVat == "false" && !neverShowVat) { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceWithoutVatFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; <span itemprop="price" content="@product.Price.PriceWithoutVat" class="d-none"></span> if (product.Price.Price != product.PriceBeforeDiscount.Price) { <span class="text-decoration-line-through opacity-75 @order">@beforePrice</span> } } else { string beforePrice = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).PriceBeforeDiscount.PriceFormatted : product.PriceBeforeDiscount.PriceWithoutVatFormatted; <span itemprop="price" content="@product.Price.Price" class="d-none"></span> if (product.Price.Price != product.PriceBeforeDiscount.Price) { <span class="text-decoration-line-through opacity-75 @order" style="color: #a8a8a8"> <span class="text-price fw-bold">@beforePrice</span> </span> } } @* Stock state for Schema.org, start *@ @{ Uri url = Dynamicweb.Context.Current.Request.Url; } <link itemprop="url" href="@url"> @{ bool IsNeverOutOfStock = product.NeverOutOfstock; } @if (IsNeverOutOfStock) { <span itemprop="availability" class="d-none">@Translate("Available in stock")</span> } else { if (product.StockLevel > 0) { <span itemprop="availability" class="d-none">InStock</span> } else { <span itemprop="availability" class="d-none">OutOfStock</span> } } @* Stock state for Schema.org, stop *@ </div> @if (showPricesWithVat == "false" && !neverShowVat) { if (!Pageview.IsVisualEditorMode) { <small class="opacity-85 fst-normal js-text-price-with-vat d-none" data-suffix="@Translate("Incl. VAT")"></small> } else { string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; if (product?.VariantInfo?.VariantInfo != null) { priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; } if (priceMin != priceMax) { price = priceMin + " - " + priceMax; } <small class="opacity-85 fst-normal">@price @Translate("Incl. VAT")</small> } } </div> } else if (Pageview.IsVisualEditorMode) { <div class="alert alert-dark m-0" role="alert"> <span>@Translate("No products available")</span> </div> }