Skip to main content
Error executing template "Designs/Keflico/eCom/Product/Product.cshtml"
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at CompiledRazorTemplates.Dynamic.RazorEngine_dfc3d8f561a14d8695acd9221f3a75cf.Execute() in D:\dynamicweb.net\Solutions\keflico.live\Files\Templates\Designs\Keflico\eCom\Product\Product.cshtml:line 124
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @using System.Web; 2 @using System.Web.Helpers; 3 @using System.IO; 4 5 @using Dynamicweb.Rendering; 6 @using Dynamicweb.Ecommerce.ProductCatalog; 7 @using Dynamicweb.Ecommerce.Variants; 8 @using Dynamicweb.Core; 9 @using Dynamicweb.Ecommerce.CustomerExperienceCenter.Favorites 10 @using Keflico.Website.Custom 11 @using Dynamicweb.Ecommerce 12 @{ 13 System.Web.HttpCookie lastProductIdCookie = new System.Web.HttpCookie("LastProductIdCookie"); 14 lastProductIdCookie.Value = GetString("Ecom:Product.ID"); 15 lastProductIdCookie.Expires = DateTime.MinValue; 16 HttpContext.Current.Response.Cookies.Add(lastProductIdCookie); 17 18 var viewmodelSettings = new ProductViewModelSettings(Dynamicweb.Ecommerce.Common.Context.LanguageID, Dynamicweb.Ecommerce.Common.Context.Currency.Code, Dynamicweb.Ecommerce.Common.Context.Country.Code2, Pageview.Area.EcomShopId, Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUserId()); 19 var productViewmodel = Dynamicweb.Ecommerce.ProductCatalog.ViewModelFactory.CreateView(viewmodelSettings, GetString("Ecom:Product.ID"), GetString("Ecom:Product.VariantId"), ""); 20 var combination = new VariantCombination(GetString("Ecom:Product.ID")); 21 IList<VariantCombination> productVariants = new List<VariantCombination>(); 22 var singleVariant = new VariantCombination(); 23 24 if (combination != null && combination.Product != null) 25 { 26 productVariants = combination.Product.VariantCombinations; 27 } 28 29 if (productVariants.Count == 1) 30 { 31 singleVariant = productVariants.FirstOrDefault(); 32 } 33 34 35 string CartPage = Pageview.Area.Item["CartPage"].ToString(); 36 string cartCount = GetGlobalValue("Global:eCommerce.Order.OrderLines.TotalProductQuantity"); 37 38 if (string.IsNullOrWhiteSpace(cartCount)) { 39 cartCount = "0"; 40 } 41 42 string EcomPage = Pageview.Area.Item["EcomPage"].ToString(); 43 string VariantsLookup = "/" + Pageview.Area.Item["Variantslookup"].ToString(); 44 string BundleLookup = "/" + Pageview.Area.Item["Bundlelookup"].ToString(); 45 string PriceLookup = "/" + Pageview.Area.Item["Pricelookup"].ToString(); 46 string productNumber = GetString("Ecom:Product.Number"); 47 string dbNumber = GetString("Ecom:Product:Field.ProductDbNumber.Value"); 48 string productId = GetString("Ecom:Product.ID"); 49 string productName = GetString("Ecom:Product.Name"); 50 string productNameEncoded = HttpUtility.JavaScriptStringEncode(productName); 51 string primaryGroup = GetString("Ecom:Product.PrimaryGroupID").ToLower(); 52 string formAction = "/" + CartPage; 53 string priceCurrencySymbol = GetString("Ecom:Product.Currency.Symbol"); 54 string loopCounter = GetString("Ecom:Product.LoopCounter"); 55 string inputName = "Quantity" + loopCounter; 56 var categories = GetLoop("AssociatedGroups"); 57 var mainCategory = (LoopItem)null; 58 var productLayout = !string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductLayout")) ? GetString("Ecom:Product:Field.ProductLayout") : primaryGroup; 59 var materialGroupCode = GetString("Ecom:Product:Field.MaterialGroupCode"); 60 61 if (materialGroupCode == KeflicoProductExtensions.SampleMaterialGroupCode) 62 { 63 productLayout = KeflicoProductExtensions.SampleProductLayout; 64 } 65 66 67 var isSample = productLayout == KeflicoProductExtensions.SampleProductLayout; 68 var sampleLink = ""; 69 70 if (!isSample) 71 { 72 var sample = Services.ProductRelated.GetRelations(productId)?.FirstOrDefault(related => related.RelatedGroupId == "RELGRP3"); 73 sampleLink = sample == null ? "" : $"/{EcomPage}&ProductID={sample.RelatedProductId}"; 74 } 75 76 77 78 string labelCode = GetString("Ecom:Product:Field.ProductPurchaseCode"); 79 80 var breadcrumbs = new List<LoopItem>(); 81 82 bool useDifferentLengths = false; 83 84 foreach (var cat in categories) 85 { 86 if (cat.GetString("Ecom:Group.ID").ToLower() == primaryGroup) 87 { 88 mainCategory = cat; 89 } 90 } 91 92 93 if (mainCategory != null) 94 { 95 breadcrumbs.Add(mainCategory); 96 97 foreach (var child in mainCategory.GetLoop("Childgroups")) 98 { 99 foreach (var category in categories) 100 { 101 if (category.GetString("Ecom:Group.ID").ToLower() == child.GetString("Ecom:Group.ID").ToLower()) 102 { 103 breadcrumbs.Add(category); 104 useDifferentLengths = category.GetBoolean("Ecom:Group:Field.DiffLengths"); 105 } 106 } 107 } 108 } 109 110 bool enquireProduct = false; 111 bool canShowOrderForm = false; //#StockRetrieval - Assigned per-case below; used by the variant-stock JS swap. See other comment with tag #StockRetrieval 112 bool isSunDryProduct = System.Convert.ToBoolean(GetString("Ecom:Product:Field.ProductSundryItem")); 113 bool isBundleOnly = System.Convert.ToBoolean(GetString("Ecom:Product:Field.BundleOnly")); 114 115 var totalStock = GetDouble("Ecom:Product.Stock"); 116 totalStock += GetDouble("Ecom:Product:Field.StockSea.Value"); 117 118 int totalStockWareHouse = GetInteger("Ecom:Product.Stock"); 119 int totalStockSea = GetInteger("Ecom:Product:Field.StockSea.Value"); 120 121 if (primaryGroup != "group32" && !isSample) 122 { 123 totalStock += GetDouble("Ecom:Product:Field.ProductPieceOnPurchase.Value"); 124 totalStockSea += int.Parse(GetString("Ecom:Product:Field.ProductPieceOnPurchase.Value").Replace(",", string.Empty)); 125 } 126 127 int packageSize = Math.Max(1, GetInteger("Ecom:Product:Field.ProductNumberPerPackage")); 128 129 bool isSingleVariant = GetInteger("Ecom:Product.VariantCount") == 1 ? true : false; 130 131 double singleVariantStock = 0; 132 int singleVariantStockSea = 0; 133 134 if (isSingleVariant) 135 { 136 singleVariantStock = singleVariant.Product.UnitStock; 137 singleVariantStockSea = !String.IsNullOrWhiteSpace(singleVariant.Product.ProductFieldValues.GetProductFieldValue("ProductPieceOnPurchase").Value.ToString()) ? Convert.ToInt32(singleVariant.Product.ProductFieldValues.GetProductFieldValue("ProductPieceOnPurchase").Value.ToString().Replace(",", "")) : 0; 138 139 totalStock += singleVariantStock; 140 totalStock += singleVariantStockSea; 141 } 142 143 string halfParcelAmount = GetString("Ecom:Product:Field.ProductNumberPerHalfPackage.Value.Raw"); 144 string completeParcelAmount = GetString("Ecom:Product:Field.ProductNumberPerPackage"); 145 146 string standardPrice = GetString("Ecom:Product.Price.PriceWithoutVAT"); 147 string standardPriceJS = !string.IsNullOrWhiteSpace(GetString("Ecom:Product.Discount.Price.PriceWithoutVAT.Value")) ? GetString("Ecom:Product.Discount.Price.PriceWithoutVAT.Value").Replace(",", ".") : "0"; 148 bool hasAnbrud = standardPriceJS != "0"; 149 string halfPrice = !string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductPriceHalfParcel")) ? GetString("Ecom:Product:Field.ProductPriceHalfParcel").Replace(".", "-").Replace(",", ".").Replace("-", ",") : "0"; 150 string fullPrice = !string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductPriceCompleteParcel")) ? GetString("Ecom:Product:Field.ProductPriceCompleteParcel").Replace(".", "-").Replace(",", ".").Replace("-", ",") : "0"; 151 string bundlePrice = GetString("Ecom:Product:Field.ProductPriceBundle.Value").Replace(",", "-").Replace(".", ",").Replace("-", "."); 152 string bundlePriceJS = !string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductPriceBundle.Value")) ? GetString("Ecom:Product:Field.ProductPriceBundle.Value").Replace(",", "") : "0"; 153 string above100Price = !string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductPriceAbove100SQM")) ? GetString("Ecom:Product:Field.ProductPriceAbove100SQM") : "0"; 154 string above100PriceJS = !string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductPriceAbove100SQM.Value.Raw")) ? GetString("Ecom:Product:Field.ProductPriceAbove100SQM.Value.Raw").Replace(",", ".") : "0"; 155 string above3000Price = !string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductPriceAbove3000M.Value")) ? GetString("Ecom:Product:Field.ProductPriceAbove3000M.Value").Replace(".", ",") : "0"; 156 157 string salesUnit = GetString("Ecom:Product.DefaultUnitName").ToLower(); 158 string salesUnitCode = GetString("Ecom:Product:Field.ProductLengthUnitCode"); 159 160 string configuratorUrl = GetString("Ecom:Product:Field.ProductConfiguratorUrl"); 161 162 string fscLink = Pageview.Area.Item["FSC"].ToString(); 163 string pefcLink = Pageview.Area.Item["PEFC"].ToString(); 164 string ecoNordicLink = Pageview.Area.Item["EcoNordic"].ToString(); 165 string cradleToCradleLink = Pageview.Area.Item["CradleToCradle"].ToString(); 166 167 bool hasNewDownloads = false; 168 bool hasDownloads = false; 169 170 foreach (var fileCat in GetLoop("ImageCategories")) 171 { 172 173 if (fileCat.GetString("Category.SystemName").StartsWith("docView_") && fileCat.GetLoop("Category.Images").Count() > 0) 174 { 175 hasNewDownloads = true; 176 hasDownloads = false; 177 break; 178 } 179 else if (fileCat.GetString("Category.SystemName") != "Images" && fileCat.GetLoop("Category.Images").Count() > 0) 180 { 181 hasDownloads = true; 182 } 183 } 184 185 bool isloggedin = false; 186 187 if (!string.IsNullOrWhiteSpace(GetGlobalValue("Global:Extranet.UserName").ToString())) 188 { 189 isloggedin = true; 190 } 191 192 var isFavorite = false; 193 if (isloggedin) 194 { 195 var user = Dynamicweb.Security.UserManagement.User.GetCurrentFrontendUser(); 196 var favoriteList = user.GetFavoriteLists().FirstOrDefault(); 197 if (favoriteList != null) 198 { 199 var service = new FavoriteProductService(); 200 isFavorite = service.GetFavoriteProducts(favoriteList.ListId).Any(x => x.ProductId == productId); 201 } 202 203 } 204 205 206 207 208 209 if (GetString("Ecom:Product:Field.EcomProduct").Contains("forespoerg")) 210 { 211 enquireProduct = true; 212 } 213 214 if (isSunDryProduct) 215 { 216 enquireProduct = true; 217 } 218 219 if (labelCode.ToLower() == "skaffe" || labelCode.ToLower() == "relatordre") 220 { 221 enquireProduct = true; 222 } 223 224 var shouldRefreshFavorite = (isloggedin && !Dynamicweb.Security.UserManagement.User.GetCurrentFrontendUser().UserHasFavoriteList()).ToString().ToLower(); 225 226 // Function to replace Danish characters 227 Func<string, string> replaceDanishChars = (str) => { 228 if (string.IsNullOrEmpty(str)) return str; 229 return str 230 .Replace("æ", "ae") 231 .Replace("ø", "oe") 232 .Replace("å", "aa") 233 .Replace("Æ", "Ae") 234 .Replace("Ø", "Oe") 235 .Replace("Å", "Aa"); 236 }; 237 238 // Clean up the product name for use in a filename 239 var cleanProductName = replaceDanishChars(productName) 240 .Replace("[^\\w\\s-]", "") // Remove special characters (using .NET regex) 241 .Trim() // Remove leading and trailing spaces 242 .Replace("\\s+", "-") // Replace spaces with hyphens 243 .ToLower(); // Convert to lowercase 244 245 // Capitalize the first letter of cleanProductName 246 if (!string.IsNullOrEmpty(cleanProductName) && cleanProductName.Length > 0) 247 { 248 cleanProductName = char.ToUpper(cleanProductName[0]) + cleanProductName.Substring(1); 249 } 250 251 // Construct the filename with _Keflico at the end 252 var filename = $"{productId}_{cleanProductName}_Keflico.pdf"; 253 254 // Encode the filename for use in a URL 255 var encodedFilename = HttpUtility.UrlEncode(filename); 256 257 // Create the complete download URL 258 var downloadPdfUrl = $"/Default.aspx?ID=1243&ProductID={productId}&PDF=True&filename={encodedFilename}&topBottomMargin=10"; 259 260 261 } 262 263 264 @SnippetStart("PageTemplate") 265 product-page 266 @SnippetEnd("PageTemplate") 267 268 @{ 269 // --- schema.org JSON-LD: Product + BreadcrumbList (see schema-markup-plan.md) --- 270 // Area.Primarydomain is empty on this solution (verified live: og:url renders 271 // as "https:///"), so fall back to the request host to keep URLs absolute. 272 string schemaHost = (GetGlobalValue("Global:Area.Primarydomain") ?? "").ToString(); 273 if (string.IsNullOrWhiteSpace(schemaHost)) { schemaHost = (GetGlobalValue("Global:Request.Host") ?? "").ToString(); } 274 string schemaBaseUrl = GetGlobalValue("Global:Request.Scheme") + "://" + schemaHost; 275 // Percent-encode everything that is not legal in a URL: all non-ASCII (Danish 276 // æ/ø/å appear in ~half of the media paths) plus space and "#". Verified against 277 // live that the encoded form resolves identically; raw non-ASCII is rejected 278 // outright by strict HTTP clients. "%" is left alone so nothing double-encodes. 279 System.Func<string, string> schemaEncodeUrl = s => 280 { 281 if (string.IsNullOrEmpty(s)) { return s; } 282 var schemaSb = new System.Text.StringBuilder(); 283 foreach (byte b in System.Text.Encoding.UTF8.GetBytes(s)) 284 { 285 if (b > 127) { schemaSb.Append("%").Append(b.ToString("X2")); } 286 else if (b == 32) { schemaSb.Append("%20"); } 287 else if (b == 35) { schemaSb.Append("%23"); } 288 else { schemaSb.Append((char)b); } 289 } 290 return schemaSb.ToString(); 291 }; 292 System.Func<string, string> schemaAbs = u => 293 { 294 if (string.IsNullOrWhiteSpace(u)) { return null; } 295 if (u.StartsWith("http")) { return schemaEncodeUrl(u); } 296 // DW rewrites Default.aspx links into friendly URLs in rendered HTML, but NOT 297 // inside a JSON-LD script block - resolve them here so the markup uses the same 298 // canonical URLs the visible links do instead of 301-redirecting ones. 299 if (u.IndexOf(".aspx", System.StringComparison.OrdinalIgnoreCase) != -1) 300 { 301 u = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(u.TrimStart('/')); 302 } 303 u = schemaEncodeUrl(u); 304 return schemaBaseUrl + (u.StartsWith("/") ? u : "/" + u); 305 }; 306 System.Func<string, string> schemaStrip = html => 307 { 308 if (string.IsNullOrWhiteSpace(html)) { return null; } 309 var s = System.Text.RegularExpressions.Regex.Replace(html, "<[^>]*>", " "); 310 s = System.Web.HttpUtility.HtmlDecode(s); 311 s = System.Text.RegularExpressions.Regex.Replace(s, @"\s+", " ").Trim(); 312 if (s.Length == 0) { return null; } 313 return s.Length > 5000 ? s.Substring(0, 5000).TrimEnd() : s; 314 }; 315 System.Func<int, string, string, Dictionary<string, object>> schemaCrumb = (position, name, item) => 316 { 317 var crumb = new Dictionary<string, object> { { "@type", "ListItem" }, { "position", position } }; 318 if (!string.IsNullOrWhiteSpace(name)) { crumb["name"] = name.Trim(); } 319 if (!string.IsNullOrWhiteSpace(item)) { crumb["item"] = item; } 320 return crumb; 321 }; 322 323 // The PIM's "Images" file category also holds PDF datasheets (EPD, DOP, CARB), 324 // so filtering on the category alone is not enough - roughly half of what it 325 // returns is a document. schema:image must be an image, so check the extension. 326 // (The visible gallery renders those PDFs as broken <img> tags; that is a 327 // separate pre-existing issue and is deliberately left alone here.) 328 string[] schemaImageExts = new[] { ".jpg", ".jpeg", ".png", ".gif", ".webp", ".avif", ".bmp", ".tif", ".tiff" }; 329 System.Func<string, bool> schemaIsImage = u => 330 { 331 if (string.IsNullOrWhiteSpace(u)) { return false; } 332 string schemaProbe = u.ToLowerInvariant(); 333 int schemaQ = schemaProbe.IndexOf('?'); 334 string schemaPath = schemaQ == -1 ? schemaProbe : schemaProbe.Substring(0, schemaQ); 335 foreach (string ext in schemaImageExts) 336 { 337 if (schemaPath.EndsWith(ext)) { return true; } 338 } 339 // getimage.ashx?Image=/Files/foo.jpg&width=... carries the real file in the query 340 if (schemaQ != -1) 341 { 342 foreach (string ext in schemaImageExts) 343 { 344 if (schemaProbe.IndexOf(ext, schemaQ) != -1) { return true; } 345 } 346 } 347 return false; 348 }; 349 350 var schemaImages = new List<string>(); 351 string schemaMainImageRaw = GetString("Ecom:Product.ImageDefault.Clean"); 352 string schemaMainImage = schemaIsImage(schemaMainImageRaw) ? schemaAbs(schemaMainImageRaw) : null; 353 if (schemaMainImage != null) { schemaImages.Add(schemaMainImage); } 354 foreach (var schemaImgCat in GetLoop("ImageCategories")) 355 { 356 if (schemaImgCat.GetString("Category.SystemName") == "Images") 357 { 358 foreach (var schemaImg in schemaImgCat.GetLoop("Category.Images")) 359 { 360 string schemaImgRaw = schemaImg.GetString("Ecom:Product:Detail.Image.Clean"); 361 if (!schemaIsImage(schemaImgRaw)) { continue; } 362 string schemaImgUrl = schemaAbs(schemaImgRaw); 363 if (schemaImgUrl != null && !schemaImages.Contains(schemaImgUrl)) { schemaImages.Add(schemaImgUrl); } 364 } 365 } 366 } 367 368 string schemaDescription = schemaStrip(GetString("Ecom:Product.LongDescription") + " " + GetString("Ecom:Product:Field.ProductDescriptionShortLongText.Value")); 369 370 var productSchema = new Dictionary<string, object> 371 { 372 { "@context", "https://schema.org" }, 373 { "@type", "Product" }, 374 { "name", productName }, 375 { "sku", productNumber } 376 // No "offers": prices are shown only to logged-in users, so per Google's 377 // "structured data must match visible content" rule we omit them. If prices 378 // become public, add offers { price, priceCurrency, availability }. There is 379 // no brand/gtin tag on the product server-side to add today. 380 }; 381 if (schemaDescription != null) { productSchema["description"] = schemaDescription; } 382 if (schemaImages.Count > 0) { productSchema["image"] = schemaImages; } 383 string schemaCanonicalPath = Pageview.SearchFriendlyUrl; 384 // Strip any query string (utm_*, cache-busters) so the markup matches the canonical. 385 if (schemaCanonicalPath.IndexOf("?") != -1) { schemaCanonicalPath = schemaCanonicalPath.Substring(0, schemaCanonicalPath.IndexOf("?")); } 386 string schemaUrl = schemaAbs(schemaCanonicalPath); 387 if (schemaUrl != null) { productSchema["url"] = schemaUrl; } 388 if (breadcrumbs.Count > 0) { productSchema["category"] = string.Join(" / ", breadcrumbs.Select(g => g.GetString("Ecom:Group.Name"))); } 389 if (!string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.Name2"))) { productSchema["size"] = GetString("Ecom:Product:Field.Name2").Trim(); } 390 391 var schemaCrumbItems = new List<object>(); 392 int schemaCrumbPos = 1; 393 schemaCrumbItems.Add(schemaCrumb(schemaCrumbPos++, Translate("Translate_Breadcrumb_Products"), schemaAbs(EcomPage))); 394 foreach (var schemaGroup in breadcrumbs) 395 { 396 string schemaGroupUrl = schemaAbs(schemaGroup.GetString("Ecom:Group.Link.Clean")); 397 if (schemaGroupUrl == null) { continue; } // never emit a non-last crumb without an item URL (invalid BreadcrumbList) 398 schemaCrumbItems.Add(schemaCrumb(schemaCrumbPos++, schemaGroup.GetString("Ecom:Group.Name"), schemaGroupUrl)); 399 } 400 schemaCrumbItems.Add(schemaCrumb(schemaCrumbPos, productName, null)); 401 var breadcrumbSchema = new Dictionary<string, object> 402 { 403 { "@context", "https://schema.org" }, 404 { "@type", "BreadcrumbList" }, 405 { "itemListElement", schemaCrumbItems } 406 }; 407 408 var productSchemaSettings = new Newtonsoft.Json.JsonSerializerSettings { StringEscapeHandling = Newtonsoft.Json.StringEscapeHandling.EscapeHtml, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore }; 409 } 410 <article class="module module-sand product-details"> 411 <div class="breadcrumbs"> 412 <ul class="breadcrumbs__list"> 413 <li class="breadcrumbs__item"> 414 <a href="@EcomPage">@Translate("Translate_Breadcrumb_Products")</a> 415 </li> 416 417 @if (breadcrumbs.Count > 0) 418 { 419 foreach (var group in breadcrumbs) 420 { 421 <li class="breadcrumbs__item"> 422 <a href="@group.GetString("Ecom:Group.Link.Clean")">@group.GetString("Ecom:Group.Name")</a> 423 </li> 424 } 425 } 426 <li class="breadcrumbs__item active">@productName</li> 427 </ul> 428 </div> 429 <div class="product-details__container"> 430 @switch (labelCode.ToLower()) 431 { 432 case "skaffe": 433 case "relatordre": 434 <div class="product-details__label-code label-code">@Translate("LabelCode_" + labelCode.ToLower())</div> 435 break; 436 default: 437 break; 438 } 439 440 441 @if (isSample) 442 { 443 <div class="product-details__label-code label-code label-code--samples">@Translate("LabelCode_proeve")</div> 444 } 445 446 <div class="product-details__media" data-igo-gallery> 447 @if (!String.IsNullOrWhiteSpace(GetString("Ecom:Product.ImageDefault.Clean"))) 448 { 449 <picture class="product-details__image-wrap" data-igo-image="@GetString("Ecom:Product.ImageDefault.Clean")"> 450 <img src="@GetString("Ecom:Product.ImageDefault.Clean")" alt="@productName" loading="lazy"> 451 </picture> 452 } 453 @foreach (var category in GetLoop("ImageCategories")) 454 { 455 if (category.GetString("Category.SystemName") == "Images") 456 { 457 foreach (var image in category.GetLoop("Category.Images")) 458 { 459 <picture class="product-details__image-wrap" data-igo-image="@image.GetString("Ecom:Product:Detail.Image.Clean")"> 460 <img src="@image.GetString("Ecom:Product:Detail.Image.Clean")" alt="@productName" loading="lazy"> 461 </picture> 462 } 463 } 464 } 465 <div class="product-details__media-steps"> 466 <span class="disclaimer">* @Translate("Translate_Product_Page_ImageDisclaimer")</span> 467 <span class="current">1/1</span> 468 </div> 469 </div> 470 <div class="product-details__info"> 471 <div class="product-details__info-labels"> 472 <div class="product-details__info-labels-icons"> 473 @if (!String.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductCertification")) && GetString("Ecom:Product:Field.ProductCertification") != "-1") 474 { 475 string certification = GetString("Ecom:Product:Field.ProductCertification").ToLower(); 476 if (certification.Contains("pefc")) 477 { 478 <a href="@pefcLink" target="_blank"> 479 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/pefc-logo.svg"))) 480 { 481 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/pefc-logo.svg")) 482 } 483 </a> 484 } 485 else if (certification.Contains("fsc")) 486 { 487 <a href="@fscLink" target="_blank"> 488 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/fsc-logo.svg"))) 489 { 490 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/fsc-logo.svg")) 491 } 492 </a> 493 } 494 } 495 @if (!String.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductNordicEcoLabel")) && GetString("Ecom:Product:Field.ProductNordicEcoLabel") != "-1") 496 { 497 <a href="@ecoNordicLink" target="_blank"> 498 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/svanemaerket-logo.svg"))) 499 { 500 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/svanemaerket-logo.svg")) 501 } 502 </a> 503 } 504 @if (!String.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductCradleToCradle.Value")) && GetString("Ecom:Product:Field.ProductCradleToCradle.Value") != "-1" && GetString("Ecom:Product:Field.ProductCradleToCradle.Value") != "N/A") 505 { 506 <a href="@cradleToCradleLink" target="_blank"> 507 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/cradle-logo.svg"))) 508 { 509 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/cradle-logo.svg")) 510 } 511 </a> 512 } 513 </div> 514 @if (isloggedin) 515 { 516 <button id="favoriteAdd" style="@(isFavorite ? "display:none" : "")" class="product-details__info-favorite" onclick="favoriteAdd()"> 517 <svg id="Lag_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"> 518 <!-- Generator: Adobe Illustrator 29.5.0, SVG Export Plug-In . SVG Version: 2.1.0 Build 137) --> 519 <path fill="#696969" d="M50,92.9c-.2,0-.5,0-.6-.3L10,53.2c-4.9-4.9-7.5-11.3-7.5-18.2s2.7-13.4,7.5-18.2c4.9-4.9,11.3-7.5,18.2-7.5s13.4,2.7,18.2,7.5l3.5,3.5,3.5-3.5c4.9-4.9,11.3-7.5,18.2-7.5s13.4,2.7,18.2,7.5c4.9,4.9,7.5,11.3,7.5,18.2s-2.7,13.4-7.5,18.2l-39.4,39.4c-.2.2-.4.3-.6.3ZM50.1,90.8l38.8-38.8c4.5-4.5,7-10.6,7-17s-2.5-12.5-7-17c-4.5-4.5-10.6-7-17-7s-12.5,2.5-17,7l-4.2,4.2c-.2.2-.4.3-.6.3s-.5,0-.6-.3l-4.2-4.2c-4.5-4.5-10.6-7-17-7s-12.5,2.5-17,7c-4.5,4.5-7,10.6-7,17s2.5,12.5,7,17l.4.4,38.4,38.4Z" /> 520 </svg> 521 </button> 522 <button id="favoriteRemove" style="@(isFavorite ? "" : "display:none")" class="product-details__info-favorite" onclick="favoriteRemove()"> 523 <svg id="Lag_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"> 524 <!-- Generator: Adobe Illustrator 29.5.0, SVG Export Plug-In . SVG Version: 2.1.0 Build 137) --> 525 <path fill="#964B00" d="M50,92.9c-.2,0-.5,0-.6-.3L10,53.2c-4.9-4.9-7.5-11.3-7.5-18.2s2.7-13.4,7.5-18.2c4.9-4.9,11.3-7.5,18.2-7.5s13.4,2.7,18.2,7.5l3.5,3.5,3.5-3.5c4.9-4.9,11.3-7.5,18.2-7.5s13.4,2.7,18.2,7.5c4.9,4.9,7.5,11.3,7.5,18.2s-2.7,13.4-7.5,18.2l-39.4,39.4c-.2.2-.4.3-.6.3Z" /> 526 </svg> 527 </button> 528 } 529 530 </div> 531 <div class="product-details__info-meta"> 532 <ul class="product-details__info-meta-list"> 533 <li id="productNumber">@Translate("Translate_Product_Page_ProductNumber"): @productNumber</li> 534 @if (!string.IsNullOrWhiteSpace(dbNumber)) 535 { 536 <li>@GetString("Ecom:Product:Field.ProductDbNumber.Name"): @dbNumber</li> 537 } 538 </ul> 539 </div> 540 <h1 id="productName" class="product-details__info-title">@productName</h1> 541 <div class="product-details__info-size">@GetString("Ecom:Product:Field.Name2")</div> 542 543 @switch (productLayout) 544 { 545 case "group1": // Hårdtræ 546 if (isloggedin) 547 { 548 if ((standardPriceJS != "0") || bundlePriceJS != "0") 549 { 550 <div class="product-details__info-price-container"> 551 <div class="product-details__info-price-heading"> 552 @Translate("Translate_ProductPage_PriceDefinition_HardWood") 553 <span class="tooltip"> 554 <span class="tooltip__icon"> 555 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 556 { 557 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 558 } 559 </span> 560 <span class="tooltip__text tooltip__text--top"> 561 @Translate("Translate_ProductPage_PriceDefinition_HardWood_Tooltip") 562 </span> 563 </span> 564 </div> 565 @if (standardPriceJS != "0") 566 { 567 <div class="product-details__info-price-option"> 568 @if(salesUnit == "m³") { 569 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_SalesUnit_m3_Under")</div> 570 } else if(salesUnit == "kbf") { 571 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_SalesUnit_kbf_Under")</div> 572 } else { 573 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_Breakup")</div> 574 } 575 576 <div class="product-details__info-price-option-price">@standardPrice @priceCurrencySymbol pr. @salesUnit</div> 577 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 578 </div> 579 } 580 @if (bundlePriceJS != "0") 581 { 582 if (bundlePrice.Contains(",")) 583 { 584 string[] sp = bundlePrice.Split(','); 585 586 if (sp[1].Length == 1) 587 { 588 bundlePrice += "0"; 589 } 590 } 591 else 592 { 593 bundlePrice += ",00"; 594 } 595 596 <div class="product-details__info-price-option"> 597 @if(salesUnit == "m³") { 598 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_SalesUnit_m3_Over")</div> 599 } else if(salesUnit == "kbf") { 600 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_SalesUnit_kbf_Over")</div> 601 } else { 602 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_Bundle")</div> 603 } 604 605 <div class="product-details__info-price-option-price">@bundlePrice @priceCurrencySymbol pr. @salesUnit</div> 606 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 607 </div> 608 } 609 </div> 610 } 611 } 612 613 if (standardPriceJS == "0" && bundlePriceJS == "0") 614 { 615 enquireProduct = true; 616 } 617 618 <div id="product-order-button" style="min-height: 64px;"> 619 @if (enquireProduct) 620 { 621 <a data-action="open-content" data-target="#enquireForm" class="product-details__info-button btn btn--block btn-secondary product-order-form-button">@Translate("Translate_Product_Page_EnquireButton")</a> 622 } 623 else 624 { 625 <div style="display: none;" class="loader"></div> 626 <a style="display: none;" href="#" class="product-details__info-button btn btn--block btn-secondary product-order-button">@Translate("Translate_Product_Page_OrderButton")</a> 627 <a style="display: none;" data-action="open-content" data-target="#enquireForm" class="product-details__info-button btn btn--block btn-secondary product-order-form-button">@Translate("Translate_Product_Page_EnquireButton")</a> 628 } 629 </div> 630 631 break; 632 633 case "group32": // Terrasse 634 635 if (isloggedin) 636 { 637 if (standardPriceJS != "0" || above100PriceJS != "0") 638 { 639 <div class="product-details__info-price-container"> 640 <div class="product-details__info-price-heading"> 641 @Translate("Translate_ProductPage_PriceDefinition_Terrasse") 642 643 @if (primaryGroup == "group32") 644 { 645 <span class="tooltip"> 646 <span class="tooltip__icon"> 647 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 648 { 649 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 650 } 651 </span> 652 <span class="tooltip__text tooltip__text--top"> 653 @Translate("Translate_ProductPage_PriceDefinition_Terrasse_Tooltip") 654 </span> 655 </span> 656 } 657 else 658 { 659 <span class="tooltip"> 660 <span class="tooltip__icon"> 661 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 662 { 663 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 664 } 665 </span> 666 <span class="tooltip__text tooltip__text--top"> 667 @Translate("Translate_ProductPage_PriceDefinition_Facade_Tooltip") 668 </span> 669 </span> 670 } 671 </div> 672 673 @if (standardPriceJS != "0") 674 { 675 <div class="product-details__info-price-option"> 676 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_Under100")</div> 677 <div class="product-details__info-price-option-price">@standardPrice @priceCurrencySymbol pr. @salesUnit</div> 678 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 679 </div> 680 } 681 682 @if (above100PriceJS != "0") 683 { 684 if (above100Price.Contains(",")) 685 { 686 string[] sp = above100Price.Split(','); 687 688 if (sp[1].Length == 1) 689 { 690 above100Price += "0"; 691 } 692 } 693 else 694 { 695 above100Price += ",00"; 696 } 697 698 <div class="product-details__info-price-option"> 699 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_Above100")</div> 700 <div class="product-details__info-price-option-price">@above100Price @priceCurrencySymbol pr. @salesUnit</div> 701 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 702 </div> 703 } 704 </div> 705 } 706 } 707 708 if (standardPriceJS == "0" && above100PriceJS == "0") 709 { 710 enquireProduct = true; 711 } 712 713 <div id="product-order-button" style="min-height: 64px;"> 714 @if (enquireProduct) 715 { 716 <a data-action="open-content" data-target="#enquireForm" class="product-details__info-button btn btn--block btn-secondary product-order-form-button">@Translate("Translate_Product_Page_EnquireButton")</a> 717 } 718 else 719 { 720 <div style="display: none;" class="loader"></div> 721 <a style="display: none;" href="#" class="product-details__info-button btn btn--block btn-secondary product-order-button">@Translate("Translate_Product_Page_OrderButton")</a> 722 <a style="display: none;" data-action="open-content" data-target="#enquireForm" class="product-details__info-button btn btn--block btn-secondary product-order-form-button">@Translate("Translate_Product_Page_EnquireButton")</a> 723 } 724 </div> 725 726 break; 727 728 case "group73": // Facadebeklædning 729 if (isloggedin) 730 { 731 if (standardPriceJS != "0" || above100PriceJS != "0" || above3000Price != "0") 732 { 733 <div class="product-details__info-price-container"> 734 <div class="product-details__info-price-heading"> 735 @Translate("Translate_ProductPage_PriceDefinition_Terrasse") 736 737 @if (primaryGroup == "group32") 738 { 739 <span class="tooltip"> 740 <span class="tooltip__icon"> 741 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 742 { 743 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 744 } 745 </span> 746 <span class="tooltip__text tooltip__text--top"> 747 @Translate("Translate_ProductPage_PriceDefinition_Terrasse_Tooltip") 748 </span> 749 </span> 750 } 751 else 752 { 753 <span class="tooltip"> 754 <span class="tooltip__icon"> 755 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 756 { 757 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 758 } 759 </span> 760 <span class="tooltip__text tooltip__text--top"> 761 @Translate("Translate_ProductPage_PriceDefinition_Facade_Tooltip") 762 </span> 763 </span> 764 } 765 </div> 766 767 @if (standardPriceJS != "0") 768 { 769 <div class="product-details__info-price-option"> 770 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_Under1000")</div> 771 <div class="product-details__info-price-option-price">@standardPrice @priceCurrencySymbol pr. @salesUnit</div> 772 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 773 </div> 774 } 775 776 @if (above100PriceJS != "0") 777 { 778 if (above100Price.Contains(",")) 779 { 780 string[] sp = above100Price.Split(','); 781 782 if (sp[1].Length == 1) 783 { 784 above100Price += "0"; 785 } 786 } 787 else 788 { 789 above100Price += ",00"; 790 } 791 792 <div class="product-details__info-price-option"> 793 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_Between1000and3000")</div> 794 <div class="product-details__info-price-option-price">@above100Price @priceCurrencySymbol pr. @salesUnit</div> 795 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 796 </div> 797 } 798 799 @if (above3000Price != "0") 800 { 801 if (above3000Price.Contains(",")) 802 { 803 string[] tp = above3000Price.Split(','); 804 805 if (tp[1].Length == 1) 806 { 807 above3000Price += "0"; 808 } 809 } 810 else 811 { 812 above3000Price += ",00"; 813 } 814 815 <div class="product-details__info-price-option"> 816 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_Above3000")</div> 817 <div class="product-details__info-price-option-price">@above3000Price @priceCurrencySymbol pr. @salesUnit</div> 818 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 819 </div> 820 } 821 </div> 822 } 823 } 824 825 if (standardPriceJS == "0" && above100PriceJS == "0" && above3000Price == "0") 826 { 827 enquireProduct = true; 828 } 829 830 <div id="product-order-button" style="min-height: 64px;"> 831 @if (enquireProduct) 832 { 833 <a data-action="open-content" data-target="#enquireForm" class="product-details__info-button btn btn--block btn-secondary product-order-form-button">@Translate("Translate_Product_Page_EnquireButton")</a> 834 } 835 else 836 { 837 <div style="display: none;" class="loader"></div> 838 <a style="display: none;" href="#" class="product-details__info-button btn btn--block btn-secondary product-order-button">@Translate("Translate_Product_Page_OrderButton")</a> 839 <a style="display: none;" data-action="open-content" data-target="#enquireForm" class="product-details__info-button btn btn--block btn-secondary product-order-form-button">@Translate("Translate_Product_Page_EnquireButton")</a> 840 } 841 </div> 842 843 break; 844 845 case "group52": // Plader 846 case "group66": // Dekorative Overflader 847 848 if (isloggedin) 849 { 850 if (standardPriceJS != "0" || halfPrice != "0" || fullPrice != "0") 851 { 852 <div class="product-details__info-price-container"> 853 <div class="product-details__info-price-heading"> 854 @Translate("Translate_ProductPage_PriceDefinition_Plader") 855 @if (primaryGroup == "group52") 856 { 857 <span class="tooltip"> 858 <span class="tooltip__icon"> 859 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 860 { 861 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 862 } 863 </span> 864 <span class="tooltip__text tooltip__text--top"> 865 @Translate("Translate_ProductPage_PriceDefinition_Plader_Tooltip") 866 </span> 867 </span> 868 } 869 else 870 { 871 <span class="tooltip"> 872 <span class="tooltip__icon"> 873 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 874 { 875 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 876 } 877 </span> 878 <span class="tooltip__text tooltip__text--top"> 879 @Translate("Translate_ProductPage_PriceDefinition_Overflader_Tooltip") 880 </span> 881 </span> 882 } 883 </div> 884 885 @if (standardPriceJS != "0") 886 { 887 <div class="product-details__info-price-option"> 888 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_PriceUnit_Anbrud")</div> 889 <div class="product-details__info-price-option-price">@standardPrice @priceCurrencySymbol pr. @salesUnit</div> 890 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 891 </div> 892 } 893 894 @if (halfPrice != "0") 895 { 896 if (halfPrice.Contains(",")) 897 { 898 string[] sp = halfPrice.Split(','); 899 900 if (sp[1].Length == 1) 901 { 902 halfPrice += "0"; 903 } 904 } 905 else 906 { 907 halfPrice += ",00"; 908 } 909 910 <div class="product-details__info-price-option"> 911 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_PriceUnit_HalfParcel") (@halfParcelAmount @Translate("Translate_Ecom_Piece"))</div> 912 <div class="product-details__info-price-option-price">@halfPrice @priceCurrencySymbol pr. @salesUnit</div> 913 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 914 </div> 915 } 916 917 @if (fullPrice != "0") 918 { 919 if (fullPrice.Contains(",")) 920 { 921 string[] sp = fullPrice.Split(','); 922 923 if (sp[1].Length == 1) 924 { 925 fullPrice += "0"; 926 } 927 } 928 else 929 { 930 fullPrice += ",00"; 931 } 932 933 <div class="product-details__info-price-option"> 934 <div class="product-details__info-price-option-title">@Translate("Translate_ProductPage_PriceUnit_CompleteParcel") (@completeParcelAmount @Translate("Translate_Ecom_Piece"))</div> 935 <div class="product-details__info-price-option-price">@fullPrice @priceCurrencySymbol pr. @salesUnit</div> 936 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 937 </div> 938 } 939 </div> 940 } 941 } 942 943 <div class="product-details__info-quantity"> 944 @{ 945 if (standardPriceJS == "0" && halfPrice == "0" && fullPrice == "0") 946 { 947 enquireProduct = true; 948 } 949 canShowOrderForm = isloggedin && !enquireProduct; 950 } 951 @*#StockRetrieval - Render the order form whenever it would normally be available, even if main-product stock is 0, so the variant-stock JS can reveal it when variants have stock. See other comment with tag #StockRetrieval *@ 952 @if (canShowOrderForm) 953 { 954 <form class="form js-product-order-form-stock-toggle" action="@(formAction)&Redirect=@(CartPage)" method="post" name="@productId" id="@productId" style="@(totalStock > 0 ? "" : "display: none;")"> 955 <input type="hidden" name="CartCmd" value="addMulti" /> 956 957 @if (isSingleVariant) 958 { 959 <input type="hidden" name="ProductLoopCounter@(loopCounter)" id="ProductLoopCounter@(loopCounter)" value="@loopCounter"> 960 <input type="hidden" name="ProductID@(loopCounter)" id="ProductID@(loopCounter)" value="@productId"> 961 <input type="hidden" name="VariantID@(loopCounter)" id="VariantID@(loopCounter)" value="@singleVariant.VariantId"> 962 } 963 else 964 { 965 @GetString("Ecom:Product.Form.Multi.HiddenFields") 966 } 967 968 @{ 969 int initialQuantity = packageSize; 970 if (standardPriceJS != "0") // hasAnbrud - allow starting from 1 971 { 972 initialQuantity = 1; 973 } 974 else if (halfPrice != "0" && !string.IsNullOrWhiteSpace(halfParcelAmount) && int.Parse(halfParcelAmount) > 0) // hasHalfParcel 975 { 976 initialQuantity = int.Parse(halfParcelAmount); 977 } 978 } 979 980 <div class="counter"> 981 <a class="substract">-</a> 982 983 <input name="@inputName" id="Quantity" class="amount" type="tel" value="@initialQuantity" package-size="@packageSize" data-half-parcel="@halfParcelAmount" data-has-anbrud="@(standardPriceJS != "0" ? "true" : "false")" data-has-half-parcel="@(halfPrice != "0" ? "true" : "false")"> 984 <label for="Quanity" class="unit">@Translate("Translate_Piece_Short")</label> 985 <a class="add">+</a> 986 </div> 987 <button type="submit" id="product-order-button" class="product-details__info-button btn btn--block btn-secondary">Bestil</button> 988 </form> 989 } 990 @*#StockRetrieval - Only tag the request button for the variant-stock JS swap when an order form is actually rendered (logged-in). For logged-out users no order form exists, so the request button must always remain visible. See other comment with tag #StockRetrieval *@ 991 @if (totalStock <= 0 || !canShowOrderForm) 992 { 993 <a href="#product-inquire-form" id="product-order-button" data-action="open-content" data-target="#enquireForm" class="product-details__info-button btn btn--block btn-secondary @(canShowOrderForm ? "js-enquire-button-stock-toggle" : "")">@Translate("Translate_Product_Page_EnquireButton")</a> 994 } 995 </div> 996 997 break; 998 999 case "group126": // Tilbehør 1000 1001 if (isloggedin) 1002 { 1003 if (standardPriceJS != "0") 1004 { 1005 <div class="product-details__info-price-container"> 1006 <div class="product-details__info-price-heading"> 1007 @Translate("Translate_ProductPage_PriceDefinition_Andet") 1008 <span class="tooltip"> 1009 <span class="tooltip__icon"> 1010 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 1011 { 1012 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 1013 } 1014 </span> 1015 <span class="tooltip__text tooltip__text--top"> 1016 @Translate("Translate_ProductPage_PriceDefinition_Andet_Tooltip") 1017 </span> 1018 </span> 1019 </div> 1020 <div class="product-details__info-price-option"> 1021 <div class="product-details__info-price-option-price">@standardPrice @priceCurrencySymbol pr. @salesUnit</div> 1022 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 1023 </div> 1024 </div> 1025 } 1026 } 1027 1028 <div class="product-details__info-quantity"> 1029 @{ 1030 if (standardPriceJS == "0") 1031 { 1032 enquireProduct = true; 1033 } 1034 canShowOrderForm = isloggedin && !enquireProduct; 1035 } 1036 @*#StockRetrieval - Render the order form whenever it would normally be available, even if main-product stock is 0, so the variant-stock JS can reveal it when variants have stock. See other comment with tag #StockRetrieval *@ 1037 @if (canShowOrderForm) 1038 { 1039 <form class="form js-product-order-form-stock-toggle" action="@(formAction)&Redirect=@(CartPage)" method="post" name="@productId" id="@productId" style="@(totalStock > 0 ? "" : "display: none;")"> 1040 <input type="hidden" name="CartCmd" value="addMulti" /> 1041 @GetString("Ecom:Product.Form.Multi.HiddenFields") 1042 <div class="counter"> 1043 <a class="substract">-</a> 1044 <input name="@inputName" id="Quantity" class="amount" type="tel" value="1"> 1045 <label for="Quanity" class="unit">@Translate("Translate_Piece_Short")</label> 1046 <a class="add">+</a> 1047 </div> 1048 <button type="submit" id="product-order-button" class="product-details__info-button btn btn--block btn-secondary">Bestil</button> 1049 </form> 1050 } 1051 @*#StockRetrieval - Only tag the request button for the variant-stock JS swap when an order form is actually rendered (logged-in). For logged-out users no order form exists, so the request button must always remain visible. See other comment with tag #StockRetrieval *@ 1052 @if (totalStock <= 0 || !canShowOrderForm) 1053 { 1054 <a href="#product-inquire-form" id="product-order-button" data-action="open-content" data-target="#enquireForm" class="product-details__info-button btn btn--block btn-secondary @(canShowOrderForm ? "js-enquire-button-stock-toggle" : "")">@Translate("Translate_Product_Page_EnquireButton")</a> 1055 } 1056 </div> 1057 break; 1058 case KeflicoProductExtensions.SampleProductLayout: 1059 <div class="product-details__info-price-container"> 1060 <div class="product-details__info-price-heading"> 1061 @Translate("Translate_ProductPage_PriceDefinition_Samples") 1062 <span class="tooltip"> 1063 <span class="tooltip__icon"> 1064 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 1065 { 1066 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 1067 } 1068 </span> 1069 <span class="tooltip__text tooltip__text--top"> 1070 @if (isloggedin) 1071 { 1072 @Translate("Translate_ProductPage_PriceDefinition_Samples_Tooltip_LoggedIn") 1073 } 1074 else 1075 { 1076 @Translate("Translate_ProductPage_PriceDefinition_Samples_Tooltip_NotLoggedIn") 1077 } 1078 </span> 1079 </span> 1080 </div> 1081 <div class="product-details__info-price-option"> 1082 @{ 1083 var priceToShow = isloggedin ? standardPrice : GetString("Ecom:Product:Field.ProductSamplePriceNotLoggedIn"); 1084 var retailPrice = GetString("Ecom:Product:Field.ProductSamplePriceLoggedIn"); 1085 } 1086 @if (!isloggedin) 1087 { 1088 <div class="product-details__info-price-option-price">@Translate("Translate_RetailPrice")</div> 1089 } 1090 @if (isloggedin) 1091 { 1092 <div class="product-details__info-price-option-price">@priceToShow @priceCurrencySymbol pr. @salesUnit</div> 1093 <div class="product-details__info-price-option-vat">@Translate("Translate_Ecom_ExVat")</div> 1094 } 1095 1096 </div> 1097 </div> 1098 <div class="product-details__info-quantity"> 1099 @if (isloggedin && !enquireProduct ) 1100 { 1101 <form class="form" action="@(formAction)&Redirect=@(CartPage)" method="post" name="@productId" id="@productId"> 1102 <input type="hidden" name="CartCmd" value="addMulti" /> 1103 @GetString("Ecom:Product.Form.Multi.HiddenFields") 1104 @if (isSample) 1105 { 1106 <input type="hidden" name="@inputName" id="Quantity" class="amount" type="tel" value="1" /> 1107 } 1108 else 1109 { 1110 <div class="counter"> 1111 <a class="substract">-</a> 1112 <input name="@inputName" id="Quantity" class="amount" type="tel" value="1" /> 1113 <label for="Quanity" class="unit">@Translate("Translate_Piece_Short")</label> 1114 <a class="add">+</a> 1115 </div> 1116 } 1117 1118 <button type="submit" id="product-order-button" class="product-details__info-button btn btn--block btn-secondary">Bestil</button> 1119 </form> 1120 } 1121 else 1122 { 1123 <a href="#product-inquire-form" id="product-order-button" data-action="open-content" data-target="#enquireForm" class="product-details__info-button btn btn--block btn-secondary">@Translate("Translate_Product_Page_EnquireButton")</a> 1124 } 1125 </div> 1126 1127 break; 1128 default: 1129 1130 <h1>Produkt mangler at få valgt primær gruppe</h1> 1131 break; 1132 } 1133 1134 <div class="product-details__info-more"> 1135 @switch (productLayout) 1136 { 1137 case "group52": // Plader 1138 case "group66": // Dekorative Overflader 1139 case "group126": // Tilbehør 1140 1141 //#StockRetrieval - The logic here uses the main product for getting stock levels. In some instances the stock is overwritten with data from variants See other comment with tag #StockRetrieval 1142 1143 var warehouseStock = GetDouble("Ecom:Product.Stock"); 1144 var seaStock = int.Parse(GetString("Ecom:Product:Field.ProductPieceOnPurchase.Value").Replace(",", string.Empty)); 1145 var displayPreciseStockThreshold = isloggedin ? 500 : 100; 1146 1147 1148 if (isSingleVariant) 1149 { 1150 warehouseStock = singleVariantStock; 1151 seaStock = totalStockSea; 1152 } 1153 1154 string displayWarehouseStock = warehouseStock.ToString("N0"); 1155 string displaySeaStock = seaStock.ToString("N0"); 1156 1157 1158 if (warehouseStock > displayPreciseStockThreshold) 1159 { 1160 displayWarehouseStock = "+" + displayPreciseStockThreshold; 1161 } 1162 1163 if (seaStock > displayPreciseStockThreshold) 1164 { 1165 displaySeaStock = "+" + displayPreciseStockThreshold; 1166 } 1167 1168 if (labelCode.ToLower() != "skaffe" && labelCode.ToLower() != "relatordre") 1169 { 1170 <div class="product-details__info-stock product-details__info-stock--inline"> 1171 <div class="option option--in-house"> 1172 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 23.818"> 1173 <g class="warehouse" transform="translate(-551.005 -159.082)"> 1174 <path class="box box--top" d="M563.005,177.15h-5.25a.75.75,0,0,0-.75.75v4.5a.75.75,0,0,0,.75.75h4.5a.75.75,0,0,0,.75-.75Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1175 <path class="box box--bottom-right" d="M568.255,177.15h-5.25v5.25a.75.75,0,0,0,.75.75h4.5a.75.75,0,0,0,.75-.75v-4.5A.75.75,0,0,0,568.255,177.15Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1176 <path class="box box--bottom-left" d="M565.255,171.15h-4.5a.75.75,0,0,0-.75.75v5.25h6V171.9A.75.75,0,0,0,565.255,171.15Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1177 <path class="building" d="M574.255,183.15v-15.6a1.5,1.5,0,0,0-.794-1.324l-9.75-5.2a1.5,1.5,0,0,0-1.411,0l-9.75,5.2a1.5,1.5,0,0,0-.795,1.324v15.6" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1178 </g> 1179 </svg> 1180 <span>@Translate("Translate_ProductPage_StockOnWarehouse")</span> <span id="stockWarehouseValue" class="option__stock-value">@displayWarehouseStock</span> @Translate("Translate_Ecom_Piece") 1181 </div> 1182 <div class="option option--in-route"> 1183 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 16.5"> 1184 <g class="truck" transform="translate(-215 -899.75)"> 1185 <path class="back" d="M238.25,909.5V902a1.5,1.5,0,0,0-1.5-1.5h-12a1.5,1.5,0,0,0-1.5,1.5v6" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1186 <path class="front" d="M223.25,908v-6h-3a4.5,4.5,0,0,0-4.5,4.5v6a1.5,1.5,0,0,0,1.5,1.5H218" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1187 <path class="window" d="M215.75,908h3a1.5,1.5,0,0,0,1.5-1.5V902" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1188 <path class="wheel wheel--front" d="M222.5,915.5a2.25,2.25,0,1,0-2.25-2.25A2.25,2.25,0,0,0,222.5,915.5Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1189 <path class="wheel wheel--back" d="M234.5,915.5a2.25,2.25,0,1,0-2.25-2.25A2.25,2.25,0,0,0,234.5,915.5Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1190 <path class="axis" d="M227,914h3" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1191 </g> 1192 </svg> 1193 <span>@Translate("Translate_ProductPage_StockOnSea")</span> <span id="stockSeaValue" class="option__stock-value">@displaySeaStock</span> @Translate("Translate_Ecom_Piece") 1194 </div> 1195 </div> 1196 } 1197 1198 // If both warehouse stock and seastock (stock purchased but not arrived) is 0 in some instances it is because the actual stock values are on variants instead of main product, 1199 // so we check variants and override the stock numbers if stock is on the variants 1200 bool attemptVariantStockRetrieval = warehouseStock == 0 && seaStock == 0; 1201 1202 1203 if (attemptVariantStockRetrieval) 1204 { 1205 //#StockRetrieval - The logic overwrites stock level from the main product with data from variants as the main product stock is sometimes incorrect See other comment with tag #StockRetrieval 1206 <script> 1207 (function() { 1208 var isLoggedIn = @isloggedin.ToString().ToLower(); 1209 var allVariants = []; 1210 1211 function fetchVariants(productNo, url) { 1212 var requestUrl = url || '@(VariantsLookup)&ICC_itemId=' + productNo; 1213 1214 @if (!isloggedin) 1215 { 1216 <text> 1217 if (requestUrl.indexOf('username') < 0) { 1218 requestUrl += '&username=marketing@("@")keflico.com&password=Keflico10000%'; 1219 } 1220 </text> 1221 } 1222 1223 var credentials = isLoggedIn ? "same-origin" : "omit"; 1224 1225 fetch(requestUrl, { credentials: credentials }) 1226 .then(function(response) { return response.json(); }) 1227 .then(function(data) { 1228 if (data.variants && data.variants.length > 0) { 1229 allVariants = allVariants.concat(data.variants); 1230 1231 if (data.nextPage && data.nextPage != "") { 1232 fetchVariants(productNo, data.nextPage); 1233 } else { 1234 updateStockDisplay(); 1235 } 1236 } 1237 }); 1238 } 1239 1240 function updateStockDisplay() { 1241 if (allVariants.length === 0) return; 1242 1243 var warehouseSum = allVariants.reduce(function(sum, v) { return sum + parseInt(v.stock.warehouse || 0, 10); }, 0); 1244 var warehouseEl = document.getElementById('stockWarehouseValue'); 1245 if (warehouseEl) { 1246 warehouseEl.textContent = warehouseSum > @displayPreciseStockThreshold ? '+@displayPreciseStockThreshold' : warehouseSum.toLocaleString(); 1247 } 1248 1249 var purchaseSum = allVariants.reduce(function(sum, v) { return sum + parseInt(v.stock.purchase || 0, 10); }, 0); 1250 var seaEl = document.getElementById('stockSeaValue'); 1251 if (seaEl) { 1252 seaEl.textContent = purchaseSum > @displayPreciseStockThreshold ? '+@displayPreciseStockThreshold' : purchaseSum.toLocaleString(); 1253 } 1254 1255 // #StockRetrieval - When variants reveal stock the main product was missing, hide the request/enquire button and reveal the order form so the product can be added to the cart like a normally in-stock product. 1256 if (warehouseSum > 0 || purchaseSum > 0) { 1257 var enquireButtons = document.querySelectorAll('.js-enquire-button-stock-toggle'); 1258 for (var i = 0; i < enquireButtons.length; i++) { 1259 enquireButtons[i].style.display = 'none'; 1260 } 1261 1262 var orderForms = document.querySelectorAll('.js-product-order-form-stock-toggle'); 1263 for (var j = 0; j < orderForms.length; j++) { 1264 orderForms[j].style.display = ''; 1265 } 1266 } 1267 } 1268 1269 fetchVariants('@(productNumber)'); 1270 })(); 1271 </script> 1272 } 1273 1274 break; 1275 case KeflicoProductExtensions.SampleProductLayout: 1276 break; 1277 default: 1278 if (labelCode.ToLower() != "skaffe" && labelCode.ToLower() != "relatordre") 1279 { 1280 <a href="#" class="product-details__info-stock product-order-button"> 1281 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 23.818"> 1282 <g class="warehouse" transform="translate(-551.005 -159.082)"> 1283 <path class="box box--top" d="M563.005,177.15h-5.25a.75.75,0,0,0-.75.75v4.5a.75.75,0,0,0,.75.75h4.5a.75.75,0,0,0,.75-.75Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1284 <path class="box box--bottom-right" d="M568.255,177.15h-5.25v5.25a.75.75,0,0,0,.75.75h4.5a.75.75,0,0,0,.75-.75v-4.5A.75.75,0,0,0,568.255,177.15Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1285 <path class="box box--bottom-left" d="M565.255,171.15h-4.5a.75.75,0,0,0-.75.75v5.25h6V171.9A.75.75,0,0,0,565.255,171.15Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1286 <path class="building" d="M574.255,183.15v-15.6a1.5,1.5,0,0,0-.794-1.324l-9.75-5.2a1.5,1.5,0,0,0-1.411,0l-9.75,5.2a1.5,1.5,0,0,0-.795,1.324v15.6" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1287 </g> 1288 </svg> 1289 1290 @Translate("Translate_Product_Page_StockStatus") 1291 1292 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.006 11.031"> 1293 <g class="arrow" transform="translate(441 901.014) rotate(180)"> 1294 <path class="angle" d="M-17182.074-20447.988l4.809-4.809,4.809,4.809" transform="translate(20875.289 -16281.768) rotate(-90)" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" /> 1295 <line class="line" x2="17" transform="translate(423.5 895.5)" stroke-linecap="round" stroke-width="1" /> 1296 </g> 1297 </svg> 1298 </a> 1299 } 1300 break; 1301 } 1302 1303 <div class="product-details__info-delivery"> 1304 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 16.5"> 1305 <g class="truck" transform="translate(-215 -899.75)"> 1306 <path class="back" d="M238.25,909.5V902a1.5,1.5,0,0,0-1.5-1.5h-12a1.5,1.5,0,0,0-1.5,1.5v6" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1307 <path class="front" d="M223.25,908v-6h-3a4.5,4.5,0,0,0-4.5,4.5v6a1.5,1.5,0,0,0,1.5,1.5H218" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1308 <path class="window" d="M215.75,908h3a1.5,1.5,0,0,0,1.5-1.5V902" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1309 <path class="wheel wheel--front" d="M222.5,915.5a2.25,2.25,0,1,0-2.25-2.25A2.25,2.25,0,0,0,222.5,915.5Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1310 <path class="wheel wheel--back" d="M234.5,915.5a2.25,2.25,0,1,0-2.25-2.25A2.25,2.25,0,0,0,234.5,915.5Z" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1311 <path class="axis" d="M227,914h3" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 1312 </g> 1313 </svg> 1314 1315 @if (labelCode.ToLower() == "skaffe" || labelCode.ToLower() == "relatordre") 1316 { 1317 @Translate("Translate_Product_Page_DeliveryInformation")<text> </text> @GetString("Ecom:Product:Field.Leveringstid") 1318 } 1319 else 1320 { 1321 @Translate("Translate_Product_Page_DeliveryInformation") 1322 } 1323 1324 <span class="tooltip"> 1325 <span class="tooltip__icon"> 1326 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 1327 { 1328 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 1329 } 1330 </span> 1331 <span class="tooltip__text tooltip__text--left"> 1332 @if (labelCode.ToLower() == "skaffe" || labelCode.ToLower() == "relatordre") 1333 { 1334 <p>@Translate("Translate_ProductPage_DeliverInfo_Skaffe")</p> 1335 } 1336 else 1337 { 1338 <p>@Translate("Translate_ProductPage_DeliveryInfo")</p> 1339 } 1340 </span> 1341 </span> 1342 </div> 1343 1344 1345 <a class="product-details__info-reseller" href="https://keflico.com/find-forhandler"> 1346 <svg width="800px" height="800px" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" stroke-width="3" stroke="#000000" fill="none"> 1347 <path d="M52,27.18V52.76a2.92,2.92,0,0,1-3,2.84H15a2.92,2.92,0,0,1-3-2.84V27.17"></path> 1348 <polyline points="26.26 55.52 26.26 38.45 37.84 38.45 37.84 55.52"></polyline> 1349 <path d="M8.44,19.18s-1.1,7.76,6.45,8.94a7.17,7.17,0,0,0,6.1-2A7.43,7.43,0,0,0,32,26a7.4,7.4,0,0,0,5,2.49,11.82,11.82,0,0,0,5.9-2.15,6.66,6.66,0,0,0,4.67,2.15,8,8,0,0,0,7.93-9.3L50.78,9.05a1,1,0,0,0-.94-.65H14a1,1,0,0,0-.94.66Z"></path> 1350 <line x1="8.44" y1="19.18" x2="55.54" y2="19.18"></line> 1351 <line x1="21.04" y1="19.18" x2="21.04" y2="8.4"></line> 1352 <line x1="32.05" y1="19.18" x2="32.05" y2="8.4"></line> 1353 <line x1="43.01" y1="19.18" x2="43.01" y2="8.4"></line> 1354 </svg> 1355 1356 @Translate("Translate_Product_Page_Reseller") 1357 1358 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.006 11.031"> 1359 <g class="arrow" transform="translate(441 901.014) rotate(180)"> 1360 <path class="angle" d="M-17182.074-20447.988l4.809-4.809,4.809,4.809" transform="translate(20875.289 -16281.768) rotate(-90)" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" /> 1361 <line class="line" x2="17" transform="translate(423.5 895.5)" stroke-linecap="round" stroke-width="1" /> 1362 </g> 1363 </svg> 1364 </a> 1365 1366 @if (!string.IsNullOrEmpty(configuratorUrl)) 1367 { 1368 <a class="product-details__info-configurator" href="@configuratorUrl"> 1369 <svg width="800px" height="800px" viewBox="0 0 32 32" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg820" version="1.1"> 1370 <defs id="defs814"> 1371 <linearGradient gradientTransform="matrix(1.25 0 0 1.2 -484.714 468.561)" gradientUnits="userSpaceOnUse" y2="520.79797" x2="401.57144" y1="535.79797" x1="401.57144" id="linearGradient4358" xlink:href="#linearGradient4424"></linearGradient> 1372 <linearGradient id="linearGradient4424"> 1373 <stop style="stop-color:#60a5e7;stop-opacity:0" offset="0" id="stop4426"></stop> 1374 <stop style="stop-color:#a6f3fb;stop-opacity:.25773194" offset="1" id="stop4428"></stop> 1375 </linearGradient> 1376 </defs> 1377 <g transform="translate(0 -1090.52)" id="layer1"> 1378 <path id="rect2370" transform="translate(0 1090.52)" d="M2 4v24h28V4zm2 2h24v20H4z" style="opacity:1;vector-effect:none;fill:#373737;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:3.20000005;stroke-opacity:1"></path> 1379 <path id="path2381" d="M22.424 1100.096a1.996 1.996 0 0 0-2.829 0l-.707.707-7.778 7.778 2.828 2.829 7.779-7.778.707-.708a1.996 1.996 0 0 0 0-2.828zm-12.021 9.192-1.414 4.243 4.242-1.414z" style="fill:#373737;fill-opacity:1;stroke:none;stroke-width:1.26491106px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"></path> 1380 </g> 1381 </svg> 1382 1383 @Translate("Translate_Product_Page_Configurator") 1384 1385 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.006 11.031"> 1386 <g class="arrow" transform="translate(441 901.014) rotate(180)"> 1387 <path class="angle" d="M-17182.074-20447.988l4.809-4.809,4.809,4.809" transform="translate(20875.289 -16281.768) rotate(-90)" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" /> 1388 <line class="line" x2="17" transform="translate(423.5 895.5)" stroke-linecap="round" stroke-width="1" /> 1389 </g> 1390 </svg> 1391 </a> 1392 } 1393 @if (!string.IsNullOrEmpty(sampleLink)) 1394 { 1395 <a class="product-details__info-samplelink" href="@sampleLink"> 1396 <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Material Symbols Light by Google - https://github.com/google/material-design-icons/blob/master/LICENSE --><path fill="currentColor" d="M11.5 19.714v-7.427L5 8.523v7.08q0 .155.077.29t.23.23zm1 0l6.192-3.591q.154-.096.231-.23q.077-.135.077-.29v-7.08l-6.5 3.764zm-1.308.973l-6.384-3.68q-.38-.217-.593-.59Q4 16.044 4 15.61V8.391q0-.435.215-.808q.214-.373.593-.59l6.384-3.68q.38-.217.808-.217t.808.217l6.384 3.68q.38.216.594.59q.214.373.214.808v7.219q0 .434-.214.807q-.215.373-.594.59l-6.384 3.68q-.38.217-.808.217t-.808-.217m4.52-11.412l2.713-1.561l-6.117-3.541q-.154-.096-.308-.096t-.308.096L9.3 5.548zM12 11.427l2.7-1.568l-6.425-3.713l-2.7 1.567z"/></svg> 1397 @Translate("Translate_Product_Page_SampleLink") 1398 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.006 11.031"> 1399 <g class="arrow" transform="translate(441 901.014) rotate(180)"> 1400 <path class="angle" d="M-17182.074-20447.988l4.809-4.809,4.809,4.809" transform="translate(20875.289 -16281.768) rotate(-90)" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" /> 1401 <line class="line" x2="17" transform="translate(423.5 895.5)" stroke-linecap="round" stroke-width="1" /> 1402 </g> 1403 </svg> 1404 </a> 1405 } 1406 1407 1408 1409 <a id="downloadPdfButton" href="@downloadPdfUrl" class="product-details__info-download-pdf" rel="nofollow noindex" download style="text-align: left; display: flex; align-items: center;"> 1410 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"> 1411 <g class="download-icon" transform="translate(2 2)"> 1412 <path class="arrow" d="M10 0 L10 16 M5 11 L10 16 L15 11" 1413 fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> 1414 <path class="line" d="M0 20 L20 20" 1415 fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" /> 1416 </g> 1417 </svg> 1418 Download PDF 1419 </a> 1420 </div> 1421 </div> 1422 </div> 1423 </article> 1424 <article class="module module-sand product-description"> 1425 <div class="tabs"> 1426 <div class="tabs__nav"> 1427 <ul role="tablist" class="tabs__list" data-action="tabs"> 1428 <li role="none" class="tabs__item"> 1429 <a href="#description" class="tab tab--active" role="tab" id="description-tab" aria-controls="description" aria-selected="true"> 1430 <span class="tabs__item__text--web">@Translate("Translate_Product_Page_ProductDescription")</span> 1431 <span class="tabs__item__text--mobile">@Translate("Translate_Product_Page_ProductDescription_Short")</span> 1432 </a> 1433 </li> 1434 <li role="none" class="tabs__item"> 1435 <a href="#technical" class="tab" role="tab" id="technical-tab" aria-controls="technical" aria-selected="false"> 1436 <span class="tabs__item__text--web">@Translate("Translate_Product_Page_TechnicalSpecifications")</span> 1437 <span class="tabs__item__text--mobile">@Translate("Translate_Product_Page_TechnicalSpecifications_Short")</span> 1438 </a> 1439 </li> 1440 @if (hasNewDownloads) 1441 { 1442 <li role="none" class="tabs__item"> 1443 <a href="#documents" class="tab" role="tab" id="documents-tab" aria-controls="documents" aria-selected="false"> 1444 <span class="tabs__item__text--web">@Translate("Translate_Product_Page_Documents")</span> 1445 <span class="tabs__item__text--mobile">@Translate("Translate_Product_Page_Documents_Short")</span> 1446 </a> 1447 </li> 1448 } 1449 <li role="none" class="tabs__item"> 1450 <a href="#more-info" class="tab" role="tab" id="more-info-tab" aria-controls="more-info" aria-selected="false"> 1451 <span class="tabs__item__text--web">@Translate("Translate_Product_Page_MoreInformation")</span> 1452 <span class="tabs__item__text--mobile">@Translate("Translate_Product_Page_MoreInformation_Short")</span> 1453 </a> 1454 </li> 1455 </ul> 1456 1457 </div> 1458 <div id="description" class="tab__content tab__content--active" role="tabpanel" aria-hidden="false" aria-labelledby="description-tab"> 1459 <h2>@Translate("Translate_Product_Page_ProductDescription")</h2> 1460 <div class="tab__content-wrapper"> 1461 <div class="rich-text"> 1462 <div class="large-text">@GetString("Ecom:Product.LongDescription")</div> 1463 @GetString("Ecom:Product:Field.ProductDescriptionShortLongText.Value") 1464 </div> 1465 1466 @if (hasDownloads) 1467 { 1468 <div class="tab__content-sidebar"> 1469 <strong>@Translate("Translate__Product_Page_Downloads")</strong> 1470 <ul class="tab__content-list"> 1471 @foreach (var fileCat in GetLoop("ImageCategories")) 1472 { 1473 if (fileCat.GetString("Category.SystemName") != "Images") 1474 { 1475 foreach (var file in fileCat.GetLoop("Category.Images")) 1476 { 1477 string fileLink = file.GetString("Ecom:Product:Detail.Image.Clean"); 1478 string fileName = file.GetString("Ecom:Product:Detail.Name"); 1479 1480 if (String.IsNullOrWhiteSpace(fileName)) 1481 { 1482 fileName = Path.GetFileNameWithoutExtension(fileLink); 1483 } 1484 1485 <li> 1486 <a class="swap-link" href="@fileLink" data-link="@fileLink" target="_blank"> 1487 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/file.svg"))) 1488 { 1489 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/file.svg")) 1490 } 1491 @fileName.Replace("-", " ").Replace("_", " ") 1492 </a> 1493 </li> 1494 } 1495 } 1496 } 1497 1498 </ul> 1499 </div> 1500 } 1501 </div> 1502 </div> 1503 <div id="technical" class="tab__content technical-specs" role="tabpanel" aria-hidden="false" aria-labelledby="technical-tab"> 1504 <div class="rich-text"> 1505 <h2>@Translate("Translate_Product_Page_TechnicalSpecifications")</h2> 1506 1507 @{ 1508 CategoryFieldViewModel specs = productViewmodel.FieldDisplayGroups.Values.Where(x => x.Id.ToLower() == "technicalspecifications").FirstOrDefault(); 1509 CategoryFieldViewModel specsWithInfo = productViewmodel.FieldDisplayGroups.Values.Where(x => x.Id.ToLower() == "technicalspecificationswithinfo").FirstOrDefault(); 1510 } 1511 1512 @if (specs != null) 1513 { 1514 <ul class="product-description__technical-list"> 1515 @foreach (var field in specs.Fields.Values) 1516 { 1517 if (field.Type.ToLower() == "list") 1518 { 1519 List<FieldOptionValueViewModel> fieldValue = (List<FieldOptionValueViewModel>)field.Value; 1520 int i = 0; 1521 1522 if (fieldValue.First().Value.ToString() != "-1" && fieldValue.Where(x => x.Name.ToLower() == "ingen").Count() == 0) 1523 { 1524 <li class="product-description__technical-list-item"> 1525 <div class="key">@field.Name</div> 1526 <div class="value"> 1527 <span class="line"> 1528 @foreach (FieldOptionValueViewModel info in fieldValue) 1529 { 1530 if (i > 0) 1531 { 1532 @(", " + info.Name) 1533 } 1534 else 1535 { 1536 @info.Name 1537 } 1538 i++; 1539 } 1540 </span> 1541 </div> 1542 </li> 1543 } 1544 } 1545 else 1546 { 1547 if (field.Value.ToString() != "0" && field.Value.ToString().ToLower() != "ingen") 1548 { 1549 <li class="product-description__technical-list-item"> 1550 @if (field.Name.ToLower() == "number") 1551 { 1552 <div class="key">@Translate("Translate_General_ProductNumber")</div> 1553 } 1554 else if (field.Name.ToLower() == "weight") 1555 { 1556 <div class="key">@Translate("Translate_General_Weight")</div> 1557 } 1558 else 1559 { 1560 <div class="key">@field.Name</div> 1561 } 1562 <div class="value"> 1563 <span class="line">@field.Value</span> 1564 </div> 1565 </li> 1566 } 1567 } 1568 } 1569 </ul> 1570 } 1571 @if (specsWithInfo != null) 1572 { 1573 <ul class="product-description__technical-list"> 1574 @foreach (var field in specsWithInfo.Fields.Values) 1575 { 1576 if (field.Type.ToLower() == "list") 1577 { 1578 List<FieldOptionValueViewModel> fieldValue = (List<FieldOptionValueViewModel>)field.Value; 1579 int i = 0; 1580 1581 if (fieldValue.First().Value.ToString() != "-1" && fieldValue.Where(x => x.Name.ToLower() == "ingen").Count() == 0) 1582 { 1583 <li class="product-description__technical-list-item"> 1584 <div class="key">@field.Name</div> 1585 <div class="value"> 1586 <span class="line with-toolip"> 1587 @foreach (FieldOptionValueViewModel info in fieldValue) 1588 { 1589 if (i > 0) 1590 { 1591 @(", " + info.Name) 1592 } 1593 else 1594 { 1595 @info.Name 1596 } 1597 i++; 1598 } 1599 <span class="tooltip"> 1600 <span class="tooltip__icon"> 1601 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 1602 { 1603 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 1604 } 1605 </span> 1606 <span class="tooltip__text tooltip__text--left"> 1607 <p>@Translate("Translate_Product_Spec_Info_" + field.SystemName)</p> 1608 </span> 1609 </span> 1610 </span> 1611 </div> 1612 </li> 1613 } 1614 } 1615 else 1616 { 1617 if (field.Value.ToString() != "0" && field.Value.ToString().ToLower() != "ingen") 1618 { 1619 <li class="product-description__technical-list-item"> 1620 <div class="key">@field.Name</div> 1621 <div class="value"> 1622 <span class="line with-tooltip"> 1623 @if (field.SystemName.ToLower() == "productdensity") 1624 { 1625 @field.Value.ToString().Replace(",", ".") 1626 } 1627 else 1628 { 1629 @field.Value 1630 } 1631 <span class="tooltip"> 1632 <span class="tooltip__icon"> 1633 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 1634 { 1635 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 1636 } 1637 </span> 1638 <span class="tooltip__text tooltip__text--left"> 1639 <p>@Translate("Translate_Product_Spec_Info_" + field.SystemName)</p> 1640 </span> 1641 </span> 1642 </span> 1643 </div> 1644 </li> 1645 } 1646 } 1647 } 1648 </ul> 1649 } 1650 </div> 1651 </div> 1652 @if (hasNewDownloads) 1653 { 1654 <div id="documents" class="tab__content documents" role="tabpanel" aria-hidden="false" aria-labelledby="documents-tab"> 1655 <div class="rich-text"> 1656 <h2>@Translate("Translate_Product_Page_Documents")</h2> 1657 1658 <ul class="tab__content-list product-description__documents-list"> 1659 @foreach (var fileCat in GetLoop("ImageCategories")) 1660 { 1661 if (fileCat.GetString("Category.SystemName").StartsWith("docView_") && fileCat.GetLoop("Category.Images").Count() > 0) 1662 { 1663 <li class="product-description__documents-list-item"> 1664 <p class="product-description__documents-list-item-title">@fileCat.GetString("Category.Name")</p> 1665 @foreach (var file in fileCat.GetLoop("Category.Images")) 1666 { 1667 string fileLink = file.GetString("Ecom:Product:Detail.Image.Clean"); 1668 string fileName = file.GetString("Ecom:Product:Detail.Name"); 1669 1670 if (String.IsNullOrWhiteSpace(fileName)) 1671 { 1672 fileName = Path.GetFileNameWithoutExtension(fileLink); 1673 } 1674 1675 if (!String.IsNullOrEmpty(fileLink)) 1676 { 1677 <a class="swap-link" href="@fileLink" data-link="@fileLink" target="_blank"> 1678 @GetFileIcon(fileLink) 1679 @fileName.Replace("-", " ").Replace("_", " ") 1680 </a> 1681 } 1682 } 1683 </li> 1684 } 1685 } 1686 </ul> 1687 </div> 1688 </div> 1689 } 1690 1691 <div id="more-info" class="tab__content more-info-content" role="tabpanel" aria-hidden="false" aria-labelledby="more-info-tab"> 1692 <div class="rich-text"> 1693 <h2>@Translate("Translate_Product_Page_MoreInformation")</h2> 1694 @{ 1695 CategoryFieldViewModel moreInfo = productViewmodel.FieldDisplayGroups.Values.Where(x => x.Id.ToLower() == "yderlig_information").FirstOrDefault(); 1696 1697 if (moreInfo != null && moreInfo.Fields != null) 1698 { 1699 var groups = moreInfo.Fields.Values; 1700 1701 foreach (var group in groups) 1702 { 1703 <strong>@Translate("Translate_ProductPage_" + group.SystemName)</strong> 1704 @group.Value 1705 } 1706 } 1707 } 1708 </div> 1709 </div> 1710 1711 </article> 1712 1713 @* Rendered OUTSIDE #related-products on purpose: that div is the Vue mount 1714 point, and Vue re-creates its DOM on mount — which would orphan the Swiper 1715 instance swiper.js attaches to this (server-rendered) slider and kill touch 1716 dragging. Keeping it outside leaves the slider untouched by Vue. It is 1717 positioned ABOVE the related/accessories sliders by design. *@ 1718 @{ 1719 // Related cases are chosen per product: the editor attaches case pages 1720 // to the product through the "ProductRelatedCases" product field, whose 1721 // value is a comma-separated list of case PAGE IDs. Rename the field 1722 // system name below to match the field created in Dynamicweb. 1723 // 1724 // The item query can't filter on a case's page id (it's not a column), 1725 // so the selected ids are handed to the render template via Context 1726 // items and it filters/orders the cases itself. When none are attached 1727 // we fall back to a group-based match, which filters on real Case fields 1728 // (WoodTypes/Types) and is therefore safe to pass as a SQL Filter. 1729 string relatedCaseIds = GetString("Ecom:Product:Field.ProductRelatedCases"); 1730 bool hasRelatedCases = !string.IsNullOrWhiteSpace(relatedCaseIds); 1731 string fallbackFilter = hasRelatedCases ? "" : BuildFilterString(primaryGroup); 1732 1733 Dynamicweb.Context.Current.Items["ProductRelatedCasePageIds"] = hasRelatedCases ? relatedCaseIds : ""; 1734 } 1735 1736 @if (hasRelatedCases) 1737 { 1738 @* No Filter: the item query can't match on page id, so all cases are 1739 fetched and productInspiration.cshtml keeps the attached ones. Page 1740 size is high so a selected case can't fall outside the fetched set. *@ 1741 @RenderItemList(new 1742 { 1743 ItemType = "Case", 1744 ListSourceType = "SelfArea", 1745 ItemFieldsList = "*", 1746 ListTemplate = "itempublisher/list/productInspiration.cshtml", 1747 ListOrderBy = "Sort", 1748 ListPageSize = 1000 1749 }) 1750 } 1751 else if (!string.IsNullOrEmpty(fallbackFilter)) 1752 { 1753 @RenderItemList(new 1754 { 1755 ItemType = "Case", 1756 ListSourceType = "SelfArea", 1757 ItemFieldsList = "*", 1758 ListTemplate = "itempublisher/list/productInspiration.cshtml", 1759 ListOrderBy = "Sort", 1760 ListPageSize = 100, 1761 Filter = fallbackFilter 1762 }) 1763 } 1764 1765 @{ 1766 // True when the inspiration slider above actually rendered (it sets this 1767 // flag when it has cases to show). The related / accessories sliders 1768 // below read it to alternate their sand-light / sand module colours, so 1769 // no two same-coloured modules ever sit next to each other. 1770 bool inspirationAbove = (Dynamicweb.Context.Current.Items["ProductInspirationRendered"] as bool?) ?? false; 1771 } 1772 1773 <div id="related-products"> 1774 <article v-if="relatedProducts && relatedProducts.length > 0 && relatedList.length > 0" class="module related-products" :class="relatedModuleClass"> 1775 <div class="card-slider-head"> 1776 <div class="rich-text"> 1777 <h2 v-html="relatedGroups.find(x => x.Id == 'RELGRP2').Name"></h2> 1778 </div> 1779 @* Shared prev/next arrows for the Swiper-based sliders (cases, product slider, 1780 product inspiration, product-page card sliders). The .swiper-button-prev / 1781 .swiper-button-next classes are what swiper.js and the product page's Vue 1782 init bind navigation to. Styling lives in components/slider-nav.scss. *@ 1783 <div class="slider-nav"> 1784 <button type="button" class="slider-nav__btn swiper-button-prev" aria-label="@Translate("Translate_Slider_Prev", "Forrige")"> 1785 <svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 24 24"><path fill="currentColor" d="M14 17.308L8.692 12L14 6.692l.708.708l-4.6 4.6l4.6 4.6z" /></svg> 1786 </button> 1787 <button type="button" class="slider-nav__btn swiper-button-next" aria-label="@Translate("Translate_Slider_Next", "Næste")"> 1788 <svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 24 24"><path fill="currentColor" d="m8.59 18.16l5.66-5.66l-5.66-5.66l-.7.71l4.95 4.95l-4.95 4.95z" /></svg> 1789 </button> 1790 </div> 1791 1792 </div> 1793 <div class="card-swiper swiper" data-action="async-swiper"> 1794 <div class="swiper-wrapper"> 1795 <div v-for="product in relatedList" :key="product.Id" class="card-swiper__card swiper-slide"> 1796 <picture v-if="product.DefaultImage.Value != ''" class="card-swiper__card-media"> 1797 <source :srcset="productImage(product.DefaultImage.Value, 'lg')" media="(min-width: 1536px)"> 1798 <source :srcset="productImage(product.DefaultImage.Value, 'md')" media="(min-width: 992px)"> 1799 <source :srcset="productImage(product.DefaultImage.Value, 'sm')" media="(min-width: 768px)"> 1800 <img :src="productImage(product.DefaultImage.Value, 'default')" :alt="product.Name"> 1801 </picture> 1802 <div v-else class="card__picture card__picture--dummie"></div> 1803 <div class="card-swiper__card-info"> 1804 <div class="card-swiper__card-preline">@Translate("Translate_Product_Page_ProductNumber"): {{ product.Number }}</div> 1805 <h4 class="card-swiper__card-headline">{{ product.Name }}</h4> 1806 <div class="card-swiper__card-teaser">{{ product.ProductFields.Name2.Value }}</div> 1807 <a class="card-swiper__card-link" :href="'/@(EcomPage)&ProductID=' + product.Id">@Translate("Translate_Product_Page_ProductLink")</a> 1808 </div> 1809 </div> 1810 </div> 1811 <div class="swiper-pagination"></div> 1812 </div> 1813 </article> 1814 @if (isSample) 1815 { 1816 <article v-if="relatedProducts && relatedProducts.length > 0 && sampleList.length > 0" class="module related-products" :class="sampleModuleClass"> 1817 <div class="card-slider-head"> 1818 <div class="rich-text"> 1819 <h2>@Translate("Translate_Product_Page_Sample_List")</h2> 1820 </div> 1821 @* Shared prev/next arrows for the Swiper-based sliders (cases, product slider, 1822 product inspiration, product-page card sliders). The .swiper-button-prev / 1823 .swiper-button-next classes are what swiper.js and the product page's Vue 1824 init bind navigation to. Styling lives in components/slider-nav.scss. *@ 1825 <div class="slider-nav"> 1826 <button type="button" class="slider-nav__btn swiper-button-prev" aria-label="@Translate("Translate_Slider_Prev", "Forrige")"> 1827 <svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 24 24"><path fill="currentColor" d="M14 17.308L8.692 12L14 6.692l.708.708l-4.6 4.6l4.6 4.6z" /></svg> 1828 </button> 1829 <button type="button" class="slider-nav__btn swiper-button-next" aria-label="@Translate("Translate_Slider_Next", "Næste")"> 1830 <svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 24 24"><path fill="currentColor" d="m8.59 18.16l5.66-5.66l-5.66-5.66l-.7.71l4.95 4.95l-4.95 4.95z" /></svg> 1831 </button> 1832 </div> 1833 1834 </div> 1835 <div class="card-swiper swiper" data-action="async-swiper"> 1836 <div class="swiper-wrapper"> 1837 <div v-for="product in sampleList" :key="product.Id" class="card-swiper__card swiper-slide"> 1838 <picture v-if="product.DefaultImage.Value != ''" class="card-swiper__card-media"> 1839 <source :srcset="productImage(product.DefaultImage.Value, 'lg')" media="(min-width: 1536px)" /> 1840 <source :srcset="productImage(product.DefaultImage.Value, 'md')" media="(min-width: 992px)" /> 1841 <source :srcset="productImage(product.DefaultImage.Value, 'sm')" media="(min-width: 768px)" /> 1842 <img :src="productImage(product.DefaultImage.Value, 'default')" :alt="product.Name" /> 1843 </picture> 1844 <div v-else=v-else class="card__picture card__picture--dummie"></div> 1845 <div class="card-swiper__card-info"> 1846 <div class="card-swiper__card-preline">@Translate("Translate_Product_Page_ProductNumber"): {{ product.Number }}</div> 1847 <h4 class="card-swiper__card-headline">{{ product.Name }}</h4> 1848 <div class="card-swiper__card-teaser">{{ product.ProductFields.Name2.Value }}</div> 1849 <a class="card-swiper__card-link" :href="'/@(EcomPage)&ProductID=' + product.Id">@Translate("Translate_Product_Page_ProductLink")</a> 1850 </div> 1851 </div> 1852 </div> 1853 <div class="swiper-pagination"></div> 1854 </div> 1855 </article> 1856 } 1857 <article v-if="relatedProducts && relatedProducts.length > 0 && accessoriesList.length > 0" class="module accessories-products" :class="accessoriesModuleClass"> 1858 <div class="card-slider-head"> 1859 <div class="rich-text"> 1860 <h2 v-html="relatedGroups.find(x => x.Id == 'RELGRP1').Name"></h2> 1861 </div> 1862 @* Shared prev/next arrows for the Swiper-based sliders (cases, product slider, 1863 product inspiration, product-page card sliders). The .swiper-button-prev / 1864 .swiper-button-next classes are what swiper.js and the product page's Vue 1865 init bind navigation to. Styling lives in components/slider-nav.scss. *@ 1866 <div class="slider-nav"> 1867 <button type="button" class="slider-nav__btn swiper-button-prev" aria-label="@Translate("Translate_Slider_Prev", "Forrige")"> 1868 <svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 24 24"><path fill="currentColor" d="M14 17.308L8.692 12L14 6.692l.708.708l-4.6 4.6l4.6 4.6z" /></svg> 1869 </button> 1870 <button type="button" class="slider-nav__btn swiper-button-next" aria-label="@Translate("Translate_Slider_Next", "Næste")"> 1871 <svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 24 24"><path fill="currentColor" d="m8.59 18.16l5.66-5.66l-5.66-5.66l-.7.71l4.95 4.95l-4.95 4.95z" /></svg> 1872 </button> 1873 </div> 1874 1875 </div> 1876 <div class="card-swiper swiper" data-action="async-swiper"> 1877 <div class="swiper-wrapper"> 1878 <div v-for="product in accessoriesList" :key="product.Id" class="card-swiper__card swiper-slide"> 1879 <picture v-if="product.DefaultImage.Value != ''" class="card__picture"> 1880 <source :srcset="productImage(product.DefaultImage.Value, 'lg')" media="(min-width: 1536px)"> 1881 <source :srcset="productImage(product.DefaultImage.Value, 'md')" media="(min-width: 992px)"> 1882 <source :srcset="productImage(product.DefaultImage.Value, 'sm')" media="(min-width: 768px)"> 1883 <img :src="productImage(product.DefaultImage.Value, 'default')" :alt="product.Name"> 1884 </picture> 1885 <div v-else class="card__picture card__picture--dummie"></div> 1886 <div class="card-swiper__card-info"> 1887 <div class="card-swiper__card-preline">@Translate("Translate_Product_Page_ProductNumber"): {{ product.Number }}</div> 1888 <h4 class="card-swiper__card-headline">{{ product.Name }}</h4> 1889 <div class="card-swiper__card-teaser">{{ product.ProductFields.Name2.Value }}</div> 1890 <a class="card-swiper__card-link" :href="'/@(EcomPage)&ProductID=' + product.Id">@Translate("Translate_Product_Page_ProductLink")</a> 1891 </div> 1892 </div> 1893 </div> 1894 <div class="swiper-pagination"></div> 1895 </div> 1896 </article> 1897 </div> 1898 1899 @if (isSample) 1900 { 1901 @RenderSnippet("EnquireSampleProductForm") 1902 } 1903 else 1904 { 1905 @RenderSnippet("EnquireProductForm") 1906 } 1907 1908 <div class="product-floating-bar"> 1909 <div class="product-floating-bar__text">@productName @GetString("Ecom:Product:Field.Name2")</div> 1910 @if (!isSample) 1911 { 1912 if (totalStock > 0 && isloggedin && !enquireProduct) 1913 { 1914 if (primaryGroup == "group1" || primaryGroup == "group32" || primaryGroup == "group73") 1915 { 1916 <a class="btn btn-secondary product-floating-bar__button product-order-button">@Translate("Translate_Product_Page_OrderButton")</a> 1917 } 1918 else 1919 { 1920 <a href="#main" class="btn btn-secondary product-floating-bar__button">@Translate("Translate_Product_Page_OrderButton")</a> 1921 } 1922 } 1923 else 1924 { 1925 <a data-action="open-content" data-target="#enquireForm" class="btn btn-secondary product-floating-bar__button">@Translate("Translate_Product_Page_EnquireButton")</a> 1926 } 1927 } 1928 else 1929 { 1930 if (isloggedin && !enquireProduct) 1931 { 1932 <a href="#main" class="btn btn-secondary product-floating-bar__button">@Translate("Translate_Product_Page_OrderButton")</a> 1933 } 1934 else 1935 { 1936 <a data-action="open-content" data-target="#enquireForm" class="btn btn-secondary product-floating-bar__button">@Translate("Translate_Product_Page_EnquireButton")</a> 1937 } 1938 } 1939 </div> 1940 1941 @SnippetStart("JavaScripts") 1942 <script type="module" async> 1943 import Swiper from 'https://cdn.jsdelivr.net/npm/swiper@8/swiper-bundle.esm.browser.min.js'; 1944 1945 new Vue({ 1946 el: "#related-products", 1947 name: "Related Products", 1948 data() { 1949 return { 1950 relatedGroups: null, 1951 relatedProducts: null, 1952 // Baked server-side: did the inspiration slider render above us? 1953 inspirationAbove: @(inspirationAbove ? "true" : "false"), 1954 } 1955 }, 1956 computed: { 1957 relatedList() { 1958 return this.getRelatedGroup("RELGRP2", this.relatedProducts) 1959 }, 1960 sampleList() { 1961 return this.getRelatedGroup("RELGRP3", this.relatedProducts) 1962 }, 1963 accessoriesList() { 1964 return this.getRelatedGroup("RELGRP1", this.relatedProducts); 1965 }, 1966 // The slider modules alternate sand-light / sand so no two neighbours 1967 // share a colour (the product-description module above the stack is 1968 // sand). Counting only the sliders that actually render, in DOM order, 1969 // index 0 is sand-light, 1 is sand, 2 is sand-light, and so on. 1970 relatedModuleClass() { 1971 const index = (this.inspirationAbove ? 1 : 0); 1972 return index % 2 === 0 ? 'module-sand-light' : 'module-sand'; 1973 }, 1974 sampleModuleClass() { 1975 const index = (this.inspirationAbove ? 1 : 0) 1976 + (this.relatedList.length > 0 ? 1 : 0); 1977 return index % 2 === 0 ? 'module-sand-light' : 'module-sand'; 1978 }, 1979 accessoriesModuleClass() { 1980 // The sample slider only exists for sample products, so only count 1981 // it towards the alternation when it can actually appear. 1982 const sampleShown = @(isSample ? "true" : "false") && this.sampleList.length > 0; 1983 const index = (this.inspirationAbove ? 1 : 0) 1984 + (this.relatedList.length > 0 ? 1 : 0) 1985 + (sampleShown ? 1 : 0); 1986 return index % 2 === 0 ? 'module-sand-light' : 'module-sand'; 1987 } 1988 }, 1989 async mounted() { 1990 await fetch(`/dwapi/ecommerce/products/@(productNumber)`) 1991 .then(response => response.json()) 1992 .then(response => { 1993 this.relatedGroups = response.RelatedGroups; 1994 }) 1995 1996 await fetch(`/dwapi/ecommerce/products/@(productNumber)/related?ShopId=@(Pageview.Area.EcomShopId)`) 1997 .then(response => response.json()) 1998 .then(response => { 1999 if(response.TotalProductsCount > 0) { 2000 this.relatedProducts = response.Products; 2001 } 2002 }) 2003 .catch(error => { 2004 console.log(error) 2005 }) 2006 2007 const productsSliders = document.querySelectorAll('[data-action="async-swiper"]'); 2008 2009 productsSliders.forEach(swiperContainer => { 2010 // Arrows live in the card slider's headline row (outside the swiper 2011 // container), so resolve them within this article and pass the 2012 // elements directly rather than via a shared global selector. 2013 const scope = swiperContainer.closest('article') || swiperContainer.parentElement; 2014 const prevEl = scope ? scope.querySelector('.swiper-button-prev') : null; 2015 const nextEl = scope ? scope.querySelector('.swiper-button-next') : null; 2016 2017 const productSlider = new Swiper(swiperContainer, { 2018 pagination: { 2019 el: '.swiper-pagination', 2020 type: 'progressbar' 2021 }, 2022 navigation: (prevEl && nextEl) ? { prevEl, nextEl } : false, 2023 slidesPerView: 'auto', // Slide sizes are controlled with css - not here 2024 speed: 500, 2025 parallax: true, 2026 centeredSlides: false, 2027 }); 2028 2029 // Hide the arrows when the cards already fit (or only overflow a 2030 // little) — otherwise "next" stays active with nothing to scroll to. 2031 const sliderNav = scope ? scope.querySelector('.slider-nav') : null; 2032 const refreshNavVisibility = () => { 2033 if (!sliderNav) return; 2034 const slideWidth = (productSlider.slidesSizesGrid && productSlider.slidesSizesGrid.length) ? productSlider.slidesSizesGrid[0] : 0; 2035 const scrollable = productSlider.virtualSize - productSlider.size; 2036 sliderNav.style.display = scrollable > (slideWidth / 2) ? '' : 'none'; 2037 }; 2038 2039 refreshNavVisibility(); 2040 productSlider.on('resize', refreshNavVisibility); 2041 productSlider.on('update', refreshNavVisibility); 2042 }); 2043 }, 2044 methods: { 2045 getRelatedGroup(relGroup, relatedProducts) { 2046 let list = []; 2047 2048 if (relatedProducts && relatedProducts.length > 0) { 2049 relatedProducts.forEach(product => { 2050 if (product.Active && Object.keys(product.PrimaryOrDefaultGroup).length > 0) { 2051 let group = this.relatedGroups.find(x => x.Id === relGroup); 2052 2053 if (group && group.Products.find(x => x.ProductId == product.Id)) { 2054 list.push(product); 2055 } 2056 } 2057 }) 2058 } 2059 2060 return list; 2061 }, 2062 productImage(path, size) { 2063 let imagePath = "/admin/public/getimage.ashx?Image=" + encodeURIComponent(path); 2064 2065 switch(size) { 2066 case 'lg': 2067 imagePath += '&Width=416&Height=416&Crop=0&Compression=100'; 2068 break; 2069 case 'md': 2070 imagePath += '&Width=310&Height=310&Crop=0&Compression=100'; 2071 break; 2072 case 'sm': 2073 imagePath += '&Width=&230Height=230&Crop=0&Compression=100'; 2074 break; 2075 default: 2076 imagePath += '&Width=560&Height=560&Crop=0&Compression=100'; 2077 break; 2078 } 2079 2080 return imagePath; 2081 } 2082 } 2083 }) 2084 </script> 2085 2086 @SnippetEnd("Javascripts") 2087 2088 2089 2090 @if (productLayout != "group32" && productLayout != "group73" && productLayout != "group1") 2091 { 2092 @SnippetStart("JavaScripts") 2093 <script> 2094 const orderButton = document.getElementById("product-order-button"); 2095 2096 if(orderButton) { 2097 const form = orderButton.closest('form'); 2098 2099 orderButton.addEventListener('click', (event) => { 2100 event.preventDefault(); 2101 2102 const formData = new FormData(form); 2103 const qty = parseInt(formData.get('Quantity1')) 2104 2105 // Get the quantity input to read HasAnbrud data attribute 2106 const quantityInput = form.querySelector('#Quantity'); 2107 const hasAnbrud = quantityInput && quantityInput.getAttribute('data-has-anbrud') === 'true'; 2108 2109 // Add HasAnbrud parameter to form before submission 2110 const hasAnbrudInput = document.createElement('input'); 2111 hasAnbrudInput.type = 'hidden'; 2112 hasAnbrudInput.name = 'EcomOrderLineFieldInput_HasAnbrud1'; 2113 hasAnbrudInput.value = hasAnbrud; 2114 form.appendChild(hasAnbrudInput); 2115 2116 const price = @GetString("Ecom:Product.Discount.Price.PriceWithoutVAT.Value").Replace(",", "."); 2117 const halfPrice = @GetString("Ecom:Product:Field.ProductPriceHalfParcel").Replace(",", ""); 2118 const fullPrice = @GetString("Ecom:Product:Field.ProductPriceCompleteParcel").Replace(",", ""); 2119 2120 const halfParcel = @halfParcelAmount; 2121 const fullParcel = @completeParcelAmount; 2122 2123 const salesUnit = "@salesUnit"; 2124 const productLength = @GetString("Ecom:Product:Field.ProductLengthSale.Value.Raw"); 2125 const lengthUnit = "@GetString("Ecom:Product:Field.ProductLengthUnitCode.Value")"; 2126 2127 let value = 0; 2128 2129 addToValue(qty) 2130 2131 function addToValue(remainingQty) { 2132 if(salesUnit == "m") { 2133 value += remainingQty * (productLength/1000) * price; 2134 } else { 2135 value += remainingQty * price; 2136 } 2137 } 2138 2139 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 2140 dataLayer.push({ 2141 event: "add_to_cart", 2142 ecommerce: { 2143 currency: "@GetString("Ecom:Product.Currency.Code")", 2144 value: value, 2145 items: [ 2146 { 2147 item_id: "@productNumber", 2148 item_name: "@productNameEncoded", 2149 quantity: qty 2150 2151 } 2152 ] 2153 } 2154 }); 2155 form.submit() 2156 }); 2157 } 2158 </script> 2159 @SnippetEnd("Javascripts") 2160 } 2161 2162 @if (productLayout == "group32" || productLayout == "group73" || productLayout == "group1") 2163 { 2164 <div id="orderFlowApp" class="product-modal" :class="{ 'not-logged-in': !isLoggedIn, 'upsell js-slide-in' : showAccessories || showStep1 }"> 2165 <div v-if="showAccessories" class="product-modal__content product-modal__upsell-section"> 2166 <div class="product-modal__content-top"> 2167 <a href="/" class="navigation__logo"> 2168 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/keflico_logo.svg"))) 2169 { 2170 <text>@System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/keflico_logo.svg"))</text> 2171 } 2172 </a> 2173 <a href="@CartPage" class="navigation__cart"> 2174 <svg xmlns="http://www.w3.org/2000/svg" width="21.773" height="19.513" viewBox="0 0 21.773 19.513"> 2175 <g transform="translate(0.75 0.75)"> 2176 <path d="M122.747,269.657h9.076a1.359,1.359,0,0,0,1.342-1.148l1.28-5.631a.994.994,0,0,0-.982-1.148h-13.3" transform="translate(-114.186 -258.966)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2177 <path d="M88.321,247h2.551a.748.748,0,0,1,.724.563l1.973,8.555" transform="translate(-88.321 -247)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2178 <path d="M115.7,293.281l1.193,4.686h.043" transform="translate(-110.564 -284.597)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2179 <path d="M125.924,329.157a1.433,1.433,0,1,1-1.433-1.433A1.433,1.433,0,0,1,125.924,329.157Z" transform="translate(-116.54 -312.578)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2180 <path d="M169.05,329.157a1.433,1.433,0,1,1-1.433-1.433A1.433,1.433,0,0,1,169.05,329.157Z" transform="translate(-151.574 -312.578)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2181 <line x2="11.102" transform="translate(6.374 13.37)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2182 </g> 2183 </svg> 2184 <span class="cart-qty" data-count="@cartCount">@cartCount</span> 2185 </a> 2186 <a href="#" class="navigation__return product-modal__back-link" @@click="showAccessories = false"> 2187 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20.006 12.445"> 2188 <g transform="translate(-421.494 -889.275)"> 2189 <path d="M-17182.074-20447.988l4.809-4.809,4.809,4.809" transform="translate(20875.289 -16281.768) rotate(-90)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" /> 2190 <line x2="17" transform="translate(423.5 895.5)" fill="none" stroke="#000" stroke-linecap="round" stroke-width="2" /> 2191 </g> 2192 </svg> 2193 </a> 2194 <div v-if="accessoriesList.length > 0" class="breadcrumbs breadcrumbs--no-seperator"> 2195 <ul class="breadcrumbs__list"> 2196 <li class="breadcrumbs__item">1. Vælg produkter</li> 2197 <li class="breadcrumbs__item active">2. Vælg tilbehør</li> 2198 </ul> 2199 </div> 2200 </div> 2201 <div class="upsell-section__top"> 2202 <h1 class="upsell-section__title" v-html="'@Translate("Translate_OrderFlow_ProductsAdded")'.replace('{0}', '<span>' + productsAdded + '</span>')">Du har lagt <span>{{ productsAdded }}</span> varer i kurven</h1> 2203 <h2 class="upsell-section__subtitle">@Translate("Translate_OrderFlow_UpsellReminder")</h2> 2204 </div> 2205 <div class="upsell-section__card-list"> 2206 2207 <div v-for="(product, index) in accessoriesList" class="upsell-card stock-card" :class="{ active: currentMobileProduct == product.Number, dirty: getQty(product.Number) > 0 }" @@click="toggleBar(product.Number)"> 2208 <div class="counter-amount" v-if="getQty(product.Number) > 0">{{ getQty(product.Number) }}</div> 2209 <div class="upsell__content-info"> 2210 <div class="upsell__content-info-media"> 2211 <a :href="'/@(EcomPage)&ProductID=' + product.Number" target="_blank"> 2212 <img :src="'/admin/public/getimage.ashx?Image=' + product.DefaultImage.Value + '&width=175&height=175&Crop=0&Compression=100'" :alt="product.Name" loading="lazy"> 2213 </a> 2214 </div> 2215 <div class="upsell__content-info-container"> 2216 <div class="product-details__info-meta"> 2217 <ul class="product-details__info-meta-list"> 2218 <li>@Translate("Translate_Product_Page_ProductNumber") {{ product.Number }}</li> 2219 @if (!string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductDbNumber.Value"))) 2220 { 2221 <li>@GetString("Ecom:Product:Field.ProductDbNumber.Name") {{ product.EAN }}</li> 2222 } 2223 </ul> 2224 </div> 2225 <div class="product-details__info-title">{{ product.Name }}</div> 2226 <div class="product-details__info-size">{{ product.ProductFields.Name2.Value }}</div> 2227 <div class="product-details__info-quantity"> 2228 <div class="info-quantity" v-if="product.ProductFields.ProductNumberPerPackage.Value && product.ProductFields.ProductNumberPerPackage.Value > 0">{{ product.ProductFields.ProductNumberPerPackage.Value }} @Translate("Translate_General_Pieces")</div> 2229 <div class="info-price" v-if="product.Price.Price">{{ prettyPrice(product.Price.Price) }} @priceCurrencySymbol</div> 2230 </div> 2231 <div class="product-details__info-actions" v-if="product.Price.Price && product.Price.Price > 0 && !product.VariantInfo.VariantInfo"> 2232 <vue-counter :ref="'accCounter' + product.Number" :min="0" @@valueupdate="updateAccButton($event, product.Number)"></vue-counter> 2233 <a href="#" class="confirm disabled" :ref="'confirmBtn' + product.Number" @@click="addAcc($event, product.Number)"> 2234 <svg v-if="pickedAcc.find(x => x.id == product.Number)" enable-background="new 0 0 24 24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> 2235 <path fill="currentColor" d="m19.6025 12.6348c-.5586-.085-1.0547.2979-1.1348.8438-.2012 1.3711-.834 2.6221-1.8301 3.6182-2.5352 2.5352-6.6572 2.5332-9.1914 0-2.5337-2.5342-2.5337-6.6577 0-9.1914.9531-.9526 2.1563-1.5737 3.5029-1.7998.5791-.1099 1.2017-.1289 1.8477-.0557.887.1021 1.7126.3964 2.466.8285l-1.3019.2223c-.5439.0933-.9102.6099-.8164 1.1543.083.4873.5059.8315.9844.8315.0557 0 .1123-.0044.1699-.0142l3.4902-.5967c.2607-.0449.4941-.1914.6475-.4082.1533-.2163.2139-.4849.1689-.7466l-.5977-3.4897c-.0918-.5439-.6016-.9082-1.1543-.8169-.5439.0933-.9102.6104-.8164 1.1548l.1573.9185c-.9679-.543-2.0356-.8943-3.17-1.0249-.8496-.0967-1.6738-.0698-2.4282.0747-1.7368.291-3.3149 1.105-4.564 2.354-3.3135 3.3135-3.3135 8.7051 0 12.0195 1.6567 1.6572 3.8335 2.4854 6.0098 2.4854 2.1768 0 4.3525-.8281 6.0098-2.4854 1.3018-1.3018 2.1299-2.9414 2.3945-4.7412.0802-.5469-.2978-1.0548-.8437-1.1348z" /> 2236 </svg> 2237 <svg v-else xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21.773 19.513"> 2238 <g transform="translate(-87.571 -246.25)"> 2239 <g transform="translate(88.321 247)"> 2240 <path d="M122.747,269.657h9.076a1.359,1.359,0,0,0,1.342-1.148l1.28-5.631a.994.994,0,0,0-.982-1.148h-13.3" transform="translate(-114.186 -258.966)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2241 <path d="M88.321,247h2.551a.748.748,0,0,1,.724.563l1.973,8.555" transform="translate(-88.321 -247)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2242 <path d="M115.7,293.281l1.193,4.686h.043" transform="translate(-110.564 -284.597)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2243 <path d="M125.924,329.157a1.433,1.433,0,1,1-1.433-1.433A1.433,1.433,0,0,1,125.924,329.157Z" transform="translate(-116.54 -312.578)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2244 <path d="M169.05,329.157a1.433,1.433,0,1,1-1.433-1.433A1.433,1.433,0,0,1,169.05,329.157Z" transform="translate(-151.574 -312.578)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2245 <line x2="11.102" transform="translate(6.374 13.37)" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2246 </g> 2247 </g> 2248 </svg> 2249 </a> 2250 </div> 2251 </div> 2252 </div> 2253 </div> 2254 </div> 2255 <div class="notification-bar"> 2256 <div class="notification-bar__text"> 2257 @Translate("Translate_OrderFlow_HelpText") 2258 <a href="#product-inquire-form" @@click.prevent="openForm" id="product-orderflow-inquire-button" data-action="open-content" data-target="#enquireForm">@Translate("Translate_Product_Page_EnquireButton")</a> 2259 </div> 2260 </div> 2261 <div class="product-modal__content-bottom"></div> 2262 </div> 2263 <div v-if="!showAccessories" class="product-modal__content"> 2264 <div class="product-modal__content-top"> 2265 <a href="/" class="navigation__logo"> 2266 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/keflico_logo.svg"))) 2267 { 2268 <text>@System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/keflico_logo.svg"))</text> 2269 } 2270 </a> 2271 <a href="@CartPage" class="navigation__cart"> 2272 <svg xmlns="http://www.w3.org/2000/svg" width="21.773" height="19.513" viewBox="0 0 21.773 19.513"> 2273 <g transform="translate(0.75 0.75)"> 2274 <path d="M122.747,269.657h9.076a1.359,1.359,0,0,0,1.342-1.148l1.28-5.631a.994.994,0,0,0-.982-1.148h-13.3" transform="translate(-114.186 -258.966)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2275 <path d="M88.321,247h2.551a.748.748,0,0,1,.724.563l1.973,8.555" transform="translate(-88.321 -247)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2276 <path d="M115.7,293.281l1.193,4.686h.043" transform="translate(-110.564 -284.597)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2277 <path d="M125.924,329.157a1.433,1.433,0,1,1-1.433-1.433A1.433,1.433,0,0,1,125.924,329.157Z" transform="translate(-116.54 -312.578)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2278 <path d="M169.05,329.157a1.433,1.433,0,1,1-1.433-1.433A1.433,1.433,0,0,1,169.05,329.157Z" transform="translate(-151.574 -312.578)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2279 <line x2="11.102" transform="translate(6.374 13.37)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" /> 2280 </g> 2281 </svg> 2282 <span class="cart-qty" data-count="@cartCount">@cartCount</span> 2283 </a> 2284 <a href="#" class="navigation__return product-modal__back-link" @@click="showAccessories = false"> 2285 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20.006 12.445"> 2286 <g transform="translate(-421.494 -889.275)"> 2287 <path d="M-17182.074-20447.988l4.809-4.809,4.809,4.809" transform="translate(20875.289 -16281.768) rotate(-90)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" /> 2288 <line x2="17" transform="translate(423.5 895.5)" fill="none" stroke="#000" stroke-linecap="round" stroke-width="2" /> 2289 </g> 2290 </svg> 2291 </a> 2292 <div v-if="accessoriesList.length > 0" class="breadcrumbs breadcrumbs--no-seperator"> 2293 <ul class="breadcrumbs__list"> 2294 <li class="breadcrumbs__item active">1. Vælg produkter</li> 2295 <li class="breadcrumbs__item">2. Vælg tilbehør</li> 2296 </ul> 2297 </div> 2298 </div> 2299 <div class="product-modal__content-info"> 2300 <div class="product-modal__content-info-media"> 2301 <picture v-if="mainProduct.image"> 2302 <img :src="mainProduct.image" :alt="mainProduct.name" loading="lazy"> 2303 </picture> 2304 </div> 2305 <div class="product-modal__content-info-container"> 2306 <div class="product-details__info-meta"> 2307 <ul class="product-details__info-meta-list"> 2308 <li>{{ mainProduct.number }}</li> 2309 @if (!string.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ProductDbNumber.Value"))) 2310 { 2311 <li>{{ mainProduct.dbNumber }}</li> 2312 } 2313 </ul> 2314 </div> 2315 <div class="product-details__info-title">{{ mainProduct.name }}</div> 2316 <div class="product-details__info-size"> 2317 @if (primaryGroup == "group1") 2318 { 2319 <text>{{ mainProduct.size }}</text> 2320 } 2321 else 2322 { 2323 <div class="product-details__info-size-thickness"> 2324 <strong>@Translate("Translate_OrderFlow_Thickness")</strong> 2325 {{ mainProduct.thickness }} {{ thicknessUnit }} 2326 </div> 2327 <div class="product-details__info-size-width"> 2328 <strong>@Translate("Translate_OrderFlow_Width")</strong> 2329 {{ mainProduct.width }} {{ widthUnit }} 2330 </div> 2331 } 2332 </div> 2333 </div> 2334 </div> 2335 <div class="product-modal__content-product-stock"> 2336 @if (primaryGroup == "group1") 2337 { 2338 <div class="tabs"> 2339 <div v-if="bundles.length > 0" class="tabs__nav"> 2340 <ul role="tablist" class="tabs__list" data-action="tabs"> 2341 <li role="none" class="tabs__item"> 2342 @Translate("Translate_OrderFlow_Choose_ProductType") 2343 </li> 2344 <li role="none" class="tabs__item"> 2345 <a href="#helbundt" @@click.prevent="showBundles = true;" class="tab" :class="{ 'tab--active': showBundles }" role="tab" id="helbundt-tab" aria-controls="helbundt" aria-selected="true"> 2346 <span>@Translate("Translate_OrderFlow_Bundle")</span> 2347 </a> 2348 </li> 2349 @if (!isBundleOnly) 2350 { 2351 <li role="none" class="tabs__item"> 2352 <a href="#anbrud" @@click.prevent="showBundles = false;" class="tab" :class="{ 'tab--active': !showBundles }" role="tab" id="anbrud-tab" aria-controls="anbrud" aria-selected="false"> 2353 <span>@Translate("Translate_OrderFlow_Pieces")</span> 2354 </a> 2355 </li> 2356 } 2357 </ul> 2358 </div> 2359 <div id="helbundt" v-if="bundles.length > 0" class="tab__content" :class="{ 'tab__content--active': showBundles }" role="tabpanel" aria-hidden="false" aria-labelledby="helbundt-tab"> 2360 <div class="product-modal__stock"> 2361 <div class="product-modal__stock-line product-modal__stock-line--header bundle-header"> 2362 <div class="product-modal__stock-cell mobile-cell filler"></div> 2363 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_BundleNo")</div> 2364 <div class="product-modal__stock-cell desktop-cell">@Translate("Translate_OrderFlow_Thickness")</div> 2365 <div class="product-modal__stock-cell desktop-cell">@Translate("Translate_OrderFlow_Width")</div> 2366 <div class="product-modal__stock-cell desktop-cell">@Translate("Translate_OrderFlow_Length")</div> 2367 <div v-if="!enquireProduct" class="product-modal__stock-cell desktop-cell">@Translate("Translate_OrderFlow_InStock")</div> 2368 <div v-if="!enquireProduct" class="product-modal__stock-cell"> 2369 @Translate("Translate_OrderFlow_OnWayHome"): 2370 <span v-html="onTheWayHome"></span> 2371 </div> 2372 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted">@Translate("Translate_OrderFlow_ChooseAmount")</div> 2373 </div> 2374 <div v-if="!loadingBundles" v-for="bundle in sortedBundles" ref="bundle-line" :key="bundle.bundleNo" :class="{ active: currentMobileProduct == bundle.bundleNo, dirty: getQty(bundle.bundleNo) > 0, expanded: isExpanded(bundle.bundleNo) }" class="product-modal__stock-line stock-card stock-bundle-card" @@click="toggleBar(bundle.bundleNo)"> 2375 <div class="stock-bundle__header"> 2376 <div class="product-modal__stock-cell mobile-cell"> 2377 <div class="cell-radio counter-amount bundle-amount" v-html="getQty(bundle.bundleNo) > 0 ? getQty(bundle.bundleNo) : ''" :data-id="bundle.bundleNo"></div> 2378 </div> 2379 <div class="product-modal__stock-cell"> 2380 <span class="bundle-toggle" @@click="toggleBundle(bundle.bundleNo)"> 2381 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12.446 7.223"> 2382 <path d="M0,0,4.809,4.809,9.617,0" transform="translate(11.031 5.809) rotate(180)" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" /> 2383 </svg> 2384 </span> 2385 {{ bundle.bundleNo }} 2386 </div> 2387 <div class="product-modal__stock-cell mobile-cell"></div> 2388 <div class="product-modal__stock-cell mobile-cell"></div> 2389 </div> 2390 <div class="stock-bundle__body"> 2391 <div class="stock-bundle__body-columns"> 2392 <div class="stock-bundle__cell"> 2393 @Translate("Translate_OrderFlow_Dimensions") 2394 </div> 2395 <div class="stock-bundle__cell"> 2396 @Translate("Translate_OrderFlow_InStock") 2397 </div> 2398 </div> 2399 <div v-for="(product, index) in bundle.productsInBundle" class="stock-bundle__stick"> 2400 <div class="stock-bundle__cell mobile-cell"> 2401 <div class="cell-stack"> 2402 @Translate("Translate_OrderFlow_Thickness_Short") {{ product.thickness }} {{ thicknessUnit }} 2403 </div> 2404 <div class="cell-stack"> 2405 @Translate("Translate_OrderFlow_Width_Short") {{ product.width }} {{ widthUnit }} 2406 </div> 2407 <div class="cell-stack"> 2408 @Translate("Translate_OrderFlow_Length_Short") {{ product.length.replace(",", "") }} {{ lenghtUnit }} 2409 </div> 2410 </div> 2411 <div class="stock-bundle__cell desktop-cell">{{ product.thickness }} {{ thicknessUnit }}</div> 2412 <div class="stock-bundle__cell desktop-cell">{{ product.width }} {{ widthUnit }}</div> 2413 <div class="stock-bundle__cell desktop-cell">{{ product.length.replace(",", "") }} {{ lenghtUnit }}</div> 2414 <div v-if="!enquireProduct" class="stock-bundle__cell">{{ product.stock.units > 500 ? '+500' : product.stock.units }} @Translate("Translate_General_Pieces")</div> 2415 <div v-if="!enquireProduct" class="stock-bundle__cell desktop-cell"></div> 2416 <div v-if="isLoggedIn && !enquireProduct" class="stock-bundle__cell product-modal__stock-cell--highlighted desktop-cell"> 2417 <vue-counter v-if="index == 0 && isLoggedIn && !enquireProduct" ref="counter" :min="0" :max="1" @@valueupdate="addBundleToTempCart($event, bundle.bundleNo)" /> 2418 </div> 2419 </div> 2420 </div> 2421 </div> 2422 <div v-if="loadingBundles" class="bundle-loading"> 2423 <span class="loader"></span> 2424 </div> 2425 </div> 2426 </div> 2427 @if (!isBundleOnly) 2428 { 2429 <div id="anbrud" class="tab__content" :class="{ 'tab__content--active': !showBundles }" role="tabpanel" aria-hidden="false" aria-labelledby="anbrud-tab"> 2430 <div class="product-modal__stock"> 2431 <div class="product-modal__stock-line product-modal__stock-line--header"> 2432 <div class="product-modal__stock-cell filler mobile-cell" v-if="isLoggedIn && !enquireProduct"></div> 2433 <div class="product-modal__stock-cell mobile-cell">@Translate("Translate_OrderFlow_Dimension")</div> 2434 <div class="product-modal__stock-cell desktop-cell">@Translate("Translate_OrderFlow_Thickness")</div> 2435 <div class="product-modal__stock-cell desktop-cell">@Translate("Translate_OrderFlow_Width")</div> 2436 <div class="product-modal__stock-cell desktop-cell">@Translate("Translate_OrderFlow_Length")</div> 2437 <div v-if="!enquireProduct" class="product-modal__stock-cell">@Translate("Translate_OrderFlow_InStock")</div> 2438 <div v-if="!enquireProduct" class="product-modal__stock-cell"> 2439 @Translate("Translate_OrderFlow_OnWayHome"): 2440 <span v-html="onTheWayHome"></span> 2441 </div> 2442 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted">@Translate("Translate_OrderFlow_ChooseAmount")</div> 2443 </div> 2444 <div v-for="(variant, index) in sortedVariants" v-if="variant.stock.warehouse > 0" class="product-modal__stock-line stock-card" :class="{ active: currentMobileProduct == variant.id, dirty: getQty(variant.id) > 0 }" @@click="toggleBar(variant.id)" :key="index"> 2445 <div class="product-modal__stock-cell quantity" v-if="isLoggedIn && !enquireProduct"> 2446 <div class="cell-radio counter-amount" :data-id="variant.id" v-html="getQty(variant.id) > 0 ? getQty(variant.id) : ''"></div> 2447 </div> 2448 <div class="product-modal__stock-cell cell-stack"> 2449 <span class="stack">@Translate("Translate_OrderFlow_Thickness_Short") {{ variant.size.thickness }} {{ thicknessUnit }}</span> 2450 <span class="stack">@Translate("Translate_OrderFlow_Width_Short") {{ variant.size.width }} {{ widthUnit }}</span> 2451 <span class="stack">@Translate("Translate_OrderFlow_Length_Short") {{ variant.size.length }} {{ lenghtUnit }}</span> 2452 </div> 2453 <div class="product-modal__stock-cell desktop-cell">{{ variant.size.thickness }} {{ thicknessUnit }}</div> 2454 <div class="product-modal__stock-cell desktop-cell">{{ variant.size.width }} {{ widthUnit }}</div> 2455 <div class="product-modal__stock-cell desktop-cell">{{ variant.size.length }} {{ lenghtUnit }}</div> 2456 <div v-if="!enquireProduct" class="product-modal__stock-cell">{{ calculateStockLevel(variant.stock.warehouse) }} @Translate("Translate_General_Pieces") </div> 2457 <div v-if="!enquireProduct" class="product-modal__stock-cell"></div> 2458 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted" :class="{'out-of-stock': variant.stock.warehouse + variant.stock.pieces == 0 || enquireProduct}"> 2459 <vue-counter v-if="variant.stock.warehouse + variant.stock.purchase > 0 && isLoggedIn && !enquireProduct" ref="counter" :min="0" @@valueupdate="addToTempCart($event, variant.id)" /> 2460 </div> 2461 </div> 2462 </div> 2463 </div> 2464 } 2465 </div> 2466 } 2467 else 2468 { 2469 if (useDifferentLengths) // Is 'useDifferentLengths' checkbox enabled on group' 2470 { 2471 <div v-if="shortLengthVariants?.length || longLengthVariants?.length" class="product-modal__stock-wrapper product-modal__stock-wrapper--multiple-lengths"> 2472 <div v-if="shortLengthVariants?.length" class="product-modal__stock"> 2473 <div> 2474 <p class="product-modal__stock-wrapper__length-title">@Translate("Translate_ProductPage_ShortLengths")</p> 2475 </div> 2476 <div> 2477 <div class="product-modal__stock-line product-modal__stock-line--header product-modal__stock-line--terrace"> 2478 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell filler mobile-cell"></div> 2479 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_Length")</div> 2480 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_InStock")</div> 2481 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_OnWayHome")</div> 2482 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted">@Translate("Translate_OrderFlow_ChooseAmount")</div> 2483 </div> 2484 <div v-for="(variant, index) in shortLengthVariants" class="product-modal__stock-line stock-card" v-on="variant.stock.pieces > 0 || variant.stock.warehouse > 0 || variant.stock.sea > 0 ? { click: () => toggleBar(variant.id) } : {}" :class="{ 'out-of-stock': variant.stock.pieces == 0 && variant.stock.warehouse == 0 && variant.stock.sea == 0, dirty: getQty(variant.id) > 0, active: variant.id == currentMobileProduct }" :key="index"> 2485 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell quantity"> 2486 <div class="cell-radio counter-amount" :data-id="variant.id" v-html="getQty(variant.id) > 0 ? getQty(variant.id) : ''"></div> 2487 </div> 2488 <div class="product-modal__stock-cell">{{ variant.size.length }} {{ lenghtUnit }}</div> 2489 <div class="product-modal__stock-cell">{{ calculateStockLevel(variant.stock.warehouse) }}</div> 2490 @if (primaryGroup == "group73") 2491 { 2492 <div class="product-modal__stock-cell">{{ variant.stock.purchase > 0 ? "@Translate("Translate_General_Yes")" : "@Translate("Translate_General_No")" }}</div> 2493 } 2494 else 2495 { 2496 <div class="product-modal__stock-cell">{{ calculateStockLevel(variant.stock.sea) }}</div> 2497 } 2498 2499 @if (primaryGroup == "group32") 2500 { 2501 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted" :class="{'out-of-stock': variant.stock.warehouse + variant.stock.sea == 0 || enquireProduct}"> 2502 <vue-counter v-if="variant.stock.warehouse + variant.stock.sea > 0 && isLoggedIn && !enquireProduct" ref="counter" :min="0" @@valueupdate="addToTempCart($event, variant.id)" /> 2503 </div> 2504 } 2505 else 2506 { 2507 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted" :class="{'out-of-stock': variant.stock.warehouse + variant.stock.pieces == 0 || enquireProduct}"> 2508 <vue-counter v-if="variant.stock.warehouse + variant.stock.purchase > 0 && isLoggedIn && !enquireProduct" ref="counter" :min="0" @@valueupdate="addToTempCart($event, variant.id)" /> 2509 </div> 2510 } 2511 </div> 2512 </div> 2513 </div> 2514 2515 <div v-if="longLengthVariants?.length" class="product-modal__stock"> 2516 <div> 2517 <p class="product-modal__stock-wrapper__length-title">@Translate("Translate_ProductPage_LongLengths")</p> 2518 </div> 2519 <div> 2520 <div class="product-modal__stock-line product-modal__stock-line--header product-modal__stock-line--terrace"> 2521 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell filler mobile-cell"></div> 2522 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_Length")</div> 2523 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_InStock")</div> 2524 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_OnWayHome")</div> 2525 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted">@Translate("Translate_OrderFlow_ChooseAmount")</div> 2526 </div> 2527 <div v-for="(variant, index) in longLengthVariants" class="product-modal__stock-line stock-card" v-on="variant.stock.pieces > 0 || variant.stock.warehouse > 0 || variant.stock.sea > 0 ? { click: () => toggleBar(variant.id) } : {}" :class="{ 'out-of-stock': variant.stock.pieces == 0 && variant.stock.warehouse == 0 && variant.stock.sea == 0, dirty: getQty(variant.id) > 0, active: variant.id == currentMobileProduct }" :key="index"> 2528 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell quantity"> 2529 <div class="cell-radio counter-amount" :data-id="variant.id" v-html="getQty(variant.id) > 0 ? getQty(variant.id) : ''"></div> 2530 </div> 2531 <div class="product-modal__stock-cell">{{ variant.size.length }} {{ lenghtUnit }}</div> 2532 <div class="product-modal__stock-cell">{{ calculateStockLevel(variant.stock.warehouse) }}</div> 2533 @if (primaryGroup == "group73") 2534 { 2535 <div class="product-modal__stock-cell">{{ variant.stock.purchase > 0 ? "@Translate("Translate_General_Yes")" : "@Translate("Translate_General_No")" }}</div> 2536 } 2537 else 2538 { 2539 <div class="product-modal__stock-cell">{{ calculateStockLevel(variant.stock.sea) }}</div> 2540 } 2541 2542 @if (primaryGroup == "group32") 2543 { 2544 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted" :class="{'out-of-stock': variant.stock.warehouse + variant.stock.sea == 0 || enquireProduct}"> 2545 <vue-counter v-if="variant.stock.warehouse + variant.stock.sea > 0 && isLoggedIn && !enquireProduct" ref="counter" :min="0" @@valueupdate="addToTempCart($event, variant.id)" /> 2546 </div> 2547 } 2548 else 2549 { 2550 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted" :class="{'out-of-stock': variant.stock.warehouse + variant.stock.pieces == 0 || enquireProduct}"> 2551 <vue-counter v-if="variant.stock.warehouse + variant.stock.purchase > 0 && isLoggedIn && !enquireProduct" ref="counter" :min="0" @@valueupdate="addToTempCart($event, variant.id)" /> 2552 </div> 2553 } 2554 </div> 2555 </div> 2556 </div> 2557 </div> 2558 } 2559 else 2560 { 2561 <div v-if="sortedVariants?.length"> 2562 <div class="product-modal__stock-line product-modal__stock-line--header product-modal__stock-line--terrace"> 2563 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell filler mobile-cell"></div> 2564 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_Length")</div> 2565 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_InStock")</div> 2566 <div class="product-modal__stock-cell">@Translate("Translate_OrderFlow_OnWayHome")</div> 2567 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted">@Translate("Translate_OrderFlow_ChooseAmount")</div> 2568 </div> 2569 <div v-for="(variant, index) in sortedVariants" class="product-modal__stock-line stock-card" v-on="variant.stock.pieces > 0 || variant.stock.warehouse > 0 || variant.stock.sea > 0 ? { click: () => toggleBar(variant.id) } : {}" :class="{ 'out-of-stock': variant.stock.pieces == 0 && variant.stock.warehouse == 0 && variant.stock.sea == 0, dirty: getQty(variant.id) > 0, active: variant.id == currentMobileProduct }" :key="index"> 2570 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell quantity"> 2571 <div class="cell-radio counter-amount" :data-id="variant.id" v-html="getQty(variant.id) > 0 ? getQty(variant.id) : ''"></div> 2572 </div> 2573 <div class="product-modal__stock-cell">{{ variant.size.length }} {{ lenghtUnit }}</div> 2574 <div class="product-modal__stock-cell">{{ calculateStockLevel(variant.stock.warehouse) }}</div> 2575 @if (primaryGroup == "group73") 2576 { 2577 <div class="product-modal__stock-cell">{{ variant.stock.purchase > 0 ? "@Translate("Translate_General_Yes")" : "@Translate("Translate_General_No")" }}</div> 2578 } 2579 else 2580 { 2581 <div class="product-modal__stock-cell">{{ calculateStockLevel(variant.stock.sea) }}</div> 2582 } 2583 2584 @if (primaryGroup == "group32") 2585 { 2586 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted" :class="{'out-of-stock': variant.stock.warehouse + variant.stock.sea == 0 || enquireProduct}"> 2587 <vue-counter v-if="variant.stock.warehouse + variant.stock.sea > 0 && isLoggedIn && !enquireProduct" ref="counter" :min="0" @@valueupdate="addToTempCart($event, variant.id)" /> 2588 </div> 2589 } 2590 else 2591 { 2592 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__stock-cell product-modal__stock-cell--highlighted" :class="{'out-of-stock': variant.stock.warehouse + variant.stock.pieces == 0 || enquireProduct}"> 2593 <vue-counter v-if="variant.stock.warehouse + variant.stock.purchase > 0 && isLoggedIn && !enquireProduct" ref="counter" :min="0" @@valueupdate="addToTempCart($event, variant.id)" /> 2594 </div> 2595 } 2596 </div> 2597 </div> 2598 } 2599 2600 } 2601 </div> 2602 2603 2604 2605 @if(primaryGroup == "group32") { 2606 <div v-if="isLoggedIn" class="product-modal__stock-wrapper--multiple-lengths-information"> 2607 <span class="tooltip__icon"> 2608 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg"))) 2609 { 2610 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/info.svg")) 2611 } 2612 </span> 2613 <span>@Translate("Translate_ProductPage_LengthsInformation")</span> 2614 </div> 2615 <div class="notification-bar"> 2616 <div v-if="isLoggedIn" class="notification-bar__text"> 2617 @Translate("Translate_ProductPage_GeneralPricingRules") 2618 </div> 2619 <div v-else class="notification-bar__text"> 2620 @Translate("Translate_OrderFlow_HelpText") 2621 <a href="#product-inquire-form" id="product-orderflow-inquire-button" data-action="open-content" data-target="#enquireForm">@Translate("Translate_Product_Page_EnquireButton")</a> 2622 </div> 2623 </div> 2624 } else { 2625 <div class="notification-bar"> 2626 <div class="notification-bar__text"> 2627 @Translate("Translate_OrderFlow_HelpText") 2628 <a href="#product-inquire-form" id="product-orderflow-inquire-button" data-action="open-content" data-target="#enquireForm">@Translate("Translate_Product_Page_EnquireButton")</a> 2629 </div> 2630 </div> 2631 } 2632 <div class="product-modal__content-bottom"></div> 2633 </div> 2634 <div class="product-modal__side"> 2635 <div class="product-modal__side-top"> 2636 <a href="#" class="product-modal__back-link" @@click="showAccessories = false"> 2637 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20.006 12.445"> 2638 <g transform="translate(-421.494 -889.275)"> 2639 <path d="M-17182.074-20447.988l4.809-4.809,4.809,4.809" transform="translate(20875.289 -16281.768) rotate(-90)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" /> 2640 <line x2="17" transform="translate(423.5 895.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2" /> 2641 </g> 2642 </svg> 2643 @Translate("Translate_ProductFlow_Back") 2644 </a> 2645 <div class="product-modal__basket-icon"> 2646 <span class="icon"></span> 2647 <span class="badge"></span> 2648 </div> 2649 </div> 2650 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__side-basket" :class="{ 'popup--active': showMobileBasket }"> 2651 <div v-if="pickedVariants.length > 0" class="side-basket__product"> 2652 <div class="side-basket__product-head"> 2653 <div class="product-name">{{ mainProduct.name }}</div> 2654 <div class="product-price"> 2655 @if (primaryGroup == "group1") 2656 { 2657 <span v-if="!loadingPrice">{{ prettyPrice(priceObject.unitPrice) }} @priceCurrencySymbol / {{ mainProduct.prices.unit.label }}</span> 2658 <span v-if="loadingPrice" class="loader"></span> 2659 } 2660 else 2661 { 2662 <span v-if="!loadingPrice">{{ prettyPrice(priceObject.unitPrice) }} @priceCurrencySymbol / @Translate("Translate_General_RunningMeters")</span> 2663 <span v-if="loadingPrice" class="loader"></span> 2664 } 2665 </div> 2666 <div class="product-toggle" @@click="toggleState"> 2667 <span class="close">@Translate("Translate_General_Close")</span> 2668 <span class="open">@Translate("Translate_General_Open")</span> 2669 </div> 2670 </div> 2671 <div v-for="(line, index) in sortedPickedVariants" class="side-basket__product-variant"> 2672 @if (primaryGroup == "group1") 2673 { 2674 <template v-if="line.bundle"> 2675 <div class="size size__header"> 2676 <strong>@Translate("Translate_OrderFlow_BundleNo") {{ line.bundleNo }}</strong> 2677 </div> 2678 <template v-for="variant in line.productsInBundle"> 2679 <div class="size"> 2680 <template v-if="lenghtUnit == 'mm'"> 2681 {{ variant.thickness.replace(".", ",") }} x {{ variant.width }} x {{ variant.length.replace(",", "") }}mm 2682 </template> 2683 <template v-else> 2684 {{ variant.thickness.replace(".", ",") }}{{ thicknessUnit }} x {{ variant.width }}{{ widthUnit }} x {{ variant.length.replace(",", "") }} {{ lenghtUnit }} 2685 </template> 2686 </div> 2687 <div class="quantity">{{ prettyNumber(variant.stock.units) }} @Translate("Translate_General_Pieces")</div> 2688 </template> 2689 </template> 2690 <template v-else> 2691 <div class="size size__header"> 2692 <strong>@Translate("Translate_OrderFlow_Pieces")</strong> 2693 </div> 2694 <div class="size">{{ line.thickness }} x {{ line.width }} x {{ line.length }}mm</div> 2695 <div class="quantity">{{ prettyNumber(line.qty) }} @Translate("Translate_General_Pieces")</div> 2696 </template> 2697 } 2698 else 2699 { 2700 <div class="size">{{ mainProduct.thickness }} x {{ mainProduct.width }} x {{ line.length }}mm</div> 2701 <div class="quantity">{{ prettyNumber(line.qty) }} @Translate("Translate_General_Pieces")</div> 2702 } 2703 </div> 2704 <div class="side-basket__product-total"> 2705 <div class="product-meters"> 2706 @Translate("Translate_General_InTotal") 2707 <span v-if="mainProduct.prices.unit.label == 'm²' || mainProduct.prices.unit.label == 'm'">{{ prettyNumber(calculateMeters()) }} {{ mainProduct.prices.unit.label }}</span> 2708 <span v-else>{{ prettyNumber(calculatePieces()) }} @Translate("Translate_General_Pieces")</span> 2709 </div> 2710 <div class="product-square-meters"> 2711 @Translate("Translate_General_TranslatesTo") 2712 <span v-if="mainProduct.prices.unit.label == 'm²' || mainProduct.prices.unit.label == 'm'">{{ prettyNumber(calculateSquareMeters()) }} m<sup>2</sup></span> 2713 <span v-else-if="mainProduct.prices.unit.label == 'm³'">{{ prettyNumber(calculateCubicMeters(), 3) }} m<sup>3</sup></span> 2714 <span v-else-if="mainProduct.prices.unit.label == 'kbf'">{{ prettyNumber(calculateCubicFeet()) }} kbf</span> 2715 </div> 2716 </div> 2717 </div> 2718 <div v-for="product in pickedAcc" class="side-basket__product"> 2719 <div class="side-basket__product-head"> 2720 <div class="product-name">{{ product.name }}</div> 2721 <div class="product-price">{{ prettyPrice(product.price.unitPrice) }}</div> 2722 <div class="product-toggle" @@click="toggleState"> 2723 <span class="close">@Translate("Translate_General_Close")</span> 2724 <span class="open">@Translate("Translate_General_Open")</span> 2725 </div> 2726 </div> 2727 <div class="side-basket__product-variant"> 2728 <div class="size">{{ product.name2 }}</div> 2729 <div class="quantity">{{ product.qty }} @Translate("Translate_General_Pieces")</div> 2730 </div> 2731 </div> 2732 <div class="side-basket__summary"> 2733 <div class="price-raw"> 2734 @Translate("Translate_General_PriceWithoutVat") 2735 <span v-if="!loadingPrice">{{ prettyPrice(priceObject.totalEx) }} @priceCurrencySymbol</span> 2736 <span v-if="loadingPrice" class="loader"></span> 2737 </div> 2738 <div class="vat"> 2739 @Translate("Translate_General_Vat") 2740 <span v-if="!loadingPrice">{{ prettyPrice(priceObject.vat) }} @priceCurrencySymbol</span> 2741 <span v-if="loadingPrice" class="loader"></span> 2742 </div> 2743 <div class="price-vat"> 2744 @Translate("Translate_General_PriceWithVat") 2745 <span v-if="!loadingPrice">{{ prettyPrice(priceObject.totalInc) }} @priceCurrencySymbol</span> 2746 <span v-if="loadingPrice" class="loader"></span> 2747 </div> 2748 </div> 2749 2750 <div v-if="isLoggedIn && !enquireProduct" class="product-modal__floating-cart"> 2751 <div class="floating-cart__bar" :class="{ 'active-bar': showMobileActionBar }"> 2752 <div v-if="showMobileActionControls" class="product-modal__stock-control floating-cart__stock-control counter"> 2753 <button id="amount-subtract" @@click="currentMobileQty > 0 ? currentMobileQty-- : currentMobileQty = 0" class="substract"><span>−</span></button> 2754 <input id="amount-input" @@keyup="editMobileQty" class="amount" pattern="[0-9.]+" type="tel" data-min="0" min="0" :value="currentMobileQty"> 2755 <button id="amount-add" @@click="currentMobileQty++" class="add"><span>+</span></button> 2756 </div> 2757 <div v-if="!showMobileActionControls" @@click="showMobileBasket = !showMobileBasket" class="floating-cart__toggle cart-toggle"> 2758 <span v-if="!showMobileBasket" class="cart-toggle--open">Se kurv</span> 2759 <span v-if="showMobileBasket" class="cart-toggle--close">Luk kurv</span> 2760 </div> 2761 <div class="floating-cart__btn-wrapper"> 2762 <button v-if="currentActiveMobileButton == 'add'" class="btn btn-secondary floating-cart__btn btn--add" :class="{ disabled: currentMobileQty == 0 }" @@click="updateMobileBasket">Tilføj til kurv</button> 2763 <button v-if="currentActiveMobileButton == 'update'" class="btn btn-secondary floating-cart__btn btn--update" :class="{ disabled: (currentMobileQty == 0 && currentActiveMobileButton == 'add') || currentMobileQty == getQty(currentMobileProduct) }" @@click="updateMobileBasket">Opdatér kurv</button> 2764 <button v-if="currentActiveMobileButton == 'next'" class="btn btn-secondary floating-cart__btn btn--next" @@click="addToBasket"> 2765 <template v-if="!loading"> 2766 Gå videre 2767 </template> 2768 <span v-if="loading" class="loader"></span> 2769 </button> 2770 <button v-if="currentActiveMobileButton == 'order' && !showAccessories" class="btn btn-secondary floating-cart__btn btn--order" @@click="addToBasket"> 2771 <template v-if="!loading"> 2772 Gå til bestilling 2773 </template> 2774 <span v-if="loading" class="loader"></span> 2775 </button> 2776 <button v-if="currentActiveMobileButton == 'order' && showAccessories" class="btn btn-secondary floating-cart__btn btn--order" @@click="addAccToBasket"> 2777 <template v-if="!loading"> 2778 Gå til bestilling 2779 </template> 2780 <span v-if="loading" class="loader"></span> 2781 </button> 2782 </div> 2783 </div> 2784 </div> 2785 2786 <div class="side-basket__actions"> 2787 <template v-if="!showAccessories"> 2788 <button type="button" @@click="resetBasket" class="btn btn-link btn-link--underlined" :class="{ disabled: pickedVariants.length == 0 }">@Translate("Translate_General_EmptyCart")</button> 2789 <button type="button" :class="{ disabled: pickedVariants.length == 0 }" @@click="addToBasket" class="btn btn-secondary"> 2790 <template v-if="!loading"> 2791 @Translate("Translate_General_AddToCart") 2792 </template> 2793 <span v-if="loading" class="loader"></span> 2794 </button> 2795 </template> 2796 <template v-else> 2797 <a href="@CartPage" class="btn btn-link btn-link--underlined">@Translate("Translate_General_GoToCheckout")</a> 2798 <button type="button" @@click="addAccToBasket" class="btn btn-secondary" :class="{ disabled: pickedAcc.length == 0}"> 2799 <template v-if="!loading"> 2800 @Translate("Translate_OrderFlow_AddAccessories") 2801 </template> 2802 <span v-if="loading" class="loader"></span> 2803 </button> 2804 </template> 2805 </div> 2806 </div> 2807 </div> 2808 </div> 2809 2810 2811 @SnippetStart("JavaScripts") 2812 <script> 2813 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 2814 dataLayer.push({ 2815 event: "view_item", 2816 ecommerce: { 2817 items: [ 2818 { 2819 item_id: "@productNumber", 2820 item_name: "@productNameEncoded", 2821 } 2822 ] 2823 } 2824 }); 2825 2826 2827 2828 2829 </script> 2830 2831 2832 2833 <script async> 2834 const vueCounter = { 2835 name: "VueCounter", 2836 props: ['min', 'max'], 2837 data: () => { 2838 return { 2839 value: 0, 2840 hasError: false, 2841 } 2842 }, 2843 methods: { 2844 substract() { 2845 if(this.min || this.min === 0) { 2846 if(this.value > this.min) { 2847 this.value-- 2848 } else { 2849 this.handleError(); 2850 } 2851 } else { 2852 this.value-- 2853 } 2854 }, 2855 add() { 2856 if(this.max) { 2857 if(this.value < this.max) { 2858 this.value++ 2859 } else { 2860 this.handleError(); 2861 } 2862 } else { 2863 this.value++ 2864 } 2865 }, 2866 handleError() { 2867 this.hasError = true; 2868 setTimeout(() => { 2869 this.hasError = false; 2870 }, 1000); 2871 } 2872 }, 2873 watch: { 2874 value(newValue, oldValue) { 2875 this.$emit('valueupdate', newValue) 2876 } 2877 }, 2878 template: `<div class="vue-counter" :class="hasError ? 'counter--error' : ''" > 2879 <a class="counter__sub" @@click="substract">-</a> 2880 <input class="counter__value" type="tel" v-model="value" :disabled="value == max ? true : false"> 2881 <a class="counter__add" @@click="add">+</a> 2882 </div>` 2883 } 2884 2885 new Vue({ 2886 el: '#orderFlowApp', 2887 name: 'Bestillings flow', 2888 components: { 2889 'vue-counter': vueCounter 2890 }, 2891 computed: { 2892 lenghtUnit() { 2893 return this.sizeUnitValues[this.mainProduct.sizeUnits.length]; 2894 }, 2895 widthUnit() { 2896 return this.sizeUnitValues[this.mainProduct.sizeUnits.width]; 2897 }, 2898 thicknessUnit() { 2899 return this.sizeUnitValues[this.mainProduct.sizeUnits.thickness]; 2900 }, 2901 sortedVariants() { 2902 return this.variants.sort((a,b) => { 2903 if (a.size.length !== b.size.length) { 2904 return a.size.length - b.size.length; 2905 } else if (a.width !== b.width) { 2906 return a.width - b.width; 2907 } else { 2908 return a.thickness - b.thickness; 2909 } 2910 }).filter(x => x.size.length > 0); 2911 }, 2912 shortLengthVariants() { 2913 return this.sortedVariants?.filter(variant => variant.size.length < this.lengthThreshold); 2914 }, 2915 longLengthVariants() { 2916 return this.sortedVariants?.filter(variant => variant.size.length >= this.lengthThreshold); 2917 }, 2918 sortedBundles() { 2919 let newBundleList = []; 2920 2921 if(this.bundles.length > 0) { 2922 this.bundles.forEach(bundle => { 2923 const index = newBundleList.findIndex(x => x.bundleNo == bundle.bundleNo); 2924 2925 if(parseFloat(bundle.stock.warehouse) > 0) { 2926 if(index > -1) { 2927 newBundleList[index].productsInBundle.push( 2928 { 2929 length: bundle.length, 2930 width: bundle.width, 2931 thickness: bundle.thickness, 2932 stock: bundle.stock 2933 } 2934 ) 2935 } else { 2936 this.toggleBundles.push({ 2937 bundle: bundle.bundleNo, 2938 expanded: true, 2939 }); 2940 newBundleList.push( 2941 { 2942 bundleNo: bundle.bundleNo, 2943 productsInBundle: [ 2944 { 2945 length: bundle.length, 2946 width: bundle.width, 2947 thickness: bundle.thickness, 2948 stock: bundle.stock 2949 } 2950 ] 2951 } 2952 ) 2953 } 2954 } 2955 }) 2956 } 2957 2958 return newBundleList; 2959 }, 2960 sortedPickedVariants() { 2961 return this.pickedVariants.sort((x,y) => x.bundle - y.bundle); 2962 }, 2963 ga4Products() { 2964 let list = []; 2965 2966 this.sortedPickedVariants.forEach(product => { 2967 let productObject = {}; 2968 2969 if(product.bundle) { 2970 productObject.item_name = this.mainProduct.name; 2971 productObject.item_id = product.bundleNo; 2972 productObject.productsInBundle = product.productsInBundle; 2973 } else { 2974 productObject.item_id = product.id, 2975 productObject.item_name = this.mainProduct.name, 2976 productObject.item_variant = product.variantId, 2977 productObject.quantity = product.qty, 2978 productObject.price = this.priceObject.unitPrice 2979 } 2980 2981 list.push(productObject) 2982 }) 2983 2984 return list; 2985 }, 2986 onTheWayHome() { 2987 if(this.variants.filter(x => x.stock.pieces > 0).length > 0) { 2988 return "@Translate("Translate_General_Yes")"; 2989 } 2990 2991 return "@Translate("Translate_General_No")"; 2992 }, 2993 accessoriesList() { 2994 let list = []; 2995 2996 if(this.relatedProducts && this.relatedProducts.length > 0) { 2997 this.relatedProducts.forEach(product => { 2998 let group = this.relatedGroups.find(x => x.Id == "RELGRP1"); 2999 3000 if(group && group.Products.find(x => x.ProductId == product.Id)) { 3001 list.push(product); 3002 } 3003 }) 3004 } 3005 3006 return list; 3007 } 3008 }, 3009 mounted() { 3010 this.getVariants(@(productNumber)) 3011 @if(primaryGroup == "group1") { 3012 <text> 3013 this.lookUpBundle(@(productNumber)); 3014 </text> 3015 } 3016 3017 this.getAccessories(); 3018 3019 if(!this.enquireProduct && this.isLoggedIn) { 3020 this.orderButtonSpinner = setTimeout(() => { 3021 document.querySelector('#product-order-button .loader').style.display = "inline-block"; 3022 }, 3000); 3023 } else { 3024 document.querySelector('#product-order-button .product-order-form-button').style.display = "block"; 3025 } 3026 }, 3027 data() { 3028 return { 3029 isLoggedIn: @isloggedin.ToString().ToLower(), 3030 enquireProduct: @enquireProduct.ToString().ToLower(), 3031 lang: document.querySelector('html').getAttribute('data-lang'), 3032 loading: false, 3033 loadingPrice: false, 3034 loadingBundles: false, 3035 loadingVariants: false, 3036 orderLoader: true, 3037 orderButtonSpinner: null, 3038 timeOut: null, 3039 priceObject: { 3040 unitPrice: 0, 3041 totalEx: 0, 3042 vat: 0, 3043 totalInc: 0, 3044 corePrice: 0 3045 }, 3046 customerNumber: '@GetGlobalValue("Global:Extranet.CustomerNumber")', 3047 sizeUnitValues: { 3048 'ZOLL/00': '@Translate("Translate_Product_SizeUnit_Inch")', 3049 'ZOLL/01': '@Translate("Translate_Product_SizeUnit_Inch")', 3050 'FUß/00': '@Translate("Translate_Product_SizeUnit_Foot")', 3051 'FUß/01': '@Translate("Translate_Product_SizeUnit_Foot")', 3052 'MM/00': '@Translate("Translate_Product_SizeUnit_Millimeter")', 3053 'MM/01': '@Translate("Translate_Product_SizeUnit_Millimeter")' 3054 }, 3055 mainProduct: { 3056 name: '@productNameEncoded', 3057 id: @productNumber, 3058 number: '@Translate("Translate_Product_Page_ProductNumber"): @productNumber', 3059 dbNumber: '@GetString("Ecom:Product:Field.ProductDbNumber.Name"): @GetString("Ecom:Product:Field.ProductDbNumber.Value")', 3060 width: '@GetString("Ecom:Product:Field.ProductWidthSale.Value.Raw")', 3061 thickness: '@GetString("Ecom:Product:Field.ProductThicknessSale.Value.Raw")', 3062 image: '@GetString("Ecom:Product.ImageDefault.Clean")', 3063 size: @Json.Encode(GetString("Ecom:Product:Field.Name2")), 3064 hasAnbrud: @hasAnbrud.ToString().ToLower(), 3065 prices: { 3066 unit: { 3067 code: "@salesUnitCode", 3068 label: "@salesUnit" 3069 }, 3070 standard: @standardPriceJS, 3071 above100: @above100PriceJS, 3072 bundle: @bundlePriceJS 3073 }, 3074 sizeUnits: { 3075 length: '@GetString("Ecom:Product:Field.ProductLengthUnitCode.Value")', 3076 width: '@GetString("Ecom:Product:Field.ProductWidthUnitCode.Value")', 3077 thickness: '@GetString("Ecom:Product:Field.ProductThicknessUnitCode.Value")', 3078 } 3079 }, 3080 relatedGroups: null, 3081 relatedProducts: null, 3082 lengthThreshold: 3000, // <-- Field in DW? 3083 variants: [], 3084 showAccessories: false, 3085 showStep1: false, 3086 showBundles: false, 3087 bundles: [], 3088 pickedVariants: [], 3089 productsAdded: 0, 3090 pickedAcc: [], 3091 currentMobileProduct: '', 3092 showMobileBasket: false, 3093 showMobileActionBar: false, 3094 showMobileActionControls: false, 3095 currentActiveMobileButton: 'none', 3096 currentMobileQty: 0, 3097 toggleBundles: [], 3098 } 3099 }, 3100 methods: { 3101 doesCookieExist(cookieName) { 3102 const cookies = document.cookie.split('; '); 3103 const cookieExists = cookies.some(cookie => cookie.startsWith(cookieName + '=')); 3104 return cookieExists; 3105 }, 3106 setCookie(name, value, days) { 3107 let expires = ""; 3108 if (days) { 3109 const date = new Date(); 3110 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 3111 expires = "; expires=" + date.toUTCString(); 3112 } 3113 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 3114 }, 3115 deleteCookie(name) { 3116 document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 3117 }, 3118 async getAccessories() { 3119 await fetch(`/dwapi/ecommerce/products/@(productNumber)`) 3120 .then(response => response.json()) 3121 .then(response => { 3122 this.relatedGroups = response.RelatedGroups; 3123 }) 3124 3125 await fetch(`/dwapi/ecommerce/products/@(productNumber)/related`) 3126 .then(response => response.json()) 3127 .then(response => { 3128 if(response.TotalProductsCount > 0) { 3129 this.relatedProducts = response.Products; 3130 } 3131 }) 3132 .catch(error => { 3133 console.log(error) 3134 }) 3135 }, 3136 getVariants: async function(productNo, url) { 3137 this.loadingVariants = true; 3138 let requestUrl = `@(VariantsLookup)&ICC_itemId=${productNo}`; 3139 3140 if(url && url != "") { 3141 requestUrl = url; 3142 } 3143 3144 if(!this.isLoggedIn) { 3145 if(requestUrl.indexOf('username') < 0) { 3146 requestUrl += '&[email protected]&password=Keflico10000%'; 3147 } 3148 3149 if (!this.doesCookieExist('tempLogin')) { 3150 this.setCookie('tempLogin', true, 1); 3151 } 3152 } 3153 3154 let credentials = this.isLoggedIn ? "same-origin" : "omit" 3155 3156 fetch(requestUrl, { 3157 credentials: credentials 3158 }) 3159 .then(response => response.json()) 3160 .then(response => { 3161 if(response.variants && response.variants.length > 0) { 3162 this.variants = this.variants.concat(response.variants); 3163 3164 this.orderLoader = false; 3165 3166 if(response.nextPage != "") { 3167 this.getVariants(productNo, response.nextPage); 3168 } else { 3169 this.loadingVariants = false; 3170 3171 if(!this.isLoggedIn) { 3172 fetch('/Admin/Public/ExtranetLogoff.aspx'); 3173 } 3174 } 3175 } else { 3176 this.loadingVariants = false; 3177 3178 if(!this.loadingBundles) { 3179 clearTimeout(this.orderButtonSpinner); 3180 3181 var productOrderFormButton = document.querySelector('#product-order-button .product-order-form-button'); 3182 if (productOrderFormButton) { 3183 productOrderFormButton.style.display = "block"; 3184 } 3185 3186 var productOrderButtonLoader = document.querySelector('#product-order-button .loader'); 3187 if (productOrderButtonLoader) { 3188 productOrderButtonLoader.style.display = "none"; 3189 } 3190 } 3191 } 3192 }) 3193 }, 3194 lookUpBundle: async function(productNo, url) { 3195 this.loadingBundles = true; 3196 let requestUrl = `@(BundleLookup)&ICC_itemId=${productNo}`; 3197 3198 if(url && url != "") { 3199 requestUrl = url; 3200 } 3201 3202 if(!this.isLoggedIn) { 3203 if(requestUrl.indexOf('username') < 0) { 3204 requestUrl += '&[email protected]&password=Keflico10000%'; 3205 } 3206 3207 if (!this.doesCookieExist('tempLogin')) { 3208 this.setCookie('tempLogin', true, 1); 3209 } 3210 } 3211 3212 let credentials = this.isLoggedIn ? "same-origin" : "omit" 3213 3214 fetch(requestUrl, { 3215 credentials: credentials 3216 }) 3217 .then(response => response.json()) 3218 .then(response => { 3219 if(response.bundles && response.bundles.length > 0) { 3220 3221 if(response.currentPage = 1) { 3222 this.showBundles = true; 3223 } 3224 3225 this.orderLoader = false; 3226 } else { 3227 if(!this.loadingVariants) { 3228 clearTimeout(this.orderButtonSpinner); 3229 document.querySelector('#product-order-button .product-order-form-button').style.display = "block"; 3230 document.querySelector('#product-order-button .loader').style.display = "none"; 3231 } 3232 } 3233 3234 this.bundles = this.bundles.concat(response.bundles); 3235 3236 if(response.nextPage != "") { 3237 this.lookUpBundle(productNo, response.nextPage); 3238 } else { 3239 this.loadingBundles = false; 3240 3241 if(!this.isLoggedIn) { 3242 fetch('/Admin/Public/ExtranetLogoff.aspx'); 3243 } 3244 } 3245 }) 3246 }, 3247 tempPriceUpdate() { 3248 let totalAccPrice = 0; 3249 3250 this.pickedAcc.forEach(acc => { 3251 totalAccPrice += parseFloat(acc.price.exVat.replace(',', '')) 3252 }) 3253 3254 this.priceObject.totalEx = parseFloat(this.priceObject.corePrice) + totalAccPrice; 3255 this.priceObject.vat = parseFloat(this.priceObject.totalEx) * 0.25; 3256 this.priceObject.totalInc = parseFloat(this.priceObject.totalEx) * 1.25; 3257 }, 3258 priceLookUp: async function() { 3259 let x = 1; 3260 let y = 1; 3261 let queryString = "&ICC_userId=" + this.customerNumber + "&ICC_itemId=" + this.mainProduct.id; 3262 3263 this.pickedVariants.forEach(variant => { 3264 if(variant.bundle) { 3265 queryString += "&ICC_bundle" + y + "=" + variant.bundleNo; 3266 3267 y++; 3268 } else { 3269 queryString += "&ICC_variant" + x + "=" + variant.id; 3270 queryString += "&ICC_quantity" + x + "=" + variant.qty; 3271 3272 x++; 3273 } 3274 }) 3275 3276 fetch(`@(PriceLookup)${queryString}`) 3277 .then(response => response.json()) 3278 .then(response => { 3279 this.priceObject.corePrice = parseFloat(response.totalPriceWithoutVat.replace(",", "")); 3280 this.priceObject.unitPrice = response.unitPrice; 3281 this.priceObject.totalEx = response.totalPriceWithoutVat; 3282 this.priceObject.vat = response.vat; 3283 this.priceObject.totalInc = response.totalPriceWithVat; 3284 3285 this.loadingPrice = false; 3286 }) 3287 }, 3288 toggleBundle(bundleNo) { 3289 this.toggleBundles.find(x => x.bundle == bundleNo).expanded = !this.toggleBundles.find(x => x.bundle == bundleNo).expanded; 3290 }, 3291 isExpanded(bundleNo) { 3292 return this.toggleBundles.find(x => x.bundle == bundleNo).expanded; 3293 }, 3294 getQty(variantId) { 3295 let product = this.pickedVariants.find(x => x.id == variantId || x.bundleNo == variantId); 3296 let acc = this.pickedAcc.find(x => x.id == variantId); 3297 3298 if(product || acc) { 3299 if(product) { 3300 if(product.bundle) { 3301 return 1; 3302 } 3303 3304 return product.qty; 3305 } else { 3306 return acc.qty; 3307 } 3308 } else { 3309 return 0; 3310 } 3311 }, 3312 toggleBar(productId) { 3313 let product = this.accessoriesList.find(x => x.Id == productId); // product is acc 3314 3315 if((product && product.Price.Price && product.Price.Price > 0 && !product.VariantInfo.VariantInfo) || !product) { 3316 if(this.currentMobileProduct != productId) { 3317 this.currentMobileProduct = productId; 3318 this.showMobileActionBar = true; 3319 this.showMobileActionControls = true; 3320 3321 if(this.pickedVariants.find(x => x.id == productId)) { 3322 this.currentActiveMobileButton = 'update'; 3323 this.currentMobileQty = this.pickedVariants.find(x => x.id == productId).qty; 3324 } else if(this.pickedAcc.find(x => x.id == productId)) { 3325 this.currentActiveMobileButton = 'update'; 3326 this.currentMobileQty = this.pickedAcc.find(x => x.id == productId).qty; 3327 } else { 3328 this.currentActiveMobileButton = 'add'; 3329 this.currentMobileQty = 0; 3330 } 3331 } else { 3332 this.currentMobileProduct = ''; 3333 this.showMobileActionControls = false; 3334 3335 if(this.pickedVariants.length == 0) { 3336 this.showMobileActionBar = false; 3337 } 3338 3339 if(this.showAccessories || this.accessoriesList.length == 0) { 3340 this.currentActiveMobileButton = 'order'; 3341 } else { 3342 this.currentActiveMobileButton = 'next'; 3343 } 3344 } 3345 } 3346 }, 3347 addToTempCart(amount, id) { 3348 this.loadingPrice = true; 3349 clearTimeout(this.timeOut); 3350 3351 if(this.pickedVariants.filter(x => x.id == id).length > 0) { 3352 if(amount > 0) { 3353 this.pickedVariants.find(x => x.id == id).qty = amount; 3354 } else { 3355 const index = this.pickedVariants.findIndex(x => x.id == id); 3356 this.pickedVariants.splice(index, 1); 3357 } 3358 } else { 3359 if(amount > 0) { 3360 const data = this.sortedVariants.find(x => x.id == id); 3361 3362 this.pickedVariants.push({ 3363 bundle: false, 3364 id: id, 3365 qty: parseInt(amount), 3366 length: data.size.length, 3367 width: data.size.width, 3368 thickness: data.size.thickness, 3369 variantId: data.id 3370 }); 3371 } 3372 } 3373 3374 if(this.pickedVariants.length > 0) { 3375 this.timeOut = setTimeout(() => { 3376 this.priceLookUp(); 3377 }, 1000); 3378 } else { 3379 this.priceObject.totalEx = 0; 3380 this.priceObject.totalInc = 0; 3381 this.priceObject.vat = 0; 3382 this.priceObject.unitPrice = 0; 3383 3384 this.loadingPrice = false; 3385 } 3386 }, 3387 editMobileQty($event) { 3388 this.currentMobileQty = $event.target.value 3389 }, 3390 updateMobileBasket() { 3391 let productToUpdate = this.sortedVariants.find(x => x.id == this.currentMobileProduct); 3392 3393 if(!productToUpdate) { 3394 productToUpdate = this.sortedBundles.find(x => x.bundleNo == this.currentMobileProduct); 3395 } 3396 3397 if(productToUpdate) { 3398 if(productToUpdate.bundleNo) { 3399 this.addBundleToTempCart(1, this.currentMobileProduct); 3400 } else { 3401 this.addToTempCart(this.currentMobileQty, this.currentMobileProduct); 3402 } 3403 3404 this.showMobileActionControls = false; 3405 this.currentMobileProduct = ''; 3406 3407 if(this.accessoriesList.length == 0) { 3408 this.currentActiveMobileButton = 'order'; 3409 } else { 3410 this.currentActiveMobileButton = 'next'; 3411 } 3412 } else { 3413 productToUpdate = this.accessoriesList.find(x => x.id == this.currentMobileProduct); 3414 3415 this.addAcc(this.currentMobileQty, this.currentMobileProduct); 3416 3417 this.showMobileActionControls = false; 3418 this.currentMobileProduct = ''; 3419 this.currentActiveMobileButton = 'order'; 3420 } 3421 }, 3422 addBundleToTempCart(amount, bundleNo) { 3423 this.loadingPrice = true; 3424 clearTimeout(this.timeOut); 3425 3426 if(amount > 0) { 3427 this.pickedVariants.push({ 3428 bundle: true, 3429 bundleNo: bundleNo, 3430 productsInBundle: this.sortedBundles.filter(x => x.bundleNo == bundleNo)[0].productsInBundle 3431 }) 3432 } else { 3433 const index = this.pickedVariants.findIndex(x => x.bundleNo == bundleNo); 3434 this.pickedVariants.splice(index, 1); 3435 } 3436 3437 if(this.pickedVariants.length > 0) { 3438 this.timeOut = setTimeout(() => { 3439 this.priceLookUp(); 3440 }, 1000); 3441 } else { 3442 this.priceObject.totalEx = 0; 3443 this.priceObject.totalInc = 0; 3444 this.priceObject.vat = 0; 3445 this.priceObject.unitPrice = 0; 3446 3447 this.loadingPrice = false; 3448 } 3449 }, 3450 updateAccButton(amount, productNumber) { 3451 if((amount > 0 && (!this.pickedAcc.find(x => x.id == productNumber) || amount != this.pickedAcc.find(x => x.id == productNumber).qty)) || (this.pickedAcc.find(x => x.id == productNumber) && amount != this.pickedAcc.find(x => x.id == productNumber).qty)) { 3452 this.$refs['confirmBtn' + productNumber][0].classList.remove('disabled') 3453 } else { 3454 this.$refs['confirmBtn' + productNumber][0].classList.add('disabled') 3455 } 3456 }, 3457 addAcc(event, productNumber) { 3458 let product = this.pickedAcc.find(x => x.id == productNumber); 3459 let qty = typeof event == 'number' ? event : this.$refs['accCounter' + productNumber][0].value; 3460 3461 let queryString = `&ICC_userId=${this.customerNumber}&ICC_itemId=${productNumber}&ICC_quantity1=`; 3462 3463 if(product) { 3464 if(qty > 0) { 3465 product.qty = qty; 3466 queryString += product.qty; 3467 } else { 3468 this.pickedAcc.splice(this.pickedAcc.findIndex(x => x.id == product.id), 1); 3469 } 3470 } else { 3471 this.pickedAcc.push({ 3472 id: productNumber, 3473 name: this.accessoriesList.find(x => x.Number == productNumber).Name, 3474 name2: this.accessoriesList.find(x => x.Number == productNumber).ProductFields.Name2.Value, 3475 qty: qty, 3476 price: { 3477 exVat: 0, 3478 vat: 0, 3479 withVat: 0, 3480 unitPrice: 0 3481 } 3482 }) 3483 3484 queryString += qty; 3485 } 3486 3487 if(qty > 0) { 3488 fetch(`/Default.aspx?ID=1115${queryString}`) 3489 .then(response => response.json()) 3490 .then(response => { 3491 if(product) { 3492 product.price.exVat = response.totalPriceWithoutVat; 3493 product.price.vat = response.vat; 3494 product.price.withVat = response.totalPriceWithVat; 3495 product.price.unitPrice = response.unitPrice; 3496 } else { 3497 const newProduct = this.pickedAcc.at(-1); 3498 3499 newProduct.price.exVat = response.totalPriceWithoutVat; 3500 newProduct.price.vat = response.vat; 3501 newProduct.price.withVat = response.totalPriceWithVat; 3502 newProduct.price.unitPrice = response.unitPrice; 3503 } 3504 3505 this.tempPriceUpdate(); 3506 }) 3507 } else { 3508 this.tempPriceUpdate(); 3509 } 3510 3511 this.$refs['confirmBtn' + productNumber][0].classList.add('disabled'); 3512 }, 3513 prettyNumber(number, minDigits) { 3514 return parseFloat(number).toLocaleString(this.lang, { minimumFractionDigits: minDigits ? minDigits : 0 }) 3515 }, 3516 prettyPrice(price) { 3517 let rawPrice = price; 3518 3519 if(typeof price == "string" && (price.split(".").length - 1 > 1 || (price.indexOf(".") == 1 && price.length > 4) || (price.indexOf(".") == 2 && price.length >= 6) || (price.indexOf(".") == 3 && price.length > 6))) { 3520 // Price is over 1000 in danish format 3521 3522 rawPrice = rawPrice.replaceAll(".", ""); 3523 rawPrice = rawPrice.replaceAll(",", "."); 3524 } else if(typeof price == "string" && (price.split(",").length - 1 > 1 || (price.indexOf(",") == 1 && price.length > 4) || (price.indexOf(",") == 2 && price.length >= 6) || (price.indexOf(",") == 3 && price.length > 6))) { 3525 // Price is over 1000 in english format 3526 3527 rawPrice = rawPrice.replaceAll(",", ""); 3528 } 3529 3530 rawPrice = parseFloat(rawPrice); 3531 return rawPrice.toLocaleString(this.lang, { minimumFractionDigits: 2, maximumFractionDigits: 2 } ) 3532 }, 3533 calculateStockLevel(stock) { 3534 if(this.isLoggedIn && stock >= 0) { 3535 return stock > 500 ? '+500' : stock; 3536 } else { 3537 return stock > 100 ? '+100' : stock; 3538 } 3539 3540 return 0; 3541 }, 3542 toggleState($event) { 3543 $event.target.closest('.side-basket__product').classList.toggle('closed'); 3544 }, 3545 openForm(e) { 3546 document.querySelector('.product-modal').classList.remove('js-slide-in'); 3547 3548 const toggleTrigger = e.currentTarget; 3549 const target = document.querySelector(toggleTrigger.getAttribute('data-target')); 3550 3551 if (target) { 3552 disableScrollLock() 3553 history.back(); 3554 3555 if (!target.classList.contains('js-open')) { 3556 toggleTrigger.classList.add('js-open'); 3557 target.classList.add('js-open'); 3558 target.style.height = `${target.scrollHeight}px`; 3559 3560 if (toggleTrigger.getAttribute('data-action-scroll') != 'no-scroll') { 3561 setTimeout(function() { 3562 target.scrollIntoView({behavior: 'smooth'}); 3563 },300); 3564 } 3565 3566 if (target.classList.contains('dialog')) { 3567 document.querySelector('body').style.overflow = 'hidden'; 3568 } 3569 } else { 3570 toggleTrigger.classList.remove('js-open'); 3571 target.classList.remove('js-open'); 3572 target.style.height = null; 3573 3574 if (target.classList.contains('dialog')) { 3575 document.querySelector('body').style.overflow = null; 3576 } 3577 } 3578 } 3579 }, 3580 calculateMeters() { 3581 let meters = 0; 3582 3583 this.pickedVariants.forEach(variant => { 3584 let length = variant['length']; 3585 3586 if(this.mainProduct.sizeUnits.length.indexOf('FUß') > -1) { 3587 length = length * 304.8; 3588 } 3589 3590 let variantMeters = parseFloat(length) * variant.qty / 1000; 3591 meters += variantMeters; 3592 }) 3593 3594 return parseFloat(meters).toFixed(3); 3595 }, 3596 calculatePieces() { 3597 let pieces = 0; 3598 3599 this.pickedVariants.forEach(variant => { 3600 if(variant.bundle) { 3601 variant.productsInBundle.forEach(product => { 3602 pieces += parseInt(product.stock.units); 3603 }) 3604 } else { 3605 pieces += parseInt(variant.qty); 3606 } 3607 }); 3608 3609 return pieces; 3610 }, 3611 calculateSquareMeters() { 3612 return parseFloat(this.calculateMeters() * (this.mainProduct.width / 1000)).toFixed(3); 3613 }, 3614 calculateCubicMeters() { 3615 let cubicMeters = 0; 3616 3617 this.pickedVariants.forEach(variant => { 3618 let variantMeters = 0; 3619 3620 let lengthMultiplier = 1; 3621 let widthMultiplier = 1; 3622 let thicknessMultiplier = 1; 3623 3624 if(this.mainProduct.sizeUnits.length.indexOf('FUß') > -1) { 3625 lengthMultiplier = 304.79999025; 3626 } 3627 3628 if(this.mainProduct.sizeUnits.width.indexOf('ZOLL') > -1) { 3629 widthMultiplier = 25.39998628; 3630 } 3631 3632 if(this.mainProduct.sizeUnits.thickness.indexOf('ZOLL') > -1) { 3633 thicknessMultiplier = 25.39998628 3634 } 3635 3636 if(variant.bundle) { 3637 variant.productsInBundle.forEach(product => { 3638 variantMeters += (parseFloat(product.length.replace(",", "") * lengthMultiplier / 1000) * parseFloat(product.thickness * thicknessMultiplier / 1000) * parseFloat(product.width * widthMultiplier) / 1000) * parseInt(product.stock.units); 3639 }) 3640 } else { 3641 variantMeters += (parseFloat(variant['length'] / 1000) * parseFloat(variant['thickness'] / 1000) * parseFloat(variant['width']) / 1000) * variant.qty; 3642 } 3643 3644 cubicMeters += variantMeters; 3645 }) 3646 3647 return cubicMeters; 3648 }, 3649 calculateCubicFeet() { 3650 let cubicFeet = 0; 3651 3652 this.pickedVariants.forEach(variant => { 3653 let variantMeters = 0; 3654 3655 let lengthMultiplier = 1; 3656 let widthMultiplier = 1; 3657 let thicknessMultiplier = 1; 3658 3659 if(this.mainProduct.sizeUnits.length.indexOf('FUß') > -1) { 3660 lengthMultiplier = 304.79999025; 3661 } 3662 3663 if(this.mainProduct.sizeUnits.width.indexOf('ZOLL') > -1) { 3664 widthMultiplier = 25.39998628; 3665 } 3666 3667 if(this.mainProduct.sizeUnits.thickness.indexOf('ZOLL') > -1) { 3668 thicknessMultiplier = 25.39998628 3669 } 3670 3671 if(variant.bundle) { 3672 variant.productsInBundle.forEach(product => { 3673 let lengthMM = product.length.replace(",", "") * lengthMultiplier; 3674 let lengthM = lengthMM / 1000; 3675 let widthMM = product.width * widthMultiplier; 3676 let widthM = widthMM / 1000; 3677 let thicknessMM = product.thickness * thicknessMultiplier; 3678 let thicknessM = thicknessMM / 1000; 3679 3680 variantMeters += Number(parseFloat(lengthM * widthM * thicknessM * 35.32 * product.stock.units)) 3681 }) 3682 } else { 3683 variantMeters += ((parseFloat(variant['length'] * lengthMultiplier / 1000) * parseFloat(variant['thickness'] * thicknessMultiplier / 1000) * parseFloat(variant['width'] * widthMultiplier / 1000)) * variant.qty); 3684 } 3685 3686 cubicFeet += Number(variantMeters); 3687 }) 3688 3689 return Number(cubicFeet).toFixed(2); 3690 }, 3691 calculateTotalQTY() { 3692 let qty = 0; 3693 3694 this.pickedVariants.forEach(variant => { 3695 qty += variant.qty; 3696 }); 3697 3698 return qty; 3699 }, 3700 resetBasket() { 3701 this.showAccessories = false; 3702 this.pickedVariants = []; 3703 this.showStep1 = true; 3704 this.pickedAcc = []; 3705 this.priceObject.unitPrice = 0; 3706 this.priceObject.totalEx = 0; 3707 this.priceObject.vat = 0; 3708 this.priceObject.totalInc = 0; 3709 this.priceObject.corePrice = 0; 3710 3711 Array.from(this.$refs.counter).forEach(counter => { 3712 counter.value = 0; 3713 }); 3714 }, 3715 async addToBasket() { 3716 this.loading = true; 3717 var params = new FormData(); 3718 3719 params.append('CartCmd', "addMulti") 3720 3721 this.pickedVariants.forEach((variant, index) => { 3722 var productLoopCounter = index + 1; 3723 3724 if(variant.bundle) { 3725 params.append('ProductLoopCounter' + productLoopCounter, productLoopCounter); 3726 params.append('ProductID' + productLoopCounter, this.mainProduct.id); 3727 params.append('Quantity' + productLoopCounter, 1); 3728 params.append('EcomOrderLineFieldInput_BundleNo' + productLoopCounter, variant.bundleNo); 3729 params.append('EcomOrderLineFieldInput_HasAnbrud' + productLoopCounter, this.mainProduct.hasAnbrud); 3730 } else { 3731 params.append('ProductLoopCounter' + productLoopCounter, productLoopCounter); 3732 params.append('ProductID' + productLoopCounter, this.mainProduct.id); 3733 params.append('VariantID' + productLoopCounter, variant.variantId); 3734 params.append('Quantity' + productLoopCounter, parseInt(variant.qty)); 3735 params.append('EcomOrderLineFieldInput_HasAnbrud' + productLoopCounter, this.mainProduct.hasAnbrud); 3736 } 3737 }) 3738 const config = { 3739 method: 'POST', 3740 body: params 3741 } 3742 3743 this.productsAdded = this.pickedVariants.length; 3744 3745 const response = await fetch('@formAction' + '&redirect=false', config) 3746 3747 if (response.ok) { 3748 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 3749 dataLayer.push({ 3750 event: "add_to_cart", 3751 ecommerce: { 3752 currency: "@GetString("Ecom:Product.Currency.Code")", 3753 value: this.priceObject.totalEx, 3754 items: this.ga4Products 3755 } 3756 }); 3757 3758 if(this.accessoriesList.length > 0) { 3759 this.showAccessories = true; 3760 this.loading = false; 3761 this.currentActiveMobileButton = 'order'; 3762 } else { 3763 window.location.href = "@formAction"; 3764 } 3765 3766 showStep1 = false; 3767 } else { 3768 console.log(response) 3769 } 3770 }, 3771 async addAccToBasket() { 3772 this.loading = true; 3773 var params = new FormData(); 3774 3775 params.append('CartCmd', "addMulti") 3776 3777 this.pickedAcc.forEach((variant, index) => { 3778 var productLoopCounter = index + 1; 3779 3780 params.append('ProductLoopCounter' + productLoopCounter, productLoopCounter); 3781 params.append('ProductID' + productLoopCounter, variant.id); 3782 params.append('Quantity' + productLoopCounter, variant.qty); 3783 }) 3784 const config = { 3785 method: 'POST', 3786 body: params 3787 } 3788 3789 const response = await fetch('@formAction' + '&redirect=false', config) 3790 3791 if (response.ok) { 3792 window.location.href = "@formAction"; 3793 } else { 3794 console.log(response) 3795 } 3796 } 3797 }, 3798 watch: { 3799 orderLoader(newValue, oldValue) { 3800 if(!newValue && !this.enquireProduct && this.isLoggedIn) { 3801 clearTimeout(this.orderButtonSpinner); 3802 document.querySelector('#product-order-button .product-order-button').style.display = "block"; 3803 document.querySelector('#product-order-button .loader').style.display = "none"; 3804 } 3805 } 3806 } 3807 }); 3808 </script> 3809 @SnippetEnd("JavaScripts") 3810 } 3811 3812 3813 3814 <script> 3815 let changingFavorite = false; 3816 const productNumber = "@productNumber"; 3817 const shouldRefreshFavorite = '@shouldRefreshFavorite' === 'true'; 3818 3819 function updateFavoriteUI(isAdding) { 3820 document.getElementById("favoriteAdd").style.display = isAdding ? "none" : ""; 3821 document.getElementById("favoriteRemove").style.display = isAdding ? "" : "none"; 3822 3823 let favorite = document.getElementsByClassName("favorite-qty")[0]; 3824 if (favorite) { 3825 let count = Number(favorite.getAttribute("data-count")); 3826 count += isAdding ? 1 : -1; 3827 count = Math.max(0, count); // Ensure count doesn't go below 0 3828 favorite.setAttribute("data-count", count); 3829 favorite.innerHTML = count; 3830 } 3831 } 3832 3833 async function changeFavoriteStatus(isAdding) { 3834 if (changingFavorite) return; 3835 changingFavorite = true; 3836 3837 const action = isAdding ? "addproducttofavoritelist" : "RemoveProductFromFavoriteList"; 3838 const url = `${location.protocol}//${location.host}?FavoriteCmd=${action}&ProductId=${productNumber}`; 3839 3840 try { 3841 const response = await fetch(url); 3842 if (!response.ok) throw new Error('Network response was not ok'); 3843 3844 if (shouldRefreshFavorite) { 3845 location.reload(); 3846 } else { 3847 updateFavoriteUI(isAdding); 3848 } 3849 } catch (error) { 3850 console.error('Error changing favorite status:', error); 3851 // Optionally, show an error message to the user 3852 } finally { 3853 changingFavorite = false; 3854 } 3855 } 3856 3857 function favoriteAdd() { 3858 changeFavoriteStatus(true); 3859 } 3860 3861 function favoriteRemove() { 3862 changeFavoriteStatus(false); 3863 } 3864 </script> 3865 3866 <script type="application/ld+json"> 3867 @Newtonsoft.Json.JsonConvert.SerializeObject(productSchema, Newtonsoft.Json.Formatting.Indented, productSchemaSettings) 3868 </script> 3869 <script type="application/ld+json"> 3870 @Newtonsoft.Json.JsonConvert.SerializeObject(breadcrumbSchema, Newtonsoft.Json.Formatting.Indented, productSchemaSettings) 3871 </script> 3872 3873 @functions { 3874 private string GetFileIcon(string fileUrl) 3875 { 3876 string extension = Path.GetExtension(fileUrl)?.ToLower(); 3877 3878 if (string.IsNullOrEmpty(extension)) 3879 return System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/file.svg")); 3880 3881 switch (extension) 3882 { 3883 case ".pdf": 3884 return System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/file.svg")); 3885 case ".jpg": 3886 case ".jpeg": 3887 case ".png": 3888 case ".gif": 3889 case ".webp": 3890 return @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/image.svg")); 3891 default: 3892 return System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/files/templates/designs/keflico/assets/svg/product/file.svg")); 3893 } 3894 } 3895 3896 public List<string> GetFilters(string GroupId) 3897 { 3898 List<string> filters = new List<string>(); 3899 3900 switch (GroupId) 3901 { 3902 case "group1": 3903 filters.Add("10"); 3904 filters.Add("11"); 3905 break; 3906 case "group32": 3907 filters.Add("17"); 3908 break; 3909 case "group52": 3910 filters.Add("12"); 3911 filters.Add("13"); 3912 filters.Add("14"); 3913 filters.Add("16"); 3914 break; 3915 case "group53": 3916 filters.Add("14"); 3917 break; 3918 case "group56": 3919 filters.Add("16"); 3920 break; 3921 case "group61": 3922 case "group67": 3923 filters.Add("12"); 3924 break; 3925 case "group63": 3926 filters.Add("13"); 3927 break; 3928 case "group73": 3929 filters.Add("18"); 3930 break; 3931 case "group129": 3932 filters.Add("6"); 3933 break; 3934 default: 3935 filters.Add(""); 3936 break; 3937 } 3938 3939 return filters; 3940 } 3941 3942 public string BuildFilterString(string group) 3943 { 3944 string filter = ""; 3945 List<string> ids = GetFilters(group); 3946 3947 if (group == "group126") 3948 { 3949 3950 } 3951 else if (group == "group129") 3952 { 3953 foreach (var id in ids) 3954 { 3955 filter += filter == "" ? "Types contains \"" + id + "\"" : " or Types contains \"" + id + "\""; 3956 } 3957 } 3958 else 3959 { 3960 foreach (var id in ids) 3961 { 3962 filter += filter == "" ? "WoodTypes contains \"" + id + "\"" : " or WoodTypes contains \"" + id + "\""; 3963 } 3964 } 3965 3966 return filter; 3967 } 3968 } 3969