Error executing template "Designs/eCommerce/eCom/Product/Product.cshtml"
System.Data.SqlClient.SqlException (0x80131904): Error converting data type nvarchar to bigint.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
at System.Data.SqlClient.SqlDataReader.Read()
at System.Data.Linq.SqlClient.ObjectReaderCompiler.ObjectReaderBase`1.Read()
at System.Data.Linq.SqlClient.ObjectReaderCompiler.ObjectReader`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at KSCustomModules.Services.AjaxRequests.ProductGetPrice(String ProductId, Int32 UserId) in C:\Visual Studio Workspaces\KEN Storkøkken GIT\WebShop2019\Services\AjaxRequests.asmx.cs:line 1178
at CompiledRazorTemplates.Dynamic.RazorEngine_8a0ef71f03c84640b95e21bb936b7f9b.Execute() in C:\home\site\wwwroot\Files\Templates\Designs\eCommerce\eCom\Product\Product.cshtml:line 33
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.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
ClientConnectionId:1c237420-c79e-4eb8-9b10-bdfd93ecd5ae
Error Number:8114,State:5,Class:16
ClientConnectionId before routing:a9bc50e3-9eed-45ac-8207-9a5808009754
Routing Destination:da023b791e1d.tr43164.westeurope1-a.worker.database.windows.net,11008
1 @using KSCustomModules
2 @using Dynamicweb
3 @using System
4 @using System.Web.Mvc
5
6
7 @{
8 var pUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=3&ProductID=" + ((string)GetValue("Ecom:Product.ID")));
9 }
10 <link rel='canonical' href='@pUrl'>
11 @{
12 Int32 userId = 0;
13 Boolean isSkiUser = false;
14 var disableShop = "";
15 bool buyBack = false;
16 bool swapForNew = false;
17
18 Dynamicweb.Security.UserManagement.User CurrentUser = Dynamicweb.Security.UserManagement.User.get_Current(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend);
19 if (CurrentUser != null && CurrentUser.Active)
20 {
21 userId = CurrentUser.ID;
22 isSkiUser = CurrentUser.CustomFieldValues.Where(w => w.CustomField.SystemName == "AccessUser_Prisgruppekode").First().Value.ToString() == "SKI";
23 if (CurrentUser.CustomFieldValues.Where(w => w.CustomField.SystemName == "AccessUser_DisableShop").FirstOrDefault().Value.Equals(true))
24 {
25 disableShop = "hidden";
26 }
27 }
28
29
30 var activeUsed = "active";
31 var ajaxRequestCode = new KSCustomModules.Services.AjaxRequests();
32 //Finding custom price from owen matrix
33 var customPrice = ajaxRequestCode.ProductGetPrice((string)GetValue("Ecom:Product.ID"), userId);
34 string priceRegular = "";
35 string priceDiscount = "";
36 string discountCss = "";
37 bool onDiscount = false;
38 string userAgent = Dynamicweb.Context.Current.Request.UserAgent.ToLower();
39 string userDevice = Dynamicweb.Frontend.Devices.DeviceInfo.ParseFromUserAgentString(userAgent).DeviceType.ToString();
40 string groupURL = GetString("Ecom:Product.LinkGroup.Clean");
41
42
43 if (customPrice.OnDiscount)
44 {
45 onDiscount = true;
46 discountCss = customPrice.DiscountColor.Replace(".png", "").Replace("/files/Images/Shop/Discounts/", "");
47
48 if (customPrice.DiscountType.IndexOf("Bundpris") > -1 || GetString("Ecom:Product:Field.VareRabatGrp.Value").IndexOf("BASIC") > -1)
49 {
50 priceRegular = customPrice.DiscountPriceString;
51 onDiscount = false;
52 }
53 else
54 {
55 priceDiscount = customPrice.DiscountPriceString;
56 priceRegular = customPrice.PriceString;
57 }
58 }
59 else
60 {
61 priceRegular = customPrice.PriceString;
62 }
63 string productName = GetString("Ecom:Product.Name");
64
65
66 //Sustainability Oktober 2020 by Henrik
67 string categories = GetString("Ecom:Product:Field.Categories.Value");
68 List<string> sustainabilityIcons = new List<string>();
69 foreach (var categori in categories.Split(',').ToList())
70 {
71 switch (categori)
72 {
73 case "BD":
74 sustainabilityIcons.Add("/Files/Images/Shop/Sustainability/svg/Baeredygtigtigt.svg");
75 break;
76 case "FSC":
77 sustainabilityIcons.Add("/Files/Images/Shop/Sustainability/svg/FSC.svg");
78 break;
79 case "REC":
80 sustainabilityIcons.Add("/Files/Images/Shop/Sustainability/svg/Recycled.svg");
81 break;
82 case "STRØM":
83 sustainabilityIcons.Add("/Files/Images/Shop/Sustainability/svg/LavtStroemforbrug.svg");
84 break;
85 case "Vand":
86 sustainabilityIcons.Add("/Files/Images/Shop/Sustainability/svg/LavtVandforbrug.svg");
87 break;
88 case "Co2":
89 sustainabilityIcons.Add("/Files/Images/Shop/Sustainability/svg/LavtCo2-Aftryk.svg");
90 break;
91 case "BIO":
92 sustainabilityIcons.Add("/Files/Images/Shop/Sustainability/svg/Bioprodukt.svg");
93 break;
94 case "DK":
95 sustainabilityIcons.Add("/Files/Images/Shop/Sustainability/svg/DanskProduceret.svg");
96 break;
97 }
98 }
99 //End Sustainability
100 }
101
102 <div id="groupURL" data-href="@groupURL" data-name="@productName" style="display:none;">@groupURL</div>
103
104 <script>
105 isProductPage = true;
106 currentProductID = '@GetString("@Ecom:Product.ID")';
107 getGroupsBreadcrumb("product");
108 function imgError(image) {
109 image.onerror = "";
110 image.src = "/files/images/no-image.png";
111 return true;
112 }
113 </script>
114
115 <section class="product-details-content" style="">
116 @SnippetStart("ogImage")<meta property="og:image" content="http://@GetGlobalValue("Global:Request.Host")@GetValue("Ecom:Product.ImageMedium.Default.Clean")" />@SnippetEnd("ogImage")
117
118 <div id="ProductInfo" itemscope itemtype="http://schema.org/Product">
119 <meta itemprop="brand" content="@GetString("Ecom:Product:Manufacturer.Name")" />
120 <meta itemprop='url' content='http://www.kenstorkoekken.dk/@pUrl' />
121 <meta itemprop="sku" content="@GetValue("Ecom:Product:Field.EAN.Value")" />
122 @if (userDevice == "Mobile")
123 {
124 <div class="row">
125
126 <div class="col-xs-12 prod-header">
127 <h1 itemprop="name">@GetString("Ecom:Product.Name")</h1>
128 <h2>@GetString("Ecom:Product.ShortDescription.Raw")</h2>
129 <p class="product-number">
130 Varenr.: <span itemprop="mpn">@GetString("Ecom:Product.Number")</span>
131 @{
132 if (GetString("Ecom:Product:Field.EAN.Value") != "")
133 {
134 <br />
135 @:EAN: @GetString("Ecom:Product:Field.EAN.Value")
136 }
137
138 if (isSkiUser)
139 {
140 <br />@:SKI-ID: <span itemprop="mpn">@GetString("Ecom:Product.SkiId")</span>
141 }
142 }
143 </p>
144 </div>
145 </div>
146 }
147 <div class="row">
148 <div class="col-lg-6" id="product-details-image-col">
149 @{
150 string brand = GetString("Ecom:Product:Field.ProductBrand.Value").Replace("&", "og").Replace(" ", "-").Replace("'", "").Replace("ö", "o").Replace("ä", "a").Replace("Ø", "OE").Replace("/", "-");
151
152 if (brand != "")
153 {
154 brand = brand + ".jpg";
155 <img class="prod-logo" src="/Files/Images/Brandpages/Brands - Logoer/Til-produkter/@brand">
156 }
157
158
159 }
160 <div class="tags">
161 @if (discountCss != "" && GetString("Ecom:Product:Field.VareRabatGrp.Value").IndexOf("BASIC") == -1)
162 {
163 <div class="tag @discountCss">@customPrice.DiscountType</div>
164 }
165 @if (customPrice.SplashOn)
166 {
167 <div class="tag blue">@customPrice.SplashText</div>
168 }
169 @if (GetString("Ecom:Product:Field.VareRabatGrp.Value").IndexOf("BASIC") > -1)
170 {
171 <div class="tag blue">BASIC</div>
172 }
173
174 </div>
175
176 <div id="product-details-image">
177 <input id="ProductId" type="hidden" value="@GetValue("Ecom:Product.ID")" />
178 <input id="UserId" type="hidden" value="@userId" />
179
180 <div class="product-image-zoomed">
181 <img itemprop="image" id="main-image" src='/Admin/Public/GetImage.aspx?Image=@GetValue("Ecom:Product.ImageMedium.Default.Clean")&Height=450' onerror="imgError(this)" alt='@GetValue("Ecom:Product.ShortDescription.Raw")' />
182 <div id="embed-wrap" class="hidden">
183 <div></div>
184 </div>
185
186
187 @if (customPrice.SplashOn)
188 {
189 <div class="splash-line">
190 @if (customPrice.SplashText.Contains("Gennemgået") || customPrice.SplashText.Contains("Gennem-gået") || customPrice.SplashText.Contains("Demo") || customPrice.SplashText.Contains("Renoveret") || customPrice.SplashText.Contains("Midlertidig udsolgt"))
191 {
192 if (customPrice.SplashText == "Gennem-gået" || customPrice.SplashText == "Gennemgået")
193 {
194 @:Gennemgået: Min. 3 mdr. garanti
195 }
196 if (customPrice.SplashText == "Demo")
197 {
198 @:Demo: Min. 12 mdr. garanti
199 }
200 if (customPrice.SplashText == "Renoveret")
201 {
202 @:Renoveret: Min. 6 mdr. garanti
203 }
204 if (customPrice.SplashText == "Midlertidig udsolgt")
205 {
206 @:Kontakt kundeservice 86248400
207 }
208 }
209 </div>
210 }
211
212
213
214
215 </div>
216
217 @if (GetValue("Ecom:Product:Field.DetailImages.Value") != null && GetValue("Ecom:Product:Field.DetailImages.Value") != "" || !String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkFilm.Value")))
218 {
219 <script type="text/javascript">
220
221 function showProdVideo(thumb) {
222 var video = thumb.getAttribute("data-videoid");
223 var image = document.getElementById("main-image");
224 image.classList.add("hidden");
225 var embedWrap = document.getElementById("embed-wrap");
226 var embedDiv = document.querySelector("#embed-wrap > *");
227 var iframe = document.createElement("iframe");
228 iframe.setAttribute("src",
229 "https://www.youtube.com/embed/" + video + "?modestbranding=1&autoplay=1&playsinline=1&rel=0");
230 iframe.setAttribute("allow", "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture");
231 iframe.setAttribute("allowfullscreen", "");
232 embedWrap.replaceChild(iframe, embedDiv);
233 embedWrap.classList.remove("hidden");
234 }
235 function showProdImg(thumb) {
236 var imageData = thumb.getAttribute("data-image");
237 var image = document.getElementById("main-image");
238 var embedWrap = document.getElementById("embed-wrap");
239 var embedDiv = document.createElement("div");
240 embedWrap.classList.add("hidden");
241 image.setAttribute("src", imageData);
242 image.classList.remove("hidden");
243 var iframe = document.querySelector("#embed-wrap > *");
244 embedWrap.replaceChild(embedDiv, iframe);
245 }
246
247 </script>
248 <div class="product-image-subthumbs">
249
250 <div>
251 <div class="thumbnail-prod" onclick="showProdImg(this)" data-image="@GetValue("Ecom:Product.ImageMedium.Default.Clean")">
252 <p style="background-image:url('/Admin/Public/GetImage.aspx?Image=@GetValue("Ecom:Product.ImageMedium.Default.Clean")&Height=185');"></p>
253 </div>
254 </div>
255 @if (GetValue("Ecom:Product:Field.DetailImages.Value") != null && GetValue("Ecom:Product:Field.DetailImages.Value") != "")
256 {
257 foreach (String img in GetString("Ecom:Product:Field.DetailImages.Value").Split(','))
258 {
259 <div>
260 <div class="thumbnail-prod" onclick="showProdImg(this)" data-image="@img">
261 <p style="background-image:url('/Admin/Public/GetImage.aspx?Image=@(img)&Height=185');"></p>
262 </div>
263 </div>
264 }
265 }
266 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkFilm.Value")))
267 {
268 foreach (String demo in @GetString("Ecom:Product:Field.LinkFilm.Value").Split(','))
269 {
270 if (!String.IsNullOrEmpty(demo))
271 {
272 var demoURL = demo;
273 string youtubeID = "";
274 if (demoURL.Contains(".yout"))
275 {
276 string result = demoURL;
277 if (demoURL.Contains("&"))
278 {
279 result = demoURL.Substring(0, demoURL.IndexOf("&"));
280 }
281 string result2 = result.Split('=')[1];
282 youtubeID = result2;
283
284 <div>
285 <div class="thumbnail-prod thumbnail-video" onclick="showProdVideo(this)" data-videoid="@youtubeID">
286 <p style="cursor:pointer; background-image:url('https://img.youtube.com/vi/@youtubeID/default.jpg');"></p>
287 </div>
288 </div>
289 }
290
291
292 }
293 }
294
295 }
296
297 </div>
298 }
299
300 </div>
301 </div>
302 <div class="col-xs-12 col-lg-6" id="product-details-information">
303 @if (userDevice != "Mobile")
304 {
305 <div class="row">
306
307 <div class="col-xs-12 prod-header">
308 <h1 itemprop="name">@GetString("Ecom:Product.Name")</h1>
309 <h2>@GetString("Ecom:Product.ShortDescription.Raw")</h2>
310 <p class="product-number">
311 Varenr.: <span itemprop="mpn">@GetString("Ecom:Product.Number")</span>
312 @{
313 if (customPrice.StockText.IndexOf("lager") > -1)
314 {
315 <br /><span class="forbehold">Der tages forbehold for mellemsalg.</span>
316 }
317
318 if (GetString("Ecom:Product:Field.EAN.Value") != "")
319 {
320 <br />
321 @:EAN: @GetString("Ecom:Product:Field.EAN.Value")
322 }
323
324 if (isSkiUser)
325 {
326 <br />@:SKI-ID: <span itemprop="mpn">@GetString("Ecom:Product.SkiId")</span>
327 }
328 }
329 </p>
330 </div>
331 </div>
332 }
333 <div class="row">
334 <div class="col-xs-12">
335 <!--@If Not(Global:Request.Url<contains>'ski=1')-->
336 <div class="product-details-price" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
337
338 @if (userId != 0 && disableShop != "hidden")
339 {
340 <h5>Din pris</h5>
341 }
342 <div>
343 @{
344 if ((string)priceRegular == (string)"Login for pris")
345 {
346 <h3 class="product-price discount">Login for pris</h3>
347 }
348 else
349 {
350
351 string isBP = customPrice.DiscountType.Contains("Bundpris") ? "bundpris" : "";
352
353 <meta itemprop="priceCurrency" content="@GetString("Ecom:Product.Currency.Code")" />
354 <meta itemprop="availability" content="@customPrice.StockText" />
355 <div class="product-price has-discount" @(onDiscount ? "" : "style='display: none;'")>
356 <h3 class="product-price regular" style="font-size: 12px; text-decoration: line-through">@priceRegular</h3>
357 <h3 class="product-price discount @isBP">@priceDiscount.Replace("Bundpris ", "")</h3>
358 </div>
359 <div class="product-price no-discount" @(onDiscount ? "style='display: none;'" : "")>
360 <h3 class="product-price regular @isBP">@priceRegular.Replace("Bundpris ", "")</h3>
361 </div>
362 @* -- AUGUST2019 -- *@
363
364
365
366
367
368 @* -- /AUGUST2019 -- *@
369 if (onDiscount)
370 {
371 <meta itemprop="price" content="@customPrice.DiscountPrice.ToString().Replace(",", ".")" />
372 }
373 else
374 {
375 <meta itemprop="price" content="@customPrice.Price.ToString().Replace(",", ".")" />
376 }
377 }
378 }
379 </div>
380 <div class="text-right price-col">
381 @{
382 string colliText = "1 Stk.";
383 var colli = 1;
384 IEnumerable<Dynamicweb.Ecommerce.Variants.VariantOption> variants = Dynamicweb.Ecommerce.Variants.VariantOption.GetAllVariantOptions();
385 var variant = variants.Where(w => w.Id == GetString("Ecom:Product.DefaultUnitID"));
386 if (variant.Any())
387 {
388 colliText = variant.First().Name;
389 try
390 {
391 colli = Convert.ToInt32(colliText.Split(new char[] { ' ' })[0].Trim());
392
393 if (customPrice.StockQuantity > 0 && customPrice.StockQuantity < colli)
394 {
395 colli = customPrice.StockQuantity;
396 }
397 }
398 catch
399 {
400 colli = 1;
401 }
402 }
403
404 <p>Pakket i kolli af: @colliText</p>
405 <div class="product-addtocart input-group">
406 <script>
407 var coli = @colli;
408 var stockVal = @customPrice.StockQuantity;
409 function colliCheck(input)
410 {
411
412 if (input.value > stockVal && stockVal != 0) {
413 input.value = stockVal;
414 alert('Denne vare er kun på lager i ' + stockVal + ' antal!');
415 }
416
417 if (input.value % coli != 0) {
418 if (input.value < coli)
419 input.value = coli;
420 else
421 input.value = input.value - (input.value % coli);
422 alert('Colli brud. Denne vare sælges i colli a @colliText');
423 }
424 }
425 var collichange = function (gnyf, p, t) {
426 //console.log(stockVal);
427 var gnyf = gnyf;
428 var $inputField = $("input[data-input-id='" + gnyf + "']");
429 var colli = parseInt(p, 10);
430 var currVal = parseInt($inputField.attr("value"), 10);
431 var newVal = currVal;
432 if (t == "inc"){
433 newVal = currVal + colli;
434
435 }
436 if (t == "dec"){
437 newVal = currVal - colli;
438 }
439 if (newVal >= colli) {
440 $inputField.attr("value", newVal);
441
442 } else {
443 $inputField.attr("value", colli);
444 }
445 //colliCheck($inputField);
446
447 //colliCheckAngular(e, p.Colli, p.Colli + ' Stk.', p.StockQuantity);
448 }
449 </script>
450 @{
451 string inputCLS = GetString("Ecom:Product.ID");
452 }
453 <div class="quant-row">
454 <div>
455 <button class="dec button" title="Færre" onclick="collichange('@inputCLS', @colli, 'dec')">-</button>
456 <div>
457 <input id="QuantityOrderLineOL88" min="@colli" step="@colli" onblur="colliCheck(this)" name="quantity" value="@colli" type="number" data-input-id="@inputCLS" class="product-quantity form-control" style="padding: 4.5px 5px;width:64px;">
458 </div>
459 <button class="inc button" title="Flere" onclick="collichange('@inputCLS', @colli, 'inc')">+</button>
460 </div>
461 <!--@If Not(Global:Extranet.Groups<contains>'4198')-->
462 <BUTTON class="btn btn-primary put-in-cart-main" onclick="AddToCart($(this), '@GetValue("Ecom:Product.ID")', $(this).parent().parent().find('input').val())">
463 Læg i kurv <span><i class="fal fa-shopping-basket"></i></span>
464 </BUTTON>
465 <!--@EndIf-->
466 </div>
467 </div>
468 }
469 </div>
470 @{
471 string Energimaerkning = GetString("Ecom:Product:Field.Energimaerkning.Value");
472 string EnergimaerkningPdf = GetString("Ecom:Product:Field.EnergimaerkningPdf.Value");
473 string EnergimaerkningDataPdf = GetString("Ecom:Product:Field.EnergimaerkningDataPdf.Value");
474 if (Energimaerkning != null && Energimaerkning != "")
475 {
476 <div class="energy-label">
477 <button type="button" class="btn btn-energyLabel btn-energyLabel-action" data-pdf="@EnergimaerkningPdf" title="se energimærke rapport">
478 <img src="/Files/Images/Energimaerkninger/@Energimaerkning" style="margin:0;" />
479 </button>
480
481 @if (EnergimaerkningDataPdf != null && EnergimaerkningDataPdf != "")
482 {
483 <button type="button" class="btn btn-energyLabel btn-energyLabel-action" data-pdf="@EnergimaerkningDataPdf" title="se energi datablad">
484 Energi datablad
485 </button>
486 }
487 </div>
488 }
489 }
490 </div>
491 <!--@EndIf-->
492 </div>
493 </div>
494 <div class="row">
495
496
497
498 @{
499 string stockCols = "col-sm-6";
500 if (CurrentUser != null)
501 {
502 if (!CurrentUser.GroupsIds.Contains(3121) || CurrentUser.GroupsIds.Contains(107883))
503 {
504 <div class="col-sm-6">
505 <div class="product-favorites @disableShop">
506 @if (!GetBoolean("Ecom:Product.IsProductInFavoriteList"))
507 {
508 <button type="button" class="btn-favorite-action" data-id="@GetValue("Ecom:Product.ID")" data-listids="@customPrice.OnFavList" data-nr="@GetValue("Ecom:Product.Number")" data-img="@GetValue("Ecom:Product.ImageSmall.Default.Clean")" onclick='OpenFavouriteModal(this);' title="tilføj favoritter">
509 <i class="fal fa-heart" aria-hidden="true"></i> Tilføj til favoritter
510 </button>
511
512 @*<a href='@GetValue("Ecom:Product.AddToList")' class="btn btn-default">Tilføj til favoritter</a><br />*@
513 }
514 @if (GetBoolean("Ecom:Product.IsProductInFavoriteList"))
515 {
516 <button type="button" class="btn-favorite-action" data-id="@GetValue("Ecom:Product.ID")" data-listids="@customPrice.OnFavList" data-nr="@GetValue("Ecom:Product.Number")" data-img="@GetValue("Ecom:Product.ImageSmall.Default.Clean")" onclick='OpenFavouriteModal(this);' title="tilføj favoritter">
517 <i class="fas fa-heart" aria-hidden="true"></i> Favoritter
518 </button>
519 }
520 </div>
521 </div>
522 }
523 }
524 else
525 {
526 stockCols = "col-sm-12";
527 }
528 }
529
530 @if (customPrice.StockText.IndexOf("lager") != -1)
531 {
532 <div class="@stockCols stock-col">
533 <p id="productStock" class="product-stock">
534 <span class="fa-stack checkmark">
535 <i class="fas fa-circle fa-stack-1x"></i>
536 <i class="fal fa-check-circle fa-stack-1x"></i>
537 </span>
538 @(customPrice.StockText.IndexOf("lager") > -1 ? customPrice.StockText : customPrice.StockText)
539 </p>
540 </div>
541 }
542 </div>
543
544 @{
545 string susCols = "col-md-7";
546 string leaseCols = "col-md-5";
547 string susCls = "";
548 bool hasLease = customPrice.Price <= 25000 && customPrice.DiscountPrice <= 25000 ? false : true;
549
550 if (sustainabilityIcons.Count != 0)
551 {
552 if (!hasLease)
553 {
554 susCols = "col-md-12";
555 susCls = "no-lease";
556 }
557 leaseCols = "col-md-5 has-sus";
558 }
559 else
560 {
561 leaseCols = "col-md-12";
562 }
563 }
564
565 <!--Start Ring mig op-->
566 <div id="callMe" class="row sus-lease p-0">
567 <div class="col-md-12">
568 <div class="product-leasing">
569 <h3>
570 Hvad kan vi hjælpe med?
571 </h3>
572 <p style="margin-top:6px;">
573 Har du spørgsmål, som du ikke kan finde svar på her på siden, eller ønsker du et særligt tilbud på dette produkt, så klik på knappen og udfyld formularen, så kontakter vi dig hurtigst muligt.
574 </p>
575 <button type="button" class="btn btn-success btn-form-action" data-id="@GetValue("Ecom:Product.ID")" data-name="@GetValue("Ecom:Product.Name")" data-nr="@GetValue("Ecom:Product.Number")" data-img="@GetValue("Ecom:Product.ImageSmall.Default.Clean")" data-title="Ring mig op!" data-modalId="callMe" title="Ring mig op!">
576 <i class="fal fa-phone"></i> Ring mig op!
577 </button>
578 </div>
579 </div>
580 </div>
581 <!--Slut Ring mig op-->
582 <!--Start tibagekøb-->
583 <div id="buyBack" class="row sus-lease p-0" style="display:none;">
584 <div class="col-md-12">
585 <div class="product-leasing">
586 <h3>
587 Tilbagekøb ved køb af ny maskine
588 </h3>
589 <strong style="font-size:16px;">– få et tilbud på din gamle køkkenmaskine</strong>
590 <p style="margin-top:6px;">
591 Mange køkkenmaskiner kan få nyt liv. Vi tilbagekøber hvert
592 år mange maskiner af alle fabrikater, som vi renoverer og
593 sælger igen. Få derfor en vurdering af din gamle maskine.
594 Klik her og få et tilbud.
595 </p>
596 <button type="button" class="btn btn-primary btn-form-action" data-id="@GetValue("Ecom:Product.ID")" data-name="@GetValue("Ecom:Product.Name")" data-nr="@GetValue("Ecom:Product.Number")" data-img="@GetValue("Ecom:Product.ImageSmall.Default.Clean")" data-title="Tilbagekøb" data-modalId="buyBack" title="Tilbagekøb">
597 <i class="fal fa-sync"></i> Tilbagekøb
598 </button>
599 </div>
600 </div>
601 </div>
602 <!--Slut tilbagekøb-->
603 <!--Start byt til nyt-->
604 <div id="swapForNew" class="row sus-lease" style="display:none;">
605 <div class="col-md-12">
606 <div class="product-leasing">
607 <h3>
608 Byt til nyt – Få mindst 40% i rabat på dit nye stel
609 </h3>
610 <p style="margin-top:6px;">
611 Vi tilbyder dig mindst 40% i rabat på dit nye stel, hvis vi får
612 dit gamle retur (Bestående af minimum 180 blandede
613 enheder, en-til-en). Vi sørger for afhentningen. Så vil andre få glæde af
614 jeres brugte porcelæn eller vi giver det væk med henblik
615 på recirkulation. Vi kalder konceptet for BYT TIL NYT.
616 </p>
617 <button type="button" class="btn btn-primary btn-form-action" data-id="@GetValue("Ecom:Product.ID")" data-name="@GetValue("Ecom:Product.Name")" data-nr="@GetValue("Ecom:Product.Number")" data-img="@GetValue("Ecom:Product.ImageSmall.Default.Clean")" data-modalId="swapForNew" title="Byt til nyt – Få mindst 40% i rabat på dit nye stel">
618 <i class="fal fa-recycle"></i> Byt til nyt
619 </button>
620 </div>
621 </div>
622 </div>
623 <!--Slut byt til nyt-->
624 <!--Start leasing-->
625 @if (hasLease)
626 {
627 <div class="row sus-lease">
628 <div class="col-md-12">
629 <div class="product-leasing">
630 <h3>Få et leasingtilbud</h3>
631 <p style="margin-top:6px;">
632 Vi kontakter dig, så vi kan skræddersy tilbud til netop dine behov.
633 </p>
634 <button type="button" class="btn btn-primary btn-leasing-action" data-id="@GetValue("Ecom:Product.ID")" data-name="@GetValue("Ecom:Product.Name")" data-nr="@GetValue("Ecom:Product.Number")" data-img="@GetValue("Ecom:Product.ImageSmall.Default.Clean")" onclick='OpenLeasingModal(this);' title="Bestil leasing tilbud">
635 <i class="fal fa-check"></i> BESTIL TILBUD
636 </button>
637
638 </div>
639 </div>
640 </div>
641 }
642
643 @if (sustainabilityIcons.Count != 0)
644 {
645 <script>
646 var simulateClick = function () {
647 var elem = document.getElementById("menu-tab-sustainability");
648 // Create our event (with options)
649 var evt = new MouseEvent('click', {
650 bubbles: true,
651 cancelable: true,
652 view: window
653 });
654 // If cancelled, don't dispatch our event
655 var canceled = !elem.dispatchEvent(evt);
656 };
657 </script>
658
659 <div class="sustainability-icons @susCols">
660 <br />
661 <span>Hensyn</span>
662 <div class="@susCls">
663 @foreach (var imgSrc in sustainabilityIcons)
664 {
665 <a href="#" onclick="simulateClick()" data-toggle="tab"><img src="@imgSrc" /></a>
666 }
667 </div>
668 </div>
669 }
670
671 <!--Slut leasing-->
672 <div class="row">
673 <div class="col-lg-12">
674 <ul class="nav nav-tabs" id="product-tabs">
675
676 <li class="@activeUsed">
677 <a href="#tab-specs" class="btn btn-sm btn-inverse" id="menu-tab-specs" data-toggle="tab">Specifikationer</a>
678 </li>
679 @{
680 activeUsed = "";
681 }
682 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkUserManual.Value")))
683 {
684 <li class="@activeUsed">
685 <a href="#tab-usermanuals" class="btn btn-sm btn-inverse" id="menu-tab-usermanuals" data-toggle="tab">Brugervejledninger</a>
686 </li>
687 activeUsed = "";
688 }
689 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkBrochures.Value")))
690 {
691 <li class="activeUsed">
692 <a href="#tab-papers" class="btn btn-sm btn-inverse" id="menu-tab-papers" data-toggle="tab">Brochurer</a>
693 </li>
694 activeUsed = "";
695 }
696 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkProductSheet.Value")))
697 {
698 <li class="@activeUsed">
699 <a href="#tab-productsheet" class="btn btn-sm btn-inverse" id="menu-tab-productsheet" data-toggle="tab">Produktark</a>
700 </li>
701 activeUsed = "";
702 }
703 @*
704 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkFilm.Value")))
705 {
706 <li class="@activeUsed">
707 <a href="#tab-demos" class="btn btn-sm btn-inverse" id="menu-tab-demos" data-toggle="tab">Demofilm</a>
708 </li>
709 activeUsed = "";
710 }
711 *@
712 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkSustainability.Value")))
713 {
714 <li class="@activeUsed">
715 <a href="#tab-sustainability" class="btn btn-sm btn-inverse" id="menu-tab-sustainability" data-toggle="tab">Hensyn</a>
716 </li>
717 activeUsed = "";
718 }
719 </ul>
720 <br />
721 @{activeUsed = "active";}
722 @{var counter = 0;}
723 <div class="tab-content">
724 @{
725 <div class="tab-pane @activeUsed" id="tab-specs">
726
727 @{
728 string productDescription = GetString("Ecom:Product.LongDescription").Replace("<br />", "<br/>").Replace("<br/> <br/> <br/>", "");
729
730 string hasTech = "";
731 bool descEmpty = false;
732 productDescription = productDescription.Replace("Tekniske data: Tekniske data:", "Tekniske data:");
733 productDescription = productDescription.Replace("Tekniske data: Tekniske data", "Tekniske data:");
734 productDescription = productDescription.Replace("Tekniske data: Teknisk data:", "Tekniske data:");
735 if (productDescription.Contains("Tekniske data") || productDescription.Contains("Teknisk data"))
736 {
737 string tech = "";
738 string desc = "";
739
740 if (productDescription.StartsWith("<p>"))
741 {
742 productDescription = productDescription.Remove(0, 3);
743 productDescription = productDescription.Remove(productDescription.LastIndexOf("</p>"), 4);
744 }
745
746 string toBeSearched = "Tekniske data";
747 int ix = productDescription.IndexOf(toBeSearched);
748
749
750 if (ix != -1)
751 {
752 tech = productDescription.Substring(ix + toBeSearched.Length);
753
754 if (tech.StartsWith(": <br/>"))
755 {
756 tech = tech.Remove(0, 7);
757 }
758
759 if (tech.StartsWith(" <br/>"))
760 {
761 tech = tech.Remove(0, 6);
762
763 }
764
765 if (tech.StartsWith("<br/>"))
766 {
767 tech = tech.Remove(0, 5);
768 }
769
770 if (ix - toBeSearched.Length + 4 >= 0)
771 {
772 //desc = productDescription.Substring(0, ix - toBeSearched.Length + 4);
773 desc = productDescription.Substring(0, ix);
774 if (string.IsNullOrWhiteSpace(desc))
775 {
776 desc = "";
777 descEmpty = true;
778 }
779 }
780 else
781 {
782 if (string.IsNullOrWhiteSpace(desc))
783 {
784 desc = "";
785 descEmpty = true;
786 }
787 }
788
789 if (desc.StartsWith(" <br/>"))
790 {
791 desc = desc.Remove(0, 6);
792 }
793
794 if (desc.StartsWith("<br/>"))
795 {
796 desc = desc.Remove(0, 5);
797 }
798 // do something here
799 }
800
801 toBeSearched = "Teknisk data";
802 ix = productDescription.IndexOf(toBeSearched);
803
804 if (ix != -1)
805 {
806 tech = productDescription.Substring(ix + toBeSearched.Length);
807 if (tech.StartsWith(": <br/>"))
808 {
809 tech = tech.Remove(0, 7);
810 }
811
812 if (tech.StartsWith(" <br/>"))
813 {
814 tech = tech.Remove(0, 6);
815 }
816
817 if (tech.StartsWith("<br/>"))
818 {
819 tech = tech.Remove(0, 5);
820 }
821
822 if (ix - toBeSearched.Length + 4 >= 0)
823 {
824 desc = productDescription.Substring(0, ix - toBeSearched.Length + 4);
825 if (string.IsNullOrWhiteSpace(desc))
826 {
827 desc = "";
828 descEmpty = true;
829 }
830 }
831 else
832 {
833 if (string.IsNullOrWhiteSpace(desc))
834 {
835 desc = "";
836 descEmpty = true;
837 }
838 }
839
840 if (desc.StartsWith(" <br/>"))
841 {
842 desc = desc.Remove(0, 6);
843 }
844
845 if (desc.StartsWith("<br/>"))
846 {
847 desc = desc.Remove(0, 5);
848 }
849 // do something here
850 }
851
852
853 if (!String.IsNullOrEmpty(GetString("Ecom:Product:Field.Links.Value")))
854 {
855 var iLink = 0;
856 foreach (String link in GetString("Ecom:Product:Field.Links.Value").Split(','))
857 {
858 if (!String.IsNullOrEmpty(link))
859 {
860 if(iLink == 0)
861 {
862 tech += "<br /><br />";
863 }
864 tech += "<a href=\"" + link + "\">" + link.Replace("http://", "").Replace("https://","").Replace("www.", "").Replace("kenstorkoekken.dk/", "").Replace("kensk.dk/", "").Normalize() + "</a><br />";
865 iLink++;
866 }
867 }
868 }
869
870 productDescription = "<div class=\"tech\"><p><span>Tekniske data:</span>" + tech + "</p></div>";
871 if (!descEmpty)
872 {
873 productDescription = productDescription + "<div class=\"desc\"><p><span>Beskrivelse:</span>" + desc + "</p></div>";
874 }
875
876 hasTech = "has-tech";
877 }
878 else
879 {
880 if (productDescription.StartsWith(" <br/>"))
881 {
882 productDescription = productDescription.Remove(0, 6);
883 }
884 productDescription = "<div class=\"desc\"><p><span>Beskrivelse:</span>" + productDescription + "</p></div>";
885 }
886 }
887 <div itemprop="description" class="product-description @hasTech">
888 @productDescription
889 </div>
890 </div>
891 activeUsed = "";
892 }
893 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkUserManual.Value")))
894 {
895 <div class="tab-pane @activeUsed" id="tab-usermanuals">
896 <div class="list-group product-list-group">
897 @foreach (String manual in @GetString("Ecom:Product:Field.LinkUserManual.Value").Split(','))
898 {
899 if (!String.IsNullOrEmpty(manual))
900 {
901 var manualName = manual;
902 if (manual.LastIndexOf(@"/") > -1)
903 {
904 manualName = manual.Substring(manual.LastIndexOf(@"/"), manual.Length - manual.LastIndexOf(@"/"));
905 }
906 counter++;
907 <div class="list-group-item row">
908 <div class="col-xs-9" style="padding-right: 0">
909 <input class="form-control input-sm" disabled style="background:white;" value="@manualName" />
910 </div>
911 <div class="col-xs-3" style="padding-left: 0;">
912 <a href="@manual" target="_blank" class="btn btn-sm btn-primary" style="width:100%;">Download <span class="glyphicon glyphicon-download-alt"></span></a>
913 </div>
914 </div>
915 }
916 }
917 <script>
918 $('#menu-tab-usermanuals').text('Brugervejledninger');
919 </script>
920
921 </div>
922 </div>
923 activeUsed = "";
924 }
925 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkBrochures.Value")))
926 {
927 <div class="tab-pane @activeUsed" id="tab-papers">
928 <div class="list-group product-list-group">
929 @{
930 counter = (int)0;
931 }
932 @foreach (String brochurer in @GetString("Ecom:Product:Field.LinkBrochures.Value").Split(','))
933 {
934 if (!String.IsNullOrEmpty(brochurer))
935 {
936 var brochurerName = brochurer;
937 if (brochurer.LastIndexOf(@"/") > -1)
938 {
939 brochurerName = brochurer.Substring(brochurer.LastIndexOf(@"/"), brochurer.Length - brochurer.LastIndexOf(@"/"));
940 }
941
942 counter++;
943 <div class="list-group-item row">
944 <div class="col-xs-9" style="padding-right: 0">
945 <input class="form-control input-sm" disabled style="background:white;" value="@brochurerName" />
946 </div>
947 <div class="col-xs-3" style="padding-left: 0;">
948 <a href="@brochurer" target="_blank" class="btn btn-sm btn-primary" style="width:100%;">Download <span class="glyphicon glyphicon-download-alt"></span></a>
949 </div>
950 </div>
951 }
952 }
953 <script>
954 $('#menu-tab-papers').text('Brochurer');
955 </script>
956
957 </div>
958 </div>
959 activeUsed = "";
960 }
961 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkProductSheet.Value")))
962 {
963 <div class="tab-pane @activeUsed" id="tab-productsheet">
964 <div class="list-group product-list-group">
965 @{counter = 0;}
966 @foreach (String sheet in @GetString("Ecom:Product:Field.LinkProductSheet.Value").Split(','))
967 {
968 if (!String.IsNullOrEmpty(sheet))
969 {
970 var sheetName = sheet;
971 if (sheet.LastIndexOf(@"/") > -1)
972 {
973 sheetName = sheet.Substring(sheet.LastIndexOf(@"/"), sheet.Length - sheet.LastIndexOf(@"/"));
974 }
975
976 counter++;
977 <div class="list-group-item row">
978 <div class="col-xs-9" style="padding-right: 0">
979 <input class="form-control input-sm" disabled style="background:white;" value="@sheetName" />
980 </div>
981 <div class="col-xs-3" style="padding-left: 0;">
982 <a href="@sheet" target="_blank" class="btn btn-sm btn-primary" style="width:100%;">Download <span class="glyphicon glyphicon-download-alt"></span></a>
983 </div>
984 </div>
985 }
986 }
987 <script>
988 $('#menu-tab-productsheet').text('Produktark');
989 </script>
990 </div>
991 </div>
992 activeUsed = "";
993 }
994 @*
995 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkFilm.Value")))
996 {
997 <div class="tab-pane @activeUsed" id="tab-demos">
998 <div class="list-group product-list-group">
999 @{counter = 0;}
1000 @foreach (String demo in @GetString("Ecom:Product:Field.LinkFilm.Value").Split(','))
1001 {
1002 if (!String.IsNullOrEmpty(demo))
1003 {
1004 var demoName = demo;
1005 var demoURL = demo;
1006 string youtubeID = "";
1007 if (demo.LastIndexOf(@"/") > -1)
1008 {
1009 demoName = demo.Substring(demo.LastIndexOf(@"/"), demo.Length - demo.LastIndexOf(@"/"));
1010 }
1011 if (demoURL.Contains(".yout"))
1012 {
1013 string result = demoURL;
1014 if (demoURL.Contains("&")){
1015 result = demoURL.Substring(0, demoURL.IndexOf("&"));
1016 }
1017 string result2 = result.Split('=')[1];
1018 youtubeID = result2;
1019 }
1020
1021 counter++;
1022 <div class="list-group-item row">
1023 <div class="col-xs-9" style="padding-right: 0">
1024 @youtubeID
1025 <input class="form-control input-sm" disabled style="background:white;" value="@demoName" />
1026 </div>
1027 <div class="col-xs-3" style="padding-left: 0;">
1028 <a href="@demo" target="_blank" class="btn btn-sm btn-primary" style="width:100%;">Download <span class="glyphicon glyphicon-download-alt"></span></a>
1029 </div>
1030 </div>
1031 }
1032 }
1033 <script>
1034 $('#menu-tab-demos').text('Demofilm');
1035 </script>
1036 </div>
1037 </div>
1038 activeUsed = "";
1039 }
1040 *@
1041 @if (!String.IsNullOrEmpty(@GetString("Ecom:Product:Field.LinkSustainability.Value")))
1042 {
1043 <div class="tab-pane @activeUsed" id="tab-sustainability">
1044 <div class="list-group product-list-group">
1045 @{counter = 0;}
1046 @foreach (String sustainabilityFile in @GetString("Ecom:Product:Field.LinkSustainability.Value").Split(','))
1047 {
1048 if (!String.IsNullOrEmpty(sustainabilityFile))
1049 {
1050 var sustainabilityFileName = sustainabilityFile;
1051 if (sustainabilityFile.LastIndexOf(@"/") > -1)
1052 {
1053 sustainabilityFileName = sustainabilityFile.Substring(sustainabilityFile.LastIndexOf(@"/"), sustainabilityFile.Length - sustainabilityFile.LastIndexOf(@"/"));
1054 }
1055
1056 counter++;
1057 <div class="list-group-item row">
1058 <div class="col-xs-9" style="padding-right: 0">
1059 <input class="form-control input-sm" disabled style="background:white;" value="@sustainabilityFileName" />
1060 </div>
1061 <div class="col-xs-3" style="padding-left: 0;">
1062 <a href="https://doc.kenstorkoekken.dk/@sustainabilityFile" target="_blank" class="btn btn-sm btn-primary" style="width:100%;">Download <span class="glyphicon glyphicon-download-alt"></span></a>
1063 </div>
1064 </div>
1065 }
1066 }
1067 <script>
1068 $('#menu-tab-sustainability').text('Hensyn');
1069 </script>
1070 </div>
1071 </div>
1072 activeUsed = "";
1073 }
1074 </div>
1075
1076 </div>
1077 </div>
1078
1079 <div class="clearfix"></div>
1080 </div>
1081 </div>
1082 <div class="clearfix"></div>
1083 </div>
1084 <div class="clearfix"></div>
1085 </section>
1086
1087 @{
1088 var relatedCount = 0;
1089 if (GetInteger("Ecom:Product.RelatedCount") > 0)
1090 {
1091 <div id="relatedIDs" style="display: none;">
1092 @foreach (LoopItem g in GetLoop("ProductRelatedGroups"))
1093 {
1094 foreach (LoopItem i in g.GetLoop("RelatedProducts"))
1095 {
1096 relatedCount++;
1097 <div class="productId">@i.GetValue("Ecom:Product.ID")#</div>
1098 }
1099 }
1100 </div>
1101 }
1102 }
1103 @if (relatedCount > 0)
1104 {
1105 <h3 class="related-header">Tilbehør og relaterede varer</h3>
1106 <div class="hidden" id="ProductTemplate">
1107 <div class="row">
1108 <div class="product-list-item-wrapper mode-tiles" style="margin: 0 15px;">
1109 <button type="button" class="btn btn-favorite btn-favorite-action @disableShop" onclick="OpenFavouriteModal(this);" title="Tilføj favoritter">
1110 <i class=""></i>
1111 </button>
1112 <div class="thumbnail product">
1113 <a style="display: block; width: 100%" class="product-link">
1114 <div class="tags">
1115 <div class="tag discount-type"></div>
1116 @*<div class="tag blue splash"></div>*@
1117 </div>
1118 <div class="img-container"></div>
1119 <div class="img-thumbnail no-img hidden" style="">Intet billede</div>
1120 <div class="caption">
1121 <h4 class="product-name"></h4>
1122 <p class="product-number"></p>
1123 </div>
1124 <div class="product-buy-row">
1125 <div class="product-price-container">
1126 <div class="product-price has-discount hidden">
1127 <span class="product-price regular" style="font-size: 12px; text-decoration: line-through"></span>
1128 <span class="product-price discount"></span>
1129 </div>
1130 <div class="product-price no-discount hidden">
1131 <span class="product-price" style="font-size: 12px;"> </span>
1132 <span class="product-price regular"></span>
1133 </div>
1134 </div>
1135 <!--@If Not(Global:Extranet.Groups<contains>'4198')-->
1136 <div class="quant-row">
1137 <button class="dec button" title="Færre">-</button>
1138 <div>
1139 <input id="Quantity" name="quantity" value="" class="product-quantity quantity" />
1140 </div>
1141 <button class="inc button" title="Flere">+</button>
1142 <button class="put-in-cart" title="Køb" type="button" data-toggle="modal">
1143 <i class="fal fa-shopping-basket"></i>
1144 </button>
1145 </div>
1146 <!--@EndIf-->
1147 </div>
1148 </a>
1149 <div class="energyLabelRow">
1150 <button type="button" onclick="return false;" class="btn btn-energyLabel btn-energyLabel-action" title="se energimærke rapport"></button>
1151 <button type="button" onclick="return false;" class="btn btn-energyLabel btn-energyLabel-action" title="se energi datablad">
1152 Energi datablad
1153 </button>
1154 </div>
1155
1156 <p class="product-stock"></p>
1157 <div class="hover-info">
1158 <h6></h6>
1159 <div class="json-load"></div>
1160 <a href="Default.aspx?ID=3&ProductID=" style="cursor: pointer; cursor: hand;">
1161 Vis produkt
1162 </a>
1163 </div>
1164 </div>
1165 </div>
1166 </div>
1167 </div>
1168 <div class="row">
1169 <div id="ProdSlider"></div>
1170 </div>
1171 <div class="row hidden">
1172 <div class="slider-controls col-xs-12" style="top: -250px;">
1173 <a class="slider-control left img-circle" href="#productCarousel" data-slide="prev">‹</a>
1174 <a class="slider-control right img-circle" href="#productCarousel" data-slide="next">›</a>
1175 </div>
1176 </div>
1177 }
1178 <script type="text/javascript">
1179 require(
1180 ['jquery', 'layout', 'dw-carousel', 'json', 'slick'],
1181 function ($) {
1182 function ListPrices(result) {
1183 var onDiscount = result.d.OnDiscount;
1184 template = $('#ProductInfo');
1185 if (onDiscount == true) {
1186 $(template).find('.discount-indicator').show();
1187 $(template).find('.discount-indicator').text(result.d.DiscountType);
1188 $(template).find('.discount-indicator').css('background', "url('/files/images/shop/Discounts/" + result.d.DiscountColor + "') no-repeat 0 0");
1189 if (result.d.DiscountType.indexOf('Rabat') > -1) {
1190 $(template).find('.discount-indicator').css('line-height', "15px");
1191 $(template).find('.discount-indicator').css('padding', "32px 10px 0 10px");
1192 }
1193 if (result.d.DiscountType.indexOf('Bundpris') > -1) {
1194 $(template).find('.no-discount').show();
1195 $(template).find('.no-discount .regular').html(result.d.DiscountPriceString);
1196 }
1197 else {
1198 $(template).find('.has-discount .discount').html(result.d.DiscountPriceString);
1199 $(template).find('.has-discount .regular').html(result.d.PriceString);
1200 $(template).find('.has-discount').show();
1201 }
1202 } else {
1203 $(template).find('.no-discount').show();
1204 $(template).find('.no-discount .regular').html(result.d.PriceString);
1205 }
1206
1207 var stockText = result.d.StockText;
1208 if (stockText.indexOf('lager') > -1) {
1209 stockText = stockText + '<br />Der tages forbehold for mellemsalg.'
1210 }
1211 $('#productStock').text(stockText);
1212
1213 }
1214 function ListProducts(result) {
1215 //Vars
1216 var template;
1217 //Generate products
1218 var count = 0;
1219 //var itemContainer = "";
1220 //Calc number of products fits
1221 //var prodCount = parseInt(parseInt($('#ProductSlider').width()) / 292);
1222
1223 //Generate products
1224 $.each(result, function () {
1225 //Find template for specific listmode
1226 template = $('#ProductTemplate').find('.product-list-item-wrapper').clone();
1227 //Append values
1228 $(template).attr("id", this.Id);
1229 $(template).find('.thumbnail.product').attr("data-id", this.Id);
1230 $(template).find('.product-name').text(this.InfoText);
1231 $(template).find('.hover-info h6').text(this.Name);
1232
1233 //$(template).find('.product-description').text(this.InfoText);
1234 $(template).find('.product-number').text('Varenr.: ' + this.ProductNumber);
1235
1236 if (this.StockText.toLowerCase().indexOf('lager') != -1) {
1237 $(template).find('.product-stock').addClass("instock");
1238 $(template).find('.product-stock').html("<span class=\"fa-stack\"><i class=\"fas fa-circle fa-stack-1x\"></i><i class=\"fal fa-check-circle fa-stack-1x\"></i></span>" + this.StockText);
1239 } else {
1240 $(template).find('.product-stock').text(this.StockText);
1241 }
1242 if (this.DiscountType.indexOf('Bundpris') > -1) {
1243 $(template).find('.product-price.regular,.product-price.discount').addClass("bundpris");
1244 $(template).find('.product-price.regular').html(this.Price.replace("Bundpris ", ""));
1245 $(template).find('.product-price.discount').html(this.PriceDiscount.replace("Bundpris ", ""));
1246 } else {
1247 $(template).find('.product-price.regular').html(this.Price);
1248 $(template).find('.product-price.discount').html(this.PriceDiscount);
1249 }
1250 $(template).find('.dec.button').attr("onclick", "collichange('" + this.Id + "'," + this.Colli + ", 'dec')");
1251 $(template).find('.inc.button').attr("onclick", "collichange('" + this.Id + "'," + this.Colli + ", 'inc')");
1252
1253 $(template).find('.product-link').data('href', 'Default.aspx?ID=3&ProductID=' + this.Id);
1254 $(template).find('.hover-info a').attr('href', $(template).find('.hover-info a').attr('href') + this.Id);
1255 $(template).find('.img-container').attr("style", "background-image: url('/files/Images/Shop/Products/Small/" + this.ImgSrc + "');");
1256 $(template).find('.product-quantity').val(this.Colli);
1257 $(template).find('.product-quantity').attr('data-steps', this.Colli);
1258 $(template).find('.product-quantity').attr('data-input-id', this.Id);
1259
1260 $(template).find('.put-in-cart').attr("onclick", "AddToCart($(this),'" + this.Id + "', $(this).parent().find('input').val())");
1261 //Hide or show discount
1262 if (this.PriceDiscount == null || this.Price == this.PriceDiscount) {
1263 $(template).find('.no-discount').removeClass('hidden');
1264 //console.log(this.Price + " < " + this.PriceDiscount)
1265 } else {
1266 $(template).find('.has-discount').removeClass('hidden');
1267 //console.log(this.Price + " > " + this.PriceDiscount)
1268 }
1269 //Discount indicator
1270 if (this.DiscountType.indexOf('Bundpris') > -1 || this.DiscountType.indexOf('Nyhed') > -1 || this.DiscountType.indexOf('Rabat') > -1 || this.DiscountType.indexOf('Tilbud') > -1) {
1271 $(template).find('.discount-type').html(this.DiscountType);
1272 $(template).find('.discount-type').addClass(this.DiscountColor.replace(".png", ""));
1273 if (this.DiscountType.indexOf('Bundpris') > -1) {
1274 $(template).find('.product-price.regular,.product-price.discount').addClass("bundpris");
1275 }
1276 } else {
1277 $(template).find(".discount-type").remove();
1278 }
1279 if (this.SplashText.indexOf('Gennemgået') != -1 || this.SplashText.indexOf('Gennem-gået') != -1 || this.SplashText.indexOf('Demo') != -1 || this.SplashText.indexOf('Renoveret') != -1 || this.SplashText.indexOf('Midlertidig udsolgt') != -1 && this.SplashOn) {
1280 var SplashText = "";
1281 if (this.SplashText == 'Gennemgået' || this.SplashText == 'Gennem-gået') {
1282 SplashText = "<div class=\"splash-line\"><span>Gennemgået: Min. 3 mdr. garanti</span></div>";
1283 }
1284 if (this.SplashText == 'Demo') {
1285 SplashText = "<div class=\"splash-line\"><span>Demo: Min. 12 mdr. garanti</span></div>";
1286 }
1287 if (this.SplashText == 'Renoveret') {
1288 SplashText = "<div class=\"splash-line\"><span>Renoveret: Min. 6 mdr. garanti</span></div>";
1289 }
1290 if (this.SplashText == 'Midlertidig udsolgt') {
1291 SplashText = "<div class=\"splash-line\"><span>Kontakt kundeservice 86248400</span></div>";
1292 }
1293
1294 $(template).find(".img-container").html(SplashText);
1295
1296 } else {
1297 $(template).find(".splash").remove();
1298 }
1299
1300 if (this.Energimaerkning != null && this.Energimaerkning != '' && this.Energimaerkning != ' ') {
1301 $(template).find(".energyLabelRow").remove();
1302 energyLabelRow
1303 $(template).find(".energyLabelRow").find("button").first().data("pdf", "/Admin/Public/getimage.ashx?Image=/Files/Files/Documents/Energimaerkninger/" + this.EnergimaerkningPdf + "&width=600");
1304 //$(template).find(".energyLabelRow").find("button").first().html("<img src=\"/Files/Images/Energimaerkninger/" + this.Energimaerkning + "\" />");
1305 $(template).find(".energyLabelRow").find("button").last().data("pdf", "/Admin/Public/getimage.ashx?Image=/Files/Files/Documents/Energimaerkninger/" + this.EnergimaerkningDataPdf + "&width=600");
1306 } else {
1307 $(template).find(".energyLabelRow").remove();
1308 }
1309
1310 var favoriteOrNot = this.OnFavList != '' ? 'fas fa-heart' : 'fal fa-heart';
1311 $(template).find(".btn-favorite-action i").addClass(favoriteOrNot);
1312 $(template).find(".btn-favorite-action").data("listids", this.OnFavList);
1313 $(template).find(".btn-favorite-action").data("id", this.Id);
1314 $(template).find(".btn-favorite-action").data("nr", this.ProductNumber);
1315 $(template).find(".btn-favorite-action").data("img", "/files/Images/Shop/Products/Small/" + this.ImgSrc);
1316
1317 //Add item to markup
1318 $('#ProdSlider').append(template);
1319
1320 //itemContainer += $(template)[0].outerHTML;
1321 //if (count == prodCount - 1 || result.d.list.length == 1) {
1322 // var item = $('<div>');
1323 // $(item).append(itemContainer);
1324 // $('#carouselContent').append(item);
1325 // itemContainer = "";
1326 // count = 0;
1327 //}
1328 //else
1329 // count++
1330 });
1331 $('#ProdSlider').slick({
1332 dots: false,
1333 infinite: true,
1334 speed: 300,
1335 slidesToShow: 4,
1336 slidesToScroll: 4,
1337 responsive: [
1338 {
1339 breakpoint: 992,
1340 settings: {
1341 slidesToShow: 3,
1342 slidesToScroll: 3
1343 }
1344 },
1345 {
1346 breakpoint: 768,
1347 settings: {
1348 slidesToShow: 2,
1349 slidesToScroll: 2
1350 }
1351 },
1352 {
1353 breakpoint: 480,
1354 settings: {
1355 slidesToShow: 1,
1356 slidesToScroll: 1
1357 }
1358 }
1359 // You can unslick at a given breakpoint now by adding:
1360 // settings: "unslick"
1361 // instead of a settings object
1362 ]
1363 });
1364 $(".product-link").on("click", function () {
1365 var destination = $(this).data("href");
1366 window.location.href = destination;
1367 }).find("button").on('click', function (event) {
1368 event.stopPropagation();
1369 //you can also use `return false;` which is the same as `event.preventDefault()` and `event.stopPropagation()` all in one (in a jQuery event handler)
1370 });
1371
1372 /*
1373 var waitForFinalEvent = (function () {
1374 var timers = {};
1375 return function (callback, ms, uniqueId) {
1376 if (!uniqueId) {
1377 uniqueId = "Don't call this twice without a uniqueId";
1378 }
1379 if (timers[uniqueId]) {
1380 clearTimeout(timers[uniqueId]);
1381 }
1382 timers[uniqueId] = setTimeout(callback, ms);
1383 };
1384 })();
1385
1386 $("#ListProducts").on("hover",".thumbnail.product", function(e) {
1387 console.
1388 log("test");
1389 var prodId = e.currentTarget.dataset.id;
1390
1391 if (e.type == "mouseenter"){
1392 waitForFinalEvent(function () {
1393 if(! $("#" + prodId).find(".tech").length ){
1394 $.getJSON( "https://kensweb-staging.azurewebsites.net/Default.aspx?ID=5078&ProductID=" + prodId, function( data ) {
1395 $.each( data, function( key, val ) {
1396 result = data.text;
1397 $("#" + prodId + " .json-load").append(result);
1398 $("#" + prodId + " .hover-info").addClass("active");
1399 });
1400 });
1401 } else {
1402 $("#" + prodId + " .hover-info").addClass("active");
1403 }
1404 }, 150, prodId);
1405 } else {
1406 waitForFinalEvent(function () {
1407 $("#" + prodId + " .hover-info").removeClass("active");
1408 }, 1, prodId);
1409
1410 }
1411 });
1412 */
1413
1414 //window.prodSwipe = Swipe(document.getElementById('ProductSlider'));
1415
1416 //$('.slider-control').on('click', function () {
1417 // if ($(this).data('slide') == 'prev')
1418 // window.prodSwipe.prev();
1419 // else
1420 // window.prodSwipe.next();
1421 //});
1422
1423 //$('.products-carousel, .fetureCarousel').live('mouseover', function () {
1424 // $(this).parent().find('.carousel-control').show();
1425 //});
1426 //$('.products-carousel, .fetureCarousel').live('mouseout', function () {
1427 // $(this).find('.carousel-control').hide();
1428 //});
1429 //$('#productCarousel').dwThumbnailsCarousel({
1430 // enlargeHolder: null
1431 //});
1432
1433 //var carouselMapFiller = function ($target, $holder, data) {
1434 // var spanNum = Math.floor(12 / data.length);
1435 // $.each(data, function (i, item) {
1436 // $holder.append($('<div class="span' + spanNum + ' map-item" />').html(item.title));
1437 // });
1438 // $('.map-item', $holder).on('click', function (e) {
1439 // $target.carousel($(this).index());
1440 // });
1441 //}
1442
1443 //$('.carousel[data-carousel-map]').each(function (i, el) {
1444 // var $this = $(this),
1445 // $el = $(el),
1446 // $slides = $el.find('.item'),
1447 // containerMap = $el.data().carouselMap,
1448 // $carouselMap = $(containerMap),
1449 // mapData = [];
1450
1451 // $slides.each(function (i, el) {
1452 // mapData.push({
1453 // title: $.trim($(el).find('.buttonName').html())
1454 // });
1455 // });
1456
1457 // carouselMapFiller($this, $carouselMap, mapData);
1458 // $this.on('slid', function (e) {
1459 // var slideIndex = $('.item.active', this).index(),
1460 // $mapItems = $('.map-item', $carouselMap);
1461
1462 // $mapItems.removeClass('active');
1463 // $mapItems.eq(slideIndex).addClass('active');
1464 // });
1465 //});
1466 }
1467
1468 function getRelatedProducts() {
1469 var pID = '';
1470 $('#relatedIDs').each(function (index, template) {
1471 pID += $(template).find('.productId').text();
1472 });
1473
1474 if (pID != '') {
1475 var q = pID;
1476 //Get products
1477 $.ajax({
1478 type: "POST",
1479 url: "Services/AjaxRequests.asmx/SearchProductListDynamic",
1480 contentType: "application/json; charset=utf-8",
1481 dataType: "json",
1482 data: JSON.stringify({
1483 SearchString: q,
1484 SearchDocType: 'GetProducts',
1485 SearchInGroupId: '',
1486 RowsPerPage: 999,
1487 PageNumber: 1,
1488 GroupFilter: null
1489 }),
1490 error: function (msg) {
1491 console.log(JSON.stringify(msg.d))
1492 },
1493 success: function (response) {
1494 ListProducts(response.d[0].products);
1495 },
1496 complete: function (msg) {
1497 }
1498 });
1499 }
1500 }
1501
1502 $(document).ready(function () {
1503
1504 groupUrl = $('#groupURL').attr("data-href");
1505 if (groupUrl.indexOf("/maskiner/") > -1) {
1506 var buyBack = @(customPrice.Price <= 25000 && customPrice.DiscountPrice <= 25000 ? "false" : "true");
1507 if (buyBack)
1508 $('#buyBack').show();
1509 }
1510 if (groupUrl.indexOf("/stel/") > -1) {
1511 $('#swapForNew').show();
1512 }
1513
1514
1515 //Hide back button if no history
1516 if (document.referrer == "") {
1517 $('#back-button').hide();
1518 }
1519
1520 //Gets related products. :-)
1521 getRelatedProducts();
1522
1523 // Changing the main image source attribute
1524 /*
1525 var imageZoomed = '.product-image-zoomed';
1526 $('.product-image-subthumbs p').on('click', function (e) {
1527 var data = $(this).data(), $imageZoomedImg = $(imageZoomed + ' img');
1528 $imageZoomedImg.attr('src', data.thumbImage);
1529 e.stopPropagation();
1530 });
1531 */
1532
1533 // Image sizes pattern stored as JSON obnject
1534 // in data attribute on 'img' tag
1535 // Example: {'w480':[200,100],'w768':[575]}
1536 $('img[data-src]').each(function (index, el) {
1537 var $el = $(el),
1538 src = $el.data('src'),
1539 srcParsed = $.parseParams(src.split('?')[1] || ''),
1540 // srcPath = src.split('?')[0],
1541 srcPath,
1542 sizes = JSON.parse($el.data('sizes').replace(/'/g, '"')),
1543 windowWidth = Layout.params.windowWidth;
1544
1545 var diff = windowWidth,
1546 nearest, _diff;
1547
1548 if (src.indexOf('?') != -1) {
1549 srcPath = srcPath = src.split('?')[0];
1550 } else {
1551 srcPath = Layout.params.getImagePath;
1552 srcParsed['Image'] = src;
1553 }
1554 for (var key in sizes) {
1555 _diff = Math.abs(windowWidth - key.substr(1));
1556 if (diff > _diff) {
1557 diff = _diff;
1558 nearest = key;
1559 }
1560 }
1561 if (typeof sizes[nearest] === 'string') {
1562 $el.attr('src', src);
1563 return;
1564 }
1565 if (sizes[nearest][0]) {
1566 srcParsed['Width'] = sizes[nearest][0];
1567 }
1568 if (sizes[nearest][1]) {
1569 srcParsed['Height'] = sizes[nearest][1];
1570 }
1571 $el.attr('src', srcPath + '?' + decodeURIComponent($.param(srcParsed, true)));
1572 });
1573
1574 ///Mærkelig return ??????
1575 return;
1576 // Changing active tab after clicking on
1577 // comments link from details tab
1578 $('.product-comments a[data-toggle="tab"]').on('click', function (e) {
1579 var $navtabs = $('.nav-tabs'),
1580 $tabHeader = $navtabs.find('a[href*="#tab-reviews"]');
1581
1582 $navtabs.find('.active').removeClass('active');
1583 $tabHeader.parent().addClass('active');
1584 });
1585 // Attach zoom plugin if not mobile device
1586 var imageZoomed = '.product-image-zoomed';
1587 if (!Layout.isMobile.any()) {
1588 $(imageZoomed).zoom({
1589 url: $(imageZoomed + ' img').data().fullImage
1590 });
1591 /*
1592 $('.product-image-subthumbs p').on('click', function (e) {
1593 var data = $(this).data(), $imageZoomedImg = $(imageZoomed + ' img');
1594 // Changing the zoomed image sources
1595 $imageZoomedImg.data('fullImage', data.fullImage);
1596 // Destroy and reinit the instance of zoomed image
1597 $(imageZoomed).zoom('destroy');
1598 $(imageZoomed).zoom({ url: $imageZoomedImg.data().fullImage });
1599 e.stopPropagation();
1600 });
1601 */
1602 }
1603 // Changing the main image source attribute
1604 $('.product-image-subthumbs p').on('click', function (e) {
1605 var data = $(this).data(), $imageZoomedImg = $(imageZoomed + ' img');
1606 $imageZoomedImg.attr('src', data.thumbImage);
1607 e.stopPropagation();
1608 });
1609 // Manually trigger the modal box after
1610 // click on big product image
1611 $('.product-image-zoomed').on('click', function (e) {
1612 var $target = $($(this).data().target);
1613 e.preventDefault();
1614 $target.modal('show');
1615 });
1616 });
1617 }
1618 );
1619 </script>
1620