träffar.

No hits.
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_1187892942034357844ce0ce125051e6.Execute() in D:\dynamicweb.net\Solutions\Capo\sundqvist.cloud.dynamicweb-cms.com\files\Templates\Designs\CapoStarter\eCom\Product\M_Product.cshtml:line 2277
   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 hideCart = Convert.ToBoolean(Pageview.Area.Item["Hide_Cart"]); 25 if (hideCart) 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 = "/Files/Images/ProductImages/" + 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 (!hideCart) 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" class="buyHereLink"> 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 Flowbox Dynamic Product Flow--> 897 898 @{ 899 var enableFlowBoxScript = Convert.ToBoolean(Pageview.Area.Item["Enable_FlowboxScript"]); 900 var flowKey = Pageview.Area.Item["FlowKeyProductPage"]; 901 var locale = Pageview.Area.Item["FlowLocale"]; 902 var link = Pageview.Area.Item["FlowCarouselButtonLink"]; 903 904 var enableFlowBox = enableFlowBoxScript && !string.IsNullOrEmpty(flowKey.ToString()) && !string.IsNullOrEmpty(locale.ToString()); 905 906 if (enableFlowBox) 907 { 908 909 <div class="flow-text"> 910 <h2>@Translate("FlowboxHeaderSundqvistText", "DELA DINA BILDER MED SUNDQVIST")</h2> 911 <p>@Translate("FlowboxParagraphSundqvistText", "Tagga #yesSundqvist så kanske dina bilder blir visade här.")</p> 912 </div> 913 914 <div id="js-flowbox-flow"></div> 915 916 <script> 917 window.flowbox('init', { 918 container: '#js-flowbox-flow', 919 key: '@flowKey', 920 locale: '@locale', 921 productId: '@GetValue("Ecom:Product.Number")' 922 }) 923 </script> 924 925 if (link != null) 926 { 927 <div class="button-section"> 928 <a class="inspiration-button" href="@link">@Translate("FlowboxLinkText", "FÅ MER INSPIRATION HÄR")</a> 929 </div> 930 } 931 } 932 } 933 934 935 936 <!-- End Flowbox Dynamic Product Flow--> 937 <!--Start Related catagory --> 938 <div class="row related-catagories-hide-if-empty"> 939 <div class="div-max1170-centered no-padding"> 940 <div class="col-md-12 related-categories"> 941 <h2>@Translate("productHeaderRelatedCategories", "Relaterade kategorier:")</h2> 942 <div class="form-group inline"> 943 944 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 945 946 947 @{ 948 var shopID = "SHOP1"; 949 var langID = "LANG2"; 950 var shop = new Dynamicweb.Ecommerce.Shops.Shop(shopID); 951 952 foreach (var group in shop.get_TopLevelGroups(langID)) 953 { 954 @GroupTemplate(group, 0, "", "") 955 } 956 957 } 958 959 @helper GroupTemplate(Dynamicweb.Ecommerce.Products.Group group, int level, string SubID, string Name) 960 { 961 962 963 var subID = SubID; 964 var name = Name; 965 966 967 foreach (LoopItem item in GetLoop("CustomGroupFields")) 968 { 969 970 if (!string.IsNullOrEmpty(item.GetString("related_Product_Catagories"))) 971 { 972 973 974 string[] listOfCats = item.GetString("related_Product_Catagories").Split(','); 975 976 977 for (int i = 0; i < listOfCats.Length; i++) 978 { 979 var groupId = listOfCats[i]; 980 981 groupId = groupId + "-at-SHOP1"; 982 983 if (subID == groupId) 984 { 985 986 987 <a href="Default.aspx?ID=2&GroupID=@groupId" class="btn btn-categories">@name</a> 988 } 989 990 } 991 } 992 } 993 994 if (group.Subgroups.Count > 0) 995 { 996 997 foreach (var subgroup in group.Subgroups) 998 { 999 @GroupTemplate(subgroup, level + 1, subgroup.Id, subgroup.Name) 1000 1001 } 1002 1003 } 1004 1005 } 1006 1007 1008 </div> 1009 </div> 1010 </div> 1011 </div> 1012 <!--End Related catagory --> 1013 <!--Start Combined products --> 1014 <!--Get the no of combined products to adjust the layout --> 1015 <!--if no combined products hide both combined and people also looked at--> 1016 1017 @{ 1018 1019 1020 //var combinedProduct = true; 1021 var headingClass = String.Empty; 1022 var headingStyle = String.Empty; 1023 1024 //combinedProduct = GetBoolean("Ecom:Product:Field.CombinedProducts"); 1025 var hasCombinedProducts = !string.IsNullOrEmpty(GetString("Ecom:Product:Field.CombinedProducts")) ? GetString("Ecom:Product:Field.CombinedProducts") : string.Empty; 1026 1027 1028 1029 1030 if (hasCombinedProducts != string.Empty) 1031 { 1032 1033 string[] getCombinedProducts = hasCombinedProducts.Replace(" ", "").Split(','); 1034 1035 //If there are combined products show header 1036 if (GetString("Ecom:Product:Field.CombinedProducts").Length < 1) 1037 { 1038 headingStyle = "display:none"; 1039 1040 } 1041 1042 var noOfCombinedProducts = getCombinedProducts.Length; 1043 1044 //change layout per no of products 1045 switch (noOfCombinedProducts) 1046 { 1047 case 1: 1048 1049 headingClass = "margin-left:-27%"; 1050 1051 break; 1052 case 2: 1053 headingClass = "margin-right:4%"; 1054 break; 1055 case 3: 1056 headingClass = "Float:rleft; margin-left:-0%"; 1057 break; 1058 1059 } 1060 1061 <!--Start Combined products --> 1062 if (noOfCombinedProducts <= 2) 1063 { 1064 <div class="row combinedProducts" style="@headingStyle"> 1065 <div class="div-max1170-centered no-padding"> 1066 1067 <h2 class="combined-products">@Translate("productHeaderCombinedProducts", "Kombinera Med:") <span class="hedear-pull-right" style="@headingClass">@Translate("productHeaderAlsoLookedAt", "Andra Har även tittat på:")</span></h2> 1068 <!--Start Customers also looked at (Embed in same div as combined products) --> 1069 <div class="combined-products"> 1070 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1071 @using System 1072 @using System.Activities.Expressions 1073 @using System.Globalization 1074 @using System.Linq 1075 @using System.Web.Script.Serialization 1076 @using App_Code 1077 @using Dynamicweb.Controls 1078 @using Dynamicweb.Controls.Extensibility 1079 @using Dynamicweb.Ecommerce.Cart 1080 @using Dynamicweb.Ecommerce.Notifications 1081 @using Dynamicweb.Ecommerce.Products 1082 @using Dynamicweb.Management.Ecommerce 1083 @using Lucene.Net.Search 1084 @using Microsoft.CodeAnalysis.VisualBasic.Syntax 1085 @using Newtonsoft.Json 1086 1087 1088 1089 1090 1091 @{ 1092 1093 1094 1095 //Get the real data for the combined products 1096 var combinedProductString = GetValue("Ecom:Product:Field.CombinedProducts").ToString(); 1097 1098 //If no products to combine dont continue 1099 if (combinedProductString.Length < 1) 1100 { 1101 return; 1102 } 1103 1104 var productServise = new ProductService(); 1105 var baseProductId = prodnumber; 1106 var listOfCombinedProducts = new List<string>(); 1107 var prodLink = "#"; 1108 var columnClass = ""; 1109 var wrapperCount = ""; 1110 var buyButtonStyle = ""; 1111 1112 1113 // Split the product IDs into array 1114 string[] dataSplit = (combinedProductString).Replace(" ", "").Split(','); 1115 1116 //Add to list 1117 foreach (var product in dataSplit) 1118 { 1119 var productId = product; 1120 1121 listOfCombinedProducts.Add(productId); 1122 } 1123 1124 //change layout per no of products 1125 switch (dataSplit.Length) 1126 { 1127 case 1: 1128 columnClass = "2"; 1129 wrapperCount = "6"; 1130 buyButtonStyle = "bottom:20px; margin-right:-28px; width:190px; padding-left:15px"; //Use this to add extra style to buy button 1131 break; 1132 case 2: 1133 columnClass = "3"; 1134 wrapperCount = "9"; 1135 buyButtonStyle = "bottom:20px; margin-right:5px;"; //Use this to add extra style to buy button 1136 break; 1137 case 3: 1138 columnClass = "4"; 1139 wrapperCount = "12"; 1140 wrapperCount = null; 1141 buyButtonStyle = "bottom:-458px"; //Use this to add extra style to buy button 1142 break; 1143 } 1144 1145 var listOffProducts = new List<Product>(); 1146 1147 //Make the base product first item 1148 listOffProducts.Add(productServise.GetProductByNumber(baseProductId, true)); 1149 //get and and add product price to combined total price 1150 1151 double combinedPriceTotal = 0; 1152 double combinedDiscounts = 0; 1153 1154 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1155 { 1156 var baseProductPrice = Convert.ToDouble(productServise.GetProductByNumber(baseProductId, true).GetPrice("SEK", "SE").PriceWithoutVAT); 1157 combinedPriceTotal = baseProductPrice; 1158 } 1159 else 1160 { 1161 1162 var baseProductPrice = Convert.ToDouble(productServise.GetProductByNumber(baseProductId, true).GetPrice("SEK", "SE").PriceWithVAT); 1163 combinedPriceTotal = baseProductPrice; 1164 } 1165 1166 var productCount = listOfCombinedProducts.Count; 1167 var itemCounter = 0; 1168 var listOfIds = new List<string>(); 1169 var containsCampaign = false; 1170 1171 //Add main product to list of ids 1172 listOfIds.Add(productServise.GetProductByNumber(baseProductId, true).Id); 1173 1174 //Add combined products to list of ids 1175 foreach (var item in listOfCombinedProducts) 1176 { 1177 var items = productServise.GetProductByNumber(item, true); 1178 1179 //If product Id is incorrect do not continue 1180 if (items == null) 1181 { 1182 return; 1183 } 1184 1185 listOffProducts.Add(items); 1186 listOfIds.Add(items.Id); 1187 1188 containsCampaign = (bool)productServise.GetProductByNumber(items.Number, false).ProductFieldValues.GetProductFieldValue("productCampaign").Value; 1189 1190 //check if there is a campaign product in the list and add them together 1191 if (containsCampaign == true) 1192 { 1193 // Consumer old price - for campaign price graphics 1194 var test = items.Number.ToString(); 1195 var productConsumerOldPrice = 0.0; 1196 var oldPriceAsString = productServise.GetProductByNumber(items.Number, false).ProductFieldValues.GetProductFieldValue("OldProductPrice").Value.ToString(); 1197 productConsumerOldPrice = Convert.ToDouble(oldPriceAsString, CultureInfo.InvariantCulture); 1198 1199 var productConsumerOldPriceWithVat = productConsumerOldPrice * 1.25; 1200 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithVAT); 1201 combinedDiscounts = productConsumerOldPriceWithVat - productPrice; 1202 1203 } 1204 1205 //get and and add each combined products price and add to the combined total price 1206 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1207 { 1208 1209 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithoutVAT); 1210 combinedPriceTotal = productPrice + combinedPriceTotal; 1211 } 1212 else 1213 { 1214 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithVAT); 1215 combinedPriceTotal = productPrice + combinedPriceTotal; 1216 } 1217 1218 } 1219 1220 1221 1222 if (baseProductId != null) 1223 { 1224 1225 var simProdStock = 0; 1226 1227 <div class="fixed-height-boxes col-md-@wrapperCount"> 1228 1229 @foreach (var i in listOffProducts) 1230 { 1231 itemCounter++; 1232 var showHoverEfect = ""; 1233 if (itemCounter > 1) 1234 { 1235 showHoverEfect = "combinedProductLinkHover"; 1236 } 1237 1238 <div class=" col-md-@columnClass combindeProducts @showHoverEfect"> 1239 1240 @{ 1241 1242 string productNumberClean = i.Number.Replace("/", "-"); 1243 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"; 1244 var isCampaigne = (Boolean)i.GetProductFieldValue("productCampaign"); 1245 var isnews = (Boolean)i.GetProductFieldValue("productNews"); 1246 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 1247 string productId = i.Number + "-at-SHOP1"; 1248 var combindeProductsBuy = ""; 1249 var classAHref = ""; 1250 1251 if (isCampaigne && isnews) 1252 { 1253 <div class="labels"> 1254 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 1255 1256 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 1257 </div> 1258 } 1259 1260 else if (isnews) 1261 { 1262 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 1263 } 1264 1265 else if (isCampaigne) 1266 { 1267 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 1268 } 1269 1270 } 1271 1272 @if (itemCounter > 1) 1273 { 1274 1275 1276 prodLink = "/Default.aspx?ID=" + ProductsPageId + "&GroupID=" + GetValue("Ecom:Product.PrimaryOrFirstGroupID") + "&ProductID=" + i.IdUrlEncoded; 1277 1278 combindeProductsBuy = ""; 1279 //showHoverEfect = "combinedProductLinkHover"; 1280 } 1281 else 1282 { 1283 combindeProductsBuy = "combindeProductsBuy"; 1284 } 1285 1286 @if (itemCounter == 1) 1287 { 1288 classAHref = "buyHref"; 1289 } 1290 1291 <div class="thumbnail dropdown-info @showHoverEfect"> 1292 <a href=@prodLink class="@classAHref" > 1293 <div class="display-img"> 1294 <img alt="@i.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 1295 </div> 1296 1297 <div class="display-name"> 1298 <div class="name-info"> 1299 <div class="itemBrand">@i.GetProductFieldValue("productTrademark")</div> 1300 1301 <div class="itemName">@i.Name</div> 1302 1303 @if (!string.IsNullOrEmpty(i.GetProductFieldValue("productSeries").ToString())) 1304 { 1305 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @i.GetProductFieldValue("productSeries")</div> 1306 } 1307 1308 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @i.Number</div> 1309 1310 </div> 1311 </div> 1312 </a> 1313 </div> 1314 @*//Add the + sign on combined products.*@ 1315 @if (itemCounter > 1) 1316 { 1317 <div class="circle"><h1 class="relatedProduct">+</h1></div> 1318 } 1319 </div> 1320 1321 1322 1323 <div class="@combindeProductsBuy" style="@buyButtonStyle"> 1324 @if (itemCounter <= 1) 1325 { 1326 1327 <div class="itemPrice" id='id_@i.Number'> 1328 1329 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1330 { 1331 1332 string CustomerPriceFormatted = combinedPriceTotal.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1333 1334 <span>@CustomerPriceFormatted</span> 1335 1336 } 1337 else 1338 { 1339 1340 var ConsumerPriceWithVatFormatted = combinedPriceTotal.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1341 1342 if (combinedDiscounts > 0) 1343 { 1344 1345 var ConsumerOldProductPrice = combinedPriceTotal + combinedDiscounts; 1346 1347 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1348 1349 <div class="item-main-info campaign-price"> 1350 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 1351 <span>@ConsumerPriceWithVatFormatted</span> 1352 </div> 1353 } 1354 else 1355 { 1356 1357 <div class="itemPrice"> 1358 <div class="item-main-info"> 1359 <span>@ConsumerPriceWithVatFormatted</span> 1360 </div> 1361 </div> 1362 } 1363 } 1364 </div> 1365 } 1366 1367 1368 1369 1370 1371 @*//If its the base product add the price and buy button*@ 1372 @if (i.Number == baseProductId) 1373 { 1374 1375 if (!hideCart && itemCounter <= 1) 1376 { 1377 string simProdDisabledState = ""; 1378 var getSimProductId = productId; 1379 1380 simProdStock = HelperClass.StockValue(getSimProductId); 1381 1382 1383 if (simProdStock <= 2) 1384 { 1385 simProdDisabledState = "disabled card"; 1386 } 1387 1388 <form name="multiForm" id="multiForm" method="post" class="form-inline product-card-buy-button relatedProducts @buttonClass @simProdDisabledState "> 1389 1390 @{ 1391 1392 var addedItems = new Dictionary<string, string>(); 1393 1394 addedItems.Add("CartCmd", "addmulti"); 1395 var productLoopCounter = 1; 1396 foreach (var s in listOfIds) 1397 { 1398 1399 var countVal = productLoopCounter.ToString(); 1400 1401 addedItems.Add("ProductLoopCounter" + countVal, countVal); 1402 addedItems.Add("ProductID" + countVal, s); 1403 addedItems.Add("VariantID" + countVal, ""); 1404 addedItems.Add("UnitID" + countVal, ""); 1405 addedItems.Add("Quantity" + countVal, "1"); 1406 1407 productLoopCounter++; 1408 } 1409 1410 } 1411 1412 <span id="multiProductData" data-json=@JsonConvert.SerializeObject(addedItems)> 1413 </span> 1414 <button id="btnBuy" 1415 onclick="Cart.addMultiProduct(@GetValue("Ecom:Product:Page.ID"),this)" 1416 class="btn btn-default" type="button"> 1417 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 1418 <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 " /> 1419 <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" /> 1420 <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" /> 1421 <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 " /> 1422 <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 " /> 1423 <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" /> 1424 <polygon points="19 5.8 19 5.8 19 5.8 " /> 1425 </svg> 1426 <i class="fa fa-refresh"></i> 1427 @if (loggedIn) 1428 { 1429 <span class="buyText">@Translate("productBuyButtonText", "Köp")</span> 1430 } 1431 </button> 1432 1433 </form> 1434 1435 } 1436 1437 } 1438 1439 </div> 1440 } 1441 </div> 1442 1443 } 1444 1445 } 1446 1447 1448 <div class="combined-products alsoLookedAt"> 1449 <h2 class="combined-products-mobile"><span>@Translate("productHeaderAlsoLookedAt", "Andra Har även tittat på:")</span></h2> 1450 1451 <div class="row"> 1452 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1453 @using System.Activities.Statements 1454 @using Dynamicweb.Ecommerce.Products 1455 @using System.Globalization 1456 @using System.Security.Cryptography 1457 @using App_Code 1458 1459 1460 1461 @{ 1462 1463 // Get and set values 1464 1465 var itemCountToList = 3 - productCount; 1466 var singleItemClass = ""; 1467 1468 if (productCount == 3 || productCount < 1) 1469 { 1470 itemCountToList = 4; 1471 1472 } 1473 1474 if (productCount == 2) 1475 { 1476 singleItemClass = "singleItem"; 1477 1478 } 1479 1480 var customersAlsoLookedAt = GetLoop("eCom:Related.CustomersWhoSawThisAlsoSaw").GetRange(0, itemCountToList); 1481 1482 1483 if (customersAlsoLookedAt != null) 1484 { 1485 1486 var thisProdStock = 0; 1487 1488 1489 foreach (LoopItem loopitem in customersAlsoLookedAt) 1490 { 1491 var product = productServise.GetProductByNumber(loopitem.GetString("Ecom:Product.Number"), false); 1492 1493 <div class="col-md-3"> 1494 1495 @{ 1496 1497 string productNumberClean = product.Number.Replace("/", "-"); 1498 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"; 1499 var isCampaigne = (Boolean)product.GetProductFieldValue("productCampaign"); 1500 var isnews = (Boolean)product.GetProductFieldValue("productNews"); 1501 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 1502 string productId = product.Number + "-at-SHOP1"; 1503 1504 if (isCampaigne && isnews) 1505 { 1506 <div class="labels"> 1507 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 1508 1509 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 1510 </div> 1511 } 1512 1513 else if (isnews) 1514 { 1515 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 1516 } 1517 1518 else if (isCampaigne) 1519 { 1520 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 1521 } 1522 1523 } 1524 1525 <div class="thumbnail dropdown-info @singleItemClass"> 1526 <a href="/Default.aspx?ID=@ProductsPageId&GroupID=@GetValue("Ecom:Product.PrimaryOrFirstGroupID")&ProductID=@product.IdUrlEncoded"> 1527 <div class="display-img"> 1528 <img alt="@product.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 1529 </div> 1530 <div class="display-name"> 1531 <div class="name-info"> 1532 <div class="itemBrand">@product.GetProductFieldValue("productTrademark")</div> 1533 <div class="itemName">@product.Name</div> 1534 @if (!string.IsNullOrEmpty(product.GetProductFieldValue("productSeries").ToString())) 1535 { 1536 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @product.GetProductFieldValue("productSeries")</div> 1537 } 1538 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @product.Number</div> 1539 <div class="itemPrice" id='id_@product.Number'> 1540 1541 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1542 { 1543 1544 decimal CustomerPrice = Convert.ToDecimal(!string.IsNullOrEmpty(product.Price.PriceWithoutVAT.ToString()) ? product.Price.PriceWithoutVAT.ToString() : "0"); 1545 string CustomerPriceFormatted = CustomerPrice.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1546 1547 1548 1549 <span>@CustomerPriceFormatted</span> 1550 1551 } 1552 else 1553 { 1554 decimal ConsumnerPriceWithVat = Convert.ToDecimal(!string.IsNullOrEmpty(product.Price.PriceWithVAT.ToString()) ? product.Price.PriceWithVAT.ToString() : "0"); 1555 var ConsumnerPriceWithVatFormatted = ConsumnerPriceWithVat.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1556 1557 //Campaign price graphics 1558 double ConsumerOldProductPrice = double.Parse(product.GetProductFieldValue("OldProductPrice").ToString(), CultureInfo.InvariantCulture); 1559 ConsumerOldProductPrice = ConsumerOldProductPrice * 1.25; 1560 1561 if (isCampaigne && ConsumerOldProductPrice > 0) 1562 { 1563 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1564 1565 <div class="item-main-info campaign-price"> 1566 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 1567 <span>@ConsumnerPriceWithVatFormatted </span> 1568 </div> 1569 1570 } 1571 else 1572 { 1573 1574 <div class="itemPrice"> 1575 1576 <div class="item-main-info"> 1577 <span>@ConsumnerPriceWithVatFormatted</span> 1578 </div> 1579 1580 </div> 1581 1582 1583 1584 1585 } 1586 1587 } 1588 </div> 1589 </div> 1590 </div> 1591 </a> 1592 1593 @if (!hideCart) 1594 { 1595 string simProdDisabledState = ""; 1596 var thisProductId = productId; 1597 1598 thisProdStock = HelperClass.StockValue(thisProductId); 1599 1600 1601 if (thisProdStock <= 2) 1602 { 1603 simProdDisabledState = "disabled card"; 1604 } 1605 1606 1607 1608 <form class="form-inline product-card-buy-button @buttonClass @simProdDisabledState "> 1609 <span> 1610 <button id="btnBuy" 1611 onclick="Cart.addToBasket(@ProductsPageId, '@productId', '@productNumberClean', this);" 1612 class="btn btn-default @buttonClass" type="button" style="float: right; margin-top: -35px;"> 1613 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 1614 <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 " /> 1615 <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" /> 1616 <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" /> 1617 <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 " /> 1618 <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 " /> 1619 <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" /> 1620 <polygon points="19 5.8 19 5.8 19 5.8 " /> 1621 </svg> 1622 @if (loggedIn) 1623 { 1624 @Translate("productBuyButtonText", "Köp"); 1625 } 1626 <i class="fa fa-refresh"></i> 1627 </span> 1628 </form> 1629 1630 1631 } 1632 1633 </div> 1634 1635 </div> 1636 1637 } 1638 } 1639 } 1640 1641 1642 1643 </div> 1644 </div> 1645 </div> 1646 <!--End Start Customers also looked at --> 1647 </div> 1648 </div> 1649 1650 } 1651 if (noOfCombinedProducts >= 3) 1652 { 1653 <div class="row combinedProducts" style="margin-left: 10px"> 1654 <div class="div-max1170-centered no-padding"> 1655 1656 <h2>@Translate("productHeaderCombinedProducts", "Kombinera Med:")</h2> 1657 <!--Start Customers also looked at --> 1658 <div class="combined-products"> 1659 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 1660 @using System 1661 @using System.Activities.Expressions 1662 @using System.Globalization 1663 @using System.Linq 1664 @using System.Web.Script.Serialization 1665 @using App_Code 1666 @using Dynamicweb.Controls 1667 @using Dynamicweb.Controls.Extensibility 1668 @using Dynamicweb.Ecommerce.Cart 1669 @using Dynamicweb.Ecommerce.Notifications 1670 @using Dynamicweb.Ecommerce.Products 1671 @using Dynamicweb.Management.Ecommerce 1672 @using Lucene.Net.Search 1673 @using Microsoft.CodeAnalysis.VisualBasic.Syntax 1674 @using Newtonsoft.Json 1675 1676 1677 1678 1679 1680 @{ 1681 1682 1683 1684 //Get the real data for the combined products 1685 var combinedProductString = GetValue("Ecom:Product:Field.CombinedProducts").ToString(); 1686 1687 //If no products to combine dont continue 1688 if (combinedProductString.Length < 1) 1689 { 1690 return; 1691 } 1692 1693 var productServise = new ProductService(); 1694 var baseProductId = prodnumber; 1695 var listOfCombinedProducts = new List<string>(); 1696 var prodLink = "#"; 1697 var columnClass = ""; 1698 var wrapperCount = ""; 1699 var buyButtonStyle = ""; 1700 1701 1702 // Split the product IDs into array 1703 string[] dataSplit = (combinedProductString).Replace(" ", "").Split(','); 1704 1705 //Add to list 1706 foreach (var product in dataSplit) 1707 { 1708 var productId = product; 1709 1710 listOfCombinedProducts.Add(productId); 1711 } 1712 1713 //change layout per no of products 1714 switch (dataSplit.Length) 1715 { 1716 case 1: 1717 columnClass = "2"; 1718 wrapperCount = "6"; 1719 buyButtonStyle = "bottom:20px; margin-right:-28px; width:190px; padding-left:15px"; //Use this to add extra style to buy button 1720 break; 1721 case 2: 1722 columnClass = "3"; 1723 wrapperCount = "9"; 1724 buyButtonStyle = "bottom:20px; margin-right:5px;"; //Use this to add extra style to buy button 1725 break; 1726 case 3: 1727 columnClass = "4"; 1728 wrapperCount = "12"; 1729 wrapperCount = null; 1730 buyButtonStyle = "bottom:-458px"; //Use this to add extra style to buy button 1731 break; 1732 } 1733 1734 var listOffProducts = new List<Product>(); 1735 1736 //Make the base product first item 1737 listOffProducts.Add(productServise.GetProductByNumber(baseProductId, true)); 1738 //get and and add product price to combined total price 1739 1740 double combinedPriceTotal = 0; 1741 double combinedDiscounts = 0; 1742 1743 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1744 { 1745 var baseProductPrice = Convert.ToDouble(productServise.GetProductByNumber(baseProductId, true).GetPrice("SEK", "SE").PriceWithoutVAT); 1746 combinedPriceTotal = baseProductPrice; 1747 } 1748 else 1749 { 1750 1751 var baseProductPrice = Convert.ToDouble(productServise.GetProductByNumber(baseProductId, true).GetPrice("SEK", "SE").PriceWithVAT); 1752 combinedPriceTotal = baseProductPrice; 1753 } 1754 1755 var productCount = listOfCombinedProducts.Count; 1756 var itemCounter = 0; 1757 var listOfIds = new List<string>(); 1758 var containsCampaign = false; 1759 1760 //Add main product to list of ids 1761 listOfIds.Add(productServise.GetProductByNumber(baseProductId, true).Id); 1762 1763 //Add combined products to list of ids 1764 foreach (var item in listOfCombinedProducts) 1765 { 1766 var items = productServise.GetProductByNumber(item, true); 1767 1768 //If product Id is incorrect do not continue 1769 if (items == null) 1770 { 1771 return; 1772 } 1773 1774 listOffProducts.Add(items); 1775 listOfIds.Add(items.Id); 1776 1777 containsCampaign = (bool)productServise.GetProductByNumber(items.Number, false).ProductFieldValues.GetProductFieldValue("productCampaign").Value; 1778 1779 //check if there is a campaign product in the list and add them together 1780 if (containsCampaign == true) 1781 { 1782 // Consumer old price - for campaign price graphics 1783 var test = items.Number.ToString(); 1784 var productConsumerOldPrice = 0.0; 1785 var oldPriceAsString = productServise.GetProductByNumber(items.Number, false).ProductFieldValues.GetProductFieldValue("OldProductPrice").Value.ToString(); 1786 productConsumerOldPrice = Convert.ToDouble(oldPriceAsString, CultureInfo.InvariantCulture); 1787 1788 var productConsumerOldPriceWithVat = productConsumerOldPrice * 1.25; 1789 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithVAT); 1790 combinedDiscounts = productConsumerOldPriceWithVat - productPrice; 1791 1792 } 1793 1794 //get and and add each combined products price and add to the combined total price 1795 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1796 { 1797 1798 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithoutVAT); 1799 combinedPriceTotal = productPrice + combinedPriceTotal; 1800 } 1801 else 1802 { 1803 var productPrice = Convert.ToDouble(productServise.GetProductByNumber(items.Number, false).GetPrice("SEK", "SE").PriceWithVAT); 1804 combinedPriceTotal = productPrice + combinedPriceTotal; 1805 } 1806 1807 } 1808 1809 1810 1811 if (baseProductId != null) 1812 { 1813 1814 var simProdStock = 0; 1815 1816 <div class="fixed-height-boxes col-md-@wrapperCount"> 1817 1818 @foreach (var i in listOffProducts) 1819 { 1820 itemCounter++; 1821 var showHoverEfect = ""; 1822 if (itemCounter > 1) 1823 { 1824 showHoverEfect = "combinedProductLinkHover"; 1825 } 1826 1827 <div class=" col-md-@columnClass combindeProducts @showHoverEfect"> 1828 1829 @{ 1830 1831 string productNumberClean = i.Number.Replace("/", "-"); 1832 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"; 1833 var isCampaigne = (Boolean)i.GetProductFieldValue("productCampaign"); 1834 var isnews = (Boolean)i.GetProductFieldValue("productNews"); 1835 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 1836 string productId = i.Number + "-at-SHOP1"; 1837 var combindeProductsBuy = ""; 1838 var classAHref = ""; 1839 1840 if (isCampaigne && isnews) 1841 { 1842 <div class="labels"> 1843 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 1844 1845 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 1846 </div> 1847 } 1848 1849 else if (isnews) 1850 { 1851 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 1852 } 1853 1854 else if (isCampaigne) 1855 { 1856 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 1857 } 1858 1859 } 1860 1861 @if (itemCounter > 1) 1862 { 1863 1864 1865 prodLink = "/Default.aspx?ID=" + ProductsPageId + "&GroupID=" + GetValue("Ecom:Product.PrimaryOrFirstGroupID") + "&ProductID=" + i.IdUrlEncoded; 1866 1867 combindeProductsBuy = ""; 1868 //showHoverEfect = "combinedProductLinkHover"; 1869 } 1870 else 1871 { 1872 combindeProductsBuy = "combindeProductsBuy"; 1873 } 1874 1875 @if (itemCounter == 1) 1876 { 1877 classAHref = "buyHref"; 1878 } 1879 1880 <div class="thumbnail dropdown-info @showHoverEfect"> 1881 <a href=@prodLink class="@classAHref" > 1882 <div class="display-img"> 1883 <img alt="@i.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 1884 </div> 1885 1886 <div class="display-name"> 1887 <div class="name-info"> 1888 <div class="itemBrand">@i.GetProductFieldValue("productTrademark")</div> 1889 1890 <div class="itemName">@i.Name</div> 1891 1892 @if (!string.IsNullOrEmpty(i.GetProductFieldValue("productSeries").ToString())) 1893 { 1894 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @i.GetProductFieldValue("productSeries")</div> 1895 } 1896 1897 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @i.Number</div> 1898 1899 </div> 1900 </div> 1901 </a> 1902 </div> 1903 @*//Add the + sign on combined products.*@ 1904 @if (itemCounter > 1) 1905 { 1906 <div class="circle"><h1 class="relatedProduct">+</h1></div> 1907 } 1908 </div> 1909 1910 1911 1912 <div class="@combindeProductsBuy" style="@buyButtonStyle"> 1913 @if (itemCounter <= 1) 1914 { 1915 1916 <div class="itemPrice" id='id_@i.Number'> 1917 1918 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1919 { 1920 1921 string CustomerPriceFormatted = combinedPriceTotal.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1922 1923 <span>@CustomerPriceFormatted</span> 1924 1925 } 1926 else 1927 { 1928 1929 var ConsumerPriceWithVatFormatted = combinedPriceTotal.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1930 1931 if (combinedDiscounts > 0) 1932 { 1933 1934 var ConsumerOldProductPrice = combinedPriceTotal + combinedDiscounts; 1935 1936 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 1937 1938 <div class="item-main-info campaign-price"> 1939 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 1940 <span>@ConsumerPriceWithVatFormatted</span> 1941 </div> 1942 } 1943 else 1944 { 1945 1946 <div class="itemPrice"> 1947 <div class="item-main-info"> 1948 <span>@ConsumerPriceWithVatFormatted</span> 1949 </div> 1950 </div> 1951 } 1952 } 1953 </div> 1954 } 1955 1956 1957 1958 1959 1960 @*//If its the base product add the price and buy button*@ 1961 @if (i.Number == baseProductId) 1962 { 1963 1964 if (!hideCart && itemCounter <= 1) 1965 { 1966 string simProdDisabledState = ""; 1967 var getSimProductId = productId; 1968 1969 simProdStock = HelperClass.StockValue(getSimProductId); 1970 1971 1972 if (simProdStock <= 2) 1973 { 1974 simProdDisabledState = "disabled card"; 1975 } 1976 1977 <form name="multiForm" id="multiForm" method="post" class="form-inline product-card-buy-button relatedProducts @buttonClass @simProdDisabledState "> 1978 1979 @{ 1980 1981 var addedItems = new Dictionary<string, string>(); 1982 1983 addedItems.Add("CartCmd", "addmulti"); 1984 var productLoopCounter = 1; 1985 foreach (var s in listOfIds) 1986 { 1987 1988 var countVal = productLoopCounter.ToString(); 1989 1990 addedItems.Add("ProductLoopCounter" + countVal, countVal); 1991 addedItems.Add("ProductID" + countVal, s); 1992 addedItems.Add("VariantID" + countVal, ""); 1993 addedItems.Add("UnitID" + countVal, ""); 1994 addedItems.Add("Quantity" + countVal, "1"); 1995 1996 productLoopCounter++; 1997 } 1998 1999 } 2000 2001 <span id="multiProductData" data-json=@JsonConvert.SerializeObject(addedItems)> 2002 </span> 2003 <button id="btnBuy" 2004 onclick="Cart.addMultiProduct(@GetValue("Ecom:Product:Page.ID"),this)" 2005 class="btn btn-default" type="button"> 2006 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 2007 <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 " /> 2008 <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" /> 2009 <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" /> 2010 <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 " /> 2011 <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 " /> 2012 <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" /> 2013 <polygon points="19 5.8 19 5.8 19 5.8 " /> 2014 </svg> 2015 <i class="fa fa-refresh"></i> 2016 @if (loggedIn) 2017 { 2018 <span class="buyText">@Translate("productBuyButtonText", "Köp")</span> 2019 } 2020 </button> 2021 2022 </form> 2023 2024 } 2025 2026 } 2027 2028 </div> 2029 } 2030 </div> 2031 2032 } 2033 2034 } 2035 2036 2037 </div> 2038 <!--End Start Customers also looked at --> 2039 </div> 2040 </div> 2041 2042 <!--If its new row(3 combined products then use normal styling) for the others have also looked at--> 2043 <div class="row similar-Products-hide-if-empty"> 2044 <div class="div-max1170-centered no-padding"> 2045 <div class="similar-products alsoLookedAt"> 2046 <h2>@Translate("productHeaderAlsoLookedAt", "Andra Har även tittat på:")</h2> 2047 <div class="form-group inline"> 2048 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2049 @using System.Activities.Statements 2050 @using Dynamicweb.Ecommerce.Products 2051 @using System.Globalization 2052 @using System.Security.Cryptography 2053 @using App_Code 2054 2055 2056 2057 @{ 2058 2059 // Get and set values 2060 2061 var itemCountToList = 3 - productCount; 2062 var singleItemClass = ""; 2063 2064 if (productCount == 3 || productCount < 1) 2065 { 2066 itemCountToList = 4; 2067 2068 } 2069 2070 if (productCount == 2) 2071 { 2072 singleItemClass = "singleItem"; 2073 2074 } 2075 2076 var customersAlsoLookedAt = GetLoop("eCom:Related.CustomersWhoSawThisAlsoSaw").GetRange(0, itemCountToList); 2077 2078 2079 if (customersAlsoLookedAt != null) 2080 { 2081 2082 var thisProdStock = 0; 2083 2084 2085 foreach (LoopItem loopitem in customersAlsoLookedAt) 2086 { 2087 var product = productServise.GetProductByNumber(loopitem.GetString("Ecom:Product.Number"), false); 2088 2089 <div class="col-md-3"> 2090 2091 @{ 2092 2093 string productNumberClean = product.Number.Replace("/", "-"); 2094 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"; 2095 var isCampaigne = (Boolean)product.GetProductFieldValue("productCampaign"); 2096 var isnews = (Boolean)product.GetProductFieldValue("productNews"); 2097 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 2098 string productId = product.Number + "-at-SHOP1"; 2099 2100 if (isCampaigne && isnews) 2101 { 2102 <div class="labels"> 2103 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 2104 2105 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 2106 </div> 2107 } 2108 2109 else if (isnews) 2110 { 2111 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 2112 } 2113 2114 else if (isCampaigne) 2115 { 2116 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 2117 } 2118 2119 } 2120 2121 <div class="thumbnail dropdown-info @singleItemClass"> 2122 <a href="/Default.aspx?ID=@ProductsPageId&GroupID=@GetValue("Ecom:Product.PrimaryOrFirstGroupID")&ProductID=@product.IdUrlEncoded"> 2123 <div class="display-img"> 2124 <img alt="@product.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 2125 </div> 2126 <div class="display-name"> 2127 <div class="name-info"> 2128 <div class="itemBrand">@product.GetProductFieldValue("productTrademark")</div> 2129 <div class="itemName">@product.Name</div> 2130 @if (!string.IsNullOrEmpty(product.GetProductFieldValue("productSeries").ToString())) 2131 { 2132 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @product.GetProductFieldValue("productSeries")</div> 2133 } 2134 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @product.Number</div> 2135 <div class="itemPrice" id='id_@product.Number'> 2136 2137 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 2138 { 2139 2140 decimal CustomerPrice = Convert.ToDecimal(!string.IsNullOrEmpty(product.Price.PriceWithoutVAT.ToString()) ? product.Price.PriceWithoutVAT.ToString() : "0"); 2141 string CustomerPriceFormatted = CustomerPrice.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 2142 2143 2144 2145 <span>@CustomerPriceFormatted</span> 2146 2147 } 2148 else 2149 { 2150 decimal ConsumnerPriceWithVat = Convert.ToDecimal(!string.IsNullOrEmpty(product.Price.PriceWithVAT.ToString()) ? product.Price.PriceWithVAT.ToString() : "0"); 2151 var ConsumnerPriceWithVatFormatted = ConsumnerPriceWithVat.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 2152 2153 //Campaign price graphics 2154 double ConsumerOldProductPrice = double.Parse(product.GetProductFieldValue("OldProductPrice").ToString(), CultureInfo.InvariantCulture); 2155 ConsumerOldProductPrice = ConsumerOldProductPrice * 1.25; 2156 2157 if (isCampaigne && ConsumerOldProductPrice > 0) 2158 { 2159 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 2160 2161 <div class="item-main-info campaign-price"> 2162 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 2163 <span>@ConsumnerPriceWithVatFormatted </span> 2164 </div> 2165 2166 } 2167 else 2168 { 2169 2170 <div class="itemPrice"> 2171 2172 <div class="item-main-info"> 2173 <span>@ConsumnerPriceWithVatFormatted</span> 2174 </div> 2175 2176 </div> 2177 2178 2179 2180 2181 } 2182 2183 } 2184 </div> 2185 </div> 2186 </div> 2187 </a> 2188 2189 @if (!hideCart) 2190 { 2191 string simProdDisabledState = ""; 2192 var thisProductId = productId; 2193 2194 thisProdStock = HelperClass.StockValue(thisProductId); 2195 2196 2197 if (thisProdStock <= 2) 2198 { 2199 simProdDisabledState = "disabled card"; 2200 } 2201 2202 2203 2204 <form class="form-inline product-card-buy-button @buttonClass @simProdDisabledState "> 2205 <span> 2206 <button id="btnBuy" 2207 onclick="Cart.addToBasket(@ProductsPageId, '@productId', '@productNumberClean', this);" 2208 class="btn btn-default @buttonClass" type="button" style="float: right; margin-top: -35px;"> 2209 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 2210 <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 " /> 2211 <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" /> 2212 <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" /> 2213 <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 " /> 2214 <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 " /> 2215 <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" /> 2216 <polygon points="19 5.8 19 5.8 19 5.8 " /> 2217 </svg> 2218 @if (loggedIn) 2219 { 2220 @Translate("productBuyButtonText", "Köp"); 2221 } 2222 <i class="fa fa-refresh"></i> 2223 </span> 2224 </form> 2225 2226 2227 } 2228 2229 </div> 2230 2231 </div> 2232 2233 } 2234 } 2235 } 2236 2237 2238 2239 </div> 2240 </div> 2241 </div> 2242 </div> 2243 2244 } 2245 2246 } 2247 <!--End Combined products --> 2248 <!--Start Similar products --> 2249 <div class="row similar-Products-hide-if-empty"> 2250 <div class="div-max1170-centered no-padding"> 2251 <div class="similar-products"> 2252 <h2>@Translate("productHeaderSimilarProducts", "Liknande produkter:")</h2> 2253 <div class="form-group inline"> 2254 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2255 @using System.Activities.Statements 2256 @using Dynamicweb.Ecommerce.Products 2257 @using System.Globalization 2258 @using System.Security.Cryptography 2259 @using App_Code 2260 2261 @*Liknande produkter yta - speciell urvalslogik 2262 Dessa ska sökas fram enligt följande logik: 2263 Produkter i samma kategori 2264 Ta 2 som ligger närmast i pris uppåt 2265 Ta 2 som ligger närmast i pris nedåt*@ 2266 2267 @{ 2268 bool isGlobal = Convert.ToBoolean(Pageview.Area.Item["FilterGlobalProductsOnly"]); 2269 2270 // Get and set values 2271 var groupID = GetString("Ecom:Group.ID"); 2272 var productID = GetString("Ecom:Product.ID"); 2273 if (groupID == null & productID == null) 2274 { 2275 return; 2276 } 2277 var similarProducts = new SimilarProducts().GetSimilarProducts(groupID, productID, isGlobal); 2278 2279 if (similarProducts != null) 2280 { 2281 Dynamicweb.Ecommerce.LiveIntegration.Products.ProductManager.FetchProductInfos(similarProducts); 2282 var simProdStock = 0; 2283 2284 <div class="fixed-height-boxes"> 2285 2286 2287 @foreach (var i in similarProducts) 2288 { 2289 2290 <div class="col-md-3"> 2291 2292 @{ 2293 2294 string productNumberClean = i.Number.Replace("/", "-"); 2295 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"; 2296 var isCampaigne = (Boolean)i.GetProductFieldValue("productCampaign"); 2297 var isnews = (Boolean)i.GetProductFieldValue("productNews"); 2298 string ProductsPageId = GetPageIdByNavigationTag("ProductsPage").ToString(); 2299 string productId = i.Number + "-at-SHOP1"; 2300 2301 if (isCampaigne && isnews) 2302 { 2303 <div class="labels"> 2304 <button class="btn btn-small btn-danger product-flag campaign">@Translate("product_Campaign_tag", "Campaign")</button> 2305 2306 <button class="btn btn-small btn-default product-flag news">@Translate("product_News_tag", "News")</button> 2307 </div> 2308 } 2309 2310 else if (isnews) 2311 { 2312 <button class="btn btn-small btn-default product-flag news alone">@Translate("product_News_tag", "News")</button> 2313 } 2314 2315 else if (isCampaigne) 2316 { 2317 <button class="btn btn-small btn-danger product-flag campaign alone">@Translate("product_Campaign_tag", "Campaign")</button> 2318 } 2319 2320 } 2321 2322 <div class="thumbnail dropdown-info"> 2323 <a href="/Default.aspx?ID=@ProductsPageId&GroupID=@GetValue("Ecom:Product.PrimaryOrFirstGroupID")&ProductID=@i.IdUrlEncoded"> 2324 <div class="display-img"> 2325 <img alt="@i.Name" src="@imgsrc" data-original="@imgsrc" class="img-responsive lazy"> 2326 </div> 2327 <div class="display-name"> 2328 <div class="name-info"> 2329 <div class="itemBrand">@i.GetProductFieldValue("productTrademark")</div> 2330 <div class="itemName">@i.Name</div> 2331 @if (!string.IsNullOrEmpty(i.GetProductFieldValue("productSeries").ToString())) 2332 { 2333 <div class="itemBrand">@Translate("productListSeriesLabel", "Serie:") @i.GetProductFieldValue("productSeries")</div> 2334 } 2335 <div class="itemNumber">@Translate("productListArticleNrLabel", "Art. nr:") @i.Number</div> 2336 <div class="itemPrice" id='id_@i.Number'> 2337 2338 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 2339 { 2340 2341 decimal CustomerPrice = Convert.ToDecimal(!string.IsNullOrEmpty(i.Price.PriceWithoutVAT.ToString()) ? i.Price.PriceWithoutVAT.ToString() : "0"); 2342 string CustomerPriceFormatted = CustomerPrice.ToString("n", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 2343 2344 2345 2346 <span>@CustomerPriceFormatted</span> 2347 2348 } 2349 else 2350 { 2351 decimal ConsumnerPriceWithVat = Convert.ToDecimal(!string.IsNullOrEmpty(i.Price.PriceWithVAT.ToString()) ? i.Price.PriceWithVAT.ToString() : "0"); 2352 var ConsumnerPriceWithVatFormatted = ConsumnerPriceWithVat.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 2353 2354 //Campaign price graphics 2355 double ConsumerOldProductPrice = double.Parse(i.GetProductFieldValue("OldProductPrice").ToString(), CultureInfo.InvariantCulture); 2356 ConsumerOldProductPrice = ConsumerOldProductPrice * 1.25; 2357 2358 if (isCampaigne && ConsumerOldProductPrice > 0) 2359 { 2360 string ConsumerOldProductPriceFormatted = ConsumerOldProductPrice.ToString("n0", new CultureInfo(GetGlobalValue("Global:Area.Culture.Name"))) + GetGlobalValue("Global:eCommerce.Currency.Symbol"); 2361 2362 <div class="item-main-info campaign-price"> 2363 <span class="old-price">@ConsumerOldProductPriceFormatted </span>&nbsp; 2364 <span>@ConsumnerPriceWithVatFormatted </span> 2365 </div> 2366 2367 } 2368 else 2369 { 2370 2371 <div class="itemPrice"> 2372 2373 <div class="item-main-info"> 2374 <span>@ConsumnerPriceWithVatFormatted</span> 2375 </div> 2376 2377 </div> 2378 2379 2380 2381 2382 } 2383 2384 } 2385 </div> 2386 </div> 2387 </div> 2388 </a> 2389 2390 @if (!hideCart) 2391 { 2392 string simProdDisabledState = ""; 2393 var getSimProductId = productId; 2394 2395 simProdStock = HelperClass.StockValue(getSimProductId); 2396 2397 2398 if (simProdStock <= 2) 2399 { 2400 simProdDisabledState = "disabled card"; 2401 } 2402 2403 2404 2405 <form class="form-inline product-card-buy-button @buttonClass @simProdDisabledState "> 2406 <span> 2407 <button id="btnBuy" 2408 onclick="Cart.addToBasket(@ProductsPageId, '@productId', '@productNumberClean', this);" 2409 class="btn btn-default @buttonClass" type="button" style="float: right; margin-top: -35px;"> 2410 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"> 2411 <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 " /> 2412 <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" /> 2413 <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" /> 2414 <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 " /> 2415 <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 " /> 2416 <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" /> 2417 <polygon points="19 5.8 19 5.8 19 5.8 " /> 2418 </svg> 2419 @if (loggedIn) 2420 { 2421 @Translate("productBuyButtonText", "Köp"); 2422 } 2423 <i class="fa fa-refresh"></i> 2424 </span> 2425 </form> 2426 2427 2428 } 2429 2430 </div> 2431 2432 </div> 2433 2434 } 2435 2436 2437 </div> 2438 2439 } 2440 } 2441 2442 2443 2444 </div> 2445 </div> 2446 </div> 2447 </div> 2448 <!--End Similar products --> 2449 } 2450 </div> 2451 2452 </section> 2453 2454 @if (imgFunctions) 2455 { 2456 <div class="modal fade y-modalCarousel" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> 2457 <div class="modal-dialog"> 2458 2459 <button class="close" type="button" data-dismiss="modal"> 2460 <i class="fa fa-close"></i> 2461 </button> 2462 2463 <div id="modalCarousel" class="carousel slide"> 2464 <div class="carousel-inner"> 2465 </div> 2466 2467 @if (imgControl) 2468 { 2469 <a class="left carousel-control" href="#modalCarousel" data-slide="prev"> 2470 <i class="fa fa-angle-left"></i> 2471 </a> 2472 <a class="right carousel-control" href="#modalCarousel" data-slide="next"> 2473 <i class="fa fa-angle-right"></i> 2474 </a> 2475 } 2476 <span class="cl-area" data-dismiss="modal"></span> 2477 </div> 2478 </div> 2479 </div> 2480 } 2481 2482 2483 2484 2485 2486 @functions { 2487 string GetPageContent(int pageId) 2488 { 2489 2490 try 2491 { 2492 string output = null; 2493 2494 var page = ServiceLocator.Current.GetPageService().GetPage(pageId); 2495 2496 if (!string.IsNullOrEmpty(page.ItemType) && !string.IsNullOrEmpty(page.ItemId)) 2497 { 2498 var item = Dynamicweb.Content.Items.Item.GetItemById(page.ItemType, page.ItemId); 2499 output = "<div>" + item["General_TextEditor"] + "</div>"; 2500 } 2501 else 2502 { 2503 var contentPageView = Dynamicweb.Frontend.PageView.GetPageviewByPageID(pageId); 2504 output = contentPageView.Output(); 2505 2506 // Remove everything but the actual page content 2507 var startTag = "<!--PageContentStart-->"; 2508 var endTag = "<!--PageContentEnd-->"; 2509 int startIndex = output.IndexOf(startTag) + startTag.Length; 2510 int endIndex = output.IndexOf(endTag, startIndex); 2511 output = output.Substring(startIndex, endIndex - startIndex); 2512 } 2513 2514 return output; 2515 } 2516 catch { } 2517 return null; 2518 } 2519 2520 } 2521 2522 <!-- Modals --> 2523 2524 @using Dynamicweb.Rendering.Translation 2525 @using System; 2526 2527 2528 @{ var LinkText = Translate("retail_search_webshop_button", "Webshop"); 2529 //var EAN = GetString("Ecom:Product:Field.produktEAN"); 2530 2531 } 2532 2533 2534 @*<input type="hidden" id="EAN" value="@EAN" />*@ 2535 2536 <div class="modal fade" id="findStore" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> 2537 <div class="modal-dialog" role="document"> 2538 <div class="modal-content"> 2539 <div class="modal-header"> 2540 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> 2541 <h1 class="modal-title" id="myModalLabel">@Translate("ProductlistBuy", "Buy")</h1> 2542 </div> 2543 <div class="modal-body col-sm-12"> 2544 <div class="col-lg-6 col-md-12 modal-search-form"> 2545 <form class="search-form"> 2546 <div class="row"> 2547 <button type="submit" class="button-primary"><i class="fa fa-search"></i></button> 2548 <input type="text" class="u-full-width search-field" autofocus placeholder="@Translate("reseller_post_number", "Enter postal number")" value=""> 2549 </div> 2550 <div class="row address"> 2551 <small class="formatted-address"></small> 2552 </div> 2553 </form> 2554 @*<ul class="search-filter"> 2555 @{ 2556 2557 var BrandlistListId = (int) Pageview.Area.Item["BrandList"]; 2558 var BrandlistItemList = Dynamicweb.Content.Items.ItemList.GetItemListById(BrandlistListId); 2559 var Brandlsloop = BrandlistItemList.Relations.Cast<Dynamicweb.Content.Items.Item>(); 2560 2561 foreach (var i in Brandlsloop) 2562 { 2563 2564 string brand = ""; 2565 try 2566 { 2567 string nameId = i["NameID"].ToString(); 2568 2569 2570 if (!String.IsNullOrEmpty(nameId)) 2571 { 2572 brand = nameId; 2573 2574 <li><label for="@brand"><input type="checkbox" id="@brand"><icon class="check"></icon>@brand</label></li> 2575 } 2576 2577 } 2578 catch (Exception ex) 2579 { 2580 Console.WriteLine(ex.ToString()); 2581 } 2582 2583 2584 } 2585 } 2586 </ul>*@ 2587 <div class="stores-list"></div> 2588 </div> 2589 <div class="col-lg-6 col-md-12 webshops"> 2590 <h2>@Translate("retail_search_webshop", "Online shops")</h2> 2591 2592 <div class="links"> 2593 <ul> 2594 @{ 2595 var ResellersListId = (int) Pageview.Area.Item["Resellers_List"]; 2596 var ResellersItemList = Dynamicweb.Content.Items.ItemList.GetItemListById(ResellersListId); 2597 var Resellersloop = ResellersItemList.Relations.Cast<Dynamicweb.Content.Items.Item>(); 2598 string curentBrand = GetString("Ecom:Product:Field.productTrademark"); 2599 2600 2601 foreach (var c in Resellersloop) 2602 { 2603 string linkText = c["LinkText"].ToString(); 2604 string landinpageLink = String.Empty; 2605 try 2606 { 2607 landinpageLink = c[curentBrand].ToString(); 2608 //landinpageLink = c["Chasseur"].ToString(); 2609 2610 2611 if (!String.IsNullOrEmpty(landinpageLink)) 2612 { 2613 2614 <li> 2615 @linkText 2616 <a href="@landinpageLink" target="_blank" title="@linkText" class="button">@Translate("retail_search_webshop_button", "Webshop")</a> 2617 </li> 2618 2619 } 2620 2621 2622 } 2623 catch (Exception ex) 2624 { 2625 2626 Console.WriteLine(ex.ToString()); 2627 } 2628 2629 } 2630 2631 } 2632 2633 2634 </ul> 2635 </div> 2636 </div> 2637 </div> 2638 </div> 2639 </div> 2640 </div> 2641 2642 2643 2644 @{ 2645 var hostUrl = GetGlobalValue("Global:Request.Host"); 2646 } 2647 2648 @{ 2649 2650 var facebookdescription = GetString("Ecom:Product:Field.DescriptionLong"); 2651 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"; 2652 2653 var facebookdescriptionFormated = Regex.Replace(facebookdescription, @"<[^>]*>", String.Empty); 2654 } 2655 2656 @SnippetStart("FacebookOGProductMeta") 2657 2658 <meta property='og:type' content='website' /> 2659 <meta property='og:title' content='@GetString("Ecom:Product.Name")' /> 2660 <meta property='og:image' content='@imageString' /> 2661 <meta property='og:description' content='@facebookdescriptionFormated' /> 2662 <meta property='og:url' content='@GetGlobalValue("Global:Request.Scheme")://@GetGlobalValue("Global:Request.Host")@GetGlobalValue("Global:Pageview.Url")' /> 2663 2664 @SnippetEnd("FacebookOGProductMeta")

Meny

Cookies på sidan

Denna webbplats använder cookies (kakor) för statistik, anpassat innehåll och annonser.

You can always delete saved cookies by visiting the advanced settings of your browser

Vis detaljer