träffar.

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

Meny