Error executing template "Designs/CapoStarter/eCom/Product/M_Product_global.cshtml"
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at App_Code.SimilarProducts.GetSimilarProducts(String groupId, String productId, Boolean isGlobal)
   at CompiledRazorTemplates.Dynamic.RazorEngine_7cd23740119142059c00970fa619f796.Execute() in E:\Website\Sundqvist_DW9V2_PROD\Files\Templates\Designs\CapoStarter\eCom\Product\M_Product_global.cshtml:line 2049
   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()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using System.Globalization 3 @using App_Code 4 @using Dynamicweb.Extensibility 5 @using Dynamicweb.Content 6 7 @{ 8 9 var loggedIn = HelperClass.IsLoggedIn(); 10 var currrencySymbol = GetGlobalValue("Global:eCommerce.Currency.Symbol"); 11 var culture = GetGlobalValue("Global:Area.Culture.Name"); 12 13 var buttonClass = "consument"; 14 15 var disallowAddToCart = Convert.ToBoolean(Pageview.Area.Item["Hide_Cart"]); 16 17 int buyHerePageID = GetPageIdByNavigationTag("BuyHere"); 18 19 decimal priceWithVat = Convert.ToDecimal(!string.IsNullOrEmpty(GetString("Ecom:Product.Price.PriceWithVAT")) ? GetString("Ecom:Product.Price.PriceWithVAT") : "0"); 20 string priceFormattedWithVat = priceWithVat.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 21 22 //This is needed to be able to use the same Combined product template on all sites 23 bool NorwegianSite = false; 24 25 // Consumer old price - for campaign price graphics 26 double ConsumerOldPrice = GetDouble("Ecom:Product:Field.OldProductPrice"); 27 ConsumerOldPrice = ConsumerOldPrice * 1.25; 28 string ConsumerOldPriceFormatted = ConsumerOldPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 29 30 } 31 32 33 <section class="content productpage"> 34 <div class="div-max1170-centered"> 35 <div class="productcard"> 36 <div class="row"> 37 <div class="go-back-button"> 38 <button class="btn" onclick="Misc.goBack()">@Translate("productBackButton", "Tillbaka")</button> 39 </div> 40 </div> 41 42 <div class="row"> 43 <div class="col-sm-5 col-sm-offset-1"> 44 <!-- Left Column --> 45 <div class="productimages-area"> 46 <div class="productimages-wrapp"> 47 @{ 48 bool imgControl = false; 49 bool imgFunctions = false; 50 string disabledState = ""; 51 } 52 53 <div class="carousel slide" id="carousel-productimages"> 54 <!-- Wrapper for slides --> 55 <div class="carousel-inner"> 56 @{ 57 var counter = 0; 58 59 string prodnumber = GetString("Ecom:Product.Number").Replace("/", "-"); 60 61 var curprodpath = Dynamicweb.Configuration.SystemConfiguration.Instance.GetValue("/Globalsettings/sundqvist/productimagepath") + "/" + prodnumber; 62 var imglist = new List<string>(); 63 string[] imgfiles = new string[0]; 64 65 var relatedImages1 = GetString("Ecom:Product:Field.relatedImages1.FullPath"); 66 var relatedImages2 = GetString("Ecom:Product:Field.relatedImages2.FullPath"); 67 var relatedImages3 = GetString("Ecom:Product:Field.relatedImages3.FullPath"); 68 var relatedImages4 = GetString("Ecom:Product:Field.relatedImages4.FullPath"); 69 var relatedImages5 = GetString("Ecom:Product:Field.relatedImages5.FullPath"); 70 try 71 { 72 imgfiles = System.IO.Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath(curprodpath)); 73 74 } 75 catch 76 { 77 <div class="item active"> 78 <img src="/Files/Images/NoImageAvailable.png" alt="" class="img-responsive" /> 79 </div> 80 } 81 string[] fieldRelatedImages = { @relatedImages1, @relatedImages2, @relatedImages3, @relatedImages4, @relatedImages5 }; 82 83 //Check that first found image has list-image pattern productnumber_1.jpg 84 if (!imgfiles.Any(x => x.Contains(prodnumber + "_1.jpg"))) 85 { 86 87 <div class="item active"> 88 <img src="/Files/Images/NoImageAvailable.png" alt="" class="img-responsive" /> 89 </div> 90 } 91 else 92 { 93 94 for (int i = 0; i < imgfiles.Length; i++) 95 { 96 if (!imgfiles[i].EndsWith(".jpg")) { continue; } 97 98 string imgname = System.IO.Path.GetFileName(imgfiles[i]); 99 string fullpath = curprodpath + "/" + imgname; 100 imglist.Add(fullpath); 101 102 var active = (counter == 0 ? "active" : ""); 103 <div data-slide-number="@counter" class="item @active" data-hires="/admin/public/getimage.ashx?Image=@fullpath&Format=jpg&Compression=85&width=1900&height=1200&Crop=5&altFmImage_path=/Files/Images/NoImageAvailable.png"> 104 <img src="/admin/public/getimage.ashx?Image=@fullpath&Format=jpg&Compression=85&width=400&height=400&Crop=5&altFmImage_path=/Files/Images/NoImageAvailable.png" alt="" title="@imgname" class="img-responsive panzoom-elements" data-original="@fullpath" /> 105 </div> 106 107 counter = counter + 1; 108 109 } 110 111 foreach (var url in fieldRelatedImages) 112 { 113 if (!string.IsNullOrEmpty(url)) 114 { 115 <div data-slide-number="@counter" class="item " data-hires="/admin/public/getimage.ashx?Image=@url&Format=jpg&Compression=85&width=1900&height=1200&Crop=5&altFmImage_path=/Files/Images/NoImageAvailable.png"> 116 <img src="/admin/public/getimage.ashx?Image=@url&Format=jpg&Compression=85&width=400&height=400&Crop=5&altFmImage_path=/Files/Images/NoImageAvailable.png" alt="" title="@url" class="img-responsive panzoom-elements" data-original="@url" /> 117 </div> 118 119 counter = counter + 1; 120 } 121 } 122 123 // Only show image functions if there is at least one image 124 if (counter > 0) { imgFunctions = true; } 125 126 // Only show image controls if there is at least two images 127 if (counter > 1) { imgControl = true; } 128 129 } 130 131 132 133 } 134 135 </div> 136 137 @if (imgControl) 138 { 139 <!-- Controls --> 140 <a class="left carousel-control" href="#carousel-productimages" data-slide="prev"> 141 <i class="fa fa-angle-left"></i> 142 </a> 143 <a class="right carousel-control" href="#carousel-productimages" data-slide="next"> 144 <i class="fa fa-angle-right"></i> 145 </a> 146 } 147 </div> 148 149 @if (imgFunctions) 150 { 151 <div class="img-controls text-right hidden-xs"> 152 <a href="javascript:;" id="download" title="@Translate("productImageDownloadLinkText", "Ladda ner högupplöst...")"><i class="fa fa-download"></i></a> 153 <a href="javascript:;" id="y-zoom" title="@Translate("productImageEnlargeLinkText", "Förstora...")"><i class="fa fa-search-plus"></i></a> 154 </div> 155 } 156 157 158 @if (imgControl) 159 { 160 161 var counterThumbs = 0; 162 foreach (var src in imglist) 163 { 164 <div class="carousel-item col-sm-4 hidden-xs"> 165 <a id="carousel-selector-@counterThumbs"> 166 <img class="img-responsive" src="/admin/public/getimage.ashx?Image=@src&Format=jpg&Compression=80&width=100&height=70&crop=5&altFmImage_path=/Files/Images/NoImageAvailable.png"> 167 </a> 168 </div> 169 counterThumbs = counterThumbs + 1; 170 } 171 172 <!--Start RelatedImages thumbs --> 173 foreach (var val in fieldRelatedImages) 174 { 175 var url = val; 176 if (!string.IsNullOrEmpty(url)) 177 { 178 179 <div class="carousel-item col-sm-4 hidden-xs"> 180 <a id="carousel-selector-@counterThumbs"> 181 <img class="img-responsive" src="/admin/public/getimage.ashx?Image=@url&Format=jpg&Compression=80&width=100&height=70&crop=5&altFmImage_path=/Files/Images/NoImageAvailable.png"> 182 </a> 183 </div> 184 } 185 186 counterThumbs = counterThumbs + 1; 187 } 188 <!--End RelatedImages thumbs --> 189 190 } 191 </div> <!-- #END carousel area --> 192 <!-- YouTube banner--> 193 @{ 194 string youtubeVId = string.Empty; // string.Empty; 195 if (GetString("Ecom:Product:Field.YouTypeLink").Contains("?v=")) 196 { 197 var tempArr = GetString("Ecom:Product:Field.YouTypeLink").Split('='); 198 youtubeVId = tempArr[1]; 199 } 200 } 201 202 @if (!string.IsNullOrEmpty(youtubeVId)) 203 { 204 var videoThumb = "http://img.youtube.com/vi/" + youtubeVId + "/0.jpg"; 205 <div class="col-sm-6 col-md-4 youtube-vid hidden-xs"> 206 <div class="thumbnail display-box"> 207 <a class="y-video" data-video="@GetValue("Ecom:Product:Field.YouTypeLink")" data-toggle="modal" data-target="#videoModal"> 208 <div class="display-img img-wrapp"> 209 <div class="img-inner youtube product"> 210 <img src="@videoThumb" class="img-responsive" alt="..."> 211 </div> 212 </div> 213 </a> 214 </div> 215 </div> 216 } 217 </div> 218 </div> 219 <!-- #END Left Column --> 220 221 <div class="product-right col-sm-4 col-sm-offset-1"> 222 <!-- Right Column --> 223 <div class="row"> 224 <div class="col-sm-12 text-common"> 225 <!--Start show brand logo--> 226 227 @{ 228 229 230 var myListId = (int)Pageview.Area.Item["BrandList"]; 231 var itemList = Dynamicweb.Content.Items.ItemList.GetItemListById(myListId); 232 int count = 0; 233 var loop = itemList.Relations.Cast<Dynamicweb.Content.Items.Item>(); 234 string Link = string.Empty; 235 236 foreach (var c in loop) 237 { 238 239 string nameId = ""; 240 241 string LogoPath = String.Empty; 242 string LogoSmallPath = String.Empty; 243 string LogoUrl = String.Empty; 244 string Match = GetString("Ecom:Product:Field.productTrademark").ToLower(); 245 Link = c["Link"].ToString(); 246 247 if (c["NameID"] != null) 248 { 249 nameId = c["NameID"].ToString().ToLower(); 250 } 251 252 if (c["Image"] != null) 253 { 254 LogoPath = c["Image"].ToString(); 255 } 256 257 if (c["ImageSmall"] != null) 258 { 259 LogoSmallPath = c["ImageSmall"].ToString(); 260 261 } 262 263 if (!string.IsNullOrEmpty(LogoSmallPath)) 264 { 265 266 LogoUrl = LogoSmallPath; 267 268 } 269 270 else if (!string.IsNullOrEmpty(LogoPath)) 271 { 272 273 LogoUrl = LogoPath; 274 } 275 276 if (nameId == Match && !string.IsNullOrEmpty(LogoUrl)) 277 { 278 279 <a href="@Link" target="_self" class="logo-container" style="background-image: url('/admin/public/getimage.ashx?Image=@LogoUrl&amp;Format=jpg&amp;Compression=90&amp;height=140&amp;crop=0&amp;altFmImage_path=/Files/Images/NoImageAvailable.png'); background-position-y: bottom; " title="@nameId"></a> 280 281 count++; 282 283 } 284 if (nameId == Match && count == 0) 285 { 286 <a href="@Link" target="_self"> 287 <div class="itemBrand" style="height: 30px;padding-top: 12px">@GetString("Ecom:Product:Field.productTrademark")</div> 288 </a> 289 break; 290 } 291 292 } 293 294 } 295 296 <!--End show brand logo --> 297 298 <h1 class="Product-Title">@GetString("Ecom:Product.Name")</h1> 299 <span class="art-nr">Art. Nr: @GetValue("Ecom:Product.Number")</span> 300 @{ 301 var descr = GetString("Ecom:Product.LongDescription"); 302 303 <div class="lead"> 304 @descr 305 </div> 306 } 307 308 <div class="intro-black-collapse print-show collapse" id="viewdetails"> 309 </div> 310 311 <a class="pull-left las-mer hidden-print" data-toggle="collapse" data-target="#viewdetails">@Translate("productLongDescriptionReadMore", "Läs mer")<i class="fa fa-angle-right"></i></a> 312 </div> 313 </div> 314 315 <div class="x-print"> 316 <!-- well row --> 317 <div class="row well"> 318 <div class="col-md-12 no-padding"> 319 <div class="item-main-info"> 320 321 @{ 322 var stock = GetInteger("Ecom:Product:Field.ProductStockGlobal"); 323 324 if (stock <= 2) 325 { 326 disabledState = "disabled"; 327 } 328 329 var globalStockStatus = HelperClass.GetGlobalStockStatusByProductId(GetString("Ecom:Product.ID")); 330 331 332 var stockstatusClass = globalStockStatus.ExpectedDeliveryValue; 333 334 } 335 336 <div class="clearfix"> 337 <p> 338 <i class="fa stock-icon @stockstatusClass"></i><span>@globalStockStatus.Text</span> 339 </p> 340 </div> 341 </div> 342 343 <form class="form-inline"> 344 <div class="item-main-info"> 345 @{ 346 if (GetBoolean("Ecom:Product:Field.productCampaign") && ConsumerOldPrice > 0) 347 { 348 <div class="inline-price"> 349 <h5 class="campaign-price">@priceFormattedWithVat</h5> 350 &nbsp; 351 <h6 class="old-price">@ConsumerOldPriceFormatted</h6> 352 </div> 353 } 354 else 355 { 356 <h5>@priceFormattedWithVat</h5> 357 } 358 } 359 </div> 360 361 @if (!disallowAddToCart) 362 { 363 <div class="form-group inline @disabledState "> 364 <button id="btnBuy" 365 onclick="Cart.addToBasket(@GetValue("Ecom:Product:Page.ID"), '@GetValue("Ecom:Product.ID")', '@GetValue("Ecom:Product.Number")', this);gtag('event', 'Konsument Global - Köp');" 366 class="btn btn-default consument" type="button"> 367 @Translate("productAddToCartButtonText", "LÄGG I VARUKORG") 368 <i class="fa fa-refresh"></i> 369 </button> 370 </div> 371 } 372 else 373 { 374 <a href="/Default.aspx?ID=@buyHerePageID"> 375 <div class="form-group inline "> 376 <button id="btnBuyHere" class="btn btn-buy-simple" type="button"> 377 @Translate("productBuyInShopButtonText", "KÖP I BUTIK") 378 </button> 379 </div> 380 </a> 381 } 382 383 <div class="form-group inline"> 384 @if (!string.IsNullOrEmpty(GetString("Ecom:Product.AddToFavorites"))) 385 { 386 string favorite = GetBoolean("Ecom:Product.IsProductInFavoriteList") ? "favorite checked" : "favorite "; 387 <a href="javascript:;" onclick="Product.addToFavorites('?CCAddToMyLists=@GetString("Ecom:Product.ID")&CCAddToListVariantID=&CCAddToListLanguageID=LANG2', this)" class="btn btn-default @favorite " type="button"></a> 388 389 } 390 </div> 391 392 </form> 393 394 @if (!GetBoolean("Ecom:Product:Field.productOutlet")) 395 { 396 <div style="margin-top: 3px"> 397 <a href="#" onclick="$('#findStore').modal('show'); gtag('event', 'ÅF - Köp');"> 398 @Translate("productBuyInShopButtonText", "KÖP I BUTIK") 399 </a> 400 </div> 401 } 402 403 404 @if (stock <= 2) 405 { 406 407 <div id="priceDetails" class=""> <p class="outOfstocInfoText">@Translate("productButtonOutOfStockContactUS", "Varan är slut på lager - vänligen kontakta oss för mer information")</p></div> 408 409 } 410 411 </div> 412 <div style="margin-bottom: 15px;" class="visible-sm visible-xs clearfix"></div> 413 </div> 414 </div> 415 </div> 416 </div> 417 418 <div class="row tabs"> 419 420 <div class="col-md-10 tab-list"> 421 422 <ul class="nav nav-pills"> 423 424 <li class="active"><a data-toggle="tab" href="#product-description">@Translate("productTabHeaderDescription", "Beskrivning")</a></li> 425 426 <li><a data-toggle="tab" href="#product-tecnical">@Translate("productTabHeaderTechInfo", "Teknisk info")</a></li> 427 428 @if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.guaranteeText"))) 429 { 430 <li><a data-toggle="tab" href="#product-warranty">@Translate("productTabHeaderWarrenty", "Garanti")</a></li> 431 } 432 @if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.CareInstructions1")) || !string.IsNullOrEmpty(GetString("Ecom:Product:Field.CareInstructions2")) || !string.IsNullOrEmpty(GetString("Ecom:Product:Field.CareInstructions3"))) 433 { 434 <li><a data-toggle="tab" href="#product-care">@Translate("productTabHeaderCare", "Skötsel")</a></li> 435 } 436 @{ 437 try 438 { 439 string[] docfiles = System.IO.Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath(curprodpath + "/docs")); 440 441 if (docfiles.Length > 0) 442 { 443 <li><a data-toggle="tab" href="#product-documents">@Translate("productTabHeaderDocs", "Dokument")</a></li> 444 445 } 446 else 447 { 448 foreach (LoopItem i in GetLoop("Details")) 449 { 450 if (!string.IsNullOrEmpty(@i.GetString("Ecom:Product:Detail.Image.Clean"))) 451 { 452 <li><a data-toggle="tab" href="#product-documents">@Translate("productTabHeaderDocs", "Dokument")</a></li> 453 break; 454 } 455 } 456 } 457 } 458 catch 459 { 460 foreach (LoopItem i in GetLoop("Details")) 461 { 462 if (!string.IsNullOrEmpty(@i.GetString("Ecom:Product:Detail.Image.Clean"))) 463 { 464 465 <li><a data-toggle="tab" href="#product-documents">@Translate("productTabHeaderDocs", "Dokument")</a></li> 466 break; 467 } 468 } 469 } 470 } 471 472 473 </ul> 474 475 <div class="tab-content"> 476 <div id="product-description" class="tab-pane fade in active"> 477 @GetValue("Ecom:Product:Field.DescriptionLong") 478 </div> 479 480 <div id="product-tecnical" class="tab-pane fade"> 481 482 @if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.TechInfo"))) 483 { 484 @GetValue("Ecom:Product:Field.TechInfo") 485 } 486 487 <div class="product-tecnical"> 488 489 @{ 490 if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.productTrademark.Value.Clean"))) 491 { 492 493 <div class="left"><label>@Translate("productTecnicalBrand", "Varumärke")</label></div> 494 <div class="right"><span class="tech-details-value">@GetString("Ecom:Product:Field.productTrademark.Value.Clean")</span></div> 495 496 } 497 if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.productSeries.Value.Clean"))) 498 { 499 500 <div class="left"><label>@Translate("productTecnicalSeries", "Serie")</label></div> 501 <div class="right"><span class="tech-details-value">@GetString("Ecom:Product:Field.productSeries.Value.Clean")</span></div> 502 } 503 if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.ProductColor.Value.Clean"))) 504 { 505 506 <div class="left"><label>@Translate("productTecnicalColor", "Färg")</label></div> 507 <div class="right"><span class="tech-details-value">@GetString("Ecom:Product:Field.ProductColor.Value.Clean")</span></div> 508 509 } 510 if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.productMaterial.Value.Clean"))) 511 { 512 513 <div class="left"><label>@Translate("productTecnicalMaterial", "Material")</label></div> 514 <div class="right"><span class="tech-details-value">@GetString("Ecom:Product:Field.productMaterial.Value.Clean")</span></div> 515 516 517 } 518 if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.productSize.Value.Clean"))) 519 { 520 521 <div class="left"><label>@Translate("productTecnicalSize", "Storlek")</label></div> 522 <div class="right"><span class="tech-details-value">@GetString("Ecom:Product:Field.productSize.Value.Clean")</span></div> 523 } 524 if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.productsVolume.Value.Clean"))) 525 { 526 <div class="left"><label>Volym</label></div> 527 <div class="right"><span class="tech-details-value">@GetString("Ecom:Product:Field.productsVolume.Value.Clean") &nbsp;m&sup3;</span></div> 528 529 } 530 531 if (!string.IsNullOrEmpty(GetString("Ecom:Product:Field.produktEAN.Value.Clean"))) 532 { 533 <div class="left"><label>@Translate("productTecnicalEAN", "EAN")</label></div> 534 <div class="right"><span class="tech-details-value">@GetString("Ecom:Product:Field.produktEAN.Value.Clean")</span></div> 535 536 } 537 538 } 539 </div> 540 </div> 541 542 <div id="product-warranty" class="tab-pane fade"> 543 @{ 544 string pageId; 545 int id; 546 547 var path = GetString("Ecom:Product:Field.guaranteeText"); 548 549 if (!string.IsNullOrEmpty(path)) 550 { 551 552 pageId = path.Substring(path.IndexOf('=') + 1); 553 554 if (int.TryParse(pageId, out id)) 555 { 556 // Function that renders either pageItem "General_TextEditor" content OR all content from a regular page 557 @GetPageContent(id) 558 } 559 } 560 } 561 </div> 562 563 <div id="product-care" class="tab-pane fade"> 564 @{ 565 string[] fields = { "Ecom:Product:Field.CareInstructions1", "Ecom:Product:Field.CareInstructions2", "Ecom:Product:Field.CareInstructions3" }; 566 567 foreach (var fieldName in fields) 568 { 569 path = GetString(fieldName); 570 if (!string.IsNullOrEmpty(path)) 571 { 572 573 pageId = path.Substring(path.IndexOf('=') + 1); 574 id = Int32.Parse(pageId); 575 // Function that renders either pageItem "General_TextEditor" content OR all content from a regular page 576 @GetPageContent(id) 577 } 578 } 579 } 580 </div> 581 582 <div id="product-documents" class="tab-pane fade"> 583 <div class="dokument-div"> 584 <ul> 585 @{ 586 //Documents 587 try 588 { 589 string[] docfiles = System.IO.Directory.GetFiles(System.Web.HttpContext.Current.Server.MapPath(curprodpath + "/docs")); 590 591 if (docfiles.Length > 0) 592 { 593 594 for (int i = 0; i < docfiles.Length; i++) 595 { 596 var filename = System.IO.Path.GetFileName(docfiles[i]); 597 string fullpath = curprodpath + "/docs/" + filename; 598 599 <li> 600 <a href="@fullpath" target="_blank"> 601 <i class="fa fa-file-text-o"></i> @filename 602 </a> 603 </li> 604 } 605 } 606 } 607 catch (System.Exception e) 608 { 609 610 } 611 612 foreach (LoopItem i in GetLoop("Details")) 613 { 614 // You can get the details text fields using "Ecom:Product:Detail.Text" 615 if (!string.IsNullOrEmpty(i.GetString("Ecom:Product:Detail.Image.Clean"))) 616 { 617 string fullpath = i.GetString("Ecom:Product:Detail.Image.Clean"); 618 var filename = fullpath.Split('/').Last(); 619 <li> 620 <a href="@fullpath" target="_blank"> 621 <i class="fa fa-file-text-o"></i> @filename 622 </a> 623 </li> 624 } 625 } 626 } 627 </ul> 628 </div> 629 </div> 630 631 </div> <!-- #END Table --> 632 <!-- #END prod-list --> 633 </div> 634 </div> 635 636 @* MODAL CODE HAS BEEN MOVED TO \Files\Templates\Designs\CapoStarter\PageProduct.cshtml *@ 637 638 </div> 639 640 <div class="row"> 641 <div class="div-max1170-centered no-padding"> 642 @if (GetLoop("ProductRelatedGroups").Count() > 0) 643 { 644 <div class="col-md-12 prod-list"> 645 <!-- Prod-list --> 646 647 <h2 class="data-section-header">@Translate("productHeaderSimilarProducts", "Liknande produkter:")</h2> 648 <div class="row"> 649 @foreach (var relatedG in GetLoop("ProductRelatedGroups")) 650 { 651 foreach (var related in relatedG.GetLoop("RelatedProducts")) 652 { 653 654 655 <a href="@related.GetString("Ecom:Product.Link.Clean")"> 656 657 <div class="col-xs-12 col-sm-6 col-md-3"> 658 <div class="thumbnail dropdown-info"> 659 @{ 660 var imgsrc = "/admin/public/getimage.ashx?Image=/Files/Images/productImages/" + related.GetValue("Ecom:Product.Number") + "/" + related.GetValue("Ecom:Product.Number") + "_1.jpg&width=330&height=330&compression=85&Crop=5&Format=jpg&altFmImage_path=/Files/Images/NoImageAvailable.png"; 661 <div class="display-img"> 662 <img alt="@related.GetValue("Ecom:Product.Name")" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 663 </div> 664 } 665 666 @if (related.GetString("Ecom:Product.MetaDescription").Length > 156) 667 { 668 @related.GetString("Ecom:Product.MetaDescription").Substring(0, 156)<text>...</text> 669 } 670 else 671 { 672 @related.GetValue("Ecom:Product.MetaDescription") 673 } 674 675 <div class="display-name"> 676 <div class="name-info"> 677 678 <div class="itemBrand">@GetValue("Ecom:Product:Field.productTrademark")</div> 679 <div class="itemName">@related.GetString("Ecom:Product.Name")</div> 680 <div class="itemNumber">Art. nr: @related.GetValue("Ecom:Product.Number")</div> 681 <div class="itemPrice" id='id_@related.GetValue("Ecom:Product.Number")'> 682 <b> 683 </b> 684 685 @if (related.GetValue("Ecom:Product.Price.Clean") != related.GetValue("Ecom:Product.ActualPrice.Clean")) 686 { 687 <span>(@related.GetValue("Ecom:Product.ActualPrice"))</span> 688 } 689 </div> 690 </div> 691 </div> 692 693 </div> 694 </div> 695 </a> 696 } 697 } 698 </div> 699 700 </div> 701 702 } 703 </div> 704 </div> 705 706 <!--Start Related catagory --> 707 <div class="row related-catagories-hide-if-empty"> 708 <div class="div-max1170-centered no-padding"> 709 <div class="col-md-12 related-categories"> 710 <h2>@Translate("productHeaderRelatedCategories", "Relaterade kategorier:")</h2> 711 <div class="form-group inline"> 712 713 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 714 715 716 @{ 717 var shopID = "SHOP1"; 718 var langID = "LANG2"; 719 var shop = new Dynamicweb.Ecommerce.Shops.Shop(shopID); 720 721 foreach (var group in shop.get_TopLevelGroups(langID)) 722 { 723 @GroupTemplate(group, 0, "", "") 724 } 725 726 } 727 728 @helper GroupTemplate(Dynamicweb.Ecommerce.Products.Group group, int level, string SubID, string Name) 729 { 730 731 732 var subID = SubID; 733 var name = Name; 734 735 736 foreach (LoopItem item in GetLoop("CustomGroupFields")) 737 { 738 739 if (!string.IsNullOrEmpty(item.GetString("related_Product_Catagories"))) 740 { 741 742 743 string[] listOfCats = item.GetString("related_Product_Catagories").Split(','); 744 745 746 for (int i = 0; i < listOfCats.Length; i++) 747 { 748 var groupId = listOfCats[i]; 749 750 groupId = groupId + "-at-SHOP1"; 751 752 if (subID == groupId) 753 { 754 755 756 <a href="Default.aspx?ID=2&GroupID=@groupId" class="btn btn-categories">@name</a> 757 } 758 759 } 760 } 761 } 762 763 if (group.Subgroups.Count > 0) 764 { 765 766 foreach (var subgroup in group.Subgroups) 767 { 768 @GroupTemplate(subgroup, level + 1, subgroup.Id, subgroup.Name) 769 770 } 771 772 } 773 774 } 775 776 777 </div> 778 </div> 779 </div> 780 </div> 781 <!--End Related catagory --> 782 <!--Start Combined products --> 783 <!--Get the no of combined products to adjust the layout --> 784 <!--if no combined products hide both combined and people also looked at--> 785 786 @{ 787 788 789 //var combinedProduct = true; 790 var headingClass = String.Empty; 791 var headingStyle = String.Empty; 792 793 //combinedProduct = GetBoolean("Ecom:Product:Field.CombinedProducts"); 794 var hasCombinedProducts = !string.IsNullOrEmpty(GetString("Ecom:Product:Field.CombinedProducts")) ? GetString("Ecom:Product:Field.CombinedProducts") : string.Empty; 795 796 797 798 799 if (hasCombinedProducts != string.Empty) 800 { 801 802 string[] getCombinedProducts = hasCombinedProducts.Replace(" ", "").Split(','); 803 804 //If there are combined products show header 805 if (GetString("Ecom:Product:Field.CombinedProducts").Length < 1) 806 { 807 headingStyle = "display:none"; 808 809 } 810 811 var noOfCombinedProducts = getCombinedProducts.Length; 812 813 //change layout per no of products 814 switch (noOfCombinedProducts) 815 { 816 case 1: 817 818 headingClass = "margin-left:-27%"; 819 820 break; 821 case 2: 822 headingClass = "margin-right:4%"; 823 break; 824 case 3: 825 headingClass = "Float:rleft; margin-left:-0%"; 826 break; 827 828 } 829 830 <!--Start Combined products --> 831 if (noOfCombinedProducts <= 2) 832 { 833 <div class="row combinedProducts" style="@headingStyle"> 834 <div class="div-max1170-centered no-padding"> 835 836 <h2 class="combined-products">@Translate("productHeaderCombinedProducts_global", "Kombinera Med:") <span class="hedear-pull-right" style="@headingClass">@Translate("productHeaderAlsoLookedAt", "Andra Har även tittat på:")</span></h2> 837 <!--Start Customers also looked at (Embed in same div as combined products) --> 838 <div class="combined-products"> 839 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 840 @using System 841 @using System.Activities.Expressions 842 @using System.Globalization 843 @using System.Linq 844 @using System.Web.Script.Serialization 845 @using App_Code 846 @using Dynamicweb.Controls 847 @using Dynamicweb.Controls.Extensibility 848 @using Dynamicweb.Ecommerce.Cart 849 @using Dynamicweb.Ecommerce.Notifications 850 @using Dynamicweb.Ecommerce.Products 851 @using Dynamicweb.Management.Ecommerce 852 @using Lucene.Net.Search 853 @using Microsoft.CodeAnalysis.VisualBasic.Syntax 854 @using Newtonsoft.Json 855 856 857 858 859 860 @{ 861 862 863 864 //Get the real data for the combined products 865 var combinedProductString = GetValue("Ecom:Product:Field.CombinedProducts").ToString(); 866 867 //If no products to combine dont continue 868 if (combinedProductString.Length < 1) 869 { 870 return; 871 } 872 873 var productServise = new ProductService(); 874 var baseProductId = prodnumber; 875 var listOfCombinedProducts = new List<string>(); 876 var prodLink = "#"; 877 var columnClass = ""; 878 var wrapperCount = ""; 879 var buyButtonStyle = ""; 880 881 882 // Split the product IDs into array 883 string[] dataSplit = (combinedProductString).Replace(" ", "").Split(','); 884 885 //Add to list 886 foreach (var product in dataSplit) 887 { 888 var productId = product; 889 890 listOfCombinedProducts.Add(productId); 891 } 892 893 //change layout per no of products 894 switch (dataSplit.Length) 895 { 896 case 1: 897 columnClass = "2"; 898 wrapperCount = "6"; 899 buyButtonStyle = "bottom:20px; margin-right:-28px; width:190px; padding-left:15px"; //Use this to add extra style to buy button 900 break; 901 case 2: 902 columnClass = "3"; 903 wrapperCount = "9"; 904 buyButtonStyle = "bottom:20px; margin-right:5px;"; //Use this to add extra style to buy button 905 break; 906 case 3: 907 columnClass = "4"; 908 wrapperCount = "12"; 909 wrapperCount = null; 910 buyButtonStyle = "bottom:-458px"; //Use this to add extra style to buy button 911 break; 912 } 913 914 var listOffProducts = new List<Product>(); 915 916 //Make the base product first item 917 listOffProducts.Add(productServise.GetProductByNumber(baseProductId, true)); 918 //get and and add product price to combined total price 919 920 double combinedPriceTotal = 0; 921 double combinedDiscounts = 0; 922 923 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 924 { 925 var baseProductPrice = Convert.ToDouble(productServise.GetProductByNumber(baseProductId, true).GetPrice("SEK", "SE").PriceWithoutVAT); 926 combinedPriceTotal = baseProductPrice; 927 } 928 else 929 { 930 931 var baseProductPrice = Convert.ToDouble(productServise.GetProductByNumber(baseProductId, true).GetPrice("SEK", "SE").PriceWithVAT); 932 combinedPriceTotal = baseProductPrice; 933 } 934 935 var productCount = listOfCombinedProducts.Count; 936 var itemCounter = 0; 937 var listOfIds = new List<string>(); 938 var containsCampaign = false; 939 940 //Add main product to list of ids 941 listOfIds.Add(productServise.GetProductByNumber(baseProductId, true).Id); 942 943 //Add combined products to list of ids 944 foreach (var item in listOfCombinedProducts) 945 { 946 var items = productServise.GetProductByNumber(item, true); 947 948 //If product Id is incorrect do not continue 949 if (items == null) 950 { 951 return; 952 } 953 954 listOffProducts.Add(items); 955 listOfIds.Add(items.Id); 956 957 containsCampaign = (bool)productServise.GetProductByNumber(items.Number, false).ProductFieldValues.GetProductFieldValue("productCampaign").Value; 958 959 //check if there is a campaign product in the list and add them together 960 if (containsCampaign == true) 961 { 962 // Consumer old price - for campaign price graphics 963 var test = items.Number.ToString(); 964 var productConsumerOldPrice = 0.0; 965 var oldPriceAsString = productServise.GetProductByNumber(items.Number, false).ProductFieldValues.GetProductFieldValue("OldProductPrice").Value.ToString(); 966 productConsumerOldPrice = Convert.ToDouble(oldPriceAsString, CultureInfo.InvariantCulture); 967 968 var productConsumerOldPriceWithVat = productConsumerOldPrice * 1.25; 969 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithVAT); 970 combinedDiscounts = productConsumerOldPriceWithVat - productPrice; 971 972 } 973 974 //get and and add each combined products price and add to the combined total price 975 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 976 { 977 978 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithoutVAT); 979 combinedPriceTotal = productPrice + combinedPriceTotal; 980 } 981 else 982 { 983 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithVAT); 984 combinedPriceTotal = productPrice + combinedPriceTotal; 985 } 986 987 } 988 989 990 991 if (baseProductId != null) 992 { 993 994 var simProdStock = 0; 995 996 <div class="fixed-height-boxes col-md-@wrapperCount"> 997 998 @foreach (var i in listOffProducts) 999 { 1000 itemCounter++; 1001 var showHoverEfect = ""; 1002 if (itemCounter > 1) 1003 { 1004 showHoverEfect = "combinedProductLinkHover"; 1005 } 1006 1007 <div class=" col-md-@columnClass combindeProducts @showHoverEfect"> 1008 1009 @{ 1010 1011 string productNumberClean = i.Number.Replace("/", "-"); 1012 var imgsrc = "/admin/public/getimage.ashx?Image=/Files/Images/ProductImages/" + productNumberClean + "/" + productNumberClean + "_1.jpg&width=250&height=250&compression=85&Crop=5&Format=jpg&altFmImage_path=/Files/Images/NoImageAvailable.png"; 1013 var isCampaigne = (Boolean)i.GetProductFieldValue("productCampaign"); 1014 var isnews = (Boolean)i.GetProductFieldValue("productNews"); 1015 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 1016 string productId = i.Number + "-at-SHOP1"; 1017 var combindeProductsBuy = ""; 1018 var classAHref = ""; 1019 1020 if (isCampaigne && isnews) 1021 { 1022 <div class="labels"> 1023 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 1024 1025 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 1026 </div> 1027 } 1028 1029 else if (isnews) 1030 { 1031 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 1032 } 1033 1034 else if (isCampaigne) 1035 { 1036 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 1037 } 1038 1039 } 1040 1041 @if (itemCounter > 1) 1042 { 1043 1044 1045 prodLink = "/Default.aspx?ID=" + ProductsPageId + "&GroupID=" + GetValue("Ecom:Product.PrimaryOrFirstGroupID") + "&ProductID=" + i.IdUrlEncoded; 1046 1047 combindeProductsBuy = ""; 1048 //showHoverEfect = "combinedProductLinkHover"; 1049 } 1050 else 1051 { 1052 combindeProductsBuy = "combindeProductsBuy"; 1053 } 1054 1055 @if (itemCounter == 1) 1056 { 1057 classAHref = "buyHref"; 1058 } 1059 1060 <div class="thumbnail dropdown-info @showHoverEfect"> 1061 <a href=@prodLink class="@classAHref" > 1062 <div class="display-img"> 1063 <img alt="@i.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 1064 </div> 1065 1066 <div class="display-name"> 1067 <div class="name-info"> 1068 <div class="itemBrand">@i.GetProductFieldValue("productTrademark")</div> 1069 1070 <div class="itemName">@i.Name</div> 1071 1072 @if (!string.IsNullOrEmpty(i.GetProductFieldValue("productSeries").ToString())) 1073 { 1074 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @i.GetProductFieldValue("productSeries")</div> 1075 } 1076 1077 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @i.Number</div> 1078 1079 </div> 1080 </div> 1081 </a> 1082 </div> 1083 @*//Add the + sign on combined products.*@ 1084 @if (itemCounter > 1) 1085 { 1086 <div class="circle"><h1 class="relatedProduct">+</h1></div> 1087 } 1088 </div> 1089 1090 1091 1092 <div class="@combindeProductsBuy" style="@buyButtonStyle"> 1093 @if (itemCounter <= 1) 1094 { 1095 1096 <div class="itemPrice" id='id_@i.Number'> 1097 1098 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1099 { 1100 1101 string CustomerPriceFormatted = combinedPriceTotal.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1102 1103 <span>@CustomerPriceFormatted</span> 1104 1105 } 1106 else 1107 { 1108 1109 var ConsumerPriceWithVatFormatted = combinedPriceTotal.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1110 1111 if (combinedDiscounts > 0) 1112 { 1113 1114 var ConsumerOldProductPrice = combinedPriceTotal + combinedDiscounts; 1115 1116 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1117 1118 <div class="item-main-info campaign-price"> 1119 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 1120 <span>@ConsumerPriceWithVatFormatted</span> 1121 </div> 1122 } 1123 else 1124 { 1125 1126 <div class="itemPrice"> 1127 <div class="item-main-info"> 1128 <span>@ConsumerPriceWithVatFormatted</span> 1129 </div> 1130 </div> 1131 } 1132 } 1133 </div> 1134 } 1135 1136 1137 1138 1139 1140 @*//If its the base product add the price and buy button*@ 1141 @if (i.Number == baseProductId) 1142 { 1143 1144 if (!disallowAddToCart && itemCounter <= 1) 1145 { 1146 string simProdDisabledState = ""; 1147 var getSimProductId = productId; 1148 1149 simProdStock = HelperClass.StockValue(getSimProductId); 1150 1151 1152 if (simProdStock <= 2) 1153 { 1154 simProdDisabledState = "disabled card"; 1155 } 1156 1157 <form name="multiForm" id="multiForm" method="post" class="form-inline product-card-buy-button relatedProducts @buttonClass @simProdDisabledState "> 1158 1159 @{ 1160 1161 var addedItems = new Dictionary<string, string>(); 1162 1163 addedItems.Add("CartCmd", "addmulti"); 1164 var productLoopCounter = 1; 1165 foreach (var s in listOfIds) 1166 { 1167 1168 var countVal = productLoopCounter.ToString(); 1169 1170 addedItems.Add("ProductLoopCounter" + countVal, countVal); 1171 addedItems.Add("ProductID" + countVal, s); 1172 addedItems.Add("VariantID" + countVal, ""); 1173 addedItems.Add("UnitID" + countVal, ""); 1174 addedItems.Add("Quantity" + countVal, "1"); 1175 1176 productLoopCounter++; 1177 } 1178 1179 } 1180 1181 <span id="multiProductData" data-json=@JsonConvert.SerializeObject(addedItems)> 1182 </span> 1183 <button id="btnBuy" 1184 onclick="Cart.addMultiProduct(@GetValue("Ecom:Product:Page.ID"),this)" 1185 class="btn btn-default" type="button"> 1186 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 1187 <polygon class="st0" points="152.8 42.3 57.1 42.3 36.6 -40.7 18.7 -40.7 18.7 -54.7 47.6 -54.7 68 28.3 143 28.3 160.7 -20.7 64.6 -19.9 64.5 -33.9 180.7 -34.9 " /> 1188 <path class="st0" d="M77.1 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6 11.9 0 21.6 9.7 21.6 21.6C98.7 70.9 89 80.6 77.1 80.6zM77.1 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6 4.2 0 7.6-3.4 7.6-7.6C84.7 54.9 81.3 51.5 77.1 51.5z" /> 1189 <path class="st0" d="M137.4 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6S159 47.1 159 59C159 70.9 149.3 80.6 137.4 80.6zM137.4 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6s7.6-3.4 7.6-7.6C145 54.9 141.6 51.5 137.4 51.5z" /> 1190 <polygon class="st0" points="124.6 -22.6 97.6 -50.9 75.4 -24.5 64.6 -33.5 96.9 -71.9 134.7 -32.3 " /> 1191 <polygon class="st0" points="172.6 -23.6 133.4 -52.5 117 -36.8 107.3 -46.9 132.3 -70.7 180.9 -34.8 " /> 1192 <path d="M19 5.8L19 5.8l-5.4-4 -2 1.9 -1.9-2L6.1 5.9h0l0 1.5 10.7-0.1 -2 5.5H6.5L4.2 3.6H1v1.6h2l2.3 9.2H6c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.3-1.4-0.9-1.9h3.7c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.4-1.4-0.9-1.9h0.2L19 5.8zM8.2 5.9L9.8 4l1.8 1.8L8.2 5.9zM13.7 5.8l-1-1 1-1 2.7 2L13.7 5.8zM7.5 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C8.3 16.7 7.9 17 7.5 17zM14.2 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C15 16.7 14.6 17 14.2 17z" /> 1193 <polygon points="19 5.8 19 5.8 19 5.8 " /> 1194 </svg> 1195 <i class="fa fa-refresh"></i> 1196 @if (loggedIn) 1197 { 1198 <span class="buyText">@Translate("productBuyButtonText", "Köp")</span> 1199 } 1200 </button> 1201 1202 </form> 1203 1204 } 1205 1206 } 1207 1208 </div> 1209 } 1210 </div> 1211 1212 } 1213 1214 } 1215 1216 1217 <div class="combined-products alsoLookedAt"> 1218 <h2 class="combined-products-mobile"><span>@Translate("productHeaderAlsoLookedAt", "Andra Har även tittat på:")</span></h2> 1219 <div class="row"> 1220 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1221 @using System.Activities.Statements 1222 @using Dynamicweb.Ecommerce.Products 1223 @using System.Globalization 1224 @using System.Security.Cryptography 1225 @using App_Code 1226 1227 1228 1229 @{ 1230 1231 // Get and set values 1232 1233 var itemCountToList = 3 - productCount; 1234 var singleItemClass = ""; 1235 1236 if (productCount == 3 || productCount < 1) 1237 { 1238 itemCountToList = 4; 1239 1240 } 1241 1242 if (productCount == 2) 1243 { 1244 singleItemClass = "singleItem"; 1245 1246 } 1247 1248 var customersAlsoLookedAt = GetLoop("eCom:Related.CustomersWhoSawThisAlsoSaw").GetRange(0, itemCountToList); 1249 1250 1251 if (customersAlsoLookedAt != null) 1252 { 1253 1254 var thisProdStock = 0; 1255 1256 1257 foreach (LoopItem loopitem in customersAlsoLookedAt) 1258 { 1259 var product = productServise.GetProductByNumber(loopitem.GetString("Ecom:Product.Number"), false); 1260 1261 <div class="col-md-3"> 1262 1263 @{ 1264 1265 string productNumberClean = product.Number.Replace("/", "-"); 1266 var imgsrc = "/admin/public/getimage.ashx?Image=/Files/Images/ProductImages/" + productNumberClean + "/" + productNumberClean + "_1.jpg&width=250&height=250&compression=85&Crop=5&Format=jpg&altFmImage_path=/Files/Images/NoImageAvailable.png"; 1267 var isCampaigne = (Boolean)product.GetProductFieldValue("productCampaign"); 1268 var isnews = (Boolean)product.GetProductFieldValue("productNews"); 1269 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 1270 string productId = product.Number + "-at-SHOP1"; 1271 1272 if (isCampaigne && isnews) 1273 { 1274 <div class="labels"> 1275 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 1276 1277 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 1278 </div> 1279 } 1280 1281 else if (isnews) 1282 { 1283 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 1284 } 1285 1286 else if (isCampaigne) 1287 { 1288 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 1289 } 1290 1291 } 1292 1293 <div class="thumbnail dropdown-info @singleItemClass"> 1294 <a href="/Default.aspx?ID=@ProductsPageId&GroupID=@GetValue("Ecom:Product.PrimaryOrFirstGroupID")&ProductID=@product.IdUrlEncoded"> 1295 <div class="display-img"> 1296 <img alt="@product.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 1297 </div> 1298 <div class="display-name"> 1299 <div class="name-info"> 1300 <div class="itemBrand">@product.GetProductFieldValue("productTrademark")</div> 1301 <div class="itemName">@product.Name</div> 1302 @if (!string.IsNullOrEmpty(product.GetProductFieldValue("productSeries").ToString())) 1303 { 1304 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @product.GetProductFieldValue("productSeries")</div> 1305 } 1306 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @product.Number</div> 1307 <div class="itemPrice" id='id_@product.Number'> 1308 1309 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1310 { 1311 1312 decimal CustomerPrice = Convert.ToDecimal(!string.IsNullOrEmpty(product.Price.PriceWithoutVAT.ToString()) ? product.Price.PriceWithoutVAT.ToString() : "0"); 1313 string CustomerPriceFormatted = CustomerPrice.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1314 1315 1316 1317 <span>@CustomerPriceFormatted</span> 1318 1319 } 1320 else 1321 { 1322 decimal ConsumnerPriceWithVat = Convert.ToDecimal(!string.IsNullOrEmpty(product.Price.PriceWithVAT.ToString()) ? product.Price.PriceWithVAT.ToString() : "0"); 1323 var ConsumnerPriceWithVatFormatted = ConsumnerPriceWithVat.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1324 1325 //Campaign price graphics 1326 double ConsumerOldProductPrice = double.Parse(product.GetProductFieldValue("OldProductPrice").ToString(), CultureInfo.InvariantCulture); 1327 ConsumerOldProductPrice = ConsumerOldProductPrice * 1.25; 1328 1329 if (isCampaigne && ConsumerOldProductPrice > 0) 1330 { 1331 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1332 1333 <div class="item-main-info campaign-price"> 1334 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 1335 <span>@ConsumnerPriceWithVatFormatted </span> 1336 </div> 1337 1338 } 1339 else 1340 { 1341 1342 <div class="itemPrice"> 1343 1344 <div class="item-main-info"> 1345 <span>@ConsumnerPriceWithVatFormatted</span> 1346 </div> 1347 1348 </div> 1349 1350 1351 1352 1353 } 1354 1355 } 1356 </div> 1357 </div> 1358 </div> 1359 </a> 1360 1361 @if (!disallowAddToCart) 1362 { 1363 string simProdDisabledState = ""; 1364 var thisProductId = productId; 1365 1366 thisProdStock = HelperClass.StockValue(thisProductId); 1367 1368 1369 if (thisProdStock <= 2) 1370 { 1371 simProdDisabledState = "disabled card"; 1372 } 1373 1374 1375 1376 <form class="form-inline product-card-buy-button @buttonClass @simProdDisabledState "> 1377 <span> 1378 <button id="btnBuy" 1379 onclick="Cart.addToBasket(@ProductsPageId, '@productId', '@productNumberClean', this);" 1380 class="btn btn-default @buttonClass" type="button" style="float: right; margin-top: -35px;"> 1381 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 1382 <polygon class="st0" points="152.8 42.3 57.1 42.3 36.6 -40.7 18.7 -40.7 18.7 -54.7 47.6 -54.7 68 28.3 143 28.3 160.7 -20.7 64.6 -19.9 64.5 -33.9 180.7 -34.9 " /> 1383 <path class="st0" d="M77.1 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6 11.9 0 21.6 9.7 21.6 21.6C98.7 70.9 89 80.6 77.1 80.6zM77.1 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6 4.2 0 7.6-3.4 7.6-7.6C84.7 54.9 81.3 51.5 77.1 51.5z" /> 1384 <path class="st0" d="M137.4 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6S159 47.1 159 59C159 70.9 149.3 80.6 137.4 80.6zM137.4 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6s7.6-3.4 7.6-7.6C145 54.9 141.6 51.5 137.4 51.5z" /> 1385 <polygon class="st0" points="124.6 -22.6 97.6 -50.9 75.4 -24.5 64.6 -33.5 96.9 -71.9 134.7 -32.3 " /> 1386 <polygon class="st0" points="172.6 -23.6 133.4 -52.5 117 -36.8 107.3 -46.9 132.3 -70.7 180.9 -34.8 " /> 1387 <path d="M19 5.8L19 5.8l-5.4-4 -2 1.9 -1.9-2L6.1 5.9h0l0 1.5 10.7-0.1 -2 5.5H6.5L4.2 3.6H1v1.6h2l2.3 9.2H6c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.3-1.4-0.9-1.9h3.7c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.4-1.4-0.9-1.9h0.2L19 5.8zM8.2 5.9L9.8 4l1.8 1.8L8.2 5.9zM13.7 5.8l-1-1 1-1 2.7 2L13.7 5.8zM7.5 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C8.3 16.7 7.9 17 7.5 17zM14.2 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C15 16.7 14.6 17 14.2 17z" /> 1388 <polygon points="19 5.8 19 5.8 19 5.8 " /> 1389 </svg> 1390 @if (loggedIn) 1391 { 1392 @Translate("productBuyButtonText", "Köp"); 1393 } 1394 <i class="fa fa-refresh"></i> 1395 </span> 1396 </form> 1397 1398 1399 } 1400 1401 </div> 1402 1403 </div> 1404 1405 } 1406 } 1407 } 1408 1409 1410 1411 </div> 1412 </div> 1413 </div> 1414 <!--End Start Customers also looked at --> 1415 </div> 1416 </div> 1417 1418 } 1419 if (noOfCombinedProducts >= 3) 1420 { 1421 <div class="row combinedProducts" > 1422 <div class="div-max1170-centered no-padding"> 1423 1424 <h2>@Translate("productHeaderCombinedProducts_global", "Kombinera Med:")</h2> 1425 <!--Start Customers also looked at --> 1426 <div class="combined-products"> 1427 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1428 @using System 1429 @using System.Activities.Expressions 1430 @using System.Globalization 1431 @using System.Linq 1432 @using System.Web.Script.Serialization 1433 @using App_Code 1434 @using Dynamicweb.Controls 1435 @using Dynamicweb.Controls.Extensibility 1436 @using Dynamicweb.Ecommerce.Cart 1437 @using Dynamicweb.Ecommerce.Notifications 1438 @using Dynamicweb.Ecommerce.Products 1439 @using Dynamicweb.Management.Ecommerce 1440 @using Lucene.Net.Search 1441 @using Microsoft.CodeAnalysis.VisualBasic.Syntax 1442 @using Newtonsoft.Json 1443 1444 1445 1446 1447 1448 @{ 1449 1450 1451 1452 //Get the real data for the combined products 1453 var combinedProductString = GetValue("Ecom:Product:Field.CombinedProducts").ToString(); 1454 1455 //If no products to combine dont continue 1456 if (combinedProductString.Length < 1) 1457 { 1458 return; 1459 } 1460 1461 var productServise = new ProductService(); 1462 var baseProductId = prodnumber; 1463 var listOfCombinedProducts = new List<string>(); 1464 var prodLink = "#"; 1465 var columnClass = ""; 1466 var wrapperCount = ""; 1467 var buyButtonStyle = ""; 1468 1469 1470 // Split the product IDs into array 1471 string[] dataSplit = (combinedProductString).Replace(" ", "").Split(','); 1472 1473 //Add to list 1474 foreach (var product in dataSplit) 1475 { 1476 var productId = product; 1477 1478 listOfCombinedProducts.Add(productId); 1479 } 1480 1481 //change layout per no of products 1482 switch (dataSplit.Length) 1483 { 1484 case 1: 1485 columnClass = "2"; 1486 wrapperCount = "6"; 1487 buyButtonStyle = "bottom:20px; margin-right:-28px; width:190px; padding-left:15px"; //Use this to add extra style to buy button 1488 break; 1489 case 2: 1490 columnClass = "3"; 1491 wrapperCount = "9"; 1492 buyButtonStyle = "bottom:20px; margin-right:5px;"; //Use this to add extra style to buy button 1493 break; 1494 case 3: 1495 columnClass = "4"; 1496 wrapperCount = "12"; 1497 wrapperCount = null; 1498 buyButtonStyle = "bottom:-458px"; //Use this to add extra style to buy button 1499 break; 1500 } 1501 1502 var listOffProducts = new List<Product>(); 1503 1504 //Make the base product first item 1505 listOffProducts.Add(productServise.GetProductByNumber(baseProductId, true)); 1506 //get and and add product price to combined total price 1507 1508 double combinedPriceTotal = 0; 1509 double combinedDiscounts = 0; 1510 1511 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1512 { 1513 var baseProductPrice = Convert.ToDouble(productServise.GetProductByNumber(baseProductId, true).GetPrice("SEK", "SE").PriceWithoutVAT); 1514 combinedPriceTotal = baseProductPrice; 1515 } 1516 else 1517 { 1518 1519 var baseProductPrice = Convert.ToDouble(productServise.GetProductByNumber(baseProductId, true).GetPrice("SEK", "SE").PriceWithVAT); 1520 combinedPriceTotal = baseProductPrice; 1521 } 1522 1523 var productCount = listOfCombinedProducts.Count; 1524 var itemCounter = 0; 1525 var listOfIds = new List<string>(); 1526 var containsCampaign = false; 1527 1528 //Add main product to list of ids 1529 listOfIds.Add(productServise.GetProductByNumber(baseProductId, true).Id); 1530 1531 //Add combined products to list of ids 1532 foreach (var item in listOfCombinedProducts) 1533 { 1534 var items = productServise.GetProductByNumber(item, true); 1535 1536 //If product Id is incorrect do not continue 1537 if (items == null) 1538 { 1539 return; 1540 } 1541 1542 listOffProducts.Add(items); 1543 listOfIds.Add(items.Id); 1544 1545 containsCampaign = (bool)productServise.GetProductByNumber(items.Number, false).ProductFieldValues.GetProductFieldValue("productCampaign").Value; 1546 1547 //check if there is a campaign product in the list and add them together 1548 if (containsCampaign == true) 1549 { 1550 // Consumer old price - for campaign price graphics 1551 var test = items.Number.ToString(); 1552 var productConsumerOldPrice = 0.0; 1553 var oldPriceAsString = productServise.GetProductByNumber(items.Number, false).ProductFieldValues.GetProductFieldValue("OldProductPrice").Value.ToString(); 1554 productConsumerOldPrice = Convert.ToDouble(oldPriceAsString, CultureInfo.InvariantCulture); 1555 1556 var productConsumerOldPriceWithVat = productConsumerOldPrice * 1.25; 1557 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithVAT); 1558 combinedDiscounts = productConsumerOldPriceWithVat - productPrice; 1559 1560 } 1561 1562 //get and and add each combined products price and add to the combined total price 1563 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1564 { 1565 1566 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithoutVAT); 1567 combinedPriceTotal = productPrice + combinedPriceTotal; 1568 } 1569 else 1570 { 1571 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithVAT); 1572 combinedPriceTotal = productPrice + combinedPriceTotal; 1573 } 1574 1575 } 1576 1577 1578 1579 if (baseProductId != null) 1580 { 1581 1582 var simProdStock = 0; 1583 1584 <div class="fixed-height-boxes col-md-@wrapperCount"> 1585 1586 @foreach (var i in listOffProducts) 1587 { 1588 itemCounter++; 1589 var showHoverEfect = ""; 1590 if (itemCounter > 1) 1591 { 1592 showHoverEfect = "combinedProductLinkHover"; 1593 } 1594 1595 <div class=" col-md-@columnClass combindeProducts @showHoverEfect"> 1596 1597 @{ 1598 1599 string productNumberClean = i.Number.Replace("/", "-"); 1600 var imgsrc = "/admin/public/getimage.ashx?Image=/Files/Images/ProductImages/" + productNumberClean + "/" + productNumberClean + "_1.jpg&width=250&height=250&compression=85&Crop=5&Format=jpg&altFmImage_path=/Files/Images/NoImageAvailable.png"; 1601 var isCampaigne = (Boolean)i.GetProductFieldValue("productCampaign"); 1602 var isnews = (Boolean)i.GetProductFieldValue("productNews"); 1603 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 1604 string productId = i.Number + "-at-SHOP1"; 1605 var combindeProductsBuy = ""; 1606 var classAHref = ""; 1607 1608 if (isCampaigne && isnews) 1609 { 1610 <div class="labels"> 1611 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 1612 1613 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 1614 </div> 1615 } 1616 1617 else if (isnews) 1618 { 1619 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 1620 } 1621 1622 else if (isCampaigne) 1623 { 1624 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 1625 } 1626 1627 } 1628 1629 @if (itemCounter > 1) 1630 { 1631 1632 1633 prodLink = "/Default.aspx?ID=" + ProductsPageId + "&GroupID=" + GetValue("Ecom:Product.PrimaryOrFirstGroupID") + "&ProductID=" + i.IdUrlEncoded; 1634 1635 combindeProductsBuy = ""; 1636 //showHoverEfect = "combinedProductLinkHover"; 1637 } 1638 else 1639 { 1640 combindeProductsBuy = "combindeProductsBuy"; 1641 } 1642 1643 @if (itemCounter == 1) 1644 { 1645 classAHref = "buyHref"; 1646 } 1647 1648 <div class="thumbnail dropdown-info @showHoverEfect"> 1649 <a href=@prodLink class="@classAHref" > 1650 <div class="display-img"> 1651 <img alt="@i.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 1652 </div> 1653 1654 <div class="display-name"> 1655 <div class="name-info"> 1656 <div class="itemBrand">@i.GetProductFieldValue("productTrademark")</div> 1657 1658 <div class="itemName">@i.Name</div> 1659 1660 @if (!string.IsNullOrEmpty(i.GetProductFieldValue("productSeries").ToString())) 1661 { 1662 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @i.GetProductFieldValue("productSeries")</div> 1663 } 1664 1665 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @i.Number</div> 1666 1667 </div> 1668 </div> 1669 </a> 1670 </div> 1671 @*//Add the + sign on combined products.*@ 1672 @if (itemCounter > 1) 1673 { 1674 <div class="circle"><h1 class="relatedProduct">+</h1></div> 1675 } 1676 </div> 1677 1678 1679 1680 <div class="@combindeProductsBuy" style="@buyButtonStyle"> 1681 @if (itemCounter <= 1) 1682 { 1683 1684 <div class="itemPrice" id='id_@i.Number'> 1685 1686 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1687 { 1688 1689 string CustomerPriceFormatted = combinedPriceTotal.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1690 1691 <span>@CustomerPriceFormatted</span> 1692 1693 } 1694 else 1695 { 1696 1697 var ConsumerPriceWithVatFormatted = combinedPriceTotal.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1698 1699 if (combinedDiscounts > 0) 1700 { 1701 1702 var ConsumerOldProductPrice = combinedPriceTotal + combinedDiscounts; 1703 1704 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1705 1706 <div class="item-main-info campaign-price"> 1707 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 1708 <span>@ConsumerPriceWithVatFormatted</span> 1709 </div> 1710 } 1711 else 1712 { 1713 1714 <div class="itemPrice"> 1715 <div class="item-main-info"> 1716 <span>@ConsumerPriceWithVatFormatted</span> 1717 </div> 1718 </div> 1719 } 1720 } 1721 </div> 1722 } 1723 1724 1725 1726 1727 1728 @*//If its the base product add the price and buy button*@ 1729 @if (i.Number == baseProductId) 1730 { 1731 1732 if (!disallowAddToCart && itemCounter <= 1) 1733 { 1734 string simProdDisabledState = ""; 1735 var getSimProductId = productId; 1736 1737 simProdStock = HelperClass.StockValue(getSimProductId); 1738 1739 1740 if (simProdStock <= 2) 1741 { 1742 simProdDisabledState = "disabled card"; 1743 } 1744 1745 <form name="multiForm" id="multiForm" method="post" class="form-inline product-card-buy-button relatedProducts @buttonClass @simProdDisabledState "> 1746 1747 @{ 1748 1749 var addedItems = new Dictionary<string, string>(); 1750 1751 addedItems.Add("CartCmd", "addmulti"); 1752 var productLoopCounter = 1; 1753 foreach (var s in listOfIds) 1754 { 1755 1756 var countVal = productLoopCounter.ToString(); 1757 1758 addedItems.Add("ProductLoopCounter" + countVal, countVal); 1759 addedItems.Add("ProductID" + countVal, s); 1760 addedItems.Add("VariantID" + countVal, ""); 1761 addedItems.Add("UnitID" + countVal, ""); 1762 addedItems.Add("Quantity" + countVal, "1"); 1763 1764 productLoopCounter++; 1765 } 1766 1767 } 1768 1769 <span id="multiProductData" data-json=@JsonConvert.SerializeObject(addedItems)> 1770 </span> 1771 <button id="btnBuy" 1772 onclick="Cart.addMultiProduct(@GetValue("Ecom:Product:Page.ID"),this)" 1773 class="btn btn-default" type="button"> 1774 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 1775 <polygon class="st0" points="152.8 42.3 57.1 42.3 36.6 -40.7 18.7 -40.7 18.7 -54.7 47.6 -54.7 68 28.3 143 28.3 160.7 -20.7 64.6 -19.9 64.5 -33.9 180.7 -34.9 " /> 1776 <path class="st0" d="M77.1 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6 11.9 0 21.6 9.7 21.6 21.6C98.7 70.9 89 80.6 77.1 80.6zM77.1 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6 4.2 0 7.6-3.4 7.6-7.6C84.7 54.9 81.3 51.5 77.1 51.5z" /> 1777 <path class="st0" d="M137.4 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6S159 47.1 159 59C159 70.9 149.3 80.6 137.4 80.6zM137.4 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6s7.6-3.4 7.6-7.6C145 54.9 141.6 51.5 137.4 51.5z" /> 1778 <polygon class="st0" points="124.6 -22.6 97.6 -50.9 75.4 -24.5 64.6 -33.5 96.9 -71.9 134.7 -32.3 " /> 1779 <polygon class="st0" points="172.6 -23.6 133.4 -52.5 117 -36.8 107.3 -46.9 132.3 -70.7 180.9 -34.8 " /> 1780 <path d="M19 5.8L19 5.8l-5.4-4 -2 1.9 -1.9-2L6.1 5.9h0l0 1.5 10.7-0.1 -2 5.5H6.5L4.2 3.6H1v1.6h2l2.3 9.2H6c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.3-1.4-0.9-1.9h3.7c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.4-1.4-0.9-1.9h0.2L19 5.8zM8.2 5.9L9.8 4l1.8 1.8L8.2 5.9zM13.7 5.8l-1-1 1-1 2.7 2L13.7 5.8zM7.5 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C8.3 16.7 7.9 17 7.5 17zM14.2 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C15 16.7 14.6 17 14.2 17z" /> 1781 <polygon points="19 5.8 19 5.8 19 5.8 " /> 1782 </svg> 1783 <i class="fa fa-refresh"></i> 1784 @if (loggedIn) 1785 { 1786 <span class="buyText">@Translate("productBuyButtonText", "Köp")</span> 1787 } 1788 </button> 1789 1790 </form> 1791 1792 } 1793 1794 } 1795 1796 </div> 1797 } 1798 </div> 1799 1800 } 1801 1802 } 1803 1804 1805 </div> 1806 <!--End Start Customers also looked at --> 1807 </div> 1808 </div> 1809 1810 <!--If its new row(3 combined products then use normal styling) for the others have also looked at--> 1811 <div class="row similar-Products-hide-if-empty"> 1812 <div class="div-max1170-centered no-padding"> 1813 <div class="similar-products alsoLookedAt"> 1814 <h2>@Translate("productHeaderAlsoLookedAt_global", "Andra Har även tittat på:")</h2> 1815 <div class="form-group inline"> 1816 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1817 @using System.Activities.Statements 1818 @using Dynamicweb.Ecommerce.Products 1819 @using System.Globalization 1820 @using System.Security.Cryptography 1821 @using App_Code 1822 1823 1824 1825 @{ 1826 1827 // Get and set values 1828 1829 var itemCountToList = 3 - productCount; 1830 var singleItemClass = ""; 1831 1832 if (productCount == 3 || productCount < 1) 1833 { 1834 itemCountToList = 4; 1835 1836 } 1837 1838 if (productCount == 2) 1839 { 1840 singleItemClass = "singleItem"; 1841 1842 } 1843 1844 var customersAlsoLookedAt = GetLoop("eCom:Related.CustomersWhoSawThisAlsoSaw").GetRange(0, itemCountToList); 1845 1846 1847 if (customersAlsoLookedAt != null) 1848 { 1849 1850 var thisProdStock = 0; 1851 1852 1853 foreach (LoopItem loopitem in customersAlsoLookedAt) 1854 { 1855 var product = productServise.GetProductByNumber(loopitem.GetString("Ecom:Product.Number"), false); 1856 1857 <div class="col-md-3"> 1858 1859 @{ 1860 1861 string productNumberClean = product.Number.Replace("/", "-"); 1862 var imgsrc = "/admin/public/getimage.ashx?Image=/Files/Images/ProductImages/" + productNumberClean + "/" + productNumberClean + "_1.jpg&width=250&height=250&compression=85&Crop=5&Format=jpg&altFmImage_path=/Files/Images/NoImageAvailable.png"; 1863 var isCampaigne = (Boolean)product.GetProductFieldValue("productCampaign"); 1864 var isnews = (Boolean)product.GetProductFieldValue("productNews"); 1865 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 1866 string productId = product.Number + "-at-SHOP1"; 1867 1868 if (isCampaigne && isnews) 1869 { 1870 <div class="labels"> 1871 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 1872 1873 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 1874 </div> 1875 } 1876 1877 else if (isnews) 1878 { 1879 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 1880 } 1881 1882 else if (isCampaigne) 1883 { 1884 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 1885 } 1886 1887 } 1888 1889 <div class="thumbnail dropdown-info @singleItemClass"> 1890 <a href="/Default.aspx?ID=@ProductsPageId&GroupID=@GetValue("Ecom:Product.PrimaryOrFirstGroupID")&ProductID=@product.IdUrlEncoded"> 1891 <div class="display-img"> 1892 <img alt="@product.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 1893 </div> 1894 <div class="display-name"> 1895 <div class="name-info"> 1896 <div class="itemBrand">@product.GetProductFieldValue("productTrademark")</div> 1897 <div class="itemName">@product.Name</div> 1898 @if (!string.IsNullOrEmpty(product.GetProductFieldValue("productSeries").ToString())) 1899 { 1900 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @product.GetProductFieldValue("productSeries")</div> 1901 } 1902 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @product.Number</div> 1903 <div class="itemPrice" id='id_@product.Number'> 1904 1905 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1906 { 1907 1908 decimal CustomerPrice = Convert.ToDecimal(!string.IsNullOrEmpty(product.Price.PriceWithoutVAT.ToString()) ? product.Price.PriceWithoutVAT.ToString() : "0"); 1909 string CustomerPriceFormatted = CustomerPrice.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1910 1911 1912 1913 <span>@CustomerPriceFormatted</span> 1914 1915 } 1916 else 1917 { 1918 decimal ConsumnerPriceWithVat = Convert.ToDecimal(!string.IsNullOrEmpty(product.Price.PriceWithVAT.ToString()) ? product.Price.PriceWithVAT.ToString() : "0"); 1919 var ConsumnerPriceWithVatFormatted = ConsumnerPriceWithVat.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1920 1921 //Campaign price graphics 1922 double ConsumerOldProductPrice = double.Parse(product.GetProductFieldValue("OldProductPrice").ToString(), CultureInfo.InvariantCulture); 1923 ConsumerOldProductPrice = ConsumerOldProductPrice * 1.25; 1924 1925 if (isCampaigne && ConsumerOldProductPrice > 0) 1926 { 1927 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1928 1929 <div class="item-main-info campaign-price"> 1930 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 1931 <span>@ConsumnerPriceWithVatFormatted </span> 1932 </div> 1933 1934 } 1935 else 1936 { 1937 1938 <div class="itemPrice"> 1939 1940 <div class="item-main-info"> 1941 <span>@ConsumnerPriceWithVatFormatted</span> 1942 </div> 1943 1944 </div> 1945 1946 1947 1948 1949 } 1950 1951 } 1952 </div> 1953 </div> 1954 </div> 1955 </a> 1956 1957 @if (!disallowAddToCart) 1958 { 1959 string simProdDisabledState = ""; 1960 var thisProductId = productId; 1961 1962 thisProdStock = HelperClass.StockValue(thisProductId); 1963 1964 1965 if (thisProdStock <= 2) 1966 { 1967 simProdDisabledState = "disabled card"; 1968 } 1969 1970 1971 1972 <form class="form-inline product-card-buy-button @buttonClass @simProdDisabledState "> 1973 <span> 1974 <button id="btnBuy" 1975 onclick="Cart.addToBasket(@ProductsPageId, '@productId', '@productNumberClean', this);" 1976 class="btn btn-default @buttonClass" type="button" style="float: right; margin-top: -35px;"> 1977 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 1978 <polygon class="st0" points="152.8 42.3 57.1 42.3 36.6 -40.7 18.7 -40.7 18.7 -54.7 47.6 -54.7 68 28.3 143 28.3 160.7 -20.7 64.6 -19.9 64.5 -33.9 180.7 -34.9 " /> 1979 <path class="st0" d="M77.1 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6 11.9 0 21.6 9.7 21.6 21.6C98.7 70.9 89 80.6 77.1 80.6zM77.1 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6 4.2 0 7.6-3.4 7.6-7.6C84.7 54.9 81.3 51.5 77.1 51.5z" /> 1980 <path class="st0" d="M137.4 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6S159 47.1 159 59C159 70.9 149.3 80.6 137.4 80.6zM137.4 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6s7.6-3.4 7.6-7.6C145 54.9 141.6 51.5 137.4 51.5z" /> 1981 <polygon class="st0" points="124.6 -22.6 97.6 -50.9 75.4 -24.5 64.6 -33.5 96.9 -71.9 134.7 -32.3 " /> 1982 <polygon class="st0" points="172.6 -23.6 133.4 -52.5 117 -36.8 107.3 -46.9 132.3 -70.7 180.9 -34.8 " /> 1983 <path d="M19 5.8L19 5.8l-5.4-4 -2 1.9 -1.9-2L6.1 5.9h0l0 1.5 10.7-0.1 -2 5.5H6.5L4.2 3.6H1v1.6h2l2.3 9.2H6c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.3-1.4-0.9-1.9h3.7c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.4-1.4-0.9-1.9h0.2L19 5.8zM8.2 5.9L9.8 4l1.8 1.8L8.2 5.9zM13.7 5.8l-1-1 1-1 2.7 2L13.7 5.8zM7.5 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C8.3 16.7 7.9 17 7.5 17zM14.2 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C15 16.7 14.6 17 14.2 17z" /> 1984 <polygon points="19 5.8 19 5.8 19 5.8 " /> 1985 </svg> 1986 @if (loggedIn) 1987 { 1988 @Translate("productBuyButtonText", "Köp"); 1989 } 1990 <i class="fa fa-refresh"></i> 1991 </span> 1992 </form> 1993 1994 1995 } 1996 1997 </div> 1998 1999 </div> 2000 2001 } 2002 } 2003 } 2004 2005 2006 2007 </div> 2008 </div> 2009 </div> 2010 </div> 2011 2012 } 2013 2014 } 2015 <!--End Combined products --> 2016 <!--Start Similar products --> 2017 <div class="row similar-Products-hide-if-empty"> 2018 <div class="div-max1170-centered no-padding"> 2019 <div class="similar-products"> 2020 <h2>@Translate("productHeaderSimilarProducts_global", "Liknande produkter:")</h2> 2021 <div class="form-group inline"> 2022 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2023 @using System.Activities.Statements 2024 @using Dynamicweb.Ecommerce.Products 2025 @using System.Globalization 2026 @using System.Security.Cryptography 2027 @using App_Code 2028 2029 @*Liknande produkter yta - speciell urvalslogik 2030 Dessa ska sökas fram enligt följande logik: 2031 Produkter i samma kategori 2032 Ta 2 som ligger närmast i pris uppåt 2033 Ta 2 som ligger närmast i pris nedåt*@ 2034 2035 @{ 2036 bool isGlobal = false; 2037 if (Pageview.Area.Name.Equals("Global")) 2038 { 2039 isGlobal = true; 2040 } 2041 2042 // Get and set values 2043 var groupID = GetString("Ecom:Group.ID"); 2044 var productID = GetString("Ecom:Product.ID"); 2045 if (groupID == null & productID == null) 2046 { 2047 return; 2048 } 2049 var similarProducts = new SimilarProducts().GetSimilarProducts(groupID, productID, isGlobal); 2050 2051 if (similarProducts != null) 2052 { 2053 Dynamicweb.Ecommerce.LiveIntegration.Products.ProductManager.FetchProductInfos(similarProducts); 2054 var simProdStock = 0; 2055 2056 <div class="fixed-height-boxes"> 2057 2058 2059 @foreach (var i in similarProducts) 2060 { 2061 2062 <div class="col-md-3"> 2063 2064 @{ 2065 2066 string productNumberClean = i.Number.Replace("/", "-"); 2067 var imgsrc = "/admin/public/getimage.ashx?Image=/Files/Images/ProductImages/" + productNumberClean + "/" + productNumberClean + "_1.jpg&width=250&height=250&compression=85&Crop=5&Format=jpg&altFmImage_path=/Files/Images/NoImageAvailable.png"; 2068 var isCampaigne = (Boolean)i.GetProductFieldValue("productCampaign"); 2069 var isnews = (Boolean)i.GetProductFieldValue("productNews"); 2070 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 2071 string productId = i.Number + "-at-SHOP1"; 2072 2073 if (isCampaigne && isnews) 2074 { 2075 <div class="labels"> 2076 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 2077 2078 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 2079 </div> 2080 } 2081 2082 else if (isnews) 2083 { 2084 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 2085 } 2086 2087 else if (isCampaigne) 2088 { 2089 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 2090 } 2091 2092 } 2093 2094 <div class="thumbnail dropdown-info"> 2095 <a href="/Default.aspx?ID=@ProductsPageId&GroupID=@GetValue("Ecom:Product.PrimaryOrFirstGroupID")&ProductID=@i.IdUrlEncoded"> 2096 <div class="display-img"> 2097 <img alt="@i.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 2098 </div> 2099 <div class="display-name"> 2100 <div class="name-info"> 2101 <div class="itemBrand">@i.GetProductFieldValue("productTrademark")</div> 2102 <div class="itemName">@i.Name</div> 2103 @if (!string.IsNullOrEmpty(i.GetProductFieldValue("productSeries").ToString())) 2104 { 2105 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @i.GetProductFieldValue("productSeries")</div> 2106 } 2107 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @i.Number</div> 2108 <div class="itemPrice" id='id_@i.Number'> 2109 2110 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 2111 { 2112 2113 decimal CustomerPrice = Convert.ToDecimal(!string.IsNullOrEmpty(i.Price.PriceWithoutVAT.ToString()) ? i.Price.PriceWithoutVAT.ToString() : "0"); 2114 string CustomerPriceFormatted = CustomerPrice.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 2115 2116 2117 2118 <span>@CustomerPriceFormatted</span> 2119 2120 } 2121 else 2122 { 2123 decimal ConsumnerPriceWithVat = Convert.ToDecimal(!string.IsNullOrEmpty(i.Price.PriceWithVAT.ToString()) ? i.Price.PriceWithVAT.ToString() : "0"); 2124 var ConsumnerPriceWithVatFormatted = ConsumnerPriceWithVat.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 2125 2126 //Campaign price graphics 2127 double ConsumerOldProductPrice = double.Parse(i.GetProductFieldValue("OldProductPrice").ToString(), CultureInfo.InvariantCulture); 2128 ConsumerOldProductPrice = ConsumerOldProductPrice * 1.25; 2129 2130 if (isCampaigne && ConsumerOldProductPrice > 0) 2131 { 2132 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 2133 2134 <div class="item-main-info campaign-price"> 2135 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 2136 <span>@ConsumnerPriceWithVatFormatted </span> 2137 </div> 2138 2139 } 2140 else 2141 { 2142 2143 <div class="itemPrice"> 2144 2145 <div class="item-main-info"> 2146 <span>@ConsumnerPriceWithVatFormatted</span> 2147 </div> 2148 2149 </div> 2150 2151 2152 2153 2154 } 2155 2156 } 2157 </div> 2158 </div> 2159 </div> 2160 </a> 2161 2162 @if (!disallowAddToCart) 2163 { 2164 string simProdDisabledState = ""; 2165 var getSimProductId = productId; 2166 2167 simProdStock = HelperClass.StockValue(getSimProductId); 2168 2169 2170 if (simProdStock <= 2) 2171 { 2172 simProdDisabledState = "disabled card"; 2173 } 2174 2175 2176 2177 <form class="form-inline product-card-buy-button @buttonClass @simProdDisabledState "> 2178 <span> 2179 <button id="btnBuy" 2180 onclick="Cart.addToBasket(@ProductsPageId, '@productId', '@productNumberClean', this);" 2181 class="btn btn-default @buttonClass" type="button" style="float: right; margin-top: -35px;"> 2182 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 2183 <polygon class="st0" points="152.8 42.3 57.1 42.3 36.6 -40.7 18.7 -40.7 18.7 -54.7 47.6 -54.7 68 28.3 143 28.3 160.7 -20.7 64.6 -19.9 64.5 -33.9 180.7 -34.9 " /> 2184 <path class="st0" d="M77.1 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6 11.9 0 21.6 9.7 21.6 21.6C98.7 70.9 89 80.6 77.1 80.6zM77.1 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6 4.2 0 7.6-3.4 7.6-7.6C84.7 54.9 81.3 51.5 77.1 51.5z" /> 2185 <path class="st0" d="M137.4 80.6c-11.9 0-21.6-9.7-21.6-21.6 0-11.9 9.7-21.6 21.6-21.6S159 47.1 159 59C159 70.9 149.3 80.6 137.4 80.6zM137.4 51.5c-4.2 0-7.6 3.4-7.6 7.6 0 4.2 3.4 7.6 7.6 7.6s7.6-3.4 7.6-7.6C145 54.9 141.6 51.5 137.4 51.5z" /> 2186 <polygon class="st0" points="124.6 -22.6 97.6 -50.9 75.4 -24.5 64.6 -33.5 96.9 -71.9 134.7 -32.3 " /> 2187 <polygon class="st0" points="172.6 -23.6 133.4 -52.5 117 -36.8 107.3 -46.9 132.3 -70.7 180.9 -34.8 " /> 2188 <path d="M19 5.8L19 5.8l-5.4-4 -2 1.9 -1.9-2L6.1 5.9h0l0 1.5 10.7-0.1 -2 5.5H6.5L4.2 3.6H1v1.6h2l2.3 9.2H6c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.3-1.4-0.9-1.9h3.7c-0.5 0.4-0.9 1.1-0.9 1.9 0 1.3 1.1 2.4 2.4 2.4s2.4-1.1 2.4-2.4c0-0.8-0.4-1.4-0.9-1.9h0.2L19 5.8zM8.2 5.9L9.8 4l1.8 1.8L8.2 5.9zM13.7 5.8l-1-1 1-1 2.7 2L13.7 5.8zM7.5 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C8.3 16.7 7.9 17 7.5 17zM14.2 17c-0.5 0-0.8-0.4-0.8-0.8 0-0.5 0.4-0.8 0.8-0.8 0.5 0 0.8 0.4 0.8 0.8C15 16.7 14.6 17 14.2 17z" /> 2189 <polygon points="19 5.8 19 5.8 19 5.8 " /> 2190 </svg> 2191 @if (loggedIn) 2192 { 2193 @Translate("productBuyButtonText", "Köp"); 2194 } 2195 <i class="fa fa-refresh"></i> 2196 </span> 2197 </form> 2198 2199 2200 } 2201 2202 </div> 2203 2204 </div> 2205 2206 } 2207 2208 2209 </div> 2210 2211 } 2212 } 2213 2214 2215 2216 </div> 2217 </div> 2218 </div> 2219 </div> 2220 <!--End Similar products --> 2221 } 2222 </div> 2223 2224 </section> 2225 2226 2227 @if (imgFunctions) 2228 { 2229 <div class="modal fade y-modalCarousel" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> 2230 <div class="modal-dialog"> 2231 2232 <button class="close" type="button" data-dismiss="modal"> 2233 <i class="fa fa-close"></i> 2234 </button> 2235 2236 <div id="modalCarousel" class="carousel slide"> 2237 <div class="carousel-inner"> 2238 </div> 2239 2240 @if (imgControl) 2241 { 2242 <a class="left carousel-control" href="#modalCarousel" data-slide="prev"> 2243 <i class="fa fa-angle-left"></i> 2244 </a> 2245 <a class="right carousel-control" href="#modalCarousel" data-slide="next"> 2246 <i class="fa fa-angle-right"></i> 2247 </a> 2248 } 2249 <span class="cl-area" data-dismiss="modal"></span> 2250 </div> 2251 </div> 2252 </div> 2253 } 2254 2255 2256 2257 2258 2259 @functions { 2260 string GetPageContent(int pageId) 2261 { 2262 2263 try 2264 { 2265 string output = null; 2266 2267 var page = ServiceLocator.Current.GetPageService().GetPage(pageId); 2268 2269 if (!string.IsNullOrEmpty(page.ItemType) && !string.IsNullOrEmpty(page.ItemId)) 2270 { 2271 var item = Dynamicweb.Content.Items.Item.GetItemById(page.ItemType, page.ItemId); 2272 output = "<div>" + item["General_TextEditor"] + "</div>"; 2273 } 2274 else 2275 { 2276 var contentPageView = Dynamicweb.Frontend.PageView.GetPageviewByPageID(pageId); 2277 output = contentPageView.Output(); 2278 2279 // Remove everything but the actual page content 2280 var startTag = "<!--PageContentStart-->"; 2281 var endTag = "<!--PageContentEnd-->"; 2282 int startIndex = output.IndexOf(startTag) + startTag.Length; 2283 int endIndex = output.IndexOf(endTag, startIndex); 2284 output = output.Substring(startIndex, endIndex - startIndex); 2285 } 2286 2287 return output; 2288 } 2289 catch { } 2290 return null; 2291 } 2292 2293 } 2294 2295 <!-- Modals --> 2296 2297 @using Dynamicweb.Rendering.Translation 2298 @using System; 2299 2300 2301 @{ var LinkText = Translate("retail_search_webshop_button", "Webshop"); 2302 //var EAN = GetString("Ecom:Product:Field.produktEAN"); 2303 2304 } 2305 2306 2307 @*<input type="hidden" id="EAN" value="@EAN" />*@ 2308 2309 <div class="modal fade" id="findStore" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> 2310 <div class="modal-dialog" role="document"> 2311 <div class="modal-content"> 2312 <div class="modal-header"> 2313 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> 2314 <h1 class="modal-title" id="myModalLabel">@Translate("ProductlistBuy", "Buy")</h1> 2315 </div> 2316 <div class="modal-body col-sm-12"> 2317 <div class="col-lg-6 col-md-12 modal-search-form"> 2318 <form class="search-form"> 2319 <div class="row"> 2320 <button type="submit" class="button-primary"><i class="fa fa-search"></i></button> 2321 <input type="text" class="u-full-width search-field" autofocus placeholder="@Translate("reseller_post_number", "Enter postal number")" value=""> 2322 </div> 2323 <div class="row address"> 2324 <small class="formatted-address"></small> 2325 </div> 2326 </form> 2327 @*<ul class="search-filter"> 2328 @{ 2329 2330 var BrandlistListId = (int) Pageview.Area.Item["BrandList"]; 2331 var BrandlistItemList = Dynamicweb.Content.Items.ItemList.GetItemListById(BrandlistListId); 2332 var Brandlsloop = BrandlistItemList.Relations.Cast<Dynamicweb.Content.Items.Item>(); 2333 2334 foreach (var i in Brandlsloop) 2335 { 2336 2337 string brand = ""; 2338 try 2339 { 2340 string nameId = i["NameID"].ToString(); 2341 2342 2343 if (!String.IsNullOrEmpty(nameId)) 2344 { 2345 brand = nameId; 2346 2347 <li><label for="@brand"><input type="checkbox" id="@brand"><icon class="check"></icon>@brand</label></li> 2348 } 2349 2350 } 2351 catch (Exception ex) 2352 { 2353 Console.WriteLine(ex.ToString()); 2354 } 2355 2356 2357 } 2358 } 2359 </ul>*@ 2360 <div class="stores-list"></div> 2361 </div> 2362 <div class="col-lg-6 col-md-12 webshops"> 2363 <h2>@Translate("retail_search_webshop", "Online shops")</h2> 2364 2365 <div class="links"> 2366 <ul> 2367 @{ 2368 var ResellersListId = (int) Pageview.Area.Item["Resellers_List"]; 2369 var ResellersItemList = Dynamicweb.Content.Items.ItemList.GetItemListById(ResellersListId); 2370 var Resellersloop = ResellersItemList.Relations.Cast<Dynamicweb.Content.Items.Item>(); 2371 string curentBrand = GetString("Ecom:Product:Field.productTrademark"); 2372 2373 2374 foreach (var c in Resellersloop) 2375 { 2376 string linkText = c["LinkText"].ToString(); 2377 string landinpageLink = String.Empty; 2378 try 2379 { 2380 landinpageLink = c[curentBrand].ToString(); 2381 //landinpageLink = c["Chasseur"].ToString(); 2382 2383 2384 if (!String.IsNullOrEmpty(landinpageLink)) 2385 { 2386 2387 <li> 2388 @linkText 2389 <a href="@landinpageLink" target="_blank" title="@linkText" class="button">@Translate("retail_search_webshop_button", "Webshop")</a> 2390 </li> 2391 2392 } 2393 2394 2395 } 2396 catch (Exception ex) 2397 { 2398 2399 Console.WriteLine(ex.ToString()); 2400 } 2401 2402 } 2403 2404 } 2405 2406 2407 </ul> 2408 </div> 2409 </div> 2410 </div> 2411 </div> 2412 </div> 2413 </div> 2414 2415 2416 2417 @{ 2418 var hostUrl = GetGlobalValue("Global:Request.Host"); 2419 } 2420 2421 @SnippetStart("FacebookOGProductMeta") 2422 2423 <meta property='og:type' content='website' /> 2424 <meta property='og:title' content='@GetString("Ecom:Product.Name")' /> 2425 <meta property='og:image' content='@GetGlobalValue("Global:Request.Scheme")://@hostUrl/Admin/Public/GetImage.ashx?image=@curprodpath/@GetString("Ecom:Product.Number")_1.jpg&Compression=85&width=400&height=400&Crop=5&altFmImage_path=/Files/Images/NoImageAvailable.png' /> 2426 <meta property='og:description' content='@GetString("Ecom:Product:Field.DescriptionLong")'/> 2427 <meta property='og:url' content='@GetGlobalValue("Global:Request.Scheme")://@GetGlobalValue("Global:Request.Host")@GetGlobalValue("Global:Pageview.Url")' /> 2428 2429 @SnippetEnd("FacebookOGProductMeta")

Meny