Product number:
PROD5282
Mini-Stecker
- Mouldpro
Error compiling template "Designs/Swift/Paragraph/Swift_ProductPrice.cshtml" Line 11: The using directive for 'Dynamicweb.Ecommerce.ProductCatalog' appeared previously in this namespace Line 75: 'User.GetCurrentExtranetUser()' is obsolete: 'Use UserContext.Current.User instead.' Line 149: A local variable or function named 'product' is already defined in this scope Line 165: A local variable or function named 'anonymousUsersLimitations' is already defined in this scope Line 166: A local variable or function named 'anonymousUser' is already defined in this scope Line 167: A local variable or function named 'isErpConnectionDown' is already defined in this scope Line 168: A local variable or function named 'hidePrice' is already defined in this scope Line 170: A local variable or function named 'productIsDiscontinued' is already defined in this scope Line 171: A local variable or function named 'doNotShowPriceIfProductIsDiscontinued' is already defined in this scope Line 172: A local variable or function named 'isDiscontinued' is already defined in this scope Line 205: 'User.GetCurrentExtranetUser()' is obsolete: 'Use UserContext.Current.User instead.' Line 129: The result of the expression is always 'true' since a value of type 'double' is never equal to 'null' of type 'double?' Line 259: The result of the expression is always 'true' since a value of type 'double' is never equal to 'null' of type 'double?' Line 84: The variable 'priceMin' is assigned but its value is never used Line 85: The variable 'priceMax' is assigned but its value is never used Line 149: The variable 'product' is assigned but its value is never used1 // <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.ProductCatalog; 12 internal class RazorEngine_f2927021975f420598d75fe1e1553114 : 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("\r\n"); 18 19 ProductViewModel product = null; 20 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 21 { 22 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 23 } 24 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 25 { 26 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 27 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 28 29 if (productList?.Products is object) 30 { 31 product = productList.Products[0]; 32 } 33 } 34 35 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 36 bool anonymousUser = Pageview.User == null; 37 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); 38 bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHidePrices") && isErpConnectionDown; 39 40 bool productIsDiscontinued = product is object && product.Discontinued; 41 bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); 42 var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; 43 WriteLiteral("\r\n"); 44 if (product is object && !hidePrice && !isDiscontinued) 45 { 46 bool showInformativePrice = Model.Item.GetBoolean("ShowInformativePrice"); 47 bool hideVatPrice = Model.Item.GetBoolean("HideVatPrice"); 48 string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : string.Empty; 49 50 string priceFontSize = Model.Item.GetRawValueString("PriceSize", "fs-2"); 51 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 52 string layout = Model.Item.GetRawValueString("Layout", "horizontal"); 53 string textAlign = horizontalAlign == "center" ? "text-center" : string.Empty; 54 textAlign = horizontalAlign == "end" ? "text-end" : textAlign; 55 56 horizontalAlign = horizontalAlign == "center" && layout == "horizontal" ? "justify-content-center" : horizontalAlign; 57 horizontalAlign = horizontalAlign == "end" && layout == "horizontal" ? "justify-content-end" : horizontalAlign; 58 horizontalAlign = horizontalAlign == "center" && layout == "vertical" ? "align-items-center" : horizontalAlign; 59 horizontalAlign = horizontalAlign == "end" && layout == "vertical" ? "align-items-end" : horizontalAlign; 60 61 string flexDirection = layout == "horizontal" ? string.Empty : "flex-column"; 62 string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; 63 string order = layout == "horizontal" ? string.Empty : "order-2"; 64 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 65 theme = GetViewParameter("theme") != null ? GetViewParameterString("theme") : theme; 66 67 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 68 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 69 contentPadding = contentPadding == "small" ? "p-1 px-md-2 py-md-1" : contentPadding; 70 contentPadding = contentPadding == "large" ? "p-2 px-md-3 py-md-2" : contentPadding; 71 72 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 73 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 74 75 if (Dynamicweb.Frontend.PageView.Current().Area.ReverseChargeForVat || Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser()?.ReverseChargeForVat == true) 76 { 77 if (showPricesWithVat == "false") 78 { 79 showPricesWithVat = ""; 80 neverShowVat = true; 81 } 82 } 83 84 string priceMin = ""; 85 string priceMax = ""; 86 87 string liveInfoClass = ""; 88 string productInfoFeed = ""; 89 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 90 double discountPercentage = 0; 91 92 93 if (product.ProductDiscounts?.Count() > 0) 94 { 95 96 foreach (var discount in product.ProductDiscounts) 97 { 98 discountPercentage = discountPercentage + discount.Percentage; 99 } 100101 } 102 if (isLazyLoadingForProductInfoEnabled) 103 { 104 if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) 105 { 106 productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); 107 if (!string.IsNullOrEmpty(productInfoFeed)) 108 { 109 productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; 110 } 111 } 112 liveInfoClass = "js-live-info"; 113 } 114115 WriteLiteral("\t<div"); 116 BeginWriteAttribute("class", " class=\"", 4841, "\"", 4912, 4); 117 WriteAttributeValue("", 4849, textAlign, 4849, 10, false); 118 WriteAttributeValue(" ", 4859, liveInfoClass, 4860, 14, false); 119 WriteAttributeValue(" ", 4874, "item_", 4875, 6, true); 120 WriteAttributeValue("", 4880, Model.Item.SystemName.ToLower(), 4880, 32, false); 121 EndWriteAttribute(); 122 WriteLiteral(" data-product-id=\""); 123 Write(product.Id); 124 WriteLiteral("\" data-variant-id=\""); 125 Write(product.VariantId); 126 WriteLiteral("\" "); 127 Write(productInfoFeed); 128 WriteLiteral(">\r\n"); 129 if (showInformativePrice && product.PriceInformative.Price != null && product.PriceInformative.Price != 0) 130 { 131 WriteLiteral("\t\t\t<div class=\"opacity-50\">\r\n\t\t\t\t<span>"); 132 Write(Translate("RRP")); 133 WriteLiteral(" </span>\r\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 134 Write(product.PriceInformative.PriceFormatted); 135 WriteLiteral("</span>\r\n\t\t\t</div>\r\n"); 136 } 137 WriteLiteral("\r\n\t\t</div>\r\n"); 138139140 } 141 else if (Pageview.IsVisualEditorMode) 142 { 143 WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\r\n\t\t<span>"); 144 Write(Translate("No products available")); 145 WriteLiteral("</span>\r\n\t</div>\r\n"); 146 } 147 WriteLiteral("\r\n"); 148149 ProductViewModel product = null; 150 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 151 { 152 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 153 } 154 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 155 { 156 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 157 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 158159 if (productList?.Products is object) 160 { 161 product = productList.Products[0]; 162 } 163 } 164165 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 166 bool anonymousUser = Pageview.User == null; 167 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); 168 bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHidePrices") && isErpConnectionDown; 169170 bool productIsDiscontinued = product is object && product.Discontinued; 171 bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); 172 var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; 173 WriteLiteral("\r\n"); 174 if (product is object && !hidePrice && !isDiscontinued) 175 { 176 bool showInformativePrice = Model.Item.GetBoolean("ShowInformativePrice"); 177 bool hideVatPrice = Model.Item.GetBoolean("HideVatPrice"); 178 string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : string.Empty; 179180 string priceFontSize = Model.Item.GetRawValueString("PriceSize", "fs-2"); 181 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 182 string layout = Model.Item.GetRawValueString("Layout", "horizontal"); 183 string textAlign = horizontalAlign == "center" ? "text-center" : string.Empty; 184 textAlign = horizontalAlign == "end" ? "text-end" : textAlign; 185186 horizontalAlign = horizontalAlign == "center" && layout == "horizontal" ? "justify-content-center" : horizontalAlign; 187 horizontalAlign = horizontalAlign == "end" && layout == "horizontal" ? "justify-content-end" : horizontalAlign; 188 horizontalAlign = horizontalAlign == "center" && layout == "vertical" ? "align-items-center" : horizontalAlign; 189 horizontalAlign = horizontalAlign == "end" && layout == "vertical" ? "align-items-end" : horizontalAlign; 190191 string flexDirection = layout == "horizontal" ? string.Empty : "flex-column"; 192 string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; 193 string order = layout == "horizontal" ? string.Empty : "order-2"; 194 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 195 theme = GetViewParameter("theme") != null ? GetViewParameterString("theme") : theme; 196197 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 198 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 199 contentPadding = contentPadding == "small" ? "p-1 px-md-2 py-md-1" : contentPadding; 200 contentPadding = contentPadding == "large" ? "p-2 px-md-3 py-md-2" : contentPadding; 201202 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 203 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 204205 if (Dynamicweb.Frontend.PageView.Current().Area.ReverseChargeForVat || Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser()?.ReverseChargeForVat == true) 206 { 207 if (showPricesWithVat == "false") 208 { 209 showPricesWithVat = ""; 210 neverShowVat = true; 211 } 212 } 213214 string priceMin = ""; 215 string priceMax = ""; 216217 string liveInfoClass = ""; 218 string productInfoFeed = ""; 219 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 220 double discountPercentage = 0; 221222223 if (product.ProductDiscounts?.Count() > 0) 224 { 225226 foreach (var discount in product.ProductDiscounts) 227 { 228 discountPercentage = discountPercentage + discount.Percentage; 229 } 230231 } 232 if (isLazyLoadingForProductInfoEnabled) 233 { 234 if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) 235 { 236 productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); 237 if (!string.IsNullOrEmpty(productInfoFeed)) 238 { 239 productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; 240 } 241 } 242 liveInfoClass = "js-live-info"; 243 } 244245 WriteLiteral("\t<div"); 246 BeginWriteAttribute("class", " class=\"", 10323, "\"", 10394, 4); 247 WriteAttributeValue("", 10331, textAlign, 10331, 10, false); 248 WriteAttributeValue(" ", 10341, liveInfoClass, 10342, 14, false); 249 WriteAttributeValue(" ", 10356, "item_", 10357, 6, true); 250 WriteAttributeValue("", 10362, Model.Item.SystemName.ToLower(), 10362, 32, false); 251 EndWriteAttribute(); 252 WriteLiteral(" data-product-id=\""); 253 Write(product.Id); 254 WriteLiteral("\" data-variant-id=\""); 255 Write(product.VariantId); 256 WriteLiteral("\" "); 257 Write(productInfoFeed); 258 WriteLiteral(">\r\n"); 259 if (showInformativePrice && product.PriceInformative.Price != null && product.PriceInformative.Price != 0) 260 { 261 WriteLiteral("\t\t\t<div class=\"opacity-50\">\r\n\t\t\t\t<span>"); 262 Write(Translate("RRP")); 263 WriteLiteral(" </span>\r\n\t\t\t\t<span class=\"text-decoration-line-through text-price\">"); 264 Write(product.PriceInformative.PriceFormatted); 265 WriteLiteral("</span>\r\n\t\t\t</div>\r\n"); 266 } 267 WriteLiteral("\r\n"); 268 if (showPricesWithVat == "false" && !neverShowVat) 269 { 270 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 271 { 272 if (!hideVatPrice) 273 { 274 WriteLiteral("\t\t\t\t\t<small class=\"opacity-85 fst-normal js-text-price-with-vat d-none\" data-suffix=\""); 275 Write(Translate("Incl. VAT")); 276 WriteLiteral("\"></small>\r\n"); 277 } 278 } 279 else 280 { 281 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; 282 var priceNotFormatted = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVat : product.Price.PriceWithVat; 283284 if (product?.VariantInfo?.VariantInfo != null) 285 { 286 priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; 287 priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; 288 } 289 if (priceMin != priceMax) 290 { 291 price = priceMin + " - " + priceMax; 292 } 293 else if (priceNotFormatted == 0) 294 { 295 price = priceMin; 296 } 297 if (discountPercentage > 0) 298 { 299300 double discountpriceMin = 0; 301 double discountpriceMax = 0; 302 string pricediscount = ""; 303 string currencySymbol = Dynamicweb.Ecommerce.Common.Context.Currency.Symbol; 304305 if (product?.VariantInfo?.VariantInfo != null) 306 { 307 discountpriceMin = product?.VariantInfo?.PriceMin?.PriceWithVat != null ? product.VariantInfo.PriceMin.PriceWithVat : 0; 308 discountpriceMax = product?.VariantInfo?.PriceMax?.PriceWithVat != null ? product.VariantInfo.PriceMax.PriceWithVat : 0; 309310 discountpriceMin = discountpriceMin - (discountpriceMin * discountPercentage / 100); 311 discountpriceMax = discountpriceMax - (discountpriceMax * discountPercentage / 100); 312313 } 314 if (discountpriceMin != discountpriceMax) 315 { 316 pricediscount = currencySymbol + discountpriceMin.ToString("F2") + " - " + currencySymbol + discountpriceMax.ToString("F2"); 317 } 318 else if (priceNotFormatted == 0) 319 { 320 pricediscount = currencySymbol + discountpriceMin.ToString("F2"); 321 } 322323 if (!hideVatPrice) 324 { 325 WriteLiteral("\t\t\t\t\t\t<div><small class=\"text-decoration-line-through opacity-85 fst-normal\">"); 326 Write(price); 327 WriteLiteral(" "); 328 Write(Translate("Incl. VAT")); 329 WriteLiteral("</small></div>\r\n\t\t\t\t\t\t<small class=\"opacity-85 fst-normal\">"); 330 Write(pricediscount); 331 WriteLiteral(" "); 332 Write(Translate("Incl. VAT")); 333 WriteLiteral("</small>\r\n"); 334 } 335336337 } 338 else 339 { 340 if (!hideVatPrice) 341 { 342 WriteLiteral("\t\t\t\t\t\t<small class=\"opacity-85 fst-normal\">"); 343 Write(price); 344 WriteLiteral(" "); 345 Write(Translate("Incl. VAT")); 346 WriteLiteral("</small>\r\n"); 347 } 348 } 349 } 350 } 351 WriteLiteral("\t</div>\r\n"); 352 } 353 else if (Pageview.IsVisualEditorMode) 354 { 355 WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\r\n\t\t<span>"); 356 Write(Translate("No products available")); 357 WriteLiteral("</span>\r\n\t</div>\r\n"); 358 } 359 } 360 #pragma warning restore 1998 361 } 362 } 363 #pragma warning restore 1591 3641 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 4 @{ 5 ProductViewModel product = null; 6 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 7 { 8 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 9 } 10 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 11 { 12 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 13 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 14 15 if (productList?.Products is object) 16 { 17 product = productList.Products[0]; 18 } 19 } 20 21 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 22 bool anonymousUser = Pageview.User == null; 23 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); 24 bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHidePrices") && isErpConnectionDown; 25 26 bool productIsDiscontinued = product is object && product.Discontinued; 27 bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); 28 var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; 29 } 30 31 @if (product is object && !hidePrice && !isDiscontinued) 32 { 33 bool showInformativePrice = Model.Item.GetBoolean("ShowInformativePrice"); 34 bool hideVatPrice = Model.Item.GetBoolean("HideVatPrice"); 35 string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : string.Empty; 36 37 string priceFontSize = Model.Item.GetRawValueString("PriceSize", "fs-2"); 38 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 39 string layout = Model.Item.GetRawValueString("Layout", "horizontal"); 40 string textAlign = horizontalAlign == "center" ? "text-center" : string.Empty; 41 textAlign = horizontalAlign == "end" ? "text-end" : textAlign; 42 43 horizontalAlign = horizontalAlign == "center" && layout == "horizontal" ? "justify-content-center" : horizontalAlign; 44 horizontalAlign = horizontalAlign == "end" && layout == "horizontal" ? "justify-content-end" : horizontalAlign; 45 horizontalAlign = horizontalAlign == "center" && layout == "vertical" ? "align-items-center" : horizontalAlign; 46 horizontalAlign = horizontalAlign == "end" && layout == "vertical" ? "align-items-end" : horizontalAlign; 47 48 string flexDirection = layout == "horizontal" ? string.Empty : "flex-column"; 49 string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; 50 string order = layout == "horizontal" ? string.Empty : "order-2"; 51 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 52 theme = GetViewParameter("theme") != null ? GetViewParameterString("theme") : theme; 53 54 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 55 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 56 contentPadding = contentPadding == "small" ? "p-1 px-md-2 py-md-1" : contentPadding; 57 contentPadding = contentPadding == "large" ? "p-2 px-md-3 py-md-2" : contentPadding; 58 59 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 60 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 61 62 if (Dynamicweb.Frontend.PageView.Current().Area.ReverseChargeForVat || Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser()?.ReverseChargeForVat == true) 63 { 64 if (showPricesWithVat == "false") 65 { 66 showPricesWithVat = ""; 67 neverShowVat = true; 68 } 69 } 70 71 string priceMin = ""; 72 string priceMax = ""; 73 74 string liveInfoClass = ""; 75 string productInfoFeed = ""; 76 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 77 double discountPercentage = 0; 78 79 80 if (product.ProductDiscounts?.Count() > 0) 81 { 82 83 foreach (var discount in product.ProductDiscounts) 84 { 85 discountPercentage = discountPercentage + discount.Percentage; 86 } 87 88 } 89 if (isLazyLoadingForProductInfoEnabled) 90 { 91 if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) 92 { 93 productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); 94 if (!string.IsNullOrEmpty(productInfoFeed)) 95 { 96 productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; 97 } 98 } 99 liveInfoClass = "js-live-info"; 100 } 101102 <div class="@textAlign @liveInfoClass item_@Model.Item.SystemName.ToLower()" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> 103 @if (showInformativePrice && product.PriceInformative.Price != null && product.PriceInformative.Price != 0) 104 { 105 <div class="opacity-50"> 106 <span>@Translate("RRP") </span> 107 <span class="text-decoration-line-through text-price">@product.PriceInformative.PriceFormatted</span> 108 </div> 109 } 110111 </div> 112113114 } 115 else if (Pageview.IsVisualEditorMode) 116 { 117 <div class="alert alert-dark m-0" role="alert"> 118 <span>@Translate("No products available")</span> 119 </div> 120 } 121 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 122 @using Dynamicweb.Ecommerce.ProductCatalog 123124 @{ 125 ProductViewModel product = null; 126 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 127 { 128 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 129 } 130 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 131 { 132 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 133 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 134135 if (productList?.Products is object) 136 { 137 product = productList.Products[0]; 138 } 139 } 140141 string anonymousUsersLimitations = Pageview.AreaSettings.GetRawValueString("AnonymousUsers", ""); 142 bool anonymousUser = Pageview.User == null; 143 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsWebServiceConnectionAvailable"]); 144 bool hidePrice = anonymousUsersLimitations.Contains("price") && anonymousUser || Pageview.AreaSettings.GetBoolean("ErpDownHidePrices") && isErpConnectionDown; 145146 bool productIsDiscontinued = product is object && product.Discontinued; 147 bool doNotShowPriceIfProductIsDiscontinued = Model.Item.GetBoolean("DoNotShowPriceIfProductIsDiscontinued"); 148 var isDiscontinued = productIsDiscontinued && doNotShowPriceIfProductIsDiscontinued; 149 } 150151 @if (product is object && !hidePrice && !isDiscontinued) 152 { 153 bool showInformativePrice = Model.Item.GetBoolean("ShowInformativePrice"); 154 bool hideVatPrice = Model.Item.GetBoolean("HideVatPrice"); 155 string unitId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.Form.Get("UnitId")) ? Dynamicweb.Context.Current.Request.Form.Get("UnitId") : string.Empty; 156157 string priceFontSize = Model.Item.GetRawValueString("PriceSize", "fs-2"); 158 string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", ""); 159 string layout = Model.Item.GetRawValueString("Layout", "horizontal"); 160 string textAlign = horizontalAlign == "center" ? "text-center" : string.Empty; 161 textAlign = horizontalAlign == "end" ? "text-end" : textAlign; 162163 horizontalAlign = horizontalAlign == "center" && layout == "horizontal" ? "justify-content-center" : horizontalAlign; 164 horizontalAlign = horizontalAlign == "end" && layout == "horizontal" ? "justify-content-end" : horizontalAlign; 165 horizontalAlign = horizontalAlign == "center" && layout == "vertical" ? "align-items-center" : horizontalAlign; 166 horizontalAlign = horizontalAlign == "end" && layout == "vertical" ? "align-items-end" : horizontalAlign; 167168 string flexDirection = layout == "horizontal" ? string.Empty : "flex-column"; 169 string flexGap = layout == "horizontal" ? "gap-3" : string.Empty; 170 string order = layout == "horizontal" ? string.Empty : "order-2"; 171 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 172 theme = GetViewParameter("theme") != null ? GetViewParameterString("theme") : theme; 173174 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 175 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 176 contentPadding = contentPadding == "small" ? "p-1 px-md-2 py-md-1" : contentPadding; 177 contentPadding = contentPadding == "large" ? "p-2 px-md-3 py-md-2" : contentPadding; 178179 string showPricesWithVat = Pageview.Area.EcomPricesWithVat.ToLower(); 180 bool neverShowVat = string.IsNullOrEmpty(showPricesWithVat); 181182 if (Dynamicweb.Frontend.PageView.Current().Area.ReverseChargeForVat || Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser()?.ReverseChargeForVat == true) 183 { 184 if (showPricesWithVat == "false") 185 { 186 showPricesWithVat = ""; 187 neverShowVat = true; 188 } 189 } 190191 string priceMin = ""; 192 string priceMax = ""; 193194 string liveInfoClass = ""; 195 string productInfoFeed = ""; 196 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 197 double discountPercentage = 0; 198199200 if (product.ProductDiscounts?.Count() > 0) 201 { 202203 foreach (var discount in product.ProductDiscounts) 204 { 205 discountPercentage = discountPercentage + discount.Percentage; 206 } 207208 } 209 if (isLazyLoadingForProductInfoEnabled) 210 { 211 if (Dynamicweb.Context.Current.Items.Contains("ProductInfoFeed")) 212 { 213 productInfoFeed = Dynamicweb.Context.Current.Items["ProductInfoFeed"]?.ToString(); 214 if (!string.IsNullOrEmpty(productInfoFeed)) 215 { 216 productInfoFeed = $"data-product-info-feed=\"{productInfoFeed}\""; 217 } 218 } 219 liveInfoClass = "js-live-info"; 220 } 221222 <div class="@textAlign @liveInfoClass item_@Model.Item.SystemName.ToLower()" data-product-id="@product.Id" data-variant-id="@product.VariantId" @productInfoFeed> 223 @if (showInformativePrice && product.PriceInformative.Price != null && product.PriceInformative.Price != 0) 224 { 225 <div class="opacity-50"> 226 <span>@Translate("RRP") </span> 227 <span class="text-decoration-line-through text-price">@product.PriceInformative.PriceFormatted</span> 228 </div> 229 } 230231 @if (showPricesWithVat == "false" && !neverShowVat) 232 { 233 if (isLazyLoadingForProductInfoEnabled && !Pageview.IsVisualEditorMode) 234 { 235 if (!hideVatPrice) 236 { 237 <small class="opacity-85 fst-normal js-text-price-with-vat d-none" data-suffix="@Translate("Incl. VAT")"></small> 238 } 239 } 240 else 241 { 242 string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVatFormatted : product.Price.PriceWithVatFormatted; 243 var priceNotFormatted = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceWithVat : product.Price.PriceWithVat; 244245 if (product?.VariantInfo?.VariantInfo != null) 246 { 247 priceMin = product?.VariantInfo?.PriceMin?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMin.PriceWithVatFormatted : ""; 248 priceMax = product?.VariantInfo?.PriceMax?.PriceWithVatFormatted != null ? product.VariantInfo.PriceMax.PriceWithVatFormatted : ""; 249 } 250 if (priceMin != priceMax) 251 { 252 price = priceMin + " - " + priceMax; 253 } 254 else if (priceNotFormatted == 0) 255 { 256 price = priceMin; 257 } 258 if (discountPercentage > 0) 259 { 260261 double discountpriceMin = 0; 262 double discountpriceMax = 0; 263 string pricediscount = ""; 264 string currencySymbol = Dynamicweb.Ecommerce.Common.Context.Currency.Symbol; 265266 if (product?.VariantInfo?.VariantInfo != null) 267 { 268 discountpriceMin = product?.VariantInfo?.PriceMin?.PriceWithVat != null ? product.VariantInfo.PriceMin.PriceWithVat : 0; 269 discountpriceMax = product?.VariantInfo?.PriceMax?.PriceWithVat != null ? product.VariantInfo.PriceMax.PriceWithVat : 0; 270271 discountpriceMin = discountpriceMin - (discountpriceMin * discountPercentage / 100); 272 discountpriceMax = discountpriceMax - (discountpriceMax * discountPercentage / 100); 273274 } 275 if (discountpriceMin != discountpriceMax) 276 { 277 pricediscount = currencySymbol + discountpriceMin.ToString("F2") + " - " + currencySymbol + discountpriceMax.ToString("F2"); 278 } 279 else if (priceNotFormatted == 0) 280 { 281 pricediscount = currencySymbol + discountpriceMin.ToString("F2"); 282 } 283284 if (!hideVatPrice) 285 { 286 <div><small class="text-decoration-line-through opacity-85 fst-normal">@price @Translate("Incl. VAT")</small></div> 287 <small class="opacity-85 fst-normal">@pricediscount @Translate("Incl. VAT")</small> 288 } 289290291 } 292 else 293 { 294 if (!hideVatPrice) 295 { 296 <small class="opacity-85 fst-normal">@price @Translate("Incl. VAT")</small> 297 } 298 } 299 } 300 } 301 </div> 302 } 303 else if (Pageview.IsVisualEditorMode) 304 { 305 <div class="alert alert-dark m-0" role="alert"> 306 <span>@Translate("No products available")</span> 307 </div> 308 } 309
Files
Images
3D Viewer
Specification
Material: Glasfaserverstärkter Hochtemperatur-Thermoplast, für Dauerbelastungen bis 200 °C ausgelegt.
• Einfacher und sicherer Kabelanschluss
• Polaritätskennzeichnung zur Vermeidung von Anschlussfehlern
• Kompatibel mit Kabeldurchmessern von 0,2 bis 2,0 mm
• Maximaler Kabeldurchmesser: 8 mm

