Biesse
✔ Fri fragt ved køb over 2.000,- ex. moms på webshoppen
✔ Mulighed for at handle 24/7
✔ Kvalitetsværktøj til professionelle
Biesse
Error executing template "Designs/Junget/eCom/Product/productview.cshtml" System.IO.FileNotFoundException: D:\Web\DW3\Junget2026\Website\Files\System\Images\Shop\Category\W9\W9-11.jpg at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement) at CompiledRazorTemplates.Dynamic.RazorEngine_b727d90b8e9c4d83af326785d58a96e4.Execute() in D:\Web\DW3\Junget2026\Website\Files\Templates\Designs\Junget\eCom\Product\productview.cshtml:line 279 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 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 3 @using System; 4 @using System.Collections.Generic; 5 @using System.Web 6 @using System.Drawing 7 @using System.Text.RegularExpressions; 8 @using Dynamicweb.Content 9 @using Dynamicweb.Security.UserManagement; 10 @using Helpers = Website.Helpers; 11 12 @{ 13 bool webshopOK = GetBoolean("Ecom:Product:Field.WebshopOK"); 14 bool internalProduct = GetBoolean("Ecom:Product:Field.InternalProduct"); 15 if (!webshopOK && !internalProduct) 16 { 17 HttpContext.Current.Response.Redirect("/", true); 18 } 19 20 var productId = GetString("Ecom:Product.ID"); 21 var productVariantId = GetString("Ecom:Product.VariantID"); 22 var productLanguageId = GetString("Ecom:Product.LanguageID"); 23 var productService = new Dynamicweb.Ecommerce.Products.ProductService(); 24 var productImageService = new Dynamicweb.Ecommerce.Products.ProductImageService(); 25 var productApi = productService.GetProductById(productId, productVariantId, productLanguageId); 26 var shop = new Dynamicweb.Ecommerce.Shops.ShopService().GetShop("SHOP1"); 27 var fields = productApi.ProductFieldValues; 28 29 //productHelper 30 var productHelper = new Website.Helpers.Product(); 31 32 int pageId = GetInteger("Ecom:Product:Page.ID"); 33 34 // Stock status 35 int jungStockAmount = Dynamicweb.Core.Converter.ToInt32(GetString("Ecom:Product:Field.jung_stock").Replace("D", "")); 36 string jungStockText = Helpers.Product.GetJungStock(GetString("Ecom:Product:Field.jung_stock"), GetInteger("Ecom:Product.Stock")); 37 int addDaysToLeadtimeCalculationDate = jungStockAmount; 38 if (GetInteger("Ecom:Product.Stock") > 0) 39 { 40 addDaysToLeadtimeCalculationDate = 0; 41 } 42 if (Pageview.Area.ID == 8) 43 { 44 addDaysToLeadtimeCalculationDate = addDaysToLeadtimeCalculationDate + 5; 45 } 46 double minQuantity = GetDouble("Ecom:Product.PurchaseMinimumQuantity"); 47 if (minQuantity < 1) 48 { 49 minQuantity = 1; 50 } 51 double quantityStep = GetDouble("Ecom:Product.PurchaseQuantityStep"); 52 if (quantityStep < 1) 53 { 54 quantityStep = 1; 55 } 56 57 // Images and files 58 string grpId = GetString("Ecom:Product.PrimaryOrFirstGroupID"); 59 string productImage = Website.Helpers.Product.GetMainProductImage(productApi); 60 if (String.IsNullOrEmpty(productImage)) 61 { 62 productImage = "/Files/System/Images/Shop/na-image.jpg"; 63 } 64 string productImageFullurl = "https://www.junget.com/" + productImage; 65 var imagesPatterns = productImageService.GetImagesFromPatterns(productApi, shop).ToList(); 66 string youtubeId = GetString("Ecom:Product:Field.YoutubeId"); 67 68 69 // Price 70 string productPrice = GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-"); 71 double productPriceDouble = GetDouble("Ecom:Product.Price.PriceWithoutVAT"); 72 string productName = GetString("Ecom:Product.Name"); 73 string productNumber = GetString("Ecom:Product.Number"); 74 string productVariantName = GetString("Ecom:Product:Field.VariantName"); 75 76 string longDescription = GetString("Ecom:Product.LongDescription"); 77 string teaserText = GetString("Ecom:Product.ShortDescription"); 78 string metaDescription = teaserText + longDescription; 79 80 string productSpecifications = GetString("Ecom:Product:Field.DJSpecifications"); 81 string userManuals = GetString("Ecom:Product:Field.UserManuals"); 82 int counter = 0; 83 string productFabrikat = GetString("Ecom:Product:Field.fabrikat").ToLower(); 84 85 if (string.IsNullOrEmpty(metaDescription)) 86 { 87 metaDescription = Translate("Besøg vores Webshop og find dit værktøj til gode priser.Tilmeld dig som bruger og få masser af fordele fx.nem genbestilling, Fri fragt v.køb over 2.000,.mm."); 88 } 89 metaDescription = Regex.Replace(System.Web.HttpUtility.HtmlDecode(metaDescription.Trim().Replace(System.Environment.NewLine, " ")), "<.*?>", String.Empty); 90 if (metaDescription.Length > 155) 91 { 92 metaDescription = metaDescription.Substring(0, 155); 93 } 94 95 //set meta title to productname 96 Dynamicweb.Frontend.PageView.Current().Meta.Title = productName; 97 98 User mainUserHeader = Pageview.User?.CurrentSecondaryUser != null ? Pageview.User.CurrentSecondaryUser : Pageview.User; 99 100 101 //skal hentes på en anden måde, så det bliver den gyldige pris fra ribbon price 102 double webPrice = 0; 103 104 //get prices 105 var prices = productApi.Prices; 106 bool hasCombinations = productApi.VariantCombinations.Any(); 107 108 //get campaign name 109 string campaignName = ""; 110 double oldPrice = 0; 111 double oldPriceVat = 0; 112 string oldPriceCurrency = ""; 113 114 var userToTakePriceFrom = Pageview.User; 115 foreach (var priceFromMatrix in prices) 116 { 117 if (Helpers.Product.IsPriceValid(priceFromMatrix)) 118 { 119 120 if (userToTakePriceFrom != null) 121 { 122 if (!string.IsNullOrEmpty(userToTakePriceFrom.Currency) && priceFromMatrix.CurrencyCode == userToTakePriceFrom.Currency) 123 { 124 webPrice = priceFromMatrix.Amount; 125 } 126 127 if (priceFromMatrix.CurrencyCode == "DKK" && string.IsNullOrEmpty(userToTakePriceFrom.Currency)) 128 { 129 webPrice = priceFromMatrix.Amount; 130 } 131 } 132 else if (priceFromMatrix.CurrencyCode == Pageview.Area.EcomCurrencyId) 133 { 134 135 webPrice = priceFromMatrix.Amount; 136 137 } 138 else 139 { 140 webPrice = priceFromMatrix.Amount; 141 } 142 143 } 144 145 if (priceFromMatrix.Amount == GetDouble("Ecom:Product.Price.PriceWithoutVAT.Value") && Helpers.Product.IsCampaingPrice(priceFromMatrix) 146 && Helpers.Product.IsPriceValid(priceFromMatrix)) 147 { 148 campaignName = priceFromMatrix.Periods.FirstOrDefault()?.Name; 149 foreach (var priceFromMatrix2 in prices) 150 { 151 152 153 if (priceFromMatrix2.Amount != GetDouble("Ecom:Product.Price.PriceWithoutVAT.Value") && 154 !Helpers.Product.IsCampaingPrice(priceFromMatrix2) && Helpers.Product.IsPriceValid(priceFromMatrix2)) 155 { 156 157 if (Pageview.Area.EcomCurrencyId == priceFromMatrix2.CurrencyCode) 158 { 159 oldPrice = priceFromMatrix2.Amount; 160 oldPriceVat = priceFromMatrix2.Amount * 1.25; 161 oldPriceCurrency = priceFromMatrix2.CurrencyCode; 162 break; 163 } 164 165 } 166 } 167 168 } 169 } 170 171 List<Dynamicweb.Ecommerce.Products.Group> 172 empty = new List<Dynamicweb.Ecommerce.Products.Group> 173 (); 174 bool isSparePartGroup = productApi.Groups.FirstOrDefault().ProductGroupFieldValues.GetProductGroupFieldValue("Spareparts").Value.ToString() == "True"; 175 176 //Addtional items 177 178 var extraItems = GetLoop("ProductRelatedGroups"); 179 List<string> 180 possibleExtraItems = new List<string> 181 (); 182 possibleExtraItems.Add("Tilvalg_motor"); 183 possibleExtraItems.Add("Tilvalg_tilbehør"); 184 possibleExtraItems.Add("Tilvalg_forridser"); 185 possibleExtraItems.Add("Tilvalg_Snitbredde"); 186 possibleExtraItems.Add("Tilvalg_Snitlængde"); 187 possibleExtraItems.Add("Tilvalg_installation"); 188 possibleExtraItems.Add("Tilvalg_Værktøj"); 189 possibleExtraItems.Add("Tilvalg_test"); 190 possibleExtraItems.Add("Tilvalg_test2"); 191 List<LoopItem> 192 extraLoopItems = new List<LoopItem> 193 (); 194 195 foreach (var item in extraItems) 196 { 197 if (possibleExtraItems.Contains(item.GetString("Ecom:Product:RelatedGroup.Name"))) 198 { 199 var currentProducts = item.GetLoop("RelatedProducts"); 200 var hasItems = false; 201 202 //Checks if item in itemgroup has any items with webshop ok before adding 203 foreach (var product in currentProducts) 204 { 205 if (product.GetString("Ecom:Product:Field.WebshopOK.Value") == "True") 206 { 207 hasItems = true; 208 } 209 210 } 211 //if it has items with webshop ok, add it to list 212 if (hasItems) 213 { 214 extraLoopItems.Add(item); 215 } 216 } 217 } 218 219 bool showWebDiscountMessage = false; 220 bool webDiscountIsNotEmpty = !string.IsNullOrEmpty(GetString("Ecom:Product:Field.WebDiscount")) && GetString("Ecom:Product:Field.WebDiscount") != "0"; 221 bool webDiscountIsLowest = false; 222 223 double customerPrice = GetDouble("Ecom:Product.Price.PriceWithoutVAT"); 224 225 if (webPrice <= customerPrice) 226 { 227 webDiscountIsLowest = true; 228 } 229 230 var priceCurrency = GetString("Ecom:Product.Currency"); 231 232 if (webDiscountIsNotEmpty) 233 { 234 235 if (!User.IsExtranetUserLoggedIn()) 236 { 237 showWebDiscountMessage = true; 238 } 239 else if (User.IsExtranetUserLoggedIn() && webDiscountIsLowest) 240 { 241 showWebDiscountMessage = true; 242 } 243 } 244 245 //if productVariantid, then get the min and max for customSize 246 int customSizeMin = 0; 247 int customSizeMax = 10000000; 248 if (!String.IsNullOrEmpty(productVariantId) && productVariantId.Contains("-")) 249 { 250 var customSize = productVariantId.Split('-'); 251 customSizeMin = Dynamicweb.Core.Converter.ToInt32(customSize[0]); 252 customSizeMax = Dynamicweb.Core.Converter.ToInt32(customSize[1]); 253 } 254 } 255 256 @* Set product canonical URL *@ 257 @SnippetStart("canonical") 258 @{ 259 string host = GetGlobalValue("Global:Request.Host"); 260 string url = GetGlobalValue("Global:Pageview.Url"); 261 int queryIndex = url.IndexOf("?", StringComparison.Ordinal); 262 if (queryIndex > -1) 263 { 264 url = url.Substring(0, queryIndex); 265 } 266 } 267 268 <meta name="description" content="@metaDescription" /> 269 270 <link rel="canonical" href="https://@host@url"> 271 @SnippetEnd("canonical") 272 273 <section class="product-details js-photoswipe"> 274 <div class="container-fluid"> 275 <div class="row no-gutters"> 276 @* Product images *@ 277 <div class="col-12 col-md-6"> 278 @{ 279 Image productImageSize = System.Drawing.Image.FromFile(System.Web.HttpContext.Current.Server.MapPath(productImage)); 280 <div class="d-block"> 281 <a class="mb-3" href="/Admin/Public/GetImage.ashx?Image=@productImage&Width=@productImageSize.Width&Height=@productImageSize.Height&Compression=75&Format=webP" data-fancybox="gallery" data-caption="@productName"> 282 <img class="img-fluid" src="/Admin/Public/GetImage.ashx?Image=@productImage&Width=483&Height=416&format=webP&Compression=75&Background=ffffff&fillcanvas=true" alt="@productName"> 283 </a> 284 </div> 285 286 foreach (string imagesPattern in imagesPatterns) 287 { 288 Image productFigureSize = System.Drawing.Image.FromFile(System.Web.HttpContext.Current.Server.MapPath(imagesPattern)); 289 <div class="d-inline-block"> 290 <a class="d-inline-block mr-3 mt-3" href="/Admin/Public/GetImage.ashx?Image=@imagesPattern&Width=@productFigureSize.Width&Height=@productFigureSize.Height&Compression=75&Format=webP" data-fancybox="gallery" data-caption="@productName"> 291 <img class="img-fluid" src="/Admin/Public/GetImage.ashx?Image=@imagesPattern&width=110&height=100&format=webP&Compression=75&crop=0&Background=ffffff&fillcanvas=true" alt="@productName"> 292 </a> 293 </div> 294 } 295 296 <div class="d-inline-block video-item"> 297 @if (!string.IsNullOrWhiteSpace(youtubeId)) 298 { 299 string youtubeUrl = "https://youtube.com/embed/" + youtubeId; 300 var uri = new Uri(youtubeUrl); 301 302 <a href="@youtubeUrl?autoplay=1" class="video-play-btn js-video-button d-inline-block mr-3 mt-3" data-type="youtube" style="position:relative"> 303 <picture> 304 <!--[if IE 9]><video style="display: none;"><![endif]--> 305 <source srcset="https://img.youtube.com/vi/@youtubeId/hqdefault.jpg 2x" media="(min-width: 576px)"> 306 <!--[if IE 9]></video><![endif]--> 307 <img class="w-100 img-fluid" src="https://img.youtube.com/vi/@youtubeId/hqdefault.jpg" alt=""> 308 </picture> 309 <div class="video js-video_bcg"></div> 310 <div class="video-play-icon video-play-icon--small">PLAY</div> 311 </a> 312 } 313 </div> 314 } 315 </div> 316 <div class="col-12 col-md-6 pl-md-4 mt-md-0 mt-7 pl-0"> 317 @if (!string.IsNullOrEmpty(campaignName)) 318 { 319 string discountImage = ""; //@TODO hvad skal vi gøre med billeder? 320 bool blackFriday = false; //@TODO hvad skal vi gøre med black friday? 321 <div class="mb-8"> 322 @if (!String.IsNullOrEmpty(discountImage)) 323 { 324 <img src="@discountImage" alt="Kampagne billede" /> 325 } 326 else if (blackFriday) 327 { 328 <div class="product-details__promo-badge blackfriday-badge float-left">@Translate("ecom-campaigne-blackfriday", "Black Friday")</div> 329 } 330 else 331 { 332 <div class="product-details__promo-badge float-left">@Translate("Campaign-" + campaignName, campaignName)</div> 333 } 334 335 </div> 336 } 337 338 @if (internalProduct && !webshopOK) 339 { 340 <img src="/Files/System/Images/Shop/Webshop_logo_intern.jpg" alt="Internt produkt" class="mb-4" height="70" /> 341 } 342 343 <h1 class="h2 mb-5">@productName</h1> 344 <div class="mb-7">@Translate("ProductNumber", "Varenummer") @productNumber</div> 345 @if (mainUserHeader != null && mainUserHeader.HasGroup(24)) 346 { 347 string image = VestjyskMarketing.Helpers.ImageHelper.ResizeImage(new ResizeImageSettings() 348 { 349 Image = "/Files/Files/Images/img_calculator.png", 350 Height = 96, 351 Width = 96, 352 Quality = 85 353 }); 354 355 string sPrice = GetDouble("Ecom:Product.DBPrice").ToString("F2"); 356 string wPrice = webPrice.ToString("F2"); 357 string webDiscount = Dynamicweb.Core.Converter.ToDouble(productApi.GetProductFieldValue("WebDiscount")).ToString("F2"); 358 string cost = Dynamicweb.Core.Converter.ToString(productApi.Cost); 359 string externalNumber = Dynamicweb.Core.Converter.ToString(productApi.GetProductFieldValue("ExterntNummer")); 360 string manufacturer = productApi.Manufacturer != null ? productApi.Manufacturer.Name : ""; 361 string discountGroup = Dynamicweb.Core.Converter.ToString(productApi.GetProductFieldValue("ItemDiscGroup")); 362 363 if (addDaysToLeadtimeCalculationDate == 0) 364 { 365 <div> 366 Beholdning: 367 (@GetInteger("Ecom:Product.Stock") @Translate("stk.")) 368 </div> 369 } 370 371 <div class="d-flex align-items-end flex-row"> 372 <div> 373 <div> 374 @Translate("Bruttopris", "Bruttopris"): @sPrice 375 </div> 376 377 <div> 378 @Translate("Webpris", "Webpris"): @wPrice 379 </div> 380 </div> 381 <div class="product-item__details ml-6"> 382 <img src="@image" class="product-item__details__image"> 383 <div class="product-item__details__tooltip"> 384 <div class="row"> 385 <div class="col-7"> 386 @Translate("Bruttopris", "Bruttopris"): 387 </div> 388 <div class="col-5"> 389 @sPrice 390 </div> 391 <div class="col-7"> 392 @Translate("Webrabat", "Webrabat") %: 393 </div> 394 <div class="col-5"> 395 @webDiscount 396 </div> 397 <div class="col-7"> 398 @Translate("Webpris", "Webpris"): 399 </div> 400 <div class="col-5"> 401 @wPrice 402 </div> 403 <div class="col-7"> 404 @Translate("Cost", "Kostpris"): 405 </div> 406 <div class="col-5"> 407 @cost 408 </div> 409 <div class="col-7"> 410 @Translate("Manufacturer's number", "Leverandørens varenr"): 411 </div> 412 <div class="col-5"> 413 @externalNumber 414 </div> 415 <div class="col-7"> 416 @Translate("Manufacturer", "Levenrandør"): 417 </div> 418 <div class="col-5"> 419 @manufacturer 420 </div> 421 <div class="col-7"> 422 @Translate("DiscountGroup", "Varerabatgruppe"): 423 </div> 424 <div class="col-5"> 425 @discountGroup 426 </div> 427 </div> 428 </div> 429 </div> 430 </div> 431 } 432 @if (minQuantity > 1) 433 { 434 <div><strong>@Translate("Minimumskøb:", "Minimumskøb:")</strong> @minQuantity @Translate("stk.")</div> 435 } 436 437 @if (grpId == "W2-1") 438 { 439 <div class="mb-8"> 440 @{ 441 Dynamicweb.Content.ParagraphService paragraphService = new Dynamicweb.Content.ParagraphService(); 442 Dynamicweb.Content.Paragraph paragraph = paragraphService.GetParagraph(11486); 443 444 if (paragraph != null) 445 { 446 @paragraph.Text 447 } 448 } 449 </div> 450 } 451 452 @{ 453 var itemQuality = GetLoop("quality_dd.Options").Where(item => item.GetBoolean("quality_dd.Option.IsSelected")).FirstOrDefault(); 454 } 455 456 <div class="d-flex align-items-center mb-4 flex-row"> 457 <div class="popup-wrap favorite"> 458 <button class="popup-show" data-popup="favorite-list" type="button" title="@Translate("Add to favorites", "Add to favorites")"><i class="icon icon-heart"></i> </button> 459 <div id="favorite-list" class="popup-form"> 460 <div class="close"> 461 <i class="icon icon-close"></i> 462 </div> 463 <h3>@Translate("Choose list", "Choose list")</h3> 464 <ul> 465 @{ 466 if (Dynamicweb.Frontend.PageView.Current().User != null) 467 { 468 var lists = Dynamicweb.Ecommerce.CustomerCenter.CustomerProductList.GetListByCustomerId(Dynamicweb.Frontend.PageView.Current().User.ID); 469 470 foreach (var list in lists) 471 { 472 473 if (list.Products.Where(p => p.ProductId.ToString() == GetString("Ecom:Product.ID")).Count() > 0) 474 { 475 <li><i class="icon icon-heart-solid"></i> <a href="@(System.Web.HttpContext.Current.Request.Url)&CCRemoveFromMyLists=@GetString("Ecom:Product.ID")&CCAddToListVariantID=&CCAddToListLanguageID=LANG1&CCAddToListID=@list.ListId&CCListType=">@list.Name</a></li> 476 } 477 else 478 { 479 <li><i class="icon icon-heart"></i> <a href="@(System.Web.HttpContext.Current.Request.Url)&CCAddToMyLists=@GetString("Ecom:Product.ID")&CCAddToListVariantID=&CCAddToListLanguageID=LANG1&CCAddToListID=@list.ListId&CCListType=">@list.Name</a></li> 480 } 481 } 482 } 483 } 484 <li><i class="icon icon-plus"></i> <a href="/da-dk/favoritlister?CC11503=CreateFormList">@Translate("Add new list", "Add new list")</a></li> 485 </ul> 486 </div> 487 </div> 488 </div> 489 490 @* Variants *@ 491 @{ 492 var pageServiceNew = new Dynamicweb.Content.PageService(); 493 var pagesNew = pageServiceNew.GetPagesForItems(new string[] { "PageShopList" }); 494 var variantsGroup = GetLoop("ProductRelatedGroups").FirstOrDefault(g => g.GetString("Ecom:Product:RelatedGroup.Name") == "Variants"); 495 } 496 @if (variantsGroup != null) 497 { 498 var activeProducts = variantsGroup.GetLoop("RelatedProducts").Where(p => p.GetBoolean("Ecom:Product:Field.WebshopOK") && !string.IsNullOrEmpty(p.GetString("Ecom:Product:Field.VariantName"))); 499 if (activeProducts.Count() > 0) 500 { 501 <div class="container"> 502 <div class="row product-details__related-products"> 503 <div class="accordion"> 504 <div class="card"> 505 <div class="card-header product-details__related-products__header" id="faqhead1"> 506 <a href="#" class="btn btn-header-link" data-toggle="collapse" data-target="#faq1" 507 aria-expanded="false" aria-controls="faq1"> 508 <span> 509 @productVariantName 510 </span> 511 <span class="arrow"> </span> 512 <span class="variants"> 513 @activeProducts.Count() @Translate("varianter", "varianter") 514 </span> 515 </a> 516 </div> 517 518 <div id="faq1" class="collapse" aria-labelledby="faqhead1" data-parent="#faq"> 519 <div> 520 @foreach (LoopItem related in activeProducts) 521 { 522 var productRelated = Dynamicweb.Ecommerce.Services.Products.GetProductById(related.GetString("Ecom:Product.ID"), null, false); 523 int jungStockNumber = Dynamicweb.Core.Converter.ToInt32(related.GetString("Ecom:Product:Field.jung_stock").Replace("D", "")); 524 525 string productRelatedImage = Website.Helpers.Product.GetMainProductImage(productRelated); 526 if (String.IsNullOrEmpty(productImage)) 527 { 528 productRelatedImage = "/Files/System/Images/Shop/na-image.jpg"; 529 } 530 531 //set URL for page. To get correct URL all places in regards to list 532 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(related.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 533 int pageNumber = 0; 534 foreach (var page in pagesNew) 535 { 536 var shopGroupPage = Dynamicweb.Core.Converter.ToString(page.Item["ShopCategoryNumber"]); 537 if (group != null && shopGroupPage == group.Number && page.AreaId.Equals(Pageview.AreaID)) 538 { 539 pageId = page.ID; 540 break; 541 } 542 } 543 string productPageUrl = "/Default.aspx?ID=" + pageId + "&ProductID=" + related.GetString("Ecom:Product.ID"); 544 if (pageId == 0) 545 { 546 productPageUrl = related.GetString("Ecom:Product.Link.Clean"); 547 } 548 string variantProductFabrikat = related.GetString("Ecom:Product:Field.fabrikat").ToLower(); 549 550 <a href="@productPageUrl" class="product-details__related-products__item"> 551 <div class="product-details__related-products__item__title">@related.GetString("Ecom:Product:Field.VariantName")</div> 552 @if ((variantProductFabrikat == "leitz" && Pageview.User != null) || variantProductFabrikat != "leitz") 553 { 554 <div class="product-details__related-products__item__price"> 555 <div class="lazyload-price lazyload-price-dash" data-id="@related.GetString("Ecom:Product.ID")" data-variantid="@related.GetString("Ecom:Product.VariantID")"><img src="/Files/Images/loading.gif"><span>@related.GetString("Ecom:Product.ActualPriceWithoutVAT").Replace(",00", ",-")</span></div> 556 </div> 557 } 558 <div class="product-details__related-products__item__stock"> 559 @if (jungStockNumber > 0 && jungStockNumber < 3) 560 { 561 @Translate("pa-lager", "På lager") <span class="product-details__related-products__item__stock__in-stock"></span> 562 } 563 else 564 { 565 566 string jungStockTextRelated = Helpers.Product.GetJungStock(related.GetString("Ecom:Product:Field.jung_stock"), related.GetInteger("Ecom:Product.Stock")); 567 568 if (variantProductFabrikat != "leitz" && !String.IsNullOrEmpty(jungStockTextRelated)) 569 { 570 <div class="product-details__stock-info"> 571 <span class="text-success">@jungStockTextRelated</span> 572 @if (jungStockNumber < 10 || GetInteger("Ecom:Product.Stock") > 0) 573 { 574 <span class="product-details__related-products__item__stock__in-stock"></span> 575 } 576 </div> 577 578 } 579 else 580 { 581 @Translate("ikke-pa-lager", "Ikke på lager") <span class="product-details__related-products__item__stock__not-in-stock"></span> 582 } 583 } 584 </div> 585 </a> 586 } 587 </div> 588 </div> 589 </div> 590 </div> 591 </div> 592 </div> 593 } 594 } 595 @* Variants end *@ 596 597 598 @* Product price *@ 599 @if (productFabrikat != "leitz") 600 { 601 602 603 <div class="mb-md-5 text-success font-weight-bold product-details__price mb-1"> 604 605 606 607 @if (!String.IsNullOrEmpty(campaignName) && oldPrice > 0 && !User.IsExtranetUserLoggedIn()) 608 { 609 610 611 if (showWebDiscountMessage) 612 { 613 614 <div class="product-details__web-discount">@Translate("ecom-web-price-only")</div> 615 } 616 617 <div class="product-details__price-container"> 618 <div class="price-offer"> 619 <div class="product-details__price-item">@productPrice</div> 620 <div class="product-details__price-withvat">( @Translate("ecom-price-incl-vat", "Vat included") @GetString("Ecom:Product.Price.PriceWithVATFormatted").Replace(",00", ",-"),-)</div> 621 </div> 622 <div class="price-before"> 623 <span class="product-details__price-before">@oldPriceCurrency @oldPrice,-</span> 624 <div class="product-details__price-before product-details__price-withvat">( @Translate("ecom-price-incl-vat", "Vat included") @oldPriceCurrency @oldPriceVat,- )</div> 625 626 627 </div> 628 </div> 629 } 630 else 631 { 632 633 if (showWebDiscountMessage) 634 { 635 636 <div class="product-details__web-discount">@Translate("ecom-web-price-only")</div> 637 } 638 639 640 641 <div data-id="@GetString("Ecom:Product.ID")" data-variantid="@(hasCombinations ? "variantid" :"")" class="lazyload-price lazyload-price-main"> 642 <span> 643 <div>@productPrice</div> 644 </span> 645 <img class="productview" src="/Files/Images/loading.gif"> 646 </div> 647 648 <div class="product-details__price-withvat" style="visibility: hidden">( @Translate("ecom-price-incl-vat", "Vat included") <span data-id="@GetString("Ecom:Product.ID")" data-variantid="@(hasCombinations ? "variantid" : "")" class="lazyload-price lazyload-price-with-vat lazyload-price-main">@GetString("Ecom:Product.Price.PriceWithVATFormatted").Replace(",00", ",-")</span> )</div> 649 650 } 651 </div> 652 653 <div class="product-details__stock-info mb-2"><span class="text-success">@jungStockText</span></div> 654 655 656 } 657 else if (User.IsExtranetUserLoggedIn()) 658 { 659 <div class="mb-md-9 text-success font-weight-bold product-details__price mb-5"> 660 <div data-id="@GetString("Ecom:Product.ID")" data-variantid="@(hasCombinations ? "variantid" :"")" class="lazyload-price lazyload-price-main"> 661 @productPrice 662 <img class="productview" src="/Files/Images/loading.gif"> 663 </div> 664 <div style="visibility: hidden" class=" product-details__price-withvat">( @Translate("ecom-price-incl-vat", "Vat included") <span data-id="@GetString("Ecom:Product.ID")" data-variantid="@(hasCombinations ? "variantid" : "")" class="lazyload-price lazyload-price-with-vat lazyload-price-main"> @GetString("Ecom:Product.Price.PriceWithVATFormatted").Replace(",00", ",-") )</span>)</div> 665 </div> 666 667 <div class="product-details__stock-info mb-2"><span class="text-success">@jungStockText</span></div> 668 } 669 else 670 { 671 <div class="d-inline-block no-wrap ml-auto flex-row"> 672 <div class="align-self-end d-md-inline-block product-details-login px-4">@Translate("Log ind for at se prisen")</div> 673 <button type="button" class="btn btn-success align-self-end d-md-inline-block js-aside-btn" href="#" data-view="login">@Translate("HeaderLoginButton", "Login")</button> 674 </div> 675 } 676 677 @* Add to cart functionality *@ 678 @if (productFabrikat != "leitz") 679 { 680 <form id="ecomCart" class="js-product-form mt-5" name="ecomCart" method="post"> 681 @GetString("Ecom:Product.Form.Multi.HiddenFields") 682 683 <div class="form-group m-0 mt-4"> 684 @if (productApi.VariantCombinations.Any()) 685 { 686 <label for="customsize" class="col-form-label m-0">@Translate("TextSelectVariant", "Vælg variant")</label> 687 <select data-current-value="@Dynamicweb.Context.Current.Request.QueryString["variantid"]" id="product-options" class="js-radio-container js-product-variant-select js-required-select form-control" name="variant" required> 688 <option value="" disabled selected hidden>@Translate("TextSelectVariant", "Vælg variant")</option> 689 690 @foreach (var variant in productApi.VariantCombinations) 691 { 692 string isSelected = variant.VariantId == GetString("Ecom:Product.VariantID") ? "selected" : null; 693 string link = "Default.aspx?ID=" + Pageview.Page.ID + "&ProductID=" + variant.ProductId + "&VariantID=" + variant.VariantId; 694 <option @isSelected value="@variant.VariantId" data-variantlink="@link"> 695 @variant.GetVariantName(Pageview.Area.EcomLanguageId) 696 </option> 697 } 698 699 </select> 700 } 701 @foreach (LoopItem item in GetLoop("Product.OrderLineFields")) 702 { 703 if (item.GetString("Ecom:Product.OrderLineField.SystemName") == "DeliveryPromised") 704 { 705 <input name="EcomOrderLineFieldInput_DeliveryPromised1" type="hidden" value="@jungStockText"> 706 707 } 708 else if (item.GetString("Ecom:Product.OrderLineField.SystemName") == "LeadtimeCalculationDate") 709 { 710 <input name="EcomOrderLineFieldInput_LeadtimeCalculationDate1" type="hidden" value="@DateTime.Today.AddDays(addDaysToLeadtimeCalculationDate).ToString("yyyy-MM-dd")"> 711 } 712 else 713 { 714 <label for="customsize" class="col-form-label">@Translate(item.GetString("Ecom:Product.OrderLineField.Name"))</label> 715 <input id="customsize" name="EcomOrderLineFieldInput_customSizeAdded1" class="form-control input mb-3" type="number" placeholder="Eks. 3650" min="@customSizeMin" max="@customSizeMax" required> 716 } 717 718 } 719 </div> 720 721 <input type="hidden" name="@GetString("Ecom:Product:Field.customsize.Value")" id="@GetString("Ecom:Product:Field.customsize.Value")" value="@GetString("Ecom:Product:Field.customsize.Value")"> 722 <div class="d-flex align-items-top justify-content-between flex-row"> 723 724 <div class="w-100 d-flex align-items-end"> 725 726 727 <div class="input-group product-item__quantity-wrapper"> 728 <span class="input-group-btn"> 729 <button class="btn btn-buy js-product-quantity-subtract" type="button"><span class="icon icon-minus"></span></button> 730 </span> 731 <input type="text" autocomplete="off" class="form-control js-quantity-input text-center" name="Quantity1" min="@minQuantity" value="@minQuantity" data-step="@quantityStep"> 732 733 734 <span class="input-group-btn"> 735 <button class="btn btn-buy js-product-quantity-add" type="button"><span class="icon icon-plus"></span></button> 736 </span> 737 </div> 738 </div> 739 740 <div class="w-100 pl-7"> 741 742 @if (extraLoopItems.Count > 0) 743 { 744 <div class="product-item__basket-notification js-basket-notification"> 745 746 <a class="js-cta-button w-100 btn btn-secondary align-self-end d-md-inline-block ml-auto px-4"> 747 <span class="icon mr-4"></span> 748 <span class="text-uppercase product-item__basket-notification__buttons">Gå til tilkøb</span> 749 </a> 750 </div> 751 } 752 753 <div class="product-item__basket-notification js-basket-notification mt-5"> 754 <div class="product-item__basket-notification-inner"> 755 <img class="product-item__basket-notification-image" src="/webroot/images/loading-bubbles.svg" title="Loading"> 756 </div> 757 <button type="submit" class="js-product-add-to-basket add-multi-basket w-100 btn btn-success align-self-end d-md-inline-block ml-auto px-4"> 758 <span class="icon icon-shopping-cart mr-4"></span> 759 <span class="text-uppercase product-item__basket-notification__buttons">@Translate("ecom-add-to-basket", "Læg i kurv")</span> 760 </button> 761 </div> 762 763 764 765 </div> 766 </div> 767 768 769 <input name="cartcmd" value="addmulti" type="hidden"> 770 771 772 @if (mainUserHeader != null && mainUserHeader.HasGroup(24)) 773 { 774 <input type="hidden" name="OrderContext" id="OrderContext" value="ORDERCONTEXT2"> 775 } 776 </form> 777 } 778 else if (User.IsExtranetUserLoggedIn()) 779 { 780 <form id="ecomCart" class="js-product-form" name="ecomCart" method="post"> 781 @GetString("Ecom:Product.Form.Multi.HiddenFields") 782 <div class="form-group"> 783 @if (productApi.VariantCombinations.Any()) 784 { 785 <label for="customsize" class="col-form-label">@Translate("TextSelectVariant", "Vælg variant")</label> 786 <select data-current-value="@Dynamicweb.Context.Current.Request.QueryString["variantid"]" id="product-options" class="js-radio-container js-product-variant-select js-required-select form-control" name="variant" required> 787 <option value="" disabled selected hidden>@Translate("TextSelectVariant", "Vælg variant")</option> 788 @foreach (var variant in productApi.VariantCombinations) 789 { 790 string isSelected = variant.VariantId == GetString("Ecom:Product.VariantID") ? "selected" : null; 791 string link = "Default.aspx?ID=" + Pageview.Page.ID + "&ProductID=" + variant.ProductId + "&VariantID=" + variant.VariantId; 792 <option @isSelected value="@variant.VariantId" data-variantlink="@link"> 793 @variant.GetVariantName(Pageview.Area.EcomLanguageId) 794 </option> 795 } 796 </select> 797 } 798 @foreach (LoopItem item in GetLoop("Product.OrderLineFields")) 799 { 800 if (item.GetString("Ecom:Product.OrderLineField.SystemName") == "DeliveryPromised") 801 { 802 <input name="EcomOrderLineFieldInput_DeliveryPromised1" type="hidden" value="@jungStockText"> 803 804 } 805 else if (item.GetString("Ecom:Product.OrderLineField.SystemName") == "LeadtimeCalculationDate") 806 { 807 <input name="EcomOrderLineFieldInput_LeadtimeCalculationDate1" type="hidden" value="@DateTime.Today.AddDays(addDaysToLeadtimeCalculationDate).ToString("yyyy-MM-dd")"> 808 } 809 else 810 { 811 <label for="customsize" class="col-form-label">@Translate(item.GetString("Ecom:Product.OrderLineField.Name"))</label> 812 <input id="customsize" name="EcomOrderLineFieldInput_customSizeAdded1" class="form-control input" type="number" placeholder="Eks. 3650" min="@customSizeMin" max="@customSizeMax" required> 813 } 814 815 } 816 </div> 817 <div class="d-flex align-items-top flex-row"> 818 <div class="input-group product-item__quantity-wrapper"> 819 <span class="input-group-btn"> 820 <button class="btn btn-buy js-product-quantity-subtract" type="button"><span class="icon icon-minus"></span></button> 821 </span> 822 <input type="text" autocomplete="off" class="form-control js-quantity-input text-center" name="Quantity1" min="@minQuantity" value="@minQuantity" data-step="@quantityStep"> 823 <span class="input-group-btn"> 824 <button class="btn btn-buy js-product-quantity-add" type="button"><span class="icon icon-plus"></span></button> 825 </span> 826 </div> 827 828 <div class="w-100 pl-7"> 829 <div class="product-item__basket-notification js-basket-notification"> 830 <div class="product-item__basket-notification-inner"> 831 <img class="product-item__basket-notification-image" src="/webroot/images/loading-bubbles.svg" title="Loading"> 832 </div> 833 <button type="submit" class="js-product-add-to-basket add-multi-basket w-100 btn btn-success align-self-end d-md-inline-block ml-auto px-4"> 834 <span class="icon icon icon-shopping-cart mr-4"></span> 835 <span>@Translate("ecom-add-to-basket", "Læg i kurv")</span> 836 </button> 837 </div> 838 </div> 839 </div> 840 <input name="cartcmd" value="addmulti" type="hidden"> 841 @if (mainUserHeader != null && mainUserHeader.HasGroup(24)) 842 { 843 <input type="hidden" name="OrderContext" id="OrderContext" value="ORDERCONTEXT2"> 844 } 845 </form> 846 } 847 </div> 848 </div> 849 850 @*Product specs*@ 851 <div class="product-details__specs row no-gutters js-toggle-class" data-trigger-once="true"> 852 <button type="button" class="show-more-btn btn btn-outline-primary text-uppercase">@Translate("ecom-show-more", "Show more")</button> 853 <div class="col-12 col-md-6 pr-md-4"> 854 @{ 855 var disallowedFields = new List<string> { "Webshop OK", "Beholdning", "Kvalitet (God, Bedre og Bedst)", "VariantName", "Specifikationer", "Produktbeskrivelse", "InternalProduct", "Beholdning Tal", "Youtube video id", "WebDiscount" }; 856 var specificationsTitle = fields.FirstOrDefault(f => f.GetFieldName() == "Specifikations titel").Value.ToString(); 857 var productDescriptionTitle = fields.FirstOrDefault(f => f.GetFieldName() == "Produktbeskrivelse titel").Value.ToString(); 858 } 859 @if (specificationsTitle != null && !string.IsNullOrEmpty(specificationsTitle)) 860 { 861 <h2 class="mb-6">@specificationsTitle</h2> 862 } 863 else 864 { 865 <h2 class="mb-6">@Translate("ecom-specs", "Specs")</h2> 866 } 867 @{ 868 bool isSKUShown = false; 869 string skuNumber = ""; 870 var allowedProducers = new List<string> { "leitz", "sistemi", "biesse", "gjerde", "maggi", "weinig", "robland", "altendorf", "striebig" }; 871 872 if (allowedProducers.Contains(productFabrikat)) 873 { 874 isSKUShown = true; 875 var skuNumberField = fields.FirstOrDefault(f => f.GetFieldName().Equals("ExterntNummer")); 876 if (skuNumberField != null) 877 { 878 skuNumber = skuNumberField.Value.ToString(); 879 } 880 } 881 } 882 <dl class="row no-gutters mb-6"> 883 884 @foreach (var item in fields) 885 { 886 if (item.ProductField.DoNotRender == true || String.IsNullOrEmpty(item.Value.ToString()) || item.Value.ToString() == "0" || item.Value.ToString() == "0,00" || disallowedFields.Contains(item.GetFieldName()) 887 || (item.GetFieldName() == "Fabrikat" && !isSKUShown)) 888 { 889 continue; 890 } 891 892 string fieldValue = item.Value.ToString(); 893 string fieldName = item.GetFieldName(); 894 895 //the most dumt way to get out these values. I dont know why - but I am afraid to change the logic if it is needed, so create fallback and all sorts. 896 if (item.ProductField.TypeId == 15) 897 { 898 bool useTranslationDwFields = false; 899 foreach (var loopCustom in GetLoop("CustomFieldValues")) 900 { 901 loopCustom.Values.TryGetValue("Product.CustomField.Value.Clean", out object valueCustomFieldValue); 902 if (valueCustomFieldValue != null) 903 { 904 if (valueCustomFieldValue.ToString() == fieldValue) 905 { 906 loopCustom.Values.TryGetValue("Product.CustomField.Label", out object fieldValueTemp); 907 fieldValue = fieldValueTemp.ToString(); 908 useTranslationDwFields = true; 909 break; 910 } 911 912 } 913 } 914 915 if (useTranslationDwFields == false) 916 { 917 var prodOptionCollection = Dynamicweb.Ecommerce.Services.FieldOptions.GetOptionsByFieldId(item.ProductField.Id); 918 foreach (var myOptions in prodOptionCollection) 919 { 920 if (myOptions.Value == item.Value.ToString()) 921 { 922 var translationField = myOptions.Translations.Get(productLanguageId); 923 924 if (translationField != null) 925 { 926 fieldValue = translationField.Name; 927 928 } 929 else 930 { 931 fieldValue = myOptions.GetName(productLanguageId); 932 } 933 break; 934 } 935 } 936 } 937 } 938 939 940 if (item.GetFieldName() == ("Fabrikat")) 941 { 942 fieldValue = skuNumber; 943 fieldName = Translate("Lev_varenr", "Lev. varenr."); 944 } 945 946 947 counter++; 948 string bgColor = counter % 2 == 1 ? "bg-light-gray" : ""; 949 950 <dt class="used-machine__specs-display col-12 col-sm-4 p-4 @bgColor">@fieldName</dt> 951 <dd class="used-machine__specs-value col-12 col-sm-8 m-0 py-4 @bgColor"> 952 @if (item.ProductField.TypeId == 9) 953 { 954 <a href="/Files/Images/@fieldValue" target="_blank">@Translate("Download") @fieldName</a> 955 } 956 else 957 { 958 959 @fieldValue 960 } 961 </dd> 962 } 963 </dl> 964 </div> 965 <div class="col-12 col-md-6 pl-md-4"> 966 @if (productDescriptionTitle != null && !string.IsNullOrEmpty(productDescriptionTitle)) 967 { 968 <h2 class="mb-6">@productDescriptionTitle</h2> 969 } 970 else 971 { 972 <h2 class="mb-6">@Translate("ecom-description", "Description")</h2> 973 } 974 <div class="mb-6"> 975 @GetString("Ecom:Product.ShortDescription") @GetString("Ecom:Product.LongDescription") 976 </div> 977 </div> 978 </div> 979 980 981 982 </div> 983 984 985 986 @* Tilvalg *@ 987 988 @{ 989 990 if (extraLoopItems.Count > 0) 991 { 992 993 994 <!-- Tilvalg--> 995 <div class="w-100 h-100" style="background-color: #e8e4ec"> 996 <div class="pt-10"> 997 <div class=""> 998 <h2 class="js-contact-form mb-7 pl-10 pr-10">Tilvalg</h2> 999 </div> 1000 1001 @{ 1002 List<string> colors = new List<string> { "#e8e4ec", "#f8f4f4" }; 1003 } 1004 1005 1006 @{ 1007 1008 1009 var groupIndex = 0; 1010 var totalIndex = 0; 1011 foreach (LoopItem item in extraLoopItems) 1012 { 1013 string columnName = item.GetString("Ecom:Product:RelatedGroup.Name").Replace("Tilvalg_", ""); 1014 var items = item.GetLoop("RelatedProducts"); 1015 1016 //Checks if items has webshop as true 1017 List<LoopItem> okItems = new List<LoopItem>(); 1018 1019 1020 foreach (LoopItem _item in items) 1021 { 1022 1023 if (_item.GetString("Ecom:Product:Field.WebshopOK.Value") == "True") 1024 { 1025 1026 okItems.Add(_item); 1027 1028 } 1029 } 1030 1031 1032 items = okItems; 1033 1034 1035 <!--Række 1--> 1036 1037 1038 var color = ""; 1039 1040 if (groupIndex % 2 == 0) 1041 { 1042 color = colors[0]; 1043 1044 } 1045 else 1046 { 1047 color = colors[1]; 1048 } 1049 1050 groupIndex++; 1051 1052 <div style="background-color: @color"> 1053 <div class="pb-5 pl-10 pr-10"> 1054 1055 <div class="d-flex"> 1056 <div class="col-3 additional-container__text text-capitalize mt-5 p-0">@columnName</div> 1057 <div class="col-9 d-flex additional-container flex-wrap p-0"> 1058 <div class="col-3 text-break additional-container__text p-0"> 1059 </div> 1060 <div class="col-6 p-0"> </div> 1061 <div class="col-3 col-3 d-flex justify-content-end additional-container__text p-0"> 1062 </div> 1063 </div> 1064 </div> 1065 1066 @{ 1067 var index = 0; 1068 var count = items.Count; 1069 } 1070 1071 @foreach (LoopItem subitem in items) 1072 { 1073 index++; 1074 totalIndex++; 1075 var name = subitem.GetString("Ecom:Product.Name"); 1076 var id = subitem.GetString("Ecom:Product.ID"); 1077 1078 var variantId = subitem.GetString("Ecom:Product.VariantID"); 1079 var product = productService.GetProductById(id, variantId, false); 1080 1081 var _prices = Website.Helpers.Product.GetProductLivePrices(product); 1082 var price = subitem.GetString("Ecom:Product.Price.PriceWithoutVATFormatted"); 1083 1084 if (prices != null) 1085 { 1086 foreach (var subPrice in _prices) 1087 { 1088 if (price != null) 1089 { 1090 price = subPrice.Currency.Format(subPrice.Amount); 1091 } 1092 } 1093 } 1094 1095 //Der må der være en bedre måde at gøre dette på? - altså at fjerne p tag fra LongDescription 1096 var description = subitem.GetString("Ecom:Product.ShortDescription.Raw").Replace("<p>", ""); 1097 string image = Website.Helpers.Product.GetMainProductImage(product); 1098 var hasTooltip = !string.IsNullOrEmpty(description) || !string.IsNullOrEmpty(image); 1099 1100 description = description.Replace("</p>", ""); 1101 1102 <div class="d-flex"> 1103 <div class="col-0 col-sm-0 col-lg-3 p-0"></div> 1104 <div class="col-12 col-sm-12 col-lg-9 d-flex additional-container flex-wrap p-0"> 1105 <div class="col-9 text-break additional-container__text p-0"> 1106 <input id="productId/@totalIndex" data-productId="@id" data-productVariantId="@variantId" class="additional-container__text__input product-info" type="checkbox" value=""> 1107 <label for="productId/@totalIndex">@name</label><br> 1108 </div> 1109 1110 <div class="justify-content-end w-100 position-absolute additional-container__tooltip" id="additionalDescription-@totalIndex" style="display: none;"> 1111 @if (!string.IsNullOrEmpty(image)) 1112 { 1113 <img class="additional-container__image__hover-container @(!string.IsNullOrEmpty(description) ? "" : "additional-container__image__hover-container--right")" src="/Admin/Public/GetImage.ashx?Image=@image&Width=1000&Height=1000" alt="@name"> 1114 } 1115 1116 @if (!string.IsNullOrEmpty(description)) 1117 { 1118 <div class="additional-container__text__hover-container">@description</div> 1119 } 1120 </div> 1121 1122 <div class="col-3 d-flex justify-content-end additional-container__text p-0"> 1123 @if (hasTooltip) 1124 { 1125 <span class="icon icon-info additionalIcon mr-2" style="z-index: 1" data-id="@totalIndex"></span> 1126 } 1127 (+ <span class="lazyload-price" data-id="@subitem.GetString("Ecom:Product.ID")" data-variantid="@subitem.GetString("Ecom:Product.VariantID")"><img src="/Files/Images/loading.gif"> @price</span> ) 1128 </div> 1129 @if (index != count) 1130 { 1131 <div class="w-100 mb-3 ml-5 mt-3" style="border-top: 1px solid #cfd4dc"> 1132 </div> 1133 } 1134 </div> 1135 </div> 1136 } 1137 </div> 1138 </div> 1139 } 1140 } 1141 1142 <div class="addmulti-item"> 1143 <input type="hidden" name="" value="1"> 1144 <input type="hidden" name="" value=""> 1145 <input type="hidden" name="" value=""> 1146 <input type="hidden" name="" value="1"> 1147 </div> 1148 1149 <form id="ecomCartMulti" class="js-product-multi-form" method="post"> 1150 <div class="form-content"> 1151 </div> 1152 1153 <div class="d-flex justify-content-end p-10"> 1154 1155 <div class="product-item__basket-notification js-basket-notification mt-5"> 1156 <div class="product-item__basket-notification-inner"> 1157 <img class="product-item__basket-notification-image" src="/webroot/images/loading-bubbles.svg" title="Loading"> 1158 </div> 1159 <button type="submit" class="js-product-add-to-basket add-multi-basket w-100 btn btn-success align-self-end d-md-inline-block ml-5 ml-auto mr-5 px-4"> 1160 <span class="icon icon-shopping-cart mr-4"></span> 1161 <span class="text-uppercase product-item__basket-notification__buttons">@Translate("ecom-add-to-basket", "Læg i kurv")</span> 1162 </button> 1163 </div> 1164 </div> 1165 </form> 1166 </div> 1167 </div> 1168 } 1169 } 1170 </section> 1171 1172 <!-- New related products --> 1173 @using Dynamicweb.Ecommerce 1174 @using Dynamicweb.Ecommerce.Products 1175 @using Dynamicweb.Security.UserManagement; 1176 @using Helpers = Website.Helpers; 1177 @using VestjyskMarketing.Models; 1178 1179 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1180 @functions { 1181 1182 string DiscountPct(LoopItem context = null) { 1183 double oldPrice = 0; 1184 double price = 0; 1185 double discount = 0; 1186 1187 string inputdiscountPrice = (context != null ? context.GetString("Ecom:Product.Discount.AmountWithVAT") : GetString("Ecom:Product.Discount.AmountWithVAT")); 1188 string inputprice = (context != null ? context.GetString("Ecom:Product.Price.Price") : GetString("Ecom:Product.Price.Price")); 1189 1190 double.TryParse( inputprice, out oldPrice); 1191 double.TryParse( inputdiscountPrice, out price); 1192 1193 double difference = ( oldPrice - price ); 1194 discount = Math.Round((difference / oldPrice) * 100); 1195 1196 return discount.ToString(); 1197 } 1198 1199 string DiscountDiff(LoopItem context = null) { 1200 double oldPrice = 0; 1201 double price = 0; 1202 1203 var inputdiscountPrice = (context != null ? context.GetString("Ecom:Product.Discount.AmountWithVAT") : GetString("Ecom:Product.Discount.AmountWithVAT")); 1204 var inputprice = (context != null ? context.GetString("Ecom:Product.Price.Price") : GetString("Ecom:Product.Price.Price")); 1205 1206 double.TryParse( inputprice, out oldPrice); 1207 double.TryParse( inputdiscountPrice, out price); 1208 1209 double difference = ( oldPrice - price ); 1210 1211 return SliceCommas(difference.ToString()); 1212 } 1213 1214 string OldPrice(LoopItem context = null, LoopItem product = null) { 1215 double oldPrice = 0; 1216 double price = 0; 1217 1218 var inputdiscountPrice = (context != null ? context.GetString("Ecom:Product.Discount.AmountWithVAT") : GetString("Ecom:Product.Discount.AmountWithVAT")); 1219 var inputprice = (product != null ? product.GetString("Ecom:Product.Price.Price") : GetString("Ecom:Product.Price.Price")); 1220 1221 double.TryParse( inputprice, out oldPrice); 1222 double.TryParse( inputdiscountPrice, out price); 1223 1224 double difference = ( oldPrice + price ); 1225 1226 return SliceCommas(difference.ToString()); 1227 } 1228 1229 string SliceCommas(string givenPrice) { 1230 // We remove everything after comma, if the Discount-Handler calculates it differently, however the price in the cart is with comma values *@ 1231 string price = givenPrice; 1232 int index = price.LastIndexOf(','); 1233 1234 if(index > -1) { 1235 price = price.Substring(0, index) + ",-"; 1236 } 1237 else { 1238 price = price + ",-"; 1239 } 1240 1241 return price.ToString(); 1242 } 1243 1244 string ChangeAttribute(string input, string format) { 1245 if(!String.IsNullOrEmpty(input) && input == "checked") { 1246 return format; 1247 } 1248 else if(!String.IsNullOrEmpty(input) && Convert.ToBoolean(input)) { 1249 return format; 1250 } 1251 return null; 1252 } 1253 1254 } 1255 1256 1257 @helper ContentRenderingNew(LoopItem item, string loopName, bool isSmallSpot = false, string productUrl = "", bool checkoutPage = false) 1258 { 1259 User mainUserHeader = Pageview.User?.CurrentSecondaryUser != null ? Pageview.User.CurrentSecondaryUser : Pageview.User; 1260 1261 //set URL for page. To get correct URL all places in regards to list 1262 //fetch pages from shop 1263 var pageService = new Dynamicweb.Content.PageService(); 1264 var pages = pageService.GetPagesForItems(new string[] { "PageShopList" }).Where(p => p.AreaId == Pageview.AreaID); 1265 string productPrice = GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-"); 1266 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(item.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 1267 int pageId = 0; 1268 foreach (var page in pages) 1269 { 1270 var shopGroupPage = Dynamicweb.Core.Converter.ToString(page.Item["ShopCategoryNumber"]); 1271 if (shopGroupPage == group.Number && page.AreaId.Equals(Pageview.AreaID)) 1272 { 1273 pageId = page.ID; 1274 break; 1275 } 1276 } 1277 1278 productUrl = "/Default.aspx?ID=" + pageId + "&ProductID=" + item.GetString("Ecom:Product.ID"); 1279 if (pageId == 0) 1280 { 1281 productUrl = "/" + item.GetString("Ecom:Product.Link.Clean"); 1282 } 1283 1284 // Images 1285 string grpId = string.Empty; 1286 string grpQtyDiscount5 = string.Empty; 1287 string grpQtyDiscount10 = string.Empty; 1288 1289 foreach (LoopItem subItem in item.GetLoop("AssociatedGroups")) 1290 { 1291 grpId = subItem.GetString("Ecom:Group.ID"); 1292 } 1293 1294 if (!string.IsNullOrEmpty(grpId)) 1295 { 1296 var productApi = Dynamicweb.Ecommerce.Services.Products.GetProductById(item.GetString("Ecom:Product.ID"), null, false); 1297 double minQuantity = item.GetDouble("Ecom:Product.PurchaseMinimumQuantity"); 1298 if (minQuantity < 1) 1299 { 1300 minQuantity = 1; 1301 } 1302 1303 double quantityStep = item.GetDouble("Ecom:Product.PurchaseQuantityStep"); 1304 if (quantityStep < 1) 1305 { 1306 quantityStep = 1; 1307 } 1308 1309 bool internalProduct = item.GetBoolean("Ecom:Product:Field.InternalProduct"); 1310 bool webshopOK = item.GetBoolean("Ecom:Product:Field.WebshopOK"); 1311 string productName = item.GetString("Ecom:Product.Name"); 1312 string productImage = Website.Helpers.Product.GetMainProductImage(productApi); 1313 if (String.IsNullOrEmpty(productImage)) 1314 { 1315 productImage = "/Files/System/Images/Shop/na-image.jpg"; 1316 } 1317 1318 var deleteLink = item.GetString("Ecom:Order:OrderLine.DeleteLink"); 1319 var newDeleteLink = deleteLink; 1320 if (!string.IsNullOrEmpty(deleteLink) && deleteLink.ToLower().Contains("&productid")) 1321 { 1322 var deleteLinkParts = deleteLink.ToLowerInvariant().Split('&'); 1323 var productItemPart = deleteLinkParts.FirstOrDefault(p => p.Contains("productid")); 1324 var productId = item.GetString("Ecom:Product.ID"); 1325 deleteLinkParts[Array.IndexOf(deleteLinkParts, productItemPart)] = "productid=" + productId; 1326 newDeleteLink = string.Join("&", deleteLinkParts); 1327 } 1328 1329 int jungStockAmount = Dynamicweb.Core.Converter.ToInt32(item.GetString("Ecom:Product:Field.jung_stock").Replace("D", "")); 1330 string productFabrikat = item.GetString("Ecom:Product:Field.fabrikat").ToLower(); 1331 1332 string image = VestjyskMarketing.Helpers.ImageHelper.ResizeImage(new ResizeImageSettings() 1333 { 1334 Image = "/Files/Files/Images/img_calculator.png", 1335 Height = 96, 1336 Width = 96, 1337 Quality = 85 1338 }); 1339 1340 //get campaign name 1341 string campaignName = ""; 1342 var prices = productApi.Prices; 1343 double oldPrice = 0; 1344 string oldPriceCurrency = ""; 1345 1346 1347 foreach (var priceFromMatrix in prices) 1348 { 1349 if (priceFromMatrix.Amount == item.GetDouble("Ecom:Product.Price.PriceWithoutVAT.Value") && Helpers.Product.IsCampaingPrice(priceFromMatrix) 1350 && Helpers.Product.IsPriceValid(priceFromMatrix)) 1351 { 1352 campaignName = priceFromMatrix.Periods.FirstOrDefault()?.Name; 1353 foreach (var priceFromMatrix2 in prices) 1354 { 1355 if (priceFromMatrix2.Amount != item.GetDouble("Ecom:Product.Price.PriceWithoutVAT.Value") && 1356 !Helpers.Product.IsCampaingPrice(priceFromMatrix2) && Helpers.Product.IsPriceValid(priceFromMatrix2)) 1357 { 1358 if (Pageview.Area.EcomCurrencyId == priceFromMatrix2.CurrencyCode) 1359 { 1360 oldPrice = priceFromMatrix2.Amount; 1361 oldPriceCurrency = priceFromMatrix2.CurrencyCode; 1362 break; 1363 } 1364 } 1365 } 1366 } 1367 } 1368 1369 //has to be done like this and not tags. tags will make more calls via live integrayion. 1370 bool hasCombinations = productApi.VariantCombinations.Any(); 1371 1372 var smallSpotClasses = "product-item__price"; 1373 1374 if (isSmallSpot) 1375 { 1376 smallSpotClasses = "text-success font-weight-bold ml-auto"; 1377 1378 if (checkoutPage) 1379 { 1380 <a href="@item.GetString("Ecom:Order:OrderLine.DeleteLink")" class="product-item__closebtn btn p-0"> 1381 <span class="icon icon-close m-0"></span> 1382 </a> 1383 } 1384 else 1385 { 1386 <a href="#" class="product-item__closebtn btn js-product-state-submit p-0" data-action="@newDeleteLink"> 1387 <span class="icon icon-close m-0"></span> 1388 </a> 1389 } 1390 } 1391 1392 if (!string.IsNullOrEmpty(campaignName)) 1393 { 1394 string discountImage = ""; //@TODO hvad skal vi gøre med billeder? 1395 bool blackFriday = false; //@TODO hvad skal vi gøre med black friday? 1396 1397 if (!String.IsNullOrEmpty(discountImage)) 1398 { 1399 <div class="product-item__badge image-badge"> 1400 <img src="@discountImage" alt="Kampagne billede" width="150px"/> 1401 </div> 1402 } 1403 else if (blackFriday) 1404 { 1405 <div class="product-item__badge blackfriday-badge text-uppercase">@Translate("ecom-campaigne-blackfriday", "Black Friday")</div> 1406 } 1407 else 1408 { 1409 //old campaign 1410 @*<div class="product-item__badge text-uppercase">@Translate("Campaign-" + campaignName, campaignName)</div>*@ 1411 } 1412 } 1413 1414 if (internalProduct && !webshopOK) 1415 { 1416 <div class="product-item__badge image-badge"> 1417 <img src="/Files/System/Images/Shop/Webshop_logo_intern.jpg" alt="Internt produkt" height="50px"/> 1418 </div> 1419 } 1420 1421 <div class="d-flex flex-column result-item__product-content w-100"> 1422 @if (loopName == "Products" || loopName == "Item.ProductDisplay") 1423 { 1424 <picture class="product-item__photo d-flex justify-content-center" onclick="window.location = '@productUrl';" style="cursor:pointer"> 1425 <!-- 1426 <source srcset="/Admin/Public/GetImage.ashx?Image=@productImage&width=146&height=128&background=ffffff&format=webP&Compression=99&fillcanvas=true" media="(min-width: 576px)"> 1427 1428 --> 1429 <img class="img-fluid" src="/Admin/Public/GetImage.ashx?Image=@productImage&width=345&height=300&background=ffffff&format=webP&Compression=99&fillcanvas=true" alt="@productName"> 1430 </picture> 1431 } 1432 <div class="d-flex mb-3 mt-3 flex-row" style="height: 110px; justify-content: center;"> 1433 <div class="w-100 d-flex flex-column justify-content-center" onclick="window.location = '@productUrl';" style="cursor:pointer"> 1434 <div style="font-size: 13px; padding: 5px; text-align: center; line-height: 15px; line-break: auto " class="product-item__title m-0 p-0">@productName</div> 1435 1436 <div class="d-flex justify-content-center"> 1437 <div class="product-item__description d-flex mt-2" style="justify-content: center; width: max-content; font-size: 12px"> 1438 @Translate("ProductNumber", "Varenummer") @item.GetString("Ecom:Product.Number") 1439 @if ((jungStockAmount > 0 && jungStockAmount < 3) || item.GetInteger("Ecom:Product.Stock") > 0) 1440 { 1441 <svg style="margin-left: 10px" height="20" width="20"> <circle cx="8" cy="8" r="6" stroke="#92D053" stroke-width="3" fill="#92D053"/> Sorry, your browser does not support inline SVG. </svg> 1442 } 1443 </div> 1444 </div> 1445 <div class="product-item__delivery-time" style="font-size: 12px; text-align: center"> 1446 @Helpers.Product.GetJungStock(item.GetString("Ecom:Product:Field.jung_stock"), item.GetInteger("Ecom:Product.Stock")) 1447 </div> 1448 1449 1450 @if (mainUserHeader != null && mainUserHeader.HasGroup(24)) 1451 { 1452 <span class="d-flex justify-content-center"> 1453 1454 (@item.GetInteger("Ecom:Product.Stock") @Translate("stk.")) 1455 </span> 1456 } 1457 1458 @{ 1459 if (minQuantity > 1) 1460 { 1461 <div class="d-flex" style="justify-content: center; font-size: 12px"> 1462 <strong> @Translate("Minimumskøb:", "Minimumskøb:") @minQuantity @Translate("stk.")</strong> 1463 </div> 1464 } 1465 } 1466 @foreach (LoopItem subItem in item.GetLoop("Order.OrderLineFields")) 1467 { 1468 <div class="product-item__description"> 1469 @if (subItem.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") == "DeliveryPromised") 1470 { 1471 @subItem.GetString("Ecom:Order:OrderLine.OrderLineField.Value") 1472 } 1473 else if (subItem.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") == "customSizeAdded") 1474 { 1475 @Translate("customSize", "Størrelse") 1476 @subItem.GetString("Ecom:Order:OrderLine.OrderLineField.Value")<span>mm</span> 1477 } 1478 </div> 1479 } 1480 </div> 1481 1482 </div> 1483 1484 <div> 1485 1486 <div class="d-flex mb-2" style="justify-content: space-evenly; align-items: center"> 1487 <input type="hidden" name="ProdId" class="js-reorder-product-id" value="@item.GetString("Ecom:Product.ID")"/> 1488 @if (loopName != "Products" && loopName != "Item.ProductDisplay") 1489 { 1490 <div class="input-group product-item__quantity-wrapper"> 1491 <span class="input-group-btn"> 1492 @if (checkoutPage) 1493 { 1494 <a href="@item.GetString("Ecom:Order:OrderLine.DecrementLink")" role="button" class="btn btn-buy d-inline-flex align-items-center justify-content-center"> 1495 <span class="icon icon-minus"></span> 1496 </a> 1497 } 1498 else 1499 { 1500 <a href="#" role="button" class="btn btn-buy d-inline-flex align-items-center justify-content-center js-product-state-submit" data-action="@item.GetString("Ecom:Order:OrderLine.DecrementLink")"> 1501 <span class="icon icon-minus"></span> 1502 </a> 1503 } 1504 </span> 1505 <input id="Quantity" type="text" autocomplete="off" class="form-control js-quantity-input text-center" name="Quantity" min="@minQuantity" value="@item.GetString("Ecom:Order:OrderLine.Quantity")" data-step="@quantityStep" data-type="order"> 1506 <span class="input-group-btn"> 1507 @if (checkoutPage) 1508 { 1509 <a href="@item.GetString("Ecom:Order:OrderLine.IncrementLink")" role="button" class="btn btn-buy d-inline-flex align-items-center justify-content-center"> 1510 <span class="icon icon-plus"></span> 1511 </a> 1512 } 1513 else 1514 { 1515 <a href="#" role="button" class="btn btn-buy d-inline-flex align-items-center justify-content-center js-product-state-submit" data-action="@item.GetString("Ecom:Order:OrderLine.IncrementLink")"> 1516 <span class="icon icon-plus"></span> 1517 </a> 1518 } 1519 1520 </span> 1521 </div> 1522 } 1523 else if (!hasCombinations) 1524 { 1525 <div class="input-group product-item__quantity-wrapper d-md-none"> 1526 <span class="input-group-btn"> 1527 <button class="btn btn-buy js-reorder-quantity-subtract" type="button"> 1528 <span class="icon icon-minus"></span> 1529 </button> 1530 </span> 1531 <input type="text" autocomplete="off" class="form-control js-reorder-quantity-input text-center" name="Quantity" min="0" max="20" value="1"> 1532 <span class="input-group-btn"> 1533 <button class="btn btn-buy js-reorder-quantity-add" type="button"> 1534 <span class="icon icon-plus"></span> 1535 </button> 1536 </span> 1537 </div> 1538 } 1539 1540 1541 @if (productFabrikat != "leitz") 1542 { 1543 <div class="@smallSpotClasses" onclick="window.location = '@productUrl';" style="cursor:pointer"> 1544 @if (!String.IsNullOrEmpty(campaignName) && oldPrice > 0 && !User.IsExtranetUserLoggedIn()) 1545 { 1546 @*<div class="product-details__price-container"> 1547 @if (hasCombinations && loopName != "OrderLines") 1548 { 1549 <div class="from-price">@Translate("ProductFromPrice", "Fra")</div> 1550 } 1551 <div>@item.GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-")</div> 1552 <div class="product-item__price--old">DKK @oldPrice,-</div> 1553 </div>*@ 1554 1555 1556 <div class="without-discount d-flex flex-column align-items-center" style="font-size: 17px; line-height: 1.2"> 1557 @if (loopName == "OrderLines") 1558 { 1559 @item.GetString("Ecom:Order:OrderLine.UnitPrice.PriceWithoutVATFormatted").Replace(",00", ",-") 1560 } 1561 else 1562 { 1563 <div class="without-discount d-flex flex-column align-items-center"> 1564 @if (hasCombinations && loopName != "OrderLines") 1565 { 1566 @Translate("ProductFromPrice", "Fra") 1567 } 1568 1569 @item.GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-") 1570 1571 <div class="product-item__price--old m-0 text-center" style="font-size: 11px; color: #68943c">@oldPriceCurrency @oldPrice,-</div> 1572 </div> 1573 } 1574 </div> 1575 } 1576 1577 else 1578 { 1579 <div class="without-discount d-flex flex-column align-items-center" style="font-size: 17px; line-height: 1.2"> 1580 @if (loopName == "OrderLines") 1581 { 1582 @item.GetString("Ecom:Order:OrderLine.UnitPrice.PriceWithoutVATFormatted").Replace(",00", ",-") 1583 } 1584 else 1585 { 1586 <div class="d-flex"> 1587 @if (hasCombinations && loopName != "OrderLines") 1588 { 1589 @Translate("ProductFromPrice", "Fra")<span> </span> 1590 } 1591 1592 <div data-id="@item.GetString("Ecom:Product.ID")" data-variantid='@(hasCombinations ? "variantid" : "")' class="lazyload-price lazyload-price-vat"> 1593 <span> 1594 @item.GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-") 1595 </span> 1596 <img src="/Files/Images/loading.gif"> 1597 </div> 1598 </div> 1599 <div class="item__container__info__no-vat">(@Translate("ecom-price-excl-vat", ""))</div> 1600 } 1601 </div> 1602 } 1603 </div> 1604 } 1605 else if (User.IsExtranetUserLoggedIn()) 1606 { 1607 <div class="@smallSpotClasses" onclick="window.location = '@productUrl';" style="cursor:pointer"> 1608 1609 @if (hasCombinations && loopName != "OrderLines") 1610 { 1611 <div class="from-price without-discount">@Translate("ProductFromPrice", "Fra")</div> 1612 } 1613 1614 <div class="without-discount d-flex flex-column align-items-center" style="font-size: 17px; line-height: 1.2"> 1615 @if (loopName == "OrderLines") 1616 { 1617 @item.GetString("Ecom:Order:OrderLine.UnitPrice.PriceWithoutVATFormatted").Replace(",00", ",-") 1618 } 1619 else 1620 { 1621 <div data-id="@item.GetString("Ecom:Product.ID")" data-variantid='@(hasCombinations ? "variantid" : "")' class="lazyload-price lazyload-price-vat"> 1622 <span> 1623 @item.GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-") 1624 </span> 1625 <img src="/Files/Images/loading.gif"> 1626 </div> 1627 } 1628 <div class="item__container__info__no-vat">(@Translate("ecom-price-excl-vat", ""))</div> 1629 </div> 1630 1631 1632 </div> 1633 } 1634 1635 @if (loopName == "Products" || loopName == "Item.ProductDisplay") 1636 { 1637 if (productFabrikat != "leitz" || User.IsExtranetUserLoggedIn()) 1638 { 1639 <div class="d-inline-block no-wrap flex-row"> 1640 @if (!hasCombinations) 1641 { 1642 <button type="submit" class="js-reorder-add-to-basket w-100 btn btn-sm btn-success align-self-end d-md-none ml-auto"> 1643 <span class="icon icon-cart"></span> 1644 </button> 1645 } 1646 else 1647 { 1648 <button type="submit" class="w-100 btn btn-sm btn-success align-self-end d-md-none ml-auto" onclick="window.location = '@productUrl';"> 1649 <span class="icon icon-cart"></span> 1650 </button> 1651 } 1652 <button type="button" class="btn btn-success align-self-end d-none d-md-flex px-4" onclick="window.location = '@productUrl';"> 1653 <div class="d-flex flex-row"> 1654 <span class="icon icon-shopping-cart mr-2" style="font-size: 14px"></span> 1655 </div>@Translate("BESTIL") 1656 </button> 1657 1658 1659 </div> 1660 } 1661 else 1662 { 1663 <div class="d-flex"> 1664 1665 <div class="align-self-end d-none d-md-inline-block px-4" style="font-size: 12px">@Translate("Log ind for at se prisen")</div> 1666 1667 <button type="button" class="btn btn-success align-self-end d-md-inline-block js-aside-btn px-4" href="#" data-view="login">@Translate("HeaderLoginButton", "Login")</button> 1668 </div> 1669 } 1670 } 1671 </div> 1672 1673 @if (mainUserHeader != null && mainUserHeader.HasGroup(24) && !isSmallSpot) 1674 { 1675 string salesPrice = item.GetDouble("Ecom:Product.DBPrice").ToString("F2"); 1676 string webPrice = salesPrice; 1677 string webDiscount = Dynamicweb.Core.Converter.ToString(productApi.GetProductFieldValue("WebDiscount")); 1678 string cost = Dynamicweb.Core.Converter.ToString(productApi.Cost); 1679 string externalNumber = Dynamicweb.Core.Converter.ToString(productApi.GetProductFieldValue("ExterntNummer")); 1680 string manufacturer = productApi.Manufacturer != null ? productApi.Manufacturer.Name : ""; 1681 string discountGroup = Dynamicweb.Core.Converter.ToString(productApi.GetProductFieldValue("ItemDiscGroup")); 1682 1683 foreach (var priceFromMatrix in productApi.Prices) 1684 { 1685 if (Helpers.Product.IsPriceValid(priceFromMatrix)) 1686 { 1687 var userToTakePriceFrom = Pageview.User; 1688 1689 if (!string.IsNullOrEmpty(userToTakePriceFrom.Currency) && priceFromMatrix.CurrencyCode == userToTakePriceFrom.Currency) 1690 { 1691 webPrice = priceFromMatrix.Amount.ToString("F2"); 1692 } 1693 1694 if (priceFromMatrix.CurrencyCode == "DKK" && string.IsNullOrEmpty(userToTakePriceFrom.Currency)) 1695 { 1696 webPrice = priceFromMatrix.Amount.ToString("F2"); 1697 } 1698 } 1699 } 1700 1701 <div class="d-flex justify-content-between align-items-end mt-3"> 1702 <div> 1703 <div class="text-center" style="margin-left: 10px; font-size: 12px;"> 1704 @Translate("Bruttopris", "Bruttopris") @salesPrice 1705 </div> 1706 1707 <div class="text-center" style="margin-left: 8px; font-size: 12px;"> 1708 @Translate("Webpris", "Webpris") @webPrice 1709 </div> 1710 </div> 1711 <div class="product-item__details"> 1712 <img src="@image" class="product-item__details__image"> 1713 <div class="product-item__details__tooltip"> 1714 <div class="row"> 1715 <div class="col-7"> 1716 @Translate("Bruttopris", "Bruttopris"): 1717 </div> 1718 <div class="col-5"> 1719 @salesPrice 1720 </div> 1721 <div class="col-7"> 1722 @Translate("Webrabat", "Webrabat") %: 1723 </div> 1724 <div class="col-5"> 1725 @webDiscount 1726 </div> 1727 <div class="col-7"> 1728 @Translate("Webpris", "Webpris"): 1729 </div> 1730 <div class="col-5"> 1731 @webPrice 1732 </div> 1733 <div class="col-7"> 1734 @Translate("Cost", "Kostpris"): 1735 </div> 1736 <div class="col-5"> 1737 @cost 1738 </div> 1739 <div class="col-7"> 1740 @Translate("Manufacturer's number", "Leverandørens varenr"): 1741 </div> 1742 <div class="col-5"> 1743 @externalNumber 1744 </div> 1745 <div class="col-7"> 1746 @Translate("Manufacturer", "Levenrandør"): 1747 </div> 1748 <div class="col-5"> 1749 @manufacturer 1750 </div> 1751 <div class="col-7"> 1752 @Translate("DiscountGroup", "Varerabatgruppe"): 1753 </div> 1754 <div class="col-5"> 1755 @discountGroup 1756 </div> 1757 </div> 1758 </div> 1759 </div> 1760 </div> 1761 } 1762 </div> 1763 </div> 1764 } 1765 } 1766 1767 @helper ContentRendering(LoopItem item, string loopName, bool isSmallSpot = false, string productUrl = "", bool checkoutPage = false) 1768 { 1769 User mainUserHeader = Pageview.User?.CurrentSecondaryUser != null ? Pageview.User.CurrentSecondaryUser : Pageview.User; 1770 1771 //set URL for page. To get correct URL all places in regards to list 1772 //fetch pages from shop 1773 var pageService = new Dynamicweb.Content.PageService(); 1774 var pages = pageService.GetPagesForItems(new string[] { "PageShopList" }).Where(p => p.AreaId == Pageview.AreaID); 1775 string productPrice = GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-"); 1776 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(item.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 1777 int pageId = 0; 1778 foreach (var page in pages) 1779 { 1780 var shopGroupPage = Dynamicweb.Core.Converter.ToString(page.Item["ShopCategoryNumber"]); 1781 if (shopGroupPage == group.Number && page.AreaId.Equals(Pageview.AreaID)) 1782 { 1783 pageId = page.ID; 1784 break; 1785 } 1786 } 1787 1788 productUrl = "/Default.aspx?ID=" + pageId + "&ProductID=" + item.GetString("Ecom:Product.ID"); 1789 if (pageId == 0) 1790 { 1791 productUrl = "/" + item.GetString("Ecom:Product.Link.Clean"); 1792 } 1793 1794 // Images 1795 string grpId = string.Empty; 1796 string grpQtyDiscount5 = string.Empty; 1797 string grpQtyDiscount10 = string.Empty; 1798 1799 foreach (LoopItem subItem in item.GetLoop("AssociatedGroups")) 1800 { 1801 grpId = subItem.GetString("Ecom:Group.ID"); 1802 } 1803 1804 if (!string.IsNullOrEmpty(grpId)) 1805 { 1806 var productApi = Dynamicweb.Ecommerce.Services.Products.GetProductById(item.GetString("Ecom:Product.ID"), null, false); 1807 double minQuantity = item.GetDouble("Ecom:Product.PurchaseMinimumQuantity"); 1808 if (minQuantity < 1) 1809 { 1810 minQuantity = 1; 1811 } 1812 1813 double quantityStep = item.GetDouble("Ecom:Product.PurchaseQuantityStep"); 1814 if (quantityStep < 1) 1815 { 1816 quantityStep = 1; 1817 } 1818 1819 bool internalProduct = item.GetBoolean("Ecom:Product:Field.InternalProduct"); 1820 bool webshopOK = item.GetBoolean("Ecom:Product:Field.WebshopOK"); 1821 string productName = item.GetString("Ecom:Product.Name"); 1822 string productImage = Website.Helpers.Product.GetMainProductImage(productApi); 1823 if (String.IsNullOrEmpty(productImage)) 1824 { 1825 productImage = "/Files/System/Images/Shop/na-image.jpg"; 1826 } 1827 1828 var deleteLink = item.GetString("Ecom:Order:OrderLine.DeleteLink"); 1829 1830 var newDeleteLink = deleteLink; 1831 if (!string.IsNullOrEmpty(deleteLink) && deleteLink.ToLower().Contains("&productid")) 1832 { 1833 var deleteLinkParts = deleteLink.ToLowerInvariant().Split('&'); 1834 var productItemPart = deleteLinkParts.FirstOrDefault(p => p.Contains("productid")); 1835 var productId = item.GetString("Ecom:Product.ID"); 1836 deleteLinkParts[Array.IndexOf(deleteLinkParts, productItemPart)] = "productid=" + productId; 1837 newDeleteLink = string.Join("&", deleteLinkParts); 1838 } 1839 1840 int jungStockAmount = Dynamicweb.Core.Converter.ToInt32(item.GetString("Ecom:Product:Field.jung_stock").Replace("D", "")); 1841 string productFabrikat = item.GetString("Ecom:Product:Field.fabrikat").ToLower(); 1842 1843 //get campaign name 1844 string campaignName = ""; 1845 var prices = productApi.Prices; 1846 foreach (var priceFromMatrix in productApi.Prices) 1847 { 1848 if (priceFromMatrix.Amount == item.GetDouble("Ecom:Product.Price.PriceWithoutVAT.Value")) 1849 { 1850 campaignName = priceFromMatrix.Periods.FirstOrDefault()?.Name; 1851 } 1852 } 1853 1854 //has to be done like this and not tags. tags will make more calls via live integrayion. 1855 bool hasCombinations = productApi.VariantCombinations.Any(); 1856 1857 var smallSpotClasses = "product-item__price"; 1858 1859 if (isSmallSpot) 1860 { 1861 smallSpotClasses = "text-success font-weight-bold ml-auto"; 1862 1863 if (checkoutPage) 1864 { 1865 <a href="@item.GetString("Ecom:Order:OrderLine.DeleteLink")" class="product-item__closebtn btn p-0"> 1866 <span class="icon icon-close m-0"></span> 1867 </a> 1868 } 1869 else 1870 { 1871 <a href="#" class="product-item__closebtn btn js-product-state-submit p-0" data-action="@newDeleteLink"> 1872 <span class="icon icon-close m-0"></span> 1873 </a> 1874 } 1875 } 1876 1877 if (!string.IsNullOrEmpty(campaignName)) 1878 { 1879 string discountImage = ""; //@TODO hvad skal vi gøre med billeder? 1880 bool blackFriday = false; //@TODO hvad skal vi gøre med black friday? 1881 1882 if (!String.IsNullOrEmpty(discountImage)) 1883 { 1884 <div class="product-item__badge image-badge"> 1885 <img src="@discountImage" alt="Kampagne billede" width="150px"/> 1886 </div> 1887 } 1888 else if (blackFriday) 1889 { 1890 <div class="product-item__badge blackfriday-badge text-uppercase">@Translate("ecom-campaigne-blackfriday", "Black Friday")</div> 1891 } 1892 else 1893 { 1894 <div class="product-item__badge text-uppercase">@Translate("Campaign-" + campaignName, campaignName)</div> 1895 } 1896 } 1897 1898 if (internalProduct && !webshopOK) 1899 { 1900 <div class="product-item__badge image-badge"> 1901 <img src="/Files/System/Images/Shop/Webshop_logo_intern.jpg" alt="Internt produkt" height="50px"/> 1902 </div> 1903 } 1904 1905 if (loopName == "Products") 1906 { 1907 <picture class="product-item__photo mr-md-7 mr-5" onclick="window.location = '@productUrl';" style="cursor:pointer"> 1908 <source srcset="/Admin/Public/GetImage.ashx?Image=@productImage&width=146&height=128&background=ffffff&format=webP&Compression=75&fillcanvas=true" media="(min-width: 576px)"> 1909 <img class="img-fluid w-100" src="/Admin/Public/GetImage.ashx?Image=@productImage&width=345&height=300&background=ffffff&format=webP&Compression=75&fillcanvas=true" alt="@productName"> 1910 1911 1912 </picture> 1913 } 1914 1915 1916 <div class="h-100 d-flex flex-column result-item__product-content"> 1917 <div class="d-flex flex-row"> 1918 <div class="d-flex flex-column mb-3" onclick="window.location = '@productUrl';" style="cursor:pointer"> 1919 <div class="product-item__title">@productName</div> 1920 <div class="product-item__description"> 1921 @Translate("ProductNumber", "Varenummer") @item.GetString("Ecom:Product.Number") 1922 @if ((jungStockAmount > 0 && jungStockAmount < 3) || item.GetInteger("Ecom:Product.Stock") > 0) 1923 { 1924 <svg height="20" width="20"> <circle cx="8" cy="8" r="6" stroke="#92D053" stroke-width="3" fill="#92D053"/> Sorry, your browser does not support inline SVG. </svg> 1925 1926 if (mainUserHeader != null && mainUserHeader.HasGroup(24)) 1927 { 1928 <span> 1929 1930 (@item.GetInteger("Ecom:Product.Stock") @Translate("stk.")) 1931 </span> 1932 } 1933 } 1934 </div> 1935 @{ 1936 if (minQuantity > 1) 1937 { 1938 <div> 1939 <strong>@Translate("Minimumskøb:", "Minimumskøb:")</strong> @minQuantity @Translate("stk.") 1940 </div> 1941 } 1942 } 1943 @foreach (LoopItem subItem in item.GetLoop("Order.OrderLineFields")) 1944 { 1945 <div class="product-item__description"> 1946 @if (subItem.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") == "DeliveryPromised") 1947 { 1948 @subItem.GetString("Ecom:Order:OrderLine.OrderLineField.Value") 1949 } 1950 else if (subItem.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") == "customSizeAdded") 1951 { 1952 @Translate("customSize", "Størrelse") 1953 @subItem.GetString("Ecom:Order:OrderLine.OrderLineField.Value")<span>mm</span> 1954 } 1955 </div> 1956 } 1957 1958 @if (mainUserHeader != null && mainUserHeader.HasGroup(24) && !isSmallSpot) 1959 { 1960 string image = VestjyskMarketing.Helpers.ImageHelper.ResizeImage(new ResizeImageSettings() 1961 { 1962 Image = "/Files/Files/Images/img_calculator.png", 1963 Height = 96, 1964 Width = 96, 1965 Quality = 85 1966 }); 1967 1968 string salesPrice = item.GetDouble("Ecom:Product.DBPrice").ToString("F2"); 1969 string webPrice = salesPrice; 1970 string webDiscount = Dynamicweb.Core.Converter.ToDouble(productApi.GetProductFieldValue("WebDiscount")).ToString("F2"); 1971 string cost = Dynamicweb.Core.Converter.ToString(productApi.Cost); 1972 string externalNumber = Dynamicweb.Core.Converter.ToString(productApi.GetProductFieldValue("ExterntNummer")); 1973 string manufacturer = productApi.Manufacturer != null ? productApi.Manufacturer.Name : ""; 1974 string discountGroup = Dynamicweb.Core.Converter.ToString(productApi.GetProductFieldValue("ItemDiscGroup")); 1975 1976 1977 foreach (var priceFromMatrix in productApi.Prices) 1978 { 1979 if (Helpers.Product.IsPriceValid(priceFromMatrix)) 1980 { 1981 var userToTakePriceFrom = Pageview.User; 1982 1983 if (!string.IsNullOrEmpty(userToTakePriceFrom.Currency) && priceFromMatrix.CurrencyCode == userToTakePriceFrom.Currency) 1984 { 1985 webPrice = priceFromMatrix.Amount.ToString("F2"); 1986 } 1987 1988 if (priceFromMatrix.CurrencyCode == "DKK" && string.IsNullOrEmpty(userToTakePriceFrom.Currency)) 1989 { 1990 webPrice = priceFromMatrix.Amount.ToString("F2"); 1991 } 1992 } 1993 } 1994 1995 <div class="d-flex align-items-end flex-row"> 1996 <div> 1997 <div class="text-center" style="font-size: 10px;"> 1998 @Translate("Salgspris", "Salgspris"): @salesPrice 1999 </div> 2000 2001 <div class="text-center" style="font-size: 10px;"> 2002 @Translate("Webpris", "Webpris"): @webPrice 2003 </div> 2004 </div> 2005 <div class="product-item__details ml-6"> 2006 <img src="@image" class="product-item__details__image"> 2007 <div class="product-item__details__tooltip"> 2008 <div class="row"> 2009 <div class="col-7"> 2010 @Translate("Salgspris", "Salgspris"): 2011 </div> 2012 <div class="col-5"> 2013 @salesPrice 2014 </div> 2015 <div class="col-7"> 2016 @Translate("Webrabat", "Webrabat") %: 2017 </div> 2018 <div class="col-5"> 2019 @webDiscount 2020 </div> 2021 <div class="col-7"> 2022 @Translate("Webpris", "Webpris"): 2023 </div> 2024 <div class="col-5"> 2025 @webPrice 2026 </div> 2027 <div class="col-7"> 2028 @Translate("Cost", "Kostpris"): 2029 </div> 2030 <div class="col-5"> 2031 @cost 2032 </div> 2033 <div class="col-7"> 2034 @Translate("Manufacturer's number", "Leverandørens varenr"): 2035 </div> 2036 <div class="col-5"> 2037 @externalNumber 2038 </div> 2039 <div class="col-7"> 2040 @Translate("Manufacturer", "Levenrandør"): 2041 </div> 2042 <div class="col-5"> 2043 @manufacturer 2044 </div> 2045 <div class="col-7"> 2046 @Translate("DiscountGroup", "Varerabatgruppe"): 2047 </div> 2048 <div class="col-5"> 2049 @discountGroup 2050 </div> 2051 </div> 2052 </div> 2053 </div> 2054 </div> 2055 } 2056 </div> 2057 </div> 2058 <div class="d-flex align-items-center justify-content-start mt-auto flex-row"> 2059 <input type="hidden" name="ProdId" class="js-reorder-product-id" value="@item.GetString("Ecom:Product.ID")"/> 2060 @if (loopName != "Products") 2061 { 2062 <div class="input-group product-item__quantity-wrapper"> 2063 <span class="input-group-btn"> 2064 @if (checkoutPage) 2065 { 2066 <a href="@item.GetString("Ecom:Order:OrderLine.DecrementLink")" role="button" class="btn btn-buy d-inline-flex align-items-center justify-content-center"> 2067 <span class="icon icon-minus"></span> 2068 </a> 2069 } 2070 else 2071 { 2072 <a href="#" role="button" class="btn btn-buy d-inline-flex align-items-center justify-content-center js-product-state-submit" data-action="@item.GetString("Ecom:Order:OrderLine.DecrementLink")"> 2073 <span class="icon icon-minus"></span> 2074 </a> 2075 } 2076 </span> 2077 <input id="Quantity" type="text" autocomplete="off" class="form-control js-quantity-input text-center" name="Quantity" min="@minQuantity" value="@item.GetString("Ecom:Order:OrderLine.Quantity")" data-step="@quantityStep" data-type="order"> 2078 <span class="input-group-btn"> 2079 @if (checkoutPage) 2080 { 2081 <a href="@item.GetString("Ecom:Order:OrderLine.IncrementLink")" role="button" class="btn btn-buy d-inline-flex align-items-center justify-content-center"> 2082 <span class="icon icon-plus"></span> 2083 </a> 2084 } 2085 else 2086 { 2087 <a href="#" role="button" class="btn btn-buy d-inline-flex align-items-center justify-content-center js-product-state-submit" data-action="@item.GetString("Ecom:Order:OrderLine.IncrementLink")"> 2088 <span class="icon icon-plus"></span> 2089 </a> 2090 } 2091 2092 </span> 2093 </div> 2094 } 2095 else if (!hasCombinations) 2096 { 2097 <div class="input-group product-item__quantity-wrapper d-md-none"> 2098 <span class="input-group-btn"> 2099 <button class="btn btn-buy js-reorder-quantity-subtract" type="button"> 2100 <span class="icon icon-minus"></span> 2101 </button> 2102 </span> 2103 <input type="text" autocomplete="off" class="form-control js-reorder-quantity-input text-center" name="Quantity" min="0" max="20" value="1"> 2104 <span class="input-group-btn"> 2105 <button class="btn btn-buy js-reorder-quantity-add" type="button"> 2106 <span class="icon icon-plus"></span> 2107 </button> 2108 </span> 2109 </div> 2110 } 2111 2112 2113 @if (productFabrikat != "leitz") 2114 { 2115 <div class="@smallSpotClasses" onclick="window.location = '@productUrl';" style="cursor:pointer"> 2116 @if (false) //TODO campaign prices 2117 { 2118 <div class="product-details__price-container"> 2119 @if (hasCombinations && loopName != "OrderLines") 2120 { 2121 <div class="from-price">@Translate("ProductFromPrice", "Fra")</div> 2122 } 2123 <div>@item.GetString("Ecom:Product.Discount.Price.PriceWithoutVATFormatted").Replace(",00", ",-")</div> 2124 <div class="product-item__price--old">@item.GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-")</div> 2125 </div> 2126 } 2127 else 2128 { 2129 if (hasCombinations && loopName != "OrderLines") 2130 { 2131 <div class="from-price without-discount"> 2132 @Translate("ProductFromPrice", "Fra")<span> </span> 2133 </div> 2134 } 2135 2136 <div class="without-discount lazyload-price" data-id="@item.GetString("Ecom:Product.ID")" data-variantid='@(hasCombinations ? "variantid" : "")'> 2137 <img src="/Files/Images/loading.gif"> 2138 @if (loopName == "OrderLines") 2139 { 2140 @item.GetString("Ecom:Order:OrderLine.UnitPrice.PriceWithoutVATFormatted").Replace(",00", ",-") 2141 } 2142 else 2143 { 2144 @item.GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-") 2145 } 2146 </div> 2147 } 2148 </div> 2149 } 2150 else if (User.IsExtranetUserLoggedIn()) 2151 { 2152 <div class="@smallSpotClasses" onclick="window.location = '@productUrl';" style="cursor:pointer"> 2153 2154 @if (hasCombinations && loopName != "OrderLines") 2155 { 2156 <div class="from-price without-discount">@Translate("ProductFromPrice", "Fra")</div> 2157 } 2158 2159 <div class="without-discount lazyload-price" data-id="@item.GetString("Ecom:Product.ID")" data-variantid='@(hasCombinations ? "variantid" : "")'> 2160 <img src="/Files/Images/loading.gif"> 2161 @if (loopName == "OrderLines") 2162 { 2163 @item.GetString("Ecom:Order:OrderLine.UnitPrice.PriceWithoutVATFormatted").Replace(",00", ",-") 2164 } 2165 else 2166 { 2167 @item.GetString("Ecom:Product.Price.PriceWithoutVATFormatted").Replace(",00", ",-") 2168 } 2169 2170 </div> 2171 2172 </div> 2173 } 2174 2175 @if (loopName == "Products") 2176 { 2177 if (productFabrikat != "leitz" || User.IsExtranetUserLoggedIn()) 2178 { 2179 <div class="product-item__infowrapper d-inline-block no-wrap ml-auto flex-row"> 2180 <button type="button" class="btn btn-link align-self-end d-none d-md-inline-block mr-2 px-4" onclick="window.location = '@productUrl';">INFO</button> 2181 @if (!hasCombinations) 2182 { 2183 <button type="submit" class="js-reorder-add-to-basket w-100 btn btn-sm btn-success align-self-end d-md-none ml-auto"> 2184 <span class="icon icon-cart mr-4"></span> 2185 </button> 2186 } 2187 else 2188 { 2189 <button type="submit" class="w-100 btn btn-sm btn-success align-self-end d-md-none ml-auto" onclick="window.location = '@productUrl';"> 2190 <span class="icon icon-cart mr-4"></span> 2191 </button> 2192 } 2193 <button type="button" class="btn btn-success align-self-end d-none d-md-inline-block px-4" onclick="window.location = '@productUrl';"> 2194 <span class="icon icon-shopping-cart mr-2"></span>@Translate("BESTIL") 2195 </button> 2196 2197 2198 </div> 2199 } 2200 else 2201 { 2202 <div class="d-flex"> 2203 2204 <div class="align-self-end d-none d-md-inline-block px-4" style="font-size: 12px">@Translate("Log ind for at se prisen")</div> 2205 2206 <button type="button" class="btn btn-success align-self-end d-md-inline-block js-aside-btn px-4" href="#" data-view="login">@Translate("HeaderLoginButton", "Login")</button> 2207 2208 </div> 2209 } 2210 } 2211 </div> 2212 2213 @if (loopName == "Products") 2214 { 2215 if (prices.Count > 1 && false) 2216 { 2217 int counterPrices = 0; 2218 string marginLeft = string.Empty; 2219 <div class="d-flex flex-column mb-md-7 font-weight-bolder my-5"> 2220 <h4 class="font-weight-bold"> 2221 Køb flere og spar: 2222 </h4> 2223 2224 <div> 2225 <div class="font-small d-flex flex-column flex-lg-row"> 2226 2227 @foreach (Dynamicweb.Ecommerce.Prices.Price priceInMatrix in prices.OrderBy(x => x.Quantity)) 2228 { 2229 if (!Helpers.Product.IsCampaingPrice(priceInMatrix) && Helpers.Product.IsPriceValid(priceInMatrix) && priceInMatrix.Quantity > 1) 2230 { 2231 if (counterPrices > 0) 2232 { 2233 marginLeft = "ml-lg-3"; 2234 } 2235 2236 double productPriceDouble = item.GetDouble("Ecom:Product.Price.PriceWithoutVAT"); 2237 double percentageSaved = (productPriceDouble - priceInMatrix.Amount) / productPriceDouble * 100; 2238 <div class="d-flex flex-row @marginLeft"> 2239 <span class="text-success"> 2240 @priceInMatrix.Quantity stk. af @priceInMatrix.Amount,- 2241 </span> 2242 <span class="text-danger ml-2"> 2243 Du sparer @Math.Round(percentageSaved)% 2244 </span> 2245 </div> 2246 counterPrices++; 2247 } 2248 } 2249 </div> 2250 </div> 2251 </div> 2252 } 2253 } 2254 </div> 2255 } 2256 } 2257 2258 @helper RenderProductListNew(string loopName, int limit = 0, bool isSmallSpot = false, bool productPage = false, List<Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>.LoopItem> newLoop = null) 2259 { 2260 var loop = GetLoop(loopName); 2261 2262 2263 if (newLoop != null) 2264 { 2265 loop = newLoop; 2266 } 2267 2268 //fetch pages from shop 2269 var pageService = new Dynamicweb.Content.PageService(); 2270 var pages = pageService.GetPagesForItems(new string[] { "PageShopList" }).Where(p => p.AreaId == Pageview.AreaID); 2271 2272 foreach (LoopItem item in limit == 0 ? loop : loop.Take(limit)) 2273 { 2274 if (!string.IsNullOrEmpty(item.GetString("Ecom:Product.PrimaryOrFirstGroupID"))) 2275 { 2276 //set URL for page. To get correct URL all places in regards to list 2277 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(item.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 2278 int pageId = 0; 2279 foreach (var page in pages) 2280 { 2281 var shopGroupPage = Dynamicweb.Core.Converter.ToString(page.Item["ShopCategoryNumber"]); 2282 if (shopGroupPage == group.Number && page.AreaId.Equals(Pageview.AreaID)) 2283 { 2284 pageId = page.ID; 2285 break; 2286 } 2287 } 2288 2289 string productPageUrl = "/Default.aspx?ID=" + pageId + "&ProductID=" + item.GetString("Ecom:Product.ID"); 2290 if (pageId == 0) 2291 { 2292 productPageUrl = "/" + item.GetString("Ecom:Product.Link.Clean"); 2293 } 2294 2295 var cols = "col-md-6 col-lg-4"; 2296 2297 if (productPage) 2298 { 2299 cols = "col-md-6 col-lg-3"; 2300 } 2301 2302 if (loopName.Equals("Products") || loopName.Equals("Item.ProductDisplay")) 2303 { 2304 //get campaign name 2305 string campaignName = ""; 2306 var productApi = Dynamicweb.Ecommerce.Services.Products.GetProductById(item.GetString("Ecom:Product.ID"), null, false); 2307 var prices = productApi.Prices; 2308 foreach (var priceFromMatrix in productApi.Prices) 2309 { 2310 if (priceFromMatrix.Amount == item.GetDouble("Ecom:Product.Price.PriceWithoutVAT.Value")) 2311 { 2312 campaignName = priceFromMatrix.Periods.FirstOrDefault()?.Name; 2313 } 2314 } 2315 2316 2317 <div class="@cols d-none d-md-flex js-product-list-item position-relative" style="padding: 8px 8px 0 8px; justify-content: center;"> 2318 <a href="@productPageUrl" class="product-item box-shadow-sm box-shadow-sm-hoover mb-3" style="width: 100%; padding: 10px; position: relative;"> 2319 @if (!string.IsNullOrEmpty(campaignName)) 2320 { 2321 <div onclick="window.location = '@productPageUrl'" class="campaign-container" style="position: absolute; height: 120px; top: 0; left: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;"> 2322 <img src="/Admin/Public/GetImage.ashx?Image=/Files/Files/Images/discount_label2.png&Format=png&Width=587&Height=628&Resolution=99&Crop=0" style="height: 120px;"> 2323 <div class="text-uppercase" style="margin-bottom: 39px; font-size: 12px; margin-right: 30px; color: white; font-weight: 600; position: absolute; z-index: 5; transform: rotate(-46deg); transform-origin: center center; white-space: nowrap">@Translate("Campaign-" + campaignName, campaignName)</div> 2324 </div> 2325 } 2326 @ContentRenderingNew(item, loopName, false, productPageUrl) 2327 </a> 2328 </div> 2329 } 2330 else 2331 { 2332 <a href="@productPageUrl" class="product-item box-shadow-sm box-shadow-sm-hoover js-product-list-item mb-3"> 2333 @ContentRenderingNew(item, loopName, false, productPageUrl) 2334 </a> 2335 } 2336 } 2337 } 2338 } 2339 2340 @helper RenderProductList(string loopName, int limit = 0, bool isSmallSpot = false, bool isSearch = false) 2341 { 2342 var loop = GetLoop(loopName); 2343 2344 //fetch pages from shop 2345 var pageService = new Dynamicweb.Content.PageService(); 2346 var pages = pageService.GetPagesForItems(new string[] { "PageShopList" }).Where(p => p.AreaId == Pageview.AreaID); 2347 var productService = new ProductService(); 2348 2349 foreach (LoopItem item in limit == 0 ? loop : loop.Take(limit)) 2350 { 2351 if (!string.IsNullOrEmpty(item.GetString("Ecom:Product.PrimaryOrFirstGroupID"))) 2352 { 2353 //set URL for page. To get correct URL all places in regards to list 2354 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(item.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 2355 int pageId = 0; 2356 foreach (var page in pages) 2357 { 2358 var shopGroupPage = Dynamicweb.Core.Converter.ToString(page.Item["ShopCategoryNumber"]); 2359 if (shopGroupPage == group.Number && page.AreaId.Equals(Pageview.AreaID)) 2360 { 2361 pageId = page.ID; 2362 break; 2363 } 2364 } 2365 2366 string productPageUrl = "/Default.aspx?ID=" + pageId + "&ProductID=" + item.GetString("Ecom:Product.ID"); 2367 if (pageId == 0) 2368 { 2369 productPageUrl = "/" + item.GetString("Ecom:Product.Link.Clean"); 2370 } 2371 2372 if (loopName.Equals("Products")) 2373 { 2374 var displays = isSearch ? "" : "d-flex d-md-none"; 2375 2376 2377 <a href="@productPageUrl" class="@displays product-item box-shadow-sm box-shadow-sm-hoover js-product-list-item mb-3"> 2378 @ContentRendering(item, loopName, false, productPageUrl) 2379 2380 <span href="@productPageUrl" class="product-item__label d-md-none"> 2381 <span>@Translate("Læs mere")</span> 2382 </span> 2383 2384 </a> 2385 } 2386 } 2387 } 2388 } 2389 @{ 2390 var relatedProductsGroup = GetLoop("ProductRelatedGroups").FirstOrDefault(g => g.GetString("Ecom:Product:RelatedGroup.Name") == "Relaterede produkter"); 2391 if (relatedProductsGroup != null) 2392 { 2393 var relatedProductList = relatedProductsGroup.GetLoop("RelatedProducts").Where(p => p.GetBoolean("Ecom:Product:Field.WebshopOK")).ToList(); 2394 if (relatedProductList.Count() > 0) 2395 { 2396 <div style="background-color: #18305b" class=""> 2397 <div class="container"> 2398 <div class="row"> 2399 <h2 style="color: white; padding-left: 8px;" class="mb-6 mt-10">@Translate("ecom-related-products")</h2> 2400 <div style="flex-flow: wrap; justify-content: start; margin-bottom: 70px" class="d-flex list-unstyled js-product-list js-product-list-loader col-12 p-0"> 2401 @RenderProductListNew("Products", 0, false, true, relatedProductList) 2402 </div> 2403 </div> 2404 </div> 2405 </div> 2406 2407 <svg width="auto" class="" height="100" style="background-color: #f4f4f4" viewBox="0 0 500 80" preserveAspectRatio="none"> 2408 <path d="M0,0 L0,40 Q250,80 500,40 L500,0 Z" fill="#18305b" /> 2409 </svg> 2410 } 2411 } 2412 } 2413 2414 @{ 2415 var productType = ""; 2416 if (isSparePartGroup) 2417 { 2418 productType = "spare_part"; 2419 } 2420 else 2421 { 2422 productType = "default"; 2423 } 2424 <div class="d-none producttype" data-type="@productType"></div> 2425 } 2426 2427 <!-- Additional products js functionality--> 2428 <script> 2429 2430 document.addEventListener("DOMContentLoaded", function () { 2431 //info icons 2432 var infoIcons = document.querySelectorAll(".additionalIcon"); 2433 2434 infoIcons.forEach(function (item) { 2435 var id = item.dataset.id; 2436 var additionalDescription = document.getElementById("additionalDescription-" + id); 2437 2438 item.addEventListener("mouseover", function () { 2439 additionalDescription.style.display = "flex"; 2440 additionalDescription.innerHTML = additionalDescription.innerHTML.trim(); 2441 2442 }) 2443 2444 item.addEventListener("mouseout", function () { 2445 additionalDescription.style.display = "none"; 2446 }) 2447 2448 item.addEventListener("click", function () { 2449 for (let i = 0; i < infoIcons.length; i++) { 2450 if (infoIcons[i].dataset.id !== id) { 2451 document.getElementById("additionalDescription-" + infoIcons[i].dataset.id).style.display = "none"; 2452 } 2453 } 2454 2455 additionalDescription.style.display = "flex"; 2456 additionalDescription.innerHTML = additionalDescription.innerHTML.trim(); 2457 }) 2458 2459 document.addEventListener("click", function (event) { 2460 var target = event.target; 2461 if (!target.closest('.additionalIcon') && additionalDescription.style.display === "flex") { 2462 additionalDescription.style.display = "none"; 2463 } 2464 }) 2465 }) 2466 }) 2467 2468 </script> 2469 2470 2471 <script> 2472 2473 document.addEventListener("DOMContentLoaded", function (){ 2474 2475 var typeElement = document.getElementsByClassName("producttype")[0]; 2476 2477 //SEO for product 2478 2479 var defaultObject = 2480 { 2481 "@@context": "https://schema.org/", 2482 "@@type": "Product", 2483 "name": "@productName", 2484 "image": [ 2485 "@productImageFullurl" 2486 ], 2487 "description": "@metaDescription", 2488 "brand": { 2489 "@@type": "Brand", 2490 "name": "@productFabrikat" 2491 }, 2492 "sku": "@productNumber", 2493 "offers": { 2494 "@@type": "Offer", 2495 "url": window.location.href, 2496 "priceCurrency": "@GetString("Ecom:Product.Currency.Code")", 2497 "price": "@GetDouble("Ecom:Product.Price.PriceWithoutVAT.Value")", 2498 "availability": "https://schema.org/InStock", 2499 "itemCondition": "https://schema.org/NewCondition" 2500 } 2501 } 2502 2503 2504 var objectSparepart = 2505 { 2506 "@@context": "https://schema.org/", 2507 "@@type": "Product", 2508 "name": "@productName", 2509 "image": [ 2510 "@productImageFullurl" 2511 ], 2512 "description": "@metaDescription", 2513 "sku": "@productNumber", 2514 "brand": "@productFabrikat", 2515 "offers": { 2516 "@@type": "Offer", 2517 "availability": "http://schema.org/InStock", 2518 "price": "@GetDouble("Ecom:Product.Price.PriceWithoutVAT.Value") ", 2519 "priceCurrency": "@GetString("Ecom:Product.Currency.Code")" 2520 } 2521 } 2522 2523 var jsonLdScript = document.createElement('script'); 2524 jsonLdScript.type = 'application/ld+json'; 2525 2526 if (typeElement.dataset.type == "spare_part") 2527 { 2528 jsonLdScript.text = JSON.stringify(objectSparepart); 2529 } 2530 else { 2531 jsonLdScript.text = JSON.stringify(defaultObject); 2532 } 2533 2534 document.head.appendChild(jsonLdScript); 2535 2536 //view_item 2537 window.dataLayer = window.dataLayer || []; 2538 dataLayer.push({ecommerce: null}) 2539 dataLayer.push({ 2540 "event": "view_item", 2541 "ecommerce": { 2542 "currency": "@GetValue("Ecom:Product.Currency.Code")", 2543 "value": @Dynamicweb.Core.Converter.ToString(GetDouble("Ecom:Product.Price.PriceWithoutVAT")).Replace(",", "."), 2544 "items": [ 2545 { 2546 "item_id": "@productNumber", 2547 "item_name": "@productName", 2548 "affiliation": "Online Store", 2549 "variant" : "@productVariantName", 2550 "price": @Dynamicweb.Core.Converter.ToString(GetDouble("Ecom:Product.Price.PriceWithoutVAT")).Replace(",", "."), 2551 } 2552 ] 2553 }, 2554 2555 }); 2556 2557 //add_to_cart 2558 2559 window.addEventListener("DOMContentLoaded", (event) => { 2560 2561 var addToBasketButton = document.getElementsByClassName("js-product-add-to-basket"); 2562 addToBasketButton = addToBasketButton[0]; 2563 addToBasketButton.addEventListener("click", addToBasketClicked); 2564 2565 function addToBasketClicked () 2566 { 2567 window.dataLayer = window.dataLayer || []; 2568 dataLayer.push({ecommerce: null}) 2569 dataLayer.push({ 2570 "event": "add_to_cart", 2571 "ecommerce": { 2572 "currency": "@GetValue("Ecom:Product.Currency.Code")", 2573 "value": @Dynamicweb.Core.Converter.ToString(GetDouble("Ecom:Product.Price.PriceWithoutVAT")).Replace(",", "."), 2574 "items": [ 2575 { 2576 "item_id": "@productNumber", 2577 "item_name": "@productName", 2578 "affiliation": "Online Store", 2579 "variant" : "@productVariantName", 2580 "price": @Dynamicweb.Core.Converter.ToString(GetDouble("Ecom:Product.Price.PriceWithoutVAT")).Replace(",", "."), 2581 } 2582 ] 2583 }, 2584 }); 2585 } 2586 2587 }); 2588 }) 2589 2590 </script> 2591 <script> 2592 2593 //fixes select option - if variantid is not selected, update select accordingly 2594 window.addEventListener('pageshow', () => { 2595 const select = document.getElementById('product-options') 2596 if (!select) return 2597 2598 const currentValue = select.dataset.currentValue?.trim() 2599 2600 if (!currentValue) { 2601 select.selectedIndex = 0 2602 } else { 2603 2604 select.value = currentValue 2605 } 2606 2607 select.querySelectorAll('option').forEach(opt => opt.removeAttribute('selected')) 2608 const activeOption = select.querySelector(`option[value="${select.value}"]`) 2609 if (activeOption) activeOption.setAttribute('selected', 'selected') 2610 2611 var customSize = document.getElementById("customsize"); 2612 if (customSize) { 2613 2614 customSize.value = ""; 2615 2616 } 2617 2618 }) 2619 </script>
Fandt du ikke den reservedel du søgte? Vi hjælper gerne med at finde de korrekte Biesse reservedele til dine maskiner.
Find en medarbejder for direkte kontakt