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