| Fragt | |||
| Total Moms |
|
||
| Total inkl. moms |
Error executing template "Designs/Dwsimple/eCom/Product/Product.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at Hounisen.Website.Helpers.GroupHelper.GetParentsRecursively(Group group, List`1 groupNames) in D:\projects\DW9\hounisen-web\hounisen\Hounisen.Website\Helpers\GroupHelper.cs:line 16 at CompiledRazorTemplates.Dynamic.RazorEngine_bee9fa6f81f248b38c35f75c94ea64d2.Execute() in D:\web\hounisen\Hounisen.Website\Files\Templates\Designs\Dwsimple\eCom\Product\Product.cshtml:line 822 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.Net; 3 @using System.Globalization; 4 @using System.Text.RegularExpressions; 5 @using Dynamicweb; 6 @using Dynamicweb.Rendering; 7 @using Dynamicweb.Security.UserManagement; 8 @using System.IO; 9 @using Dynamicweb.Content 10 @using Dynamicweb.Core; 11 @using Dynamicweb.Ecommerce.Products 12 @using Hounisen.Website.Helpers 13 @using HtmlAgilityPack 14 @using VestjyskMarketing.Models; 15 @using Website.Hounisen.Helpers; 16 17 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 18 19 @using System.Globalization 20 @using Dynamicweb.Content 21 @using Dynamicweb.Ecommerce 22 @using Dynamicweb.Ecommerce.Products 23 @using Dynamicweb.Security.UserManagement 24 @using Hounisen.Website.Helpers 25 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 26 27 @using System.Text.RegularExpressions 28 @using System.Web 29 30 31 @functions{ 32 public class WrapMethods 33 { 34 //Gets the contrasting color 35 public static string getContrastYIQ(string hexcolor) 36 { 37 if (hexcolor != "") 38 { 39 hexcolor = Regex.Replace(hexcolor, "[^0-9a-zA-Z]+", ""); 40 41 int r = Convert.ToByte(hexcolor.Substring(0, 2), 16); 42 int g = Convert.ToByte(hexcolor.Substring(2, 2), 16); 43 int b = Convert.ToByte(hexcolor.Substring(4, 2), 16); 44 int yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; 45 46 if (yiq >= 128) 47 { 48 return "black"; 49 } 50 else 51 { 52 return "white"; 53 } 54 } 55 else 56 { 57 return "black"; 58 } 59 } 60 61 62 //Truncate text 63 public static string Truncate (string value, int count, bool strip=true) 64 { 65 if (strip == true){ 66 value = StripHtmlTagByCharArray(value); 67 } 68 69 if (value.Length > count) 70 { 71 value = value.Substring(0, count - 1) + "..."; 72 } 73 74 return value; 75 } 76 77 78 //Strip text from HTML 79 public static string StripHtmlTagByCharArray(string htmlString) 80 { 81 char[] array = new char[htmlString.Length]; 82 int arrayIndex = 0; 83 bool inside = false; 84 85 for (int i = 0; i < htmlString.Length; i++) 86 { 87 char let = htmlString[i]; 88 if (let == '<') 89 { 90 inside = true; 91 continue; 92 } 93 if (let == '>') 94 { 95 inside = false; 96 continue; 97 } 98 if (!inside) 99 { 100 array[arrayIndex] = let; 101 arrayIndex++; 102 } 103 } 104 return new string(array, 0, arrayIndex); 105 } 106 107 //Make the correct count of columns 108 public static string ColumnMaker(int Col, string ScreenSize) 109 { 110 string Columns = ""; 111 112 switch (Col) 113 { 114 case 1: 115 Columns = "col-"+ScreenSize+"-12"; 116 break; 117 118 case 2: 119 Columns = "col-"+ScreenSize+"-6"; 120 break; 121 122 case 3: 123 Columns = "col-"+ScreenSize+"-4"; 124 break; 125 126 case 4: 127 Columns = "col-"+ScreenSize+"-3"; 128 break; 129 130 default: 131 Columns = "col-"+ScreenSize+"-3"; 132 break; 133 } 134 135 return Columns; 136 } 137 138 139 private string Custom(string firstoption, string secondoption) 140 { 141 if (firstoption == "custom") 142 { 143 return secondoption; 144 } 145 else 146 { 147 return firstoption; 148 } 149 } 150 } 151 } 152 153 154 155 156 157 158 @helper GetProductList(dynamic Loop, int ColMD = 3, int ColSM = 3, int ColXS = 1) 159 { 160 int Count = 0; 161 162 int index = 1; 163 164 var embeddedScript = GetString("Ecom:Group:Field.ProductEmbeddedScript"); 165 var embedIndex = GetInteger("Ecom:Group:Field.EmbedScriptStartingIndex"); 166 167 IFormatProvider jsNumberFormat = new NumberFormatInfo() { NumberDecimalSeparator = ".", NumberGroupSeparator = "" }; 168 169 170 var groupService = new GroupService(); 171 var productService = new ProductService(); 172 var pageService = new PageService(); 173 174 // SKI AND Region H 175 bool hasSkiDeal = false; 176 bool hasRegionHDeal = false; 177 bool activateLimitedProducts = false; 178 string limitedProductNumbers = ""; 179 var currentUser = User.GetCurrentExtranetUser(); 180 if (currentUser != null) 181 { 182 var skiGroup = currentUser.Groups.FirstOrDefault(e => e.Name == "SKI"); 183 if (skiGroup != null && !string.IsNullOrEmpty(skiGroup.Name)) 184 { 185 hasSkiDeal = true; 186 } 187 188 hasRegionHDeal = Dynamicweb.Core.Converter.ToBoolean(currentUser.CustomFieldValues.Find(f => f.CustomField.SystemName == "AccessUser_RegionH").Value); 189 activateLimitedProducts = Dynamicweb.Core.Converter.ToBoolean(currentUser.CustomFieldValues.Find(f => f.CustomField.SystemName == "AccessUser_ActivateLimitedProducts").Value); 190 limitedProductNumbers = Dynamicweb.Core.Converter.ToString(currentUser.CustomFieldValues.Find(f => f.CustomField.SystemName == "AccessUser_LimitedProductNumbers").Value); 191 } 192 193 List<string> limitedProductNumbersList = new List<string>(); 194 if (!String.IsNullOrWhiteSpace(limitedProductNumbers) && activateLimitedProducts) 195 { 196 limitedProductNumbersList = limitedProductNumbers.Split(',').ToList(); 197 } 198 199 200 foreach (LoopItem product in Loop) 201 { 202 203 string GroupLink = "/Default.aspx?ID=" + product.GetString("Ecom:Product.PrimaryOrCurrentPageID") + "&groupid=" + product.GetString("Ecom:Product.PrimaryOrFirstGroupID") + "&productid=" + product.GetString("Ecom:Product.ID"); 204 // string GroupLink = product.GetString("Ecom:Product.LinkGroup.Clean"); 205 int stock = product.GetInteger("Ecom:Product.Stock"); 206 string Name = product.GetString("Ecom:Product.Name"); 207 string Description = product.GetString("Ecom:Product.ShortDescription"); 208 string prodID = product.GetString("Ecom:Product.ID"); 209 string prodVariantID = product.GetString("Ecom:Product.VariantID"); 210 string prodLanguageID = product.GetString("Ecom:Product.LanguageID"); 211 string Image = "/Admin/Public/GetImage.ashx?Image=/Files/Images/Ecom/Products/" + prodID + ".jpg&format=webp&quality=85"; 212 213 //prices and units 214 string defaultUnitId = product.GetString("Ecom:Product.DefaultUnitID"); 215 var prices = product.GetLoop("CustomPriceLoop"); 216 List<string> pricesHtmlList = Hounisen.Website.Helpers.Helpers.PricesListMakeListString(prices); 217 List<Hounisen.Website.Models.Unit> unitsDropdown = Hounisen.Website.Helpers.Helpers.PopulateUnitsDropdown(prices); 218 var unitDefault = unitsDropdown.Where(x => x.Id.Equals(defaultUnitId)).FirstOrDefault(); 219 int minOrder = unitDefault != null ? unitDefault.MinOrder : 1; 220 221 if (!string.IsNullOrWhiteSpace(product.GetString("Ecom:Product.SelectedVariantComboID"))) 222 { 223 prodID = product.GetString("Ecom:Product.ID") + "&" + product.GetString("Ecom:Product.SelectedVariantComboID"); 224 } 225 226 227 GroupHelper gh = new GroupHelper(); 228 var masterPage = pageService.GetPage(product.GetInteger("Ecom:Product.PrimaryOrCurrentPageID")); 229 masterPage.GetDisplayName(); 230 231 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(product.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 232 var groups = ""; 233 if (group != null) 234 { 235 var groupNames = gh.GetParentsRecursively(group, new List<string>()); 236 groupNames = gh.Format(groupNames, masterPage.GetDisplayName(), group); 237 groups = gh.ListToString(groupNames); 238 } 239 240 // should the button for adding to cart be disabled and show different text 241 bool showLimitedProduct = false; 242 if (activateLimitedProducts) 243 { 244 showLimitedProduct = true; 245 if (limitedProductNumbersList.Count > 0 && limitedProductNumbersList.Contains(product.GetString("Ecom:Product.Number"))) 246 { 247 showLimitedProduct = false; 248 } 249 } 250 251 <div class="product-list__item"> 252 <div class="col-xs-12"> 253 <div class="product-list__item-inner"> 254 <div class="col-xs-12 col-sm-4 col-flex"> 255 256 <div class="product-list-item__primary-image"> 257 @if (currentUser != null) 258 { 259 <a href="@GroupLink" title="@Name"> 260 <img class="product-list-item__image lazy" alt="@Name" data-src="@Image&width=300" class="img-responsive img-center"> 261 </a> 262 <a class="fancybox" data-fancybox href="@Image&width=1000" title="@Name"> 263 <svg class="product-list-item__image-icon"> 264 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#fullscreen"></use> 265 </svg> 266 </a> 267 } 268 else 269 { 270 <a href="@GroupLink" title="@Name"> 271 <img class="product-list-item__image lazy" alt="@Name" data-src="@Image&width=300" class="img-responsive img-center"> 272 </a> 273 <a class="fancybox" data-fancybox href="@Image&width=1000" title="@Name"> 274 <svg class="product-list-item__image-icon"> 275 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#fullscreen"></use> 276 </svg> 277 </a> 278 } 279 280 281 </div> 282 @{ 283 var productObj = productService.GetProductById(prodID, prodVariantID, prodLanguageID); 284 var overlayNameAndColors = new ProductImageOverlayHelper().GetTextAndColor(productObj); 285 286 <div class="product__primary-image__overlay-container"> 287 @foreach (var overlayNameAndColo in overlayNameAndColors) 288 { 289 <div style="background-color: @overlayNameAndColo.Value" class="product__primary-image__overlay-container__item"> 290 @overlayNameAndColo.Key 291 </div> 292 } 293 </div>} 294 </div> 295 <div class="col-xs-12 col-sm-8"> 296 <div class="product-list-item__info js-product-info"> 297 <div class="row"> 298 @*Title & Number*@ 299 <div class="col-xs-12"> 300 <h4 data-name="@Name" data-product_id="@prodID" data-categories="@groups" class="product-list-item__title"> 301 <a class="product-list-item__title-link" href="@GroupLink">@Name</a> 302 </h4> 303 </div> 304 </div> 305 <div class="row"> 306 <div class="col-xs-12 col-sm-5"> 307 308 <div class="product-list-item__attributes"> 309 <p> 310 <strong>Varenummer:</strong> @product.GetString("Ecom:Product.Number") 311 </p> 312 <p> 313 <strong>@product.GetString("Ecom:Product:Field.Attribut1A"):</strong><br />@product.GetString("Ecom:Product:Field.Attribut1B") 314 </p> 315 <p> 316 <strong>@product.GetString("Ecom:Product:Field.Attribut2A"):</strong> @product.GetString("Ecom:Product:Field.Attribut2B") 317 </p> 318 </div> 319 320 <div class="hidden-xs"> 321 <div class=""> 322 @* IKONER *@ 323 <div class="product-list-item__icons"> 324 @{ 325 foreach (var c in product.GetString("Ecom:Product:Field.Certificates").Split(',')) 326 { 327 if (!string.IsNullOrEmpty(c)) 328 { 329 string src = "/Admin/Public/GetImage.ashx?Image=/Files/Images/Ecom/Certificates/" + @c + ".jpg&format=webp&quality=85&width=100"; 330 <img class="product-list-item__icon lazy" alt="@Translate("Cert_" + c, c)" title="@Translate("Cert_" + c, c)" data-src=@src src=@src> 331 } 332 } 333 } 334 </div> 335 </div> 336 </div> 337 </div> 338 339 <div class="col-xs-12 col-sm-7"> 340 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 341 { 342 <ul class="product-list-item__prices"> 343 @foreach (var priceHtml in pricesHtmlList) 344 { 345 <li> 346 @priceHtml 347 </li> 348 } 349 </ul> 350 } 351 </div> 352 </div> 353 354 <div class="row"> 355 <div class="col-xs-12 col-sm-4 col-lg-5"> 356 @* LAGERBEHOLDNING *@ 357 <div class="product-list-item__stock"> 358 @{ 359 if (stock > 0) 360 { 361 <p class="product-list-item__stock-text"> 362 <span class="product-list-item__stock-circle product-list-item__stock-circle--green"></span> På lager 363 </p> 364 } 365 else 366 { 367 <p class="product-list-item__stock-text"> 368 @if (!String.IsNullOrEmpty(product.GetString("Ecom:Manufacturer.Description"))) 369 { 370 @product.GetString("Ecom:Manufacturer.Description") 371 } 372 else 373 { 374 @Translate("StockStandardSoldoutText", "Kontakt os for leveringstid: 86210800 eller salg@hounisen.com") 375 } 376 </p> 377 } 378 } 379 </div> 380 381 <div class="product-list-item__see-product"> 382 <a class="product-list-item__link" href="@GroupLink" class="">@Translate("See product", "Se produkt")</a> 383 </div> 384 </div> 385 <div class="col-xs-12 col-sm-8 col-lg-7"> 386 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 387 { 388 <div class="row"> 389 @if (showLimitedProduct) 390 { 391 <div class="col-xs-12"> 392 <button class="btn btn--ghost product__button disabled"> 393 @Translate("Kan bestilles på fritekstordre", "Kan bestilles på fritekstordre") 394 </button> 395 </div> 396 } 397 else 398 { 399 <div class="col-xs-7"> 400 <div class="product__addtocart-input js-addtocart-input"> 401 <input type="button" value="-" class="product-list-item__quantity-button product-list-item__quantity-button--minus qtyminus" field="quantity" /> 402 <input type="number" class="product__quantity-input product-list-item__quantity-input quantity" data-name="quantity" name="quantity" value="@minOrder" field="quantity" /> 403 <input type="button" value="+" class="product-list-item__quantity-button product-list-item__quantity-button--plus qtyplus" field="quantity" /> 404 </div> 405 <div class="product__unit-selector" style="display: inline-block;"> 406 @{ 407 int counter = 0; 408 } 409 @foreach (var unitDropdown in unitsDropdown) 410 { 411 var currentUnitPrice = prices[counter].Values["Ecom:Product.Prices.Amount"]; 412 <input type="radio" data-id="@index" data-price="@currentUnitPrice" class="unit-type" id="@(unitDropdown.Id + prodID)" name="UnitID@(product.GetString("Ecom:Product.Number"))" value="@unitDropdown.Id" required data-lot-size="@unitDropdown.LotSize" data-min-order="@unitDropdown.MinOrder" @(unitsDropdown.Count == 1 ? "checked='checked'" : "")> 413 <label for="@(unitDropdown.Id + prodID)">@unitDropdown.Name</label> 414 counter++; 415 } 416 </div> 417 <p class="product__unit-selector-error-message"> 418 @Translate("unit-error-message", "* Du mangler at vælge type") 419 </p> 420 </div> 421 <div class="col-xs-5"> 422 <div class="product__addtocart-button"> 423 <button data-id="@index" type="submit" name="submit" onclick="AddToCart(event, '@prodID', $(this).parent().parent().prev().find('input.quantity').val(), $(this).parent().parent().prev().find('input[name=\'UnitID@(product.GetString("Ecom:Product.Number"))\']:checked').val());" class="btn btn-primary product__button product__button-js"> 424 @Translate("Add to cart", "Add to cart") 425 <svg class="product__button-icon hidden-xs"> 426 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#basket"></use> 427 </svg> 428 </button> 429 430 <div class="product-list-item__favorite-list popup-wrap favorite"> 431 432 @if (hasRegionHDeal == false) 433 { 434 <button class="popup-show" data-popup="favorite-list" type="button" title="@Translate("Add to favorites", "Add to favorites")"> 435 <i class="fa fa-star-o"></i> <span>Tilføj til liste</span> 436 </button> 437 <div id="favorite-list" class="popup-form"> 438 <div class="close"> 439 <i class="fa fa-times"></i> 440 </div> 441 <h3>@Translate("Choose list", "Choose list")</h3> 442 <ul> 443 @{ 444 var lists = Dynamicweb.Ecommerce.CustomerCenter.CustomerProductList.GetListsByUserCustomerNumber(currentUser.CustomerNumber); 445 } 446 447 @foreach (var list in lists) 448 { 449 if (list.Products.Where(p => p.ProductId.ToString() == prodID).Count() > 0) 450 { 451 <li> 452 <a href="@(System.Web.HttpContext.Current.Request.Url)&CCRemoveFromMyLists=@prodID&CCAddToListVariantID=&CCAddToListLanguageID=LANG1&CCAddToListID=@list.ListId&CCListType="> 453 <i class="fa fa-star"></i> @list.Name 454 </a> 455 </li> 456 } 457 else 458 { 459 <li> 460 <a href="@(System.Web.HttpContext.Current.Request.Url)&CCAddToMyLists=@prodID&CCAddToListVariantID=&CCAddToListLanguageID=LANG1&CCAddToListID=@list.ListId&CCListType="> 461 <i class="fa fa-star-o"></i> @list.Name 462 </a> 463 </li> 464 } 465 } 466 <li> 467 <a href="/mine-favoritter/opret-favoritliste?ProdID=@prodID"> 468 <i class="fa fa-plus"></i>@Translate("Add new list", "Add new list") 469 </a> 470 </li> 471 </ul> 472 </div> 473 } 474 475 </div> 476 </div> 477 </div> 478 } 479 480 </div> 481 } 482 else 483 { 484 <div class="not-loggedin"> 485 <p class="not-loggedin-text"><a data-toggle="modal" data-target="#login" href="">@Translate("Login", "Login")</a> eller <a href="/kontakt/opret-brugerprofil">Bliv kunde</a> for at se priser og købe på Hounisen.com</p> 486 <a data-toggle="modal" data-target="#login" href="" class="btn btn-primary not-loggedin-button"> 487 <span>Log ind</span> 488 </a> 489 </div> 490 } 491 </div> 492 </div> 493 </div> 494 495 496 </div> 497 </div> 498 </div> 499 </div> 500 501 if (index == embedIndex) 502 { 503 <div class="product-list__item"> 504 <div class="col-xs-12"> 505 @embeddedScript 506 </div> 507 </div> 508 } 509 510 511 Count++; 512 index++; 513 514 if (Count == ColMD) 515 { 516 <div class="row"></div> 517 Count = 0; 518 } 519 } 520 } 521 522 <script> 523 524 document.addEventListener("DOMContentLoaded", function () { 525 526 var addToCartButtons = document.querySelectorAll('.product__button-js'); 527 var unitTypes = document.getElementsByClassName("unit-type"); 528 var product_names = document.getElementsByClassName("product-list-item__title"); 529 530 addToCartButtons.forEach(function (item) { 531 532 item.addEventListener('click', function () { 533 534 var product_name = product_names[this.dataset.id - 1].dataset.name; 535 var product_id = product_names[this.dataset.id - 1].dataset.product_id; 536 var initialCategories = product_names[this.dataset.id - 1].dataset.categories; 537 var categories = initialCategories.split("_"); 538 var quantity = document.getElementsByClassName("quantity")[this.dataset.id - 1].value; 539 var unitPrice; 540 var variantIsNull = true; 541 var unitTypeName = null; 542 543 //Get unittype price 544 for (const unitType of unitTypes) { 545 546 if (unitType.dataset.id == this.dataset.id) { 547 548 if (unitType.checked == true) { 549 550 var tempPrice = unitType.dataset.price.replace(".", ""); 551 tempPrice = tempPrice.replace(",", "."); 552 unitPrice = parseFloat(tempPrice); 553 variantIsNull = false; 554 unitTypeName = unitType.value; 555 556 unitTypeName = unitTypeName.toString().split("_")[1]; 557 558 } 559 } 560 } 561 562 if (!variantIsNull) { 563 dataLayer.push({ ecommerce: null }); 564 dataLayer.push({ 565 'event': 'add_to_cart', 566 "ecommerce": { 567 "currency": "DKK", 568 "value": unitPrice * parseInt(quantity).toFixed(2), 569 "items": [ 570 { 571 "item_name": product_name + " - " + unitTypeName, 572 'item_id': product_id, 573 'price': unitPrice, 574 "item_brand": "", 575 "item_category": (categories[0] != null ? categories[0] : ""), 576 "item_category2": (categories[1] != null ? categories[1] : ""), 577 "item_category3": (categories[2] != null ? categories[2] : ""), 578 "item_category4": (categories[3] != null ? categories[3] : ""), 579 "item_category5": (categories[4] != null ? categories[4] : ""), 580 "quantity": parseInt(quantity), 581 } 582 ] 583 }, 584 585 }); 586 } 587 }); 588 }) 589 }); 590 591 </script> 592 @using Dynamicweb.Security.UserManagement 593 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 594 595 @helper GetProductListRelated(dynamic Loop, int ColMD = 3, int ColSM = 3, int ColXS = 1) 596 { 597 var currentUser = User.GetCurrentExtranetUser(); 598 599 <ul class="shop-list__list"> 600 601 @foreach (LoopItem product in Loop) 602 { 603 604 string GroupLink = "/Default.aspx?ID=" + product.GetString("Ecom:Product.PrimaryOrCurrentPageID") + "&groupid=" + product.GetString("Ecom:Product.PrimaryOrFirstGroupID") + "&productid=" + product.GetString("Ecom:Product.ID"); 605 string Name = product.GetString("Ecom:Product.Name"); 606 string Description = product.GetString("Ecom:Product.ShortDescription"); 607 string prodID = product.GetString("Ecom:Product.ID"); 608 string Image = "/Admin/Public/GetImage.ashx?Image=/Files/Images/Ecom/Products/" + prodID + ".jpg&format=webp&quality=85"; 609 610 <li class="shop-list__item col-xs-12"> 611 <a class="shop-list__link" href="@GroupLink" title="@Name"> 612 <figure class="shop-list__figure"> 613 <img class="shop-list__image lazy" style="width: 213px;" alt="@Name" data-src="@Image&width=213"> 614 </figure> 615 <h4 class="shop-list__title">@Name</h4> 616 <div class="shop-list__text"> 617 @if (String.IsNullOrEmpty(product.GetString("Ecom:Product.LongDescription"))) 618 { 619 var gr = Dynamicweb.Ecommerce.Products.Group.GetGroupById(product.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 620 621 @gr.Description.Replace("<a ", "<span ").Replace("</a>", "</span>").Replace("<h2>", "<p>").Replace("</h2>", "</p>") 622 } 623 else 624 { 625 @product.GetString("Ecom:Product.LongDescription").Replace("<a ", "<span ").Replace("</a>", "</span>").Replace("<h2>", "<p>").Replace("</h2>", "</p>") 626 } 627 628 </div> 629 <div class="shop-list__price"> 630 @if (currentUser != null) 631 { 632 string baseUnitPrice = String.Empty; 633 var price = product.GetLoop("CustomPriceLoop").OrderBy(x => x.GetDouble("Ecom:Product.Prices.BaseUnitPrice")).FirstOrDefault(); 634 if (price != null) 635 { 636 baseUnitPrice = price.GetString("Ecom:Product.Prices.BaseUnitPrice"); 637 } 638 <span class="shop-list__price-from">Priser fra</span> 639 <span class="shop-list__price-value">@baseUnitPrice</span> 640 <span class="shop-list__price-unit">kr./stk.</span> 641 } 642 </div> 643 </a> 644 </li> 645 646 } 647 </ul> 648 } 649 650 651 @using Dynamicweb.Security.UserManagement 652 @using System.Text.RegularExpressions; 653 @using Hounisen.Website.Helpers 654 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 655 656 @helper GetProductListFullRelated(dynamic Loop, int ColMD = 4, int ColSM = 4, int ColXS = 1) 657 { 658 int Count = 0; 659 660 string ColumnsMD = WrapMethods.ColumnMaker(ColMD, "md"); 661 string ColumnsSM = WrapMethods.ColumnMaker(ColSM, "sm"); 662 string ColumnsXS = WrapMethods.ColumnMaker(ColXS, "xs"); 663 var currentUser = User.GetCurrentExtranetUser(); 664 665 foreach (LoopItem product in Loop) 666 { 667 string GroupLink = "/Default.aspx?ID=" + product.GetString("Ecom:Product.PrimaryOrCurrentPageID") + "&groupid=" + product.GetString("Ecom:Product.PrimaryOrFirstGroupID") + "&productid=" + product.GetString("Ecom:Product.ID"); 668 string Name = product.GetString("Ecom:Product.Name"); 669 string Description = GetFormattedDescription(product.GetString("Ecom:Product.LongDescription")); 670 string prodID = product.GetString("Ecom:Product.ID"); 671 string Image = "/Admin/Public/GetImage.ashx?Image=/Files/Images/Ecom/Products/" + prodID + ".jpg&format=webp&quality=85"; 672 var productObject = Dynamicweb.Ecommerce.Products.Product.GetProductById(product.GetString("Ecom:Product.ID"), product.GetString("Ecom:Product.VariantID"), product.GetString("Ecom:Product.LanguageID")); 673 var textAndColors = new ProductImageOverlayHelper().GetTextAndColor(productObject); 674 <li class="shop-list__item col-xs-12"> 675 <a class="shop-list__link" href="@GroupLink" title="@Name"> 676 <figure class="shop-list__figure" style="position: relative"> 677 <img class="shop-list__image lazy" style="width: 213px;" alt="@Name" data-src="@Image&width=213"> 678 <div class="product__primary-image__overlay-container"> 679 @foreach (var overlayNameAndColor in textAndColors) 680 { 681 <div style="background-color: @overlayNameAndColor.Value" class="product__primary-image__overlay-container__item"> 682 @overlayNameAndColor.Key 683 </div> 684 } 685 </div> 686 </figure> 687 <h4 class="shop-list__title">@Name</h4> 688 <div class="shop-list__text">@Description</div> 689 <div class="shop-list__price"> 690 @if (currentUser != null) 691 { 692 string baseUnitPrice = String.Empty; 693 var price = product.GetLoop("CustomPriceLoop").OrderBy(x => x.GetDouble("Ecom:Product.Prices.BaseUnitPrice")).FirstOrDefault(); 694 if (price != null) 695 { 696 baseUnitPrice = price.GetString("Ecom:Product.Prices.BaseUnitPrice"); 697 } 698 699 <span class="shop-list__price-from">Priser fra</span> 700 <span class="shop-list__price-value">@baseUnitPrice</span> 701 <span class="shop-list__price-unit">kr./stk</span> 702 } 703 </div> 704 </a> 705 </li> 706 } 707 } 708 709 @functions { 710 private static string GetFormattedDescription(string description = "") 711 { 712 string formattedDescription = Regex.Replace(description, @"<.*?>|[\r\n\t]| ", " "); 713 return formattedDescription.Length > 103 ? formattedDescription.Substring(0, 103).TrimEnd() + "..." : formattedDescription; 714 } 715 } 716 717 <script src="/Files/Templates/Designs/DwSimple/js/ProductVariantsAjax.js"></script> 718 <link rel="stylesheet" href="/Files/Templates/Designs/DwSimple/css/product.css" /> 719 720 @{ 721 IFormatProvider jsNumberFormat = new NumberFormatInfo() { NumberDecimalSeparator = ".", NumberGroupSeparator = "" }; 722 string initialPrice = string.Empty; 723 string metaDescription = string.Empty; 724 if (String.IsNullOrEmpty(GetString("Ecom:Product.LongDescription"))) 725 { 726 metaDescription = StripHTML(GetString("Ecom:Group.Description")); 727 } 728 else 729 { 730 metaDescription = StripHTML(GetString("Ecom:Product.LongDescription")); 731 } 732 733 bool isMobile = Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile; 734 735 //prices and units 736 string defaultUnitId = GetString("Ecom:Product.DefaultUnitID"); 737 var prices = GetLoop("CustomPriceLoop"); 738 739 List<string> pricesHtmlList = Hounisen.Website.Helpers.Helpers.PricesListMakeListString(prices, false); 740 List<Hounisen.Website.Models.Unit> unitsDropdown = Hounisen.Website.Helpers.Helpers.PopulateUnitsDropdown(prices); 741 var unitDefault = unitsDropdown.Where(x => x.Id.Equals(defaultUnitId)).FirstOrDefault(); 742 int minOrder = unitDefault != null ? unitDefault.MinOrder : 1; 743 744 //other vars 745 var pid = GetString("Ecom:Product.ID"); 746 int stock = GetInteger("Ecom:Product.Stock"); 747 string image = "/Admin/Public/GetImage.ashx?Image=/Files/Images/Ecom/Products/" + pid + ".jpg"; 748 string currenthost = HttpContext.Current.Request.Url.AbsoluteUri; 749 Uri uri = new Uri(currenthost); 750 currenthost = string.Format("{0}://{1}", uri.Scheme, uri.Authority); 751 string ImagePathloop = ""; 752 string ImagePathClean = ""; 753 string options = "format=webp&quality=85&width=1000"; 754 string manufacturerName = GetString("Ecom:Manufacturer.Name"); 755 string manufacturerUrl = GetString("Ecom:Manufacturer.Web"); 756 757 var resizedImageLarge = VestjyskMarketing.Helpers.ImageHelper.ResizeImage(new ResizeImageSettings() 758 { 759 Image = $"/Files/Images/Ecom/Products/{pid}.jpg", 760 Width = 1000, 761 Quality = 99 762 }); 763 764 var resizedImage = VestjyskMarketing.Helpers.ImageHelper.ResizeImage(new ResizeImageSettings() 765 { 766 Image = $"/Files/Images/Ecom/Products/{pid}.jpg", 767 Width = 458, 768 Quality = 85 769 }); 770 771 772 string productname = GetString("Ecom:Product.Name"); 773 string productlink = "/Default.aspx?ID=" + GetString("Ecom:Product.PrimaryOrCurrentPageID") + "&groupid=" + GetString("Ecom:Product.PrimaryOrFirstGroupID") + "&productid=" + GetString("Ecom:Product.ID"); 774 775 776 // SKI AND Region H 777 bool hasSkiDeal = false; 778 bool hasRegionHDeal = false; 779 bool activateLimitedProducts = false; 780 string limitedProductNumbers = ""; 781 var currentUser = User.GetCurrentExtranetUser(); 782 if (currentUser != null) 783 { 784 var skiGroup = currentUser.Groups.FirstOrDefault(e => e.Name == "SKI"); 785 if (skiGroup != null && !string.IsNullOrEmpty(skiGroup.Name)) 786 { 787 hasSkiDeal = true; 788 } 789 790 hasRegionHDeal = Dynamicweb.Core.Converter.ToBoolean(currentUser.CustomFieldValues.Find(f => f.CustomField.SystemName == "AccessUser_RegionH").Value); 791 activateLimitedProducts = Dynamicweb.Core.Converter.ToBoolean(currentUser.CustomFieldValues.Find(f => f.CustomField.SystemName == "AccessUser_ActivateLimitedProducts").Value); 792 limitedProductNumbers = Dynamicweb.Core.Converter.ToString(currentUser.CustomFieldValues.Find(f => f.CustomField.SystemName == "AccessUser_LimitedProductNumbers").Value); 793 } 794 795 List<string> limitedProductNumbersList = new List<string>(); 796 if (!String.IsNullOrWhiteSpace(limitedProductNumbers) && activateLimitedProducts) 797 { 798 limitedProductNumbersList = limitedProductNumbers.Split(',').ToList(); 799 } 800 801 // should the button for adding to cart be disabled and show different text 802 bool showLimitedProduct = false; 803 if (activateLimitedProducts) 804 { 805 showLimitedProduct = true; 806 if (limitedProductNumbersList.Count > 0 && limitedProductNumbersList.Contains(GetString("Ecom:Product.Number"))) 807 { 808 showLimitedProduct = false; 809 } 810 } 811 812 //serialized data 813 var pagedata = new System.Collections.Generic.Dictionary<String, Object>(); 814 Pageview.Area.Item.SerializeTo(pagedata); 815 816 817 var pageService = new PageService(); 818 GroupHelper gh = new GroupHelper(); 819 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(GetString("Ecom:Product.PrimaryOrFirstGroupID")); 820 var masterPage = pageService.GetPage(GetInteger("Ecom:Product.PrimaryOrCurrentPageID")); 821 masterPage.GetDisplayName(); 822 var groupNames = gh.GetParentsRecursively(group, new List<string>()); 823 groupNames = gh.Format(groupNames, masterPage.GetDisplayName(), group); 824 825 var groups = gh.ListToString(groupNames); 826 827 828 829 // ---- JSON-LD Product Schema ---- 830 831 string schemaName = GetString("Ecom:Product:Field.SchemaName"); 832 if (string.IsNullOrWhiteSpace(schemaName)) 833 { 834 schemaName = productname; 835 } 836 837 string mpn = GetString("Ecom:Product:Field.MPN"); 838 if (string.IsNullOrWhiteSpace(mpn)) 839 { 840 mpn = GetString("Ecom:Product.Number"); 841 } 842 843 // FIX #3: normalize whitespace / strip (\u00A0) and \r\n from the product description, 844 // same treatment as groupDescription below. 845 string schemaDescription = System.Text.RegularExpressions.Regex.Replace( 846 metaDescription.Replace(" ", " ").Replace('\u00A0', ' '), 847 @"\s+", " " 848 ).Trim(); 849 850 string schemaAvailability = stock > 0 851 ? "https://schema.org/InStock" 852 : "https://schema.org/OutOfStock"; 853 854 // FIX #4: resizedImageLarge is a relative "/Admin/Public/GetImage.ashx?..." path - 855 // schema.org/Google require an absolute image URL. 856 string schemaImage = resizedImageLarge.StartsWith("http", StringComparison.OrdinalIgnoreCase) 857 ? resizedImageLarge 858 : currenthost.TrimEnd('/') + resizedImageLarge; 859 string productEan = GetString("Ecom:Product.EAN"); 860 string firstEan = string.Empty; 861 if (!string.IsNullOrWhiteSpace(productEan)) 862 { 863 var separators = new[] { ';', ',' }; 864 firstEan = productEan.Split(separators, StringSplitOptions.RemoveEmptyEntries) 865 .FirstOrDefault()?.Trim() ?? string.Empty; 866 } 867 868 // isVariantOf / group linking 869 string groupName = GetString("Ecom:Group.Name"); 870 string productUnspsc = GetString("Ecom:Product:Field.Unspsc"); 871 string productRawPath = GetString("Ecom:Product.Link.Clean"); 872 string productCanonicalPath = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(productRawPath); 873 string productSlug = productCanonicalPath.TrimEnd('/').Split('/').LastOrDefault() ?? ""; 874 string groupRawPath = GetString("Ecom:Product.LinkGroup.Clean"); 875 string groupCanonicalPath = string.IsNullOrWhiteSpace(groupRawPath) 876 ? "" 877 : Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(groupRawPath); 878 if (!string.IsNullOrWhiteSpace(groupCanonicalPath)) 879 { 880 string groupTrimmed = groupCanonicalPath.TrimEnd('/'); 881 int groupLastSlash = groupTrimmed.LastIndexOf('/'); 882 string groupLastSegment = groupLastSlash >= 0 ? groupTrimmed.Substring(groupLastSlash + 1) : groupTrimmed; 883 884 if (groupLastSegment.Equals(productSlug, StringComparison.OrdinalIgnoreCase) && groupLastSlash >= 0) 885 { 886 groupCanonicalPath = groupTrimmed.Substring(0, groupLastSlash); 887 } 888 } 889 890 string groupAbsoluteUrl = string.IsNullOrWhiteSpace(groupCanonicalPath) 891 ? "" 892 : currenthost.TrimEnd('/') + "/" + groupCanonicalPath.TrimStart('/'); 893 string groupId_ld = string.IsNullOrWhiteSpace(groupAbsoluteUrl) ? "" : groupAbsoluteUrl + "#productgroup"; 894 895 // productUrl = groupAbsoluteUrl (full category chain) + "/" + productSlug 896 string productAbsoluteUrl = string.IsNullOrWhiteSpace(groupAbsoluteUrl) 897 ? currenthost.TrimEnd('/') + "/" + productCanonicalPath.TrimStart('/') 898 : groupAbsoluteUrl.TrimEnd('/') + "/" + productSlug; 899 string productId_ld = productAbsoluteUrl + "#product"; 900 string groupDescription = System.Text.RegularExpressions.Regex.Replace(StripHTML(GetString("Ecom:Group.Description")).Replace(" ", " ").Replace('\u00A0', ' '), @"\s+", " ").Trim(); 901 List<string> groupChainNames = groupNames 902 .Where(g => !string.IsNullOrWhiteSpace(g)) 903 .Where(g => !g.Equals("Forside", StringComparison.OrdinalIgnoreCase)) 904 .Where(g => !g.Equals(productname, StringComparison.OrdinalIgnoreCase)) 905 .ToList(); 906 907 // FIX #4: strip ® from each group name segment before joining into the category breadcrumb 908 string categoryBreadcrumb = string.Join(" > ", groupChainNames.Select(g => g.Replace("®", "").Trim())); 909 910 string productGroupIdSlug = groupAbsoluteUrl.Split('/').LastOrDefault().ToString(); 911 string rawVolume = ""; 912 int volumeAttributeIndex = -1; 913 for (int i = 1; i <= 7; i++) 914 { 915 string labelField = GetString("Ecom:Product:Field.Attribut" + i + "A"); 916 // FIX #6: match "Volumen" as a prefix, not an exact label match - some products 917 // (e.g. the DURAN culture bottle) write the unit into the label itself, e.g. 918 // "Volumen ml", which an exact Equals() comparison was silently missing. 919 if (!string.IsNullOrWhiteSpace(labelField) && 920 labelField.Trim().StartsWith("Volumen", StringComparison.OrdinalIgnoreCase)) 921 { 922 rawVolume = GetString("Ecom:Product:Field.Attribut" + i + "B"); 923 volumeAttributeIndex = i; 924 break; 925 } 926 } 927 928 string volumeValue = rawVolume; 929 string volumeUnit = "ml"; 930 if (!string.IsNullOrWhiteSpace(rawVolume) && rawVolume.Contains(" ")) 931 { 932 var volumeParts = rawVolume.Split(' '); 933 volumeValue = volumeParts[0]; 934 volumeUnit = volumeParts.Length > 1 ? volumeParts[1] : "ml"; 935 } 936 string sizeDisplay = string.IsNullOrWhiteSpace(rawVolume) ? "" : (volumeValue + " " + volumeUnit); 937 938 // FIX #2: parse volumeValue ("1,2") into a numeric double (1.2) for the JSON-LD output. 939 // Falls back to the raw string if parsing fails, so no data is silently dropped. 940 double? volumeValueNumeric = null; 941 if (!string.IsNullOrWhiteSpace(volumeValue)) 942 { 943 string normalizedVolume = volumeValue.Replace(",", "."); 944 if (double.TryParse(normalizedVolume, NumberStyles.Any, CultureInfo.InvariantCulture, out double parsedVolume)) 945 { 946 volumeValueNumeric = parsedVolume; 947 } 948 } 949 950 // FIX #8: same bug as Volumen - "Farvekode" was hardcoded to Attribut3 only. Scan all 951 // 7 slots instead, same as the Volumen lookup above. 952 string color = string.Empty; 953 for (int colorIndex = 1; colorIndex <= 7; colorIndex++) 954 { 955 string colorLabel = GetString("Ecom:Product:Field.Attribut" + colorIndex + "A"); 956 if (!string.IsNullOrWhiteSpace(colorLabel) && 957 colorLabel.Trim().Split(' ')[0].Equals("Farvekode", StringComparison.OrdinalIgnoreCase)) 958 { 959 color = GetString("Ecom:Product:Field.Attribut" + colorIndex + "B").Trim(); 960 break; 961 } 962 } 963 var additionalProps = new List<object> 964 { 965 new Dictionary<string, object> 966 { 967 { "@type", "PropertyValue" }, 968 { "name", "UNSPSC" }, 969 { "value", productUnspsc } 970 }, 971 new Dictionary<string, object> 972 { 973 { "@type", "PropertyValue" }, 974 { "name", "Volumen" }, 975 { "value", volumeValueNumeric.HasValue ? (object)volumeValueNumeric.Value : volumeValue }, 976 { "unitText", volumeUnit } 977 } 978 }; 979 980 // FIX #5: loop all 7 attribute slots (previously only 2-6 were included, and whichever 981 // slot held "Volumen" was ALSO re-added here, duplicating it in additionalProperty). 982 // Skip the slot already represented by the dedicated "Volumen" entry above. 983 for (int attributeIndex = 1; attributeIndex <= 7; attributeIndex++) 984 { 985 if (attributeIndex == volumeAttributeIndex) 986 { 987 continue; 988 } 989 990 additionalProps.Add(new Dictionary<string, object> 991 { 992 { "@type", "PropertyValue" }, 993 { "name", GetString("Ecom:Product:Field.Attribut" + attributeIndex + "A") }, 994 { "value", GetString("Ecom:Product:Field.Attribut" + attributeIndex + "B") } 995 }); 996 } 997 998 additionalProps = additionalProps 999 .Cast<Dictionary<string, object>>() 1000 .Where(p => 1001 { 1002 bool nameOk = p.TryGetValue("name", out var nameVal) && 1003 !string.IsNullOrWhiteSpace(nameVal as string); 1004 1005 bool valueOk = p.TryGetValue("value", out var valVal) && 1006 valVal != null && 1007 (!(valVal is string) || !string.IsNullOrWhiteSpace((string)valVal)); 1008 1009 return nameOk && valueOk; 1010 }) 1011 // FIX #7: collapse any remaining entries that share the same name (case/whitespace 1012 // insensitive) - not just the Volumen slot, but any attribute that ends up labeled 1013 // the same as another one. Keeps the first occurrence. 1014 .GroupBy(p => ((p["name"] as string) ?? "").Trim().ToLowerInvariant()) 1015 .Select(g => g.First()) 1016 .Cast<object>() 1017 .ToList(); 1018 1019 // ---- ProductGroup node ---- 1020 var productGroupNode = new Dictionary<string, object> 1021 { 1022 { "@id", groupId_ld }, 1023 { "@type", "ProductGroup" }, 1024 { "brand", new Dictionary<string, object> 1025 { 1026 { "@type", "Brand" }, 1027 { "name", manufacturerName } 1028 } 1029 }, 1030 { "category", categoryBreadcrumb }, 1031 { "description", groupDescription }, 1032 { "hasVariant", new List<Dictionary<string, object>> 1033 { 1034 new Dictionary<string, object> 1035 { 1036 { "@id", productId_ld } 1037 } 1038 } 1039 }, 1040 { "name", groupName }, 1041 { "productGroupID", productGroupIdSlug }, 1042 { "url", groupAbsoluteUrl }, 1043 { "variesBy", new List<string> { "https://schema.org/size", "https://schema.org/color" } }, 1044 }; 1045 1046 // ---- Product node ---- 1047 var productNode = new Dictionary<string, object> 1048 { 1049 { "@id", productId_ld }, 1050 { "@type", "Product" }, 1051 { "additionalProperty", additionalProps }, 1052 { "brand", new Dictionary<string, object> 1053 { 1054 { "@type", "Brand" }, 1055 { "name", manufacturerName } 1056 } 1057 }, 1058 { "category", categoryBreadcrumb }, 1059 { "color", color }, 1060 { "description", schemaDescription }, 1061 { "gtin13", firstEan }, 1062 // FIX #1: galleryImages didn't exist — use resizedImageLarge wrapped in a List<string> 1063 // so the JSON-LD "image" field serializes as an array, not a bare string. 1064 // FIX #4: schemaImage is now an absolute URL (see above), not a site-relative path. 1065 { "image", new List<string> { schemaImage } }, 1066 { "isVariantOf", new Dictionary<string, object> 1067 { 1068 { "@id", groupId_ld } 1069 } 1070 }, 1071 { "manufacturer", new Dictionary<string, object> 1072 { 1073 { "@type", "Organization" }, 1074 { "name", manufacturerName } 1075 } 1076 }, 1077 { "mpn", mpn }, 1078 { "offers", new Dictionary<string, object> 1079 { 1080 { "@type", "Offer" }, 1081 { "availability", schemaAvailability }, 1082 { "eligibleCustomerType", "https://schema.org/Business" }, 1083 { "seller", new Dictionary<string, object> 1084 { 1085 { "@type", "Organization" }, 1086 { "name", "Hounisen Laboratorieudstyr A/S" } 1087 } 1088 } 1089 } 1090 }, 1091 { "name", schemaName }, 1092 { "size", sizeDisplay }, 1093 { "sku", GetString("Ecom:Product.Number") }, 1094 { "url", productAbsoluteUrl }, 1095 }; 1096 1097 // ---- Combine into one @graph ---- 1098 var graph = new Dictionary<string, object> 1099 { 1100 { "@context", "https://schema.org" }, 1101 { "@graph", new List<object> { productGroupNode, productNode } } 1102 }; 1103 1104 string productSchemaJson = Newtonsoft.Json.JsonConvert.SerializeObject(graph, Newtonsoft.Json.Formatting.None); 1105 } 1106 1107 <div class="col-md-12 col-sm-12 col-xs-12" style="margin-bottom: 25px"> 1108 1109 <div class="row product" itemscope itemtype="http://schema.org/Product"> 1110 <section class="page-header" style="margin-top: 15px"> 1111 <div class="product__help-name-container"> 1112 <div class="col-xs-12 col-sm-7 p-0"> 1113 <meta itemprop="description" content="@metaDescription" /> 1114 <h1 data-categories="@groups" data-group="@GetString("Ecom:Group.Name")" class="page-header__title" itemprop="name">@GetString("Ecom:Product.Name")</h1> 1115 <div class="page-header__short-description"> 1116 <p class="product__number">@Translate("Productnumber", "Productnumber"): <span property="identifier" itemprop="mpn">@GetString("Ecom:Product.Number")</span></p> 1117 @if (hasSkiDeal) 1118 { 1119 <p class="product__number">@Translate("Skinumber", "SKI nr"): <span property="identifier">@GetString("Ecom:Product:Field.SkiId")</span></p> 1120 } 1121 @if (hasRegionHDeal && GetBoolean("Ecom:Product:Field.RegionH")) 1122 { 1123 <p class="product__number">@Translate("RegionHText")</p> 1124 } 1125 1126 </div> 1127 </div> 1128 1129 1130 <div class="d-none d-lg-block product__help-name-container__help p-0"> 1131 <div class="need-help product-view"> 1132 <img class="need-help__image lazy" width="81" height="81" data-src='@(Pageview.Area.Item["Support_Image"].ToString())?format=webp&width=81&quality=75' /> 1133 <div class="need-help__text product-view"> 1134 @Pageview.Area.Item["Support_Content"].ToString() 1135 </div> 1136 </div> 1137 </div> 1138 1139 1140 </div> 1141 </section> 1142 <div class="row"> 1143 1144 @* The image area *@ 1145 <div class="col-md-6 col-sm-4 col-xs-12 product__column"> 1146 <div class="product__gallery"> 1147 1148 @* Discount sticker *@ 1149 1150 @if (GetString("Ecom:Product.Discount.Price.PriceWithVATFormatted") != GetString("Ecom:Product.Price.PriceWithVATFormatted")) 1151 { 1152 if (pagedata["EcommerceStickerType"].ToString() == "ribbon") 1153 { 1154 <span class="ribbon base">@Translate("On sale!", "On sale!")</span> 1155 } 1156 1157 if (pagedata["EcommerceStickerType"].ToString() == "ball") 1158 { 1159 <span class="ball">@Translate("On sale!", "On sale!")</span> 1160 } 1161 } 1162 1163 1164 @* Product images *@ 1165 @{ 1166 1167 List<string> imagepath = new List<string>(); 1168 1169 1170 //i starts at 1 - avoids showing the first image twice 1171 for (int i = 1; i <= 5; i++) 1172 { 1173 ImagePathloop = "/Admin/Public/GetImage.ashx?Image=/Files/Images/Ecom/Products/" + pid + "-0" + i.ToString() + ".jpg"; 1174 //currenthost + 1175 ImagePathClean = "/Files/Images/Ecom/Products/" + pid + "-0" + i.ToString() + ".jpg"; 1176 1177 try 1178 { 1179 if (File.Exists(HttpContext.Current.Server.MapPath(ImagePathClean))) 1180 { 1181 imagepath.Add(ImagePathloop + "&" + options); 1182 } 1183 1184 HttpWebRequest request = (HttpWebRequest)System.Net.WebRequest.Create(ImagePathloop); 1185 using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) 1186 { 1187 if (response.StatusCode == HttpStatusCode.NotFound) 1188 { 1189 break; 1190 } 1191 else 1192 { 1193 imagepath.Add("/Files/Images/Ecom/Products/" + pid + "-0" + i.ToString() + ".jpg" + "" + options); 1194 } 1195 } 1196 } 1197 catch (Exception ex) 1198 { 1199 } 1200 } 1201 } 1202 1203 1204 <div class="product__primary-image"> 1205 <a href="@resizedImageLarge" data-fancybox="product-gallery" class="fancybox"> 1206 <img src="@resizedImage" data-src="@resizedImage" width="458" alt="@productname" class="product__image img-responsive lazy" itemprop="image"> 1207 @{ 1208 var productObj = new ProductService().GetProductById(GetString("Ecom:Product.ID"), GetString("Ecom:Product.VariantID"), GetString("Ecom:Product.LanguageID")); 1209 var overlayNameAndColors = new ProductImageOverlayHelper().GetTextAndColor(productObj); 1210 } 1211 1212 <div class="product__primary-image__overlay-container"> 1213 @foreach (var overlayNameAndColor in overlayNameAndColors) 1214 { 1215 <div style="background-color: @overlayNameAndColor.Value" class="product__primary-image__overlay-container__item"> 1216 @overlayNameAndColor.Key 1217 </div> 1218 } 1219 </div> 1220 <svg class="product__image-icon"> 1221 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#fullscreen"></use> 1222 </svg> 1223 </a> 1224 </div> 1225 <div class="row col-xs-12"> 1226 <div class="product__thumbnail-list"> 1227 @foreach (var imageThumb in imagepath) 1228 { 1229 <div class="col-sm-3 col-xs-4"> 1230 <div class="product__thumbnail-images"> 1231 <a href="@imageThumb&width=1000" data-fancybox="product-gallery" rel="product" class="fancybox"> 1232 <img data-src="@imageThumb&width=458" width="458" alt="@productname" class="img-responsive lazy"> 1233 </a> 1234 </div> 1235 </div> 1236 } 1237 @{ 1238 var youtubeVideos = productObj.Details.Where(x => "YoutubeVideos" == new DetailsGroupService().GetById(x.GroupId).SystemName).ToList(); 1239 var productVideos = productObj.Details.Where(x => "ProductVideos" == new DetailsGroupService().GetById(x.GroupId).SystemName).ToList(); 1240 1241 if (youtubeVideos.Count > 0) 1242 { 1243 foreach (var youtubeVideo in youtubeVideos) 1244 { 1245 string thumbnail = youtubeVideo.Value; 1246 string youtubeId = youtubeVideo.Keywords; 1247 1248 // For Fancybox, we typically include “?autoplay=1” in the iframe URL. 1249 var youtubeEmbedUrl = $"https://www.youtube.com/embed/{youtubeId}?autoplay=1&enablejsapi=1"; 1250 1251 <div class="col-sm-3 col-xs-4"> 1252 <div class="product__thumbnail-images"> 1253 <a style="" href="@youtubeEmbedUrl" 1254 data-fancybox="product-gallery" 1255 data-type="iframe" 1256 rel="product" 1257 class="fancybox"> 1258 1259 <div class="product__play-container"> 1260 <img alt="Video thumbnail" src="@thumbnail" /> 1261 <svg class="product__play-container__play-icon" style="" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> 1262 <path d="M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c7.6-4.2 16.8-4.1 24.3 .5l144 88c7.1 4.4 11.5 12.1 11.5 20.5s-4.4 16.1-11.5 20.5l-144 88c-7.4 4.5-16.7 4.7-24.3 .5s-12.3-12.2-12.3-20.9l0-176c0-8.7 4.7-16.7 12.3-20.9z" /> 1263 </svg> 1264 </div> 1265 </a> 1266 </div> 1267 </div> 1268 } 1269 } 1270 else 1271 { 1272 var youtubeId = GetString("Ecom:Product:Field.YoutubeId"); 1273 // For Fancybox, we typically include “?autoplay=1” in the iframe URL. 1274 var youtubeEmbedUrl = $"https://www.youtube.com/embed/{youtubeId}?autoplay=1&enablejsapi=1"; 1275 1276 if (!string.IsNullOrEmpty(youtubeId)) 1277 { 1278 <div class="col-sm-3 col-xs-4"> 1279 <div class="product__thumbnail-images"> 1280 <a style="height: 63px" href="@youtubeEmbedUrl" 1281 data-fancybox="product-gallery" 1282 data-type="iframe" 1283 rel="product" 1284 class="fancybox"> 1285 <svg class="product__play-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> 1286 <path d="M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c7.6-4.2 16.8-4.1 24.3 .5l144 88c7.1 4.4 11.5 12.1 11.5 20.5s-4.4 16.1-11.5 20.5l-144 88c-7.4 4.5-16.7 4.7-24.3 .5s-12.3-12.2-12.3-20.9l0-176c0-8.7 4.7-16.7 12.3-20.9z" /> 1287 </svg> 1288 </a> 1289 </div> 1290 </div> 1291 } 1292 } 1293 1294 if (productVideos.Count > 0) 1295 { 1296 foreach (var productVideo in productVideos) 1297 { 1298 string thumbnail = productVideo.Value; 1299 string mp4Path = productVideo.Keywords; 1300 1301 1302 <div class="col-sm-3 col-xs-4"> 1303 <div class="product__thumbnail-images"> 1304 <!-- 1305 Link to a hidden <div> containing our <video>. 1306 We use data-fancybox="product-gallery" to group it with our images. 1307 data-src="#mp4VideoContent" + data-type="inline" to open inline HTML content. 1308 --> 1309 <a style="" data-fancybox="product-gallery" 1310 data-src="#mp4VideoContent" 1311 data-type="inline" 1312 href="javascript:;"> 1313 <div class="product__play-container"> 1314 <img alt="Video thumbnail" src="@thumbnail" /> 1315 <svg class="product__play-container__play-icon" style="" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> 1316 <path d="M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c7.6-4.2 16.8-4.1 24.3 .5l144 88c7.1 4.4 11.5 12.1 11.5 20.5s-4.4 16.1-11.5 20.5l-144 88c-7.4 4.5-16.7 4.7-24.3 .5s-12.3-12.2-12.3-20.9l0-176c0-8.7 4.7-16.7 12.3-20.9z" /> 1317 </svg> 1318 </div> 1319 </a> 1320 </div> 1321 </div> 1322 1323 <!-- Hidden HTML content that Fancybox will open --> 1324 <div style="display:none;" id="mp4VideoContent"> 1325 <video controls style="width:100%; height:auto;"> 1326 <source src="@mp4Path" type="video/mp4" /> 1327 <!-- You can add WebM or OGG sources if you like for broader browser support --> 1328 Your browser does not support the video tag. 1329 </video> 1330 </div> 1331 } 1332 } 1333 else 1334 { 1335 string mp4Path = GetString("Ecom:Product:Field.ProductVideo.FullPath"); 1336 1337 if (!string.IsNullOrEmpty(mp4Path)) 1338 { 1339 <div class="col-sm-3 col-xs-4"> 1340 <div class="product__thumbnail-images"> 1341 <!-- 1342 Link to a hidden <div> containing our <video>. 1343 We use data-fancybox="product-gallery" to group it with our images. 1344 data-src="#mp4VideoContent" + data-type="inline" to open inline HTML content. 1345 --> 1346 <a style="height: 63px" data-fancybox="product-gallery" 1347 data-src="#mp4VideoContent" 1348 data-type="inline" 1349 href="javascript:;"> 1350 <svg class="product__play-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> 1351 <path d="M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c7.6-4.2 16.8-4.1 24.3 .5l144 88c7.1 4.4 11.5 12.1 11.5 20.5s-4.4 16.1-11.5 20.5l-144 88c-7.4 4.5-16.7 4.7-24.3 .5s-12.3-12.2-12.3-20.9l0-176c0-8.7 4.7-16.7 12.3-20.9z" /> 1352 </svg> 1353 </a> 1354 </div> 1355 </div> 1356 1357 <!-- Hidden HTML content that Fancybox will open --> 1358 <div style="display:none;" id="mp4VideoContent"> 1359 <video controls style="width:100%; height:auto;"> 1360 <source src="@mp4Path" type="video/mp4" /> 1361 <!-- You can add WebM or OGG sources if you like for broader browser support --> 1362 Your browser does not support the video tag. 1363 </video> 1364 </div> 1365 } 1366 } 1367 } 1368 </div> 1369 </div> 1370 </div> 1371 <section class="d-block d-lg-none page-header m-0 p-0" style="border: none"> 1372 <div class="product__help-name-container" style="width: 100%"> 1373 <div class="product__help-name-container__help second"> 1374 <div class="need-help product-view"> 1375 <img class="need-help__image lazy" width="81" height="81" data-src='@(Pageview.Area.Item["Support_Image"].ToString())?format=webp&width=81&quality=75' /> 1376 <div class="need-help__text product-view second"> 1377 @Pageview.Area.Item["Support_Content"].ToString() 1378 </div> 1379 </div> 1380 </div> 1381 </div> 1382 </section> 1383 </div> 1384 1385 1386 @* The main product information area *@ 1387 1388 <div class="col-md-6 col-sm-8 col-xs-12 product__column"> 1389 <div class="product-info js-product-info" id="productinfo"> 1390 <div class="product__control"> 1391 <div class="row"> 1392 <div class="col-xs-12 col-sm-6"> 1393 @* LAGERBEHOLDNING *@ 1394 <div class="product__stock"> 1395 @{ 1396 if (stock > 0) 1397 { 1398 <p class="product__stock-text"> 1399 <span class="product__stock-circle product__stock-circle--green"></span> På lager 1400 </p> 1401 } 1402 else 1403 { 1404 <p class="product__stock-text"> 1405 @if (!String.IsNullOrEmpty(GetString("Ecom:Manufacturer.Description"))) 1406 { 1407 @GetString("Ecom:Manufacturer.Description") 1408 } 1409 else 1410 { 1411 @Translate("StockStandardSoldoutText", "Kontakt os for leveringstid: 86210800 eller salg@hounisen.com") 1412 } 1413 </p> 1414 } 1415 } 1416 </div> 1417 </div> 1418 <div class="col-xs-12 col-sm-6"> 1419 @* FAVORITTER *@ 1420 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1421 { 1422 if (hasRegionHDeal == false) 1423 { 1424 <div class="product__favorite-list popup-wrap favorite"> 1425 <button class="popup-show" data-popup="favorite-list" type="button" title="@Translate("Add to favorites", "Add to favorites")"> 1426 <i class="fa fa-star-o"></i> <span>@Translate("Add to favorites", "Add to favorites")</span> 1427 </button> 1428 <div id="favorite-list" class="popup-form"> 1429 <div class="close"> 1430 <i class="fa fa-times"></i> 1431 </div> 1432 <h3>@Translate("Choose list", "Choose list")</h3> 1433 <ul> 1434 @{ 1435 var lists = Dynamicweb.Ecommerce.CustomerCenter.CustomerProductList.GetListsByUserCustomerNumber(currentUser.CustomerNumber); 1436 } 1437 1438 @foreach (var list in lists) 1439 { 1440 if (list.Products.Where(p => p.ProductId.ToString() == GetString("Ecom:Product.ID")).Count() > 0) 1441 { 1442 <li> 1443 <a href="@(System.Web.HttpContext.Current.Request.Url)&CCRemoveFromMyLists=@GetString("Ecom:Product.ID")&CCAddToListVariantID=&CCAddToListLanguageID=LANG1&CCAddToListID=@list.ListId&CCListType="> 1444 <i class="fa fa-star"></i> @list.Name 1445 </a> 1446 </li> 1447 } 1448 else 1449 { 1450 <li> 1451 <a href="@(System.Web.HttpContext.Current.Request.Url)&CCAddToMyLists=@GetString("Ecom:Product.ID")&CCAddToListVariantID=&CCAddToListLanguageID=LANG1&CCAddToListID=@list.ListId&CCListType="> 1452 <i class="fa fa-star-o"></i> @list.Name 1453 </a> 1454 </li> 1455 } 1456 } 1457 <li> 1458 <a href="/mine-favoritter/opret-favoritliste?ProdID=@GetString("Ecom:Product.ID")"> 1459 <i class="fa fa-plus"></i>@Translate("Add new list", "Add new list") 1460 </a> 1461 </li> 1462 </ul> 1463 </div> 1464 </div> 1465 } 1466 } 1467 else 1468 { 1469 <div class="not-loggedin"> 1470 <p class="not-loggedin-text"><a data-toggle="modal" data-target="#login" href="">@Translate("Login", "Login")</a> eller <a href="/kontakt/opret-brugerprofil">Bliv kunde</a> for at se priser og købe på Hounisen.com</p> 1471 <a data-toggle="modal" data-target="#login" href="" class="btn btn-primary not-loggedin-button"> 1472 <span>Log ind</span> 1473 </a> 1474 </div> 1475 } 1476 </div> 1477 </div> 1478 1479 1480 @* Prices and actions *@ 1481 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1482 { 1483 var product = GetString("Ecom:Product.ID"); 1484 if (!string.IsNullOrWhiteSpace(GetString("Ecom:Product.SelectedVariantComboID"))) 1485 { 1486 product = GetString("Ecom:Product.ID") + "&" + GetString("Ecom:Product.SelectedVariantComboID"); 1487 } 1488 1489 <div class="row"> 1490 <div class="col-xs-12"> 1491 <ul class="product__prices"> 1492 @foreach (var priceHtml in pricesHtmlList) 1493 { 1494 <li> 1495 @priceHtml 1496 </li> 1497 } 1498 </ul> 1499 </div> 1500 </div> 1501 1502 <div class="row"> 1503 @if (showLimitedProduct) 1504 { 1505 <div class="col-xs-12"> 1506 <button class="btn btn--ghost product__button disabled"> 1507 @Translate("Kan bestilles på fritekstordre", "Kan bestilles på fritekstordre") 1508 </button> 1509 </div> 1510 } 1511 else 1512 { 1513 <div class="col-xs-7"> 1514 <div class="product__addtocart-input js-addtocart-input"> 1515 <input type="button" value="-" class="product__quantity-button product__quantity-button--minus qtyminus" field="quantity" /> 1516 <input type="number" class="product__quantity-input quantity" data-name="quantity" name="quantity" value="@minOrder" field="quantity" /> 1517 <input type="button" value="+" class="product__quantity-button product__quantity-button--plus qtyplus" field="quantity" /> 1518 </div> 1519 <div class="product__unit-selector" style="display: inline-block;"> 1520 1521 @{ 1522 var index = 0; 1523 } 1524 1525 @foreach (var unitDropdown in unitsDropdown) 1526 { 1527 index++; 1528 var currentUnitPrice = prices[index - 1].Values["Ecom:Product.Prices.Amount"]; 1529 <input data-price="@currentUnitPrice" class="unit-type" type="radio" id="@unitDropdown.Id" name="UnitID" value="@unitDropdown.Id" required data-lot-size="@unitDropdown.LotSize" data-min-order="@unitDropdown.MinOrder" @(unitsDropdown.Count == 1 ? "checked='checked'" : "")> 1530 <label for="@unitDropdown.Id">@unitDropdown.Name</label> 1531 } 1532 </div> 1533 <p class="product__unit-selector-error-message"> 1534 * Du mangler at vælge type 1535 </p> 1536 </div> 1537 <div class="col-xs-5"> 1538 <div class="product__addtocart-button"> 1539 <button type="submit" name="submit" onclick="AddToCart(event, '@product', $(this).parent().parent().prev().find('input.quantity').val(), $(this).parent().parent().prev().find('input[name=\'UnitID\']:checked').val());" class="btn btn-primary product__button"> 1540 @Translate("Add to cart", "Add to cart") 1541 <svg class="product__button-icon hidden-xs"> 1542 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#basket"></use> 1543 </svg> 1544 </button> 1545 </div> 1546 </div> 1547 } 1548 </div> 1549 } 1550 </div> 1551 1552 @* Product details *@ 1553 <div> 1554 @* IKONER *@ 1555 <div class="product__icons"> 1556 @{ 1557 foreach (var c in GetString("Ecom:Product:Field.Certificates").Split(',')) 1558 { 1559 if (!string.IsNullOrEmpty(c)) 1560 { 1561 <img class="product__icon lazy" data-src="/Files/Images/Ecom/certificates/@(c).jpg" title="@Translate("Cert_" + c, c)" /> 1562 } 1563 } 1564 } 1565 1566 1567 </div> 1568 1569 1570 </div> 1571 </div> 1572 </div> 1573 </div> 1574 </div> 1575 </div> 1576 1577 1578 @helper RenderDocuments() 1579 { 1580 var productObj = new ProductService().GetProductById(GetString("Ecom:Product.ID"), GetString("Ecom:Product.VariantID"), GetString("Ecom:Product.LanguageID")); 1581 var documents = productObj.Details.Where(x => "Documents" == new DetailsGroupService().GetById(x.GroupId).SystemName).ToList(); 1582 1583 bool hasAtLeastOneLink = 1584 !string.IsNullOrEmpty(GetString("Ecom:Product:Field.Link1Label")) || 1585 !string.IsNullOrEmpty(GetString("Ecom:Product:Field.Link2Label")) || 1586 !string.IsNullOrEmpty(GetString("Ecom:Product:Field.Link3Label")) || 1587 !string.IsNullOrEmpty(GetString("Ecom:Product:Field.Link4Label")) || 1588 !string.IsNullOrEmpty(GetString("Ecom:Product:Field.Link5Label")); 1589 bool atleastOneProductDetail = hasAtLeastOneLink || 1590 !string.IsNullOrEmpty(GetString("Ecom:Product:Field.Guidance.Value.Clean")) || 1591 !string.IsNullOrEmpty(GetString("Ecom:Product:Field.FAQ.Value.Clean")) || documents.Count > 0; 1592 1593 1594 @* DOWNLOAD *@ 1595 if (hasAtLeastOneLink) 1596 { 1597 <div class="row"> 1598 <div class="col-xs-12"> 1599 <div onclick="updateDetailAccessibility(this)" class="product__section-container"> 1600 <h3 class="product__header">@Translate("Dokumenter")</h3> 1601 <div class="product__section-container__icon-wrapper" data-height="0px" data-content-id="documents"> 1602 <svg class="product__section-container__icon"> 1603 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#arrow-right"></use> 1604 </svg> 1605 </div> 1606 1607 </div> 1608 </div> 1609 <div class="col-xs-12"> 1610 <div style="display: block;"> 1611 <div class="product__details"> 1612 <div data-content-id="documents" class="product__details__content" style="max-height: 0px;"> 1613 1614 1615 @{ 1616 if (documents.Count > 0) 1617 { 1618 foreach (var document in documents) 1619 { 1620 <div> 1621 <a class="product__download-pdf" target="_blank" href="@document.Value" class="">@document.Keywords</a> 1622 </div> 1623 } 1624 } 1625 else 1626 { 1627 if (GetString("Ecom:Product:Field.Link1Label") != "") 1628 { 1629 <div> 1630 <a class="product__download-pdf" target="_blank" href="@GetString("Ecom:Product:Field.Link1File.Clean")" class="">@GetString("Ecom:Product:Field.Link1Label")</a> 1631 </div> 1632 } 1633 1634 if (GetString("Ecom:Product:Field.Link2Label") != "") 1635 { 1636 <div> 1637 <a class="product__download-pdf" target="_blank" href="@GetString("Ecom:Product:Field.Link2File.Clean")" class="">@GetString("Ecom:Product:Field.Link2Label")</a> 1638 </div> 1639 } 1640 1641 if (GetString("Ecom:Product:Field.Link3Label") != "") 1642 { 1643 <div> 1644 <a class="product__download-pdf" target="_blank" href="@GetString("Ecom:Product:Field.Link3File.Clean")" class="">@GetString("Ecom:Product:Field.Link3Label")</a> 1645 </div> 1646 } 1647 1648 if (GetString("Ecom:Product:Field.Link4Label") != "") 1649 { 1650 <div> 1651 <a class="product__download-pdf" target="_blank" href="@GetString("Ecom:Product:Field.Link4File.Clean")" class="">@GetString("Ecom:Product:Field.Link4Label")</a> 1652 </div> 1653 } 1654 1655 if (GetString("Ecom:Product:Field.Link5Label") != "") 1656 { 1657 <div> 1658 <a class="product__download-pdf" target="_blank" href="@GetString("Ecom:Product:Field.Link5File.Clean")" class="">@GetString("Ecom:Product:Field.Link5Label")</a> 1659 </div> 1660 } 1661 } 1662 } 1663 1664 </div> 1665 </div> 1666 </div> 1667 </div> 1668 </div> 1669 <hr class="product__hr" /> 1670 } 1671 } 1672 1673 @helper RenderGuidance() 1674 { 1675 if (!String.IsNullOrEmpty(GetString("Ecom:Product:Field.Guidance.Value.Clean"))) 1676 { 1677 <div class="row"> 1678 1679 <div class="col-xs-12"> 1680 1681 1682 <div onclick="updateDetailAccessibility(this)" class="product__section-container"> 1683 <h3 class="product__header">Vejledning</h3> 1684 1685 <div class="product__section-container__icon-wrapper" data-height="0px" data-content-id="Guidance"> 1686 <svg class="product__section-container__icon"> 1687 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#arrow-right"></use> 1688 </svg> 1689 </div> 1690 1691 </div> 1692 </div> 1693 <div class="col-xs-12 py-4"> 1694 <div style="display: block;"> 1695 <div class="product__details"> 1696 @{ 1697 var text = GetString("Ecom:Product:Field.Guidance.Value.Clean"); 1698 } 1699 1700 <div data-content-id="Guidance" class="product__details__content" style="max-height: 0px;"> 1701 @text 1702 </div> 1703 1704 </div> 1705 </div> 1706 </div> 1707 </div> 1708 1709 <hr class="product__hr" /> 1710 } 1711 } 1712 1713 @helper RenderFAQ() 1714 { 1715 if (!String.IsNullOrEmpty(GetString("Ecom:Product:Field.FAQ.Value.Clean"))) 1716 { 1717 <div class="row"> 1718 1719 <div class="col-xs-12"> 1720 1721 1722 <div onclick="updateDetailAccessibility(this)" class="product__section-container"> 1723 <h3 class="product__header">@Translate("FAQ")</h3> 1724 1725 <div class="product__section-container__icon-wrapper" data-height="0px" data-content-id="FAQ"> 1726 <svg class="product__section-container__icon"> 1727 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#arrow-right"></use> 1728 </svg> 1729 </div> 1730 1731 </div> 1732 </div> 1733 <div class="col-xs-12 py-4"> 1734 <div style="display: block;"> 1735 <div class="product__details"> 1736 @{ 1737 var text = GetString("Ecom:Product:Field.FAQ.Value.Clean"); 1738 } 1739 1740 <div data-content-id="FAQ" class="product__details__content" style="max-height: 0px;"> 1741 @text 1742 </div> 1743 1744 </div> 1745 </div> 1746 </div> 1747 </div> 1748 1749 <hr class="product__hr" /> 1750 } 1751 } 1752 1753 @helper RenderAccordionTextSection(string contentId, string header, string text) 1754 { 1755 if (!String.IsNullOrEmpty(text)) 1756 { 1757 <div class="row"> 1758 <div class="col-xs-12"> 1759 <div onclick="updateDetailAccessibility(this)" class="product__section-container"> 1760 <h3 class="product__header">@header</h3> 1761 1762 <div class="product__section-container__icon-wrapper" data-height="0px" data-content-id="@contentId"> 1763 <svg class="product__section-container__icon"> 1764 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#arrow-right"></use> 1765 </svg> 1766 </div> 1767 1768 </div> 1769 </div> 1770 <div class="col-xs-12 py-4"> 1771 <div style="display: block;"> 1772 <div class="product__details"> 1773 <div data-content-id="@contentId" class="product__details__content" style="max-height: 0px;"> 1774 @text 1775 </div> 1776 </div> 1777 </div> 1778 </div> 1779 </div> 1780 1781 <hr class="product__hr" /> 1782 } 1783 } 1784 1785 @helper RenderProductAccordionTexts() 1786 { 1787 @RenderAccordionTextSection("usage-and-purpose", "Anvendelse og formål", GetString("Ecom:Product:Field.UsageAndPurpose")) 1788 @RenderAccordionTextSection("compatibility", "Kompatibilitet", GetString("Ecom:Product:Field.Compatibility")) 1789 @RenderAccordionTextSection("limitations-and-precautions", "Begrænsninger og opmærksomhedspunkter", GetString("Ecom:Product:Field.LimitationsAndPrecautions")) 1790 } 1791 1792 @helper RenderSpecifikationer() 1793 { 1794 string manufacturerName = GetString("Ecom:Manufacturer.Name"); 1795 string manufacturerUrl = GetString("Ecom:Manufacturer.Web"); 1796 <div class="row"> 1797 <div class="col-xs-12"> 1798 <hr class="product__hr" /> 1799 <div class="product__section-container product__section-container--no-hover"> 1800 <h3 class="product__header">Specifikationer</h3> 1801 </div> 1802 </div> 1803 <div class="col-xs-12 py-4"> 1804 <div style="display: block;"> 1805 <div class="product__details"> 1806 <div data-content-id="specifikationer" class="product__details__content" style="max-height: 9999px;"> 1807 @* ATTRIBUTTER *@ 1808 <div class="product__information"> 1809 1810 <dl class="product__information-table"> 1811 @{ 1812 int attributeLineCount = 0; 1813 for (int i = 1; i < 8; i++) 1814 { 1815 attributeLineCount++; 1816 string attributeName = "Ecom:Product:Field.Attribut" + attributeLineCount + "A"; 1817 string attributeValue = "Ecom:Product:Field.Attribut" + attributeLineCount + "B"; 1818 string attributeBrand = string.Empty; 1819 1820 if (GetString(attributeName) != "") 1821 { 1822 if (attributeLineCount == 7) 1823 { 1824 attributeBrand = "itemprop=\"brand\""; 1825 } 1826 1827 <dt>@GetString(attributeName) :</dt> 1828 <dd @attributeBrand>@GetString(attributeValue)</dd> 1829 } 1830 } 1831 1832 if (!manufacturerName.IsNullOrEmpty() && !manufacturerUrl.IsNullOrEmpty()) 1833 { 1834 <dt>Brand :</dt> 1835 <dd> 1836 <a target="_blank" class="product__information-table__manufacturer" href="@manufacturerUrl">@manufacturerName</a> 1837 </dd> 1838 } 1839 } 1840 1841 </dl> 1842 </div> 1843 1844 1845 </div> 1846 1847 </div> 1848 </div> 1849 </div> 1850 </div> 1851 } 1852 1853 @helper RenderDescription() 1854 { 1855 if (!String.IsNullOrEmpty(GetString("Ecom:Product.LongDescription"))) 1856 { 1857 var description = GetString("Ecom:Product.LongDescription"); 1858 1859 // Remove HTML tags 1860 string cleanedText = Regex.Replace(description, "<.*?>", " "); 1861 string[] words = cleanedText.Split(new[] { ' ', '\n', '\r', '\t' }, StringSplitOptions.RemoveEmptyEntries); 1862 bool readMoreButton = words.Length > 80; 1863 1864 <div class="row"> 1865 1866 <div class="col-xs-12"> 1867 <hr class="product__hr" /> 1868 <div onclick="updateDetailAccessibility(this)" class="product__section-container"> 1869 <h3 style="@(!readMoreButton ? "cursor: auto" : "") " id="productLongDescriptionID" class="product__header">@Translate("Description", "Description")</h3> 1870 1871 <div class="product__section-container__icon-wrapper" data-height="95px" data-content-id="description"> 1872 1873 @if (readMoreButton) 1874 { 1875 <svg class="product__section-container__icon"> 1876 <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/dist/icons/icons.svg#arrow-right"></use> 1877 </svg> 1878 } 1879 </div> 1880 </div> 1881 </div> 1882 <div class="col-xs-12 py-4"> 1883 <div style="display: block;"> 1884 <div class="product__details"> 1885 1886 @if (readMoreButton) 1887 { 1888 <div data-content-id="description" class="product__details__content" style="min-height: 95px;max-height: 95px;"> 1889 @description 1890 </div> 1891 } 1892 else 1893 { 1894 @description 1895 } 1896 </div> 1897 </div> 1898 </div> 1899 </div> 1900 } 1901 } 1902 1903 1904 <div class="row product__column__wrapper"> 1905 <div class="col-md-6 col-sm-12 col-xs-12 product__column"> 1906 @if (isMobile) 1907 { 1908 @RenderSpecifikationer() 1909 @RenderDescription() 1910 <hr class="product__hr" /> 1911 } 1912 else 1913 { 1914 @RenderDescription() 1915 <hr class="product__hr" /> 1916 @RenderGuidance() 1917 @RenderFAQ() 1918 } 1919 1920 </div> 1921 <div class="col-md-6 col-sm-12 col-xs-12 product__column"> 1922 @if (isMobile) 1923 { 1924 @RenderDocuments() 1925 @RenderProductAccordionTexts() 1926 @RenderGuidance() 1927 @RenderFAQ() 1928 } 1929 else 1930 { 1931 @RenderSpecifikationer() 1932 <hr class="product__hr" /> 1933 @RenderDocuments() 1934 @RenderProductAccordionTexts() 1935 } 1936 </div> 1937 </div> 1938 1939 1940 @* Related products *@ 1941 1942 @if (GetString("Ecom:Product.RelatedCount") != "0") 1943 { 1944 <div class="row"> 1945 <div class="col-xs-12 p-15 p-md-0 @(isMobile ? "related-products-slider" : "")"> 1946 <h2 class="product__header product__header--mobile-center">Relaterede varer</h2> 1947 <ul class="shop-list__list p-0-fc @(isMobile ? "owl-carousel" : "")"> 1948 @foreach (LoopItem relatedgroup in GetLoop("ProductRelatedGroups")) 1949 { 1950 var relatedproductloop = relatedgroup.GetLoop("RelatedProducts").OrderByDescending(g => g.GetString("Ecom:Product.LoopCounter")).Take(4).ToList(); 1951 @GetProductListFullRelated(relatedproductloop, 3, 3, 1) 1952 } 1953 </ul> 1954 </div> 1955 </div> 1956 } 1957 1958 1959 <!-- Udforsk mere --> 1960 1961 @functions 1962 { 1963 List<int> GetIds(string idsRaw) 1964 { 1965 List<int> ids = new List<int>(); 1966 if (idsRaw.IsNotNullOrEmpty()) 1967 { 1968 foreach (var articleId in idsRaw.Split(',')) 1969 { 1970 if (int.TryParse(articleId, out int id)) 1971 { 1972 ids.Add(id); 1973 } 1974 } 1975 } 1976 1977 return ids; 1978 } 1979 } 1980 1981 @{ 1982 var articlesPageId = GetPageIdByNavigationTag("ProductviewUniverseArticles"); 1983 bool hasActiveArticles = false; 1984 1985 var productId = Dynamicweb.Context.Current.Request.QueryString["productid"]; 1986 var defaultGroup = new ProductService().GetProductById(productId, "", true).DefaultGroup; 1987 1988 if (defaultGroup != null) 1989 { 1990 string articlesIdsRaw = defaultGroup.ProductGroupFieldValues.GetProductGroupFieldValue("Articles")?.Value?.ToString() ?? ""; 1991 string articleSubGroupIdsRaw = defaultGroup.ProductGroupFieldValues.GetProductGroupFieldValue("ArticleSubCategories")?.Value?.ToString() ?? ""; 1992 1993 List<int> articlesIds = new List<int>(); 1994 if (!string.IsNullOrEmpty(articlesIdsRaw)) 1995 { 1996 articlesIds = GetIds(articlesIdsRaw); 1997 1998 if (articlesIds.Count > 0) 1999 { 2000 hasActiveArticles = articlesIds.Any(x => new PageService().GetPage(x).Active); 2001 } 2002 } 2003 2004 if (!string.IsNullOrEmpty(articleSubGroupIdsRaw)) 2005 { 2006 var subCategoryIds = GetIds(articleSubGroupIdsRaw); 2007 2008 List<string> subCategoryNames = new List<string>(); 2009 2010 foreach (int subCategoryId in subCategoryIds) 2011 { 2012 var subCategory = new PageService().GetPage(subCategoryId); 2013 if (subCategory != null) 2014 { 2015 subCategoryNames.Add(subCategory.GetDisplayName()); 2016 } 2017 } 2018 2019 foreach (string subCategoryName in subCategoryNames) 2020 { 2021 try 2022 { 2023 var subCategoryArticles = new PageService().GetPagesForItems(new List<string> { "UniverseArticlePage" }).Where(x => x.Item["SubCategories"].ToString().Contains(subCategoryName)); 2024 if (subCategoryArticles.Any(x => x.Active)) 2025 { 2026 hasActiveArticles = true; 2027 } 2028 } 2029 catch 2030 { 2031 } 2032 } 2033 } 2034 } 2035 2036 if (hasActiveArticles) 2037 { 2038 string articlesHeader = ""; 2039 articlesHeader = defaultGroup.ProductGroupFieldValues.GetProductGroupFieldValue("ArticlesHeader").Value.ToString(); 2040 2041 if (string.IsNullOrEmpty(articlesHeader)) 2042 { 2043 articlesHeader = Translate("ProductViewArticleHeader"); 2044 } 2045 2046 var paragraph = new ParagraphService().GetParagraphsByPageId(articlesPageId).FirstOrDefault(); 2047 2048 if (paragraph != null) 2049 { 2050 <div class="row" style="margin-top: 15px"> 2051 <div class="col-xs-12 p-15 p-md-0"> 2052 <h2 class="product__header product__header--mobile-center articles">@articlesHeader</h2> 2053 </div> 2054 2055 </div> 2056 2057 <div class="row-25"> 2058 @RenderParagraphContent(paragraph.ID) 2059 </div> 2060 } 2061 } 2062 } 2063 2064 2065 <div class="row p-15 p-md-0" style="margin-top: 15px"> 2066 <!-- display block in clerk.js if at least one product --> 2067 <h2 class="product__header product__header--mobile-center" id="product-header-clerk" style="display: block;">Ofte købt sammen med</h2> 2068 <span class="clerk" 2069 data-template="@@product-page-others-also-bought" 2070 data-products='["@GetString("Ecom:Product.ID")"]'> 2071 </span> 2072 </div> 2073 2074 2075 <div class="row"> 2076 <div class="col-md-12 col-sm-12 col-xs-12"> </div> 2077 </div> 2078 2079 @{ 2080 2081 2082 var pricesJs = new List<CustomUnitPriceViewModel>(); 2083 foreach (var priceJs in prices) 2084 { 2085 var productPrice = new CustomUnitPriceViewModel(); 2086 productPrice.BaseUnitPrice = priceJs.GetDouble("Ecom:Product.Prices.BaseUnitPrice"); 2087 productPrice.PriceQuantityPerUnit = priceJs.GetDouble("Ecom:Product.Prices.PriceQuantityPerUnit"); 2088 productPrice.Quantity = priceJs.GetDouble("Ecom:Product.Prices.Quantity"); 2089 productPrice.UnitId = priceJs.GetString("Ecom:Product.Prices.UnitID"); 2090 pricesJs.Add(productPrice); 2091 } 2092 } 2093 2094 @if (!String.IsNullOrWhiteSpace(GetString("Ecom:Product:Field.ScriptsBottom"))) 2095 { 2096 @SnippetStart("JavaScriptBottom") 2097 @GetString("Ecom:Product:Field.ScriptsBottom") 2098 @SnippetEnd("JavaScriptBottom") 2099 } 2100 2101 <script> 2102 var pricesJs = JSON.parse('@Newtonsoft.Json.JsonConvert.SerializeObject(pricesJs)'); 2103 2104 // Create our number formatter. 2105 var formatterUs = new Intl.NumberFormat('en-US', { 2106 minimumFractionDigits: 2, 2107 }); 2108 2109 2110 2111 2112 $('.product__addtocart-button').on('click', function () { 2113 2114 var quantityAdded = parseInt($(this).parent().prev().find('input.quantity').val()); 2115 var unitAdded = $(this).parent().prev().find('select.unit').val(); 2116 var priceFound = null; 2117 for (const key in pricesJs) { 2118 if (pricesJs[key].UnitId == unitAdded && quantityAdded >= parseInt(pricesJs[key].Quantity)){ 2119 priceFound = pricesJs[key]; 2120 } 2121 } 2122 2123 var priceAdded = 0; 2124 if (priceFound != null) { 2125 priceAdded = (priceFound.BaseUnitPrice * priceFound.PriceQuantityPerUnit) * quantityAdded; } 2126 2127 var quantity = document.getElementsByClassName("product__quantity-input")[0].value; 2128 var unitTypes = document.getElementsByClassName("unit-type"); 2129 var isVariantNull = true; 2130 2131 var index = 0; 2132 var unitPrice; 2133 var currentUnitName; 2134 for (const button of unitTypes){ 2135 2136 if (button.checked != false) 2137 { 2138 isVariantNull = false; 2139 var tempPrice = button.dataset.price.replace(".",""); 2140 tempPrice = tempPrice.replace(",","."); 2141 unitPrice = parseFloat(tempPrice); 2142 currentUnitName = button.value.split("_")[1]; 2143 index++; 2144 } 2145 } 2146 2147 if (!isVariantNull) 2148 { 2149 dataLayer.push({ecommerce:null}); 2150 dataLayer.push({ 2151 'event': 'add_to_cart', 2152 "ecommerce":{ 2153 "currency" : "@GetString("Ecom:Product.CurrencyCode")", 2154 "value" : unitPrice * (parseInt(quantity)).toFixed(2), 2155 "items":[ 2156 { 2157 "item_name": "@GetString("Ecom:Product.Name")" + " - " + currentUnitName, 2158 'item_id': '@GetString("Ecom:Product.ID")', 2159 'price': unitPrice, 2160 "item_brand" : "", 2161 "item_category": (categories[0] != null ? categories[0] : ""), 2162 "item_category2": (categories[1] != null ? categories[1] : ""), 2163 "item_category3": (categories[2] != null ? categories[2] : ""), 2164 "item_category4": (categories[3] != null ? categories[3] : ""), 2165 "item_category5": (categories[4] != null ? categories[4] : ""), 2166 "quantity": parseInt(quantity), 2167 } 2168 ] 2169 }, 2170 2171 }); 2172 } 2173 2174 }); 2175 2176 //Sets the unittype if only one unittype for the product exists 2177 var types = document.getElementsByClassName("unit-type"); 2178 var currentUnitName; 2179 2180 if (types.length === 1){ 2181 currentUnitName = " - " + (types[0].value.split("_")[1]); 2182 2183 } 2184 else{ 2185 currentUnitName = ""; 2186 } 2187 2188 2189 var initialCategories = document.getElementsByClassName("page-header__title")[0].dataset.categories; 2190 var categories = initialCategories.split("_"); 2191 2192 2193 if (types.length === 1){ 2194 2195 var currentUnitPrice = 0; 2196 var tempPrice = types[0].dataset.price.replace(".",""); 2197 tempPrice = tempPrice.replace(",","."); 2198 currentUnitPrice = parseFloat(tempPrice); 2199 2200 // View_item initial, if only one unit type exists 2201 dataLayer.push({ecommerce:null}); 2202 dataLayer.push({ 2203 'event': 'view_item', 2204 "ecommerce":{ 2205 "currency" : "@GetString("Ecom:Product.CurrencyCode")", 2206 "value" : currentUnitPrice, 2207 "items":[ 2208 { 2209 "item_name": "@GetString("Ecom:Product.Name")" + currentUnitName, 2210 'item_id': '@GetString("Ecom:Product.ID")', 2211 'price': currentUnitPrice, 2212 "item_brand" : "", 2213 "item_category": (categories[0] != null ? categories[0] : ""), 2214 "item_category2": (categories[1] != null ? categories[1] : ""), 2215 "item_category3": (categories[2] != null ? categories[2] : ""), 2216 "item_category4": (categories[3] != null ? categories[3] : ""), 2217 "item_category5": (categories[4] != null ? categories[4] : ""), 2218 "quantity": 1, 2219 2220 } 2221 ] 2222 }, 2223 2224 }); 2225 } 2226 2227 2228 var unitTypes = document.getElementsByClassName("unit-type"); 2229 2230 var price; 2231 var oldPrice; 2232 2233 for (const btn of unitTypes) 2234 { 2235 btn.addEventListener("click", function () { 2236 2237 2238 tempPrice = this.dataset.price.replace(".",""); 2239 tempPrice = tempPrice.replace(",","."); 2240 price = parseFloat(tempPrice); 2241 2242 currentUnitName = btn.value.split("_")[1]; 2243 2244 //checks to see if the new variant is the same as the old one 2245 if (price != oldPrice){ 2246 2247 dataLayer.push({ecommerce:null}); 2248 dataLayer.push({ 2249 'event': 'view_item', 2250 "ecommerce":{ 2251 "currency" : "@GetString("Ecom:Product.CurrencyCode")", 2252 "value" : price, 2253 "items":[ 2254 { 2255 "item_name": "@GetString("Ecom:Product.Name")" + " - " + currentUnitName, 2256 'item_id': '@GetString("Ecom:Product.ID")', 2257 'price': price, 2258 "item_brand" : "", 2259 "item_category": (categories[0] != null ? categories[0] : ""), 2260 "item_category2": (categories[1] != null ? categories[1] : ""), 2261 "item_category3": (categories[2] != null ? categories[2] : ""), 2262 "item_category4": (categories[3] != null ? categories[3] : ""), 2263 "item_category5": (categories[4] != null ? categories[4] : ""), 2264 "quantity": 1, 2265 2266 } 2267 ] 2268 }, 2269 2270 }); 2271 2272 } 2273 oldPrice = price; 2274 }) 2275 } 2276 2277 </script> 2278 2279 @SnippetStart("JavaScriptBottom") 2280 <script type="text/javascript" src="~/Files/Templates/Designs/Dwsimple/js/video-api.js"></script> 2281 2282 @if (currentUser != null) 2283 { 2284 <script type="text/javascript" src="~/Files/Templates/Designs/Dwsimple/js/clerk.js"></script> 2285 } 2286 2287 <script> 2288 function on() { 2289 document.getElementById("overlay").style.display = "block"; 2290 callPlayer('product-video', 'playVideo'); 2291 } 2292 function off() { 2293 document.getElementById("overlay").style.display = "none"; 2294 callPlayer('product-video', 'pauseVideo'); 2295 } 2296 function updateDetailAccessibility(button) { 2297 2298 //set wrapper equal to first child of button with class product__section-container__icon-wrapper 2299 wrapper = button.parentElement.parentElement.querySelector('.product__section-container__icon-wrapper'); 2300 2301 2302 var content = document.querySelector('.product__details__content[data-content-id="' + wrapper.getAttribute('data-content-id') + '"]'); 2303 var defaultHeight = wrapper.getAttribute("data-height"); 2304 2305 if (content.style.maxHeight == defaultHeight) { 2306 content.style.maxHeight = content.scrollHeight + "px"; 2307 } else { 2308 content.style.maxHeight = defaultHeight; 2309 } 2310 2311 var icons = wrapper.querySelectorAll('.product__section-container__icon'); 2312 icons.forEach(function (icon) { 2313 2314 2315 //toggle between product__section-container__icon--active and not 2316 if (icon.classList.contains('product__section-container__icon--active')) { 2317 icon.classList.remove('product__section-container__icon--active'); 2318 2319 } else { 2320 icon.classList.add('product__section-container__icon--active'); 2321 } 2322 2323 2324 }); 2325 2326 } 2327 2328 </script> 2329 2330 @SnippetEnd("JavaScriptBottom") 2331 2332 @functions { 2333 2334 public static string StripHTML(string input) 2335 { 2336 var doc = new HtmlDocument(); 2337 doc.LoadHtml(input); 2338 return doc.DocumentNode.InnerText; 2339 } 2340 2341 // Some DynamicWeb "Link" field tags render as a full <a href="...">text</a> 2342 // anchor instead of a plain URL string. This pulls just the href out if so; 2343 // if the input is already a plain string it's returned unchanged. 2344 public static string ExtractHref(string raw) 2345 { 2346 if (string.IsNullOrWhiteSpace(raw)) 2347 { 2348 return raw ?? ""; 2349 } 2350 if (raw.TrimStart().StartsWith("<a", StringComparison.OrdinalIgnoreCase)) 2351 { 2352 var doc = new HtmlDocument(); 2353 doc.LoadHtml(raw); 2354 var anchor = doc.DocumentNode.SelectSingleNode("//a"); 2355 return anchor?.GetAttributeValue("href", "") ?? ""; 2356 } 2357 return raw; 2358 } 2359 2360 // Slugifies a Danish string for use in IDs/slugs, transliterating æ/ø/å 2361 // instead of stripping them (matches the site's existing URL conventions, 2362 // e.g. "Venøs" -> "venoes", not "ven-s"). 2363 public static string DanishSlug(string input) 2364 { 2365 if (string.IsNullOrWhiteSpace(input)) 2366 { 2367 return ""; 2368 } 2369 string s = input.ToLowerInvariant(); 2370 s = s.Replace("æ", "ae").Replace("ø", "oe").Replace("å", "aa"); 2371 s = Regex.Replace(s, @"[^a-z0-9]+", "-").Trim('-'); 2372 return s; 2373 } 2374 2375 } 2376 <script type="application/ld+json"> 2377 @(new System.Web.HtmlString(productSchemaJson)) 2378 </script> 2379 2380 <style> 2381 2382 .product__details { 2383 position: relative; 2384 margin-bottom: 10px; 2385 2386 p { 2387 margin: 0; 2388 width: fit-content; 2389 } 2390 2391 a:hover { 2392 cursor: pointer; 2393 } 2394 2395 .product__details__content { 2396 overflow: hidden; 2397 transition: max-height 0.3s ease; 2398 } 2399 } 2400 </style> 2401