Error executing template "Designs/Default/eCom/ProductCatalog/ProductList.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed7c884858b740219781e3a26675cf5d.Execute() in E:\Dynamicweb.net\Solutions\Webshop\Files\Templates\Designs\Default\eCom\ProductCatalog\ProductList.cshtml:line 2287
   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 ViewModelTemplate<ProductListViewModel> 2 @using Dynamicweb; 3 @using Dynamicweb.Core; 4 @using Dynamicweb.Environment; 5 @using Dynamicweb.Environment.Helpers; 6 @using Dynamicweb.Rendering; 7 @using Dynamicweb.Ecommerce.ProductCatalog; 8 @using System.Linq; 9 @using Cookie = Dynamicweb.Environment.Cookie; 10 @using Gasa.ProductInformation.Helpers; 11 12 @using Dynamicweb.Ecommerce.Orders; 13 @using System.Globalization; 14 @using Dynamicweb.Security.UserManagement; 15 @using Dynamicweb.Security.UserManagement.Common.CustomFields; 16 @using Dynamicweb; 17 @using Dynamicweb.Core; 18 @using Dynamicweb.Environment; 19 @using Dynamicweb.Environment.Helpers; 20 @using Dynamicweb.Rendering; 21 @using Dynamicweb.Ecommerce.ProductCatalog; 22 @using System.Linq; 23 @using Gasa.ProductInformation; 24 25 @* Note that this file will be inserted directly into another one by Dynamicweb IncludeFile 26 before evaluating the Razor code, so keep the syntax right *@ 27 28 29 @* global functions *@ 30 31 @functions { 32 bool checkIfFileExists(string imgURL) 33 { 34 return System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath(imgURL)); 35 } 36 string FormatDiameter(string value) 37 { 38 if (string.IsNullOrEmpty(value)) 39 { 40 return value; 41 } 42 43 Decimal d; 44 if (Decimal.TryParse(value, out d)) 45 { 46 return Converter.ToDouble(value).ToString("0.0", Dynamicweb.Frontend.PageView.Current().Area.CultureInfo.NumberFormat); 47 //return d.ToString("0.0", Base.GetCulture(true)); 48 } 49 50 return value; 51 } 52 53 string FormatPrice(string value) 54 { 55 if (string.IsNullOrEmpty(value)) 56 { 57 return value; 58 } 59 60 Decimal d; 61 if (Decimal.TryParse(value, out d)) 62 { 63 return Converter.ToDouble(value).ToString("0.00", Dynamicweb.Frontend.PageView.Current().Area.CultureInfo.NumberFormat); 64 } 65 66 return value; 67 } 68 69 string AvailableDeliveryDay(int leadDays) 70 { 71 DateTime today = DateTime.Now.Date; 72 DateTime availableDate = today; 73 DateTime deliveryDate = Dynamicweb.Ecommerce.Common.Context.OrderTime; 74 TimeSpan daysDifference = deliveryDate - today; 75 CultureInfo localLanguage = System.Threading.Thread.CurrentThread.CurrentCulture; 76 string result; 77 78 int leadWeekendDays = 0; 79 80 81 // check how many weekends within lead days 82 for (var i = 0; i < leadDays; i++) 83 { 84 if (availableDate.AddDays(i).DayOfWeek == DayOfWeek.Saturday) 85 { 86 leadWeekendDays++; 87 } 88 else if (availableDate.AddDays(i).DayOfWeek == DayOfWeek.Sunday) 89 { 90 leadWeekendDays++; 91 } 92 } 93 94 // check how many weekends after lead weekdays 95 for (var i = 0; i < leadWeekendDays; i++) 96 { 97 if (availableDate.AddDays(leadDays + i).DayOfWeek == DayOfWeek.Saturday) 98 { 99 leadWeekendDays++; 100 } 101 else if (availableDate.AddDays(leadDays + i).DayOfWeek == DayOfWeek.Sunday) 102 { 103 leadWeekendDays++; 104 } 105 } 106 107 var leadDaysTotal = leadWeekendDays + leadDays; 108 109 availableDate = availableDate.AddDays(leadDaysTotal); 110 111 if (daysDifference.TotalDays >= leadDaysTotal && availableDate <= deliveryDate) 112 { 113 result = null; 114 } 115 else 116 { 117 result = availableDate.ToString("dd-MM-yyyy", localLanguage); 118 } 119 //result=daysDifference.TotalDays.ToString(); 120 return result; 121 } 122 123 /* 124 bool EnableEditing() 125 { 126 return EnableEditableBarcode(); 127 } 128 */ 129 130 bool? _enableManufacturerPage; 131 bool EnableManufacturerPage() 132 { 133 if (!_enableManufacturerPage.HasValue) 134 { 135 if (Pageview.Page.PropertyItem != null && Converter.ToBoolean(Pageview.Page.PropertyItem["EnableManufacturer"])) 136 { 137 _enableManufacturerPage = true; 138 } 139 else 140 { 141 _enableManufacturerPage = false; 142 } 143 } 144 return _enableManufacturerPage.Value; 145 } 146 147 ///* generic validation of custom user fields */ 148 //bool? returnCustomUserFieldValidation(string CustomerUserFieldString) 149 //{ 150 // return GetCustomUserField<bool>(user, CustomerUserFieldString); 151 //} 152 153 154 bool? _displayPricesInclVat; 155 bool DisplayPricesInclVat() 156 { 157 if (!_displayPricesInclVat.HasValue) 158 { 159 _displayPricesInclVat = GetCustomUserField<bool>("AccessUser_DisplayPricesInclVat"); 160 } 161 return _displayPricesInclVat.Value; 162 } 163 164 bool? _enableEditableItemNumber; 165 bool EnableEditableItemNumber() 166 { 167 if (!_enableEditableItemNumber.HasValue) 168 { 169 _enableEditableItemNumber = GetCustomUserField<bool>("AccessUser_EnableEditableItemNumber"); 170 } 171 return _enableEditableItemNumber.Value; 172 } 173 174 //AccessUser_EnableManufacturerFiltering 175 bool? _enableManufacturerFiltering; 176 bool EnableManufacturerFiltering(bool chkEnableManufacturerPageEnableManufacturerPage = true) 177 { 178 if (chkEnableManufacturerPageEnableManufacturerPage && !EnableManufacturerPage()) 179 return false; 180 181 if (!_enableManufacturerFiltering.HasValue) 182 { 183 _enableManufacturerFiltering = GetCustomUserField<bool>("AccessUser_EnableManufacturerFiltering"); 184 } 185 return _enableManufacturerFiltering.Value; 186 } 187 188 bool? _enableCustomerItemNumber; 189 bool EnableCustomerItemNumber() 190 { 191 if (!_enableCustomerItemNumber.HasValue) 192 { 193 _enableCustomerItemNumber = GetCustomUserField<bool>("AccessUser_EnableCustomerItemNumber"); 194 } 195 return _enableCustomerItemNumber.Value; 196 } 197 198 bool? _enableEditableRetailPrice; 199 bool EnableEditableRetailPrice() 200 { 201 if (!_enableEditableRetailPrice.HasValue) 202 { 203 _enableEditableRetailPrice = GetCustomUserField<bool>("AccessUser_EnableEditableRetailPrice"); 204 } 205 return _enableEditableRetailPrice.Value; 206 } 207 208 bool? _enableEditableBarcode; 209 bool EnableEditableBarcode() 210 { 211 if (!_enableEditableBarcode.HasValue) 212 { 213 _enableEditableBarcode = GetCustomUserField<bool>("AccessUser_EnableEditableBarcode"); 214 } 215 return _enableEditableBarcode.Value; 216 } 217 218 bool? _enableCustomerRetailPrice; 219 bool EnableCustomerRetailPrice() 220 { 221 if (!_enableCustomerRetailPrice.HasValue) 222 { 223 _enableCustomerRetailPrice = GetCustomUserField<bool>("AccessUser_EnableCustomerRetailPrice"); 224 } 225 return _enableCustomerRetailPrice.Value; 226 } 227 228 bool? _enableCustomerBarcode; 229 bool EnableCustomerBarcode() 230 { 231 if (!_enableCustomerBarcode.HasValue) 232 { 233 _enableCustomerBarcode = GetCustomUserField<bool>("AccessUser_EnableCustomerBarcode"); 234 } 235 return _enableCustomerBarcode.Value; 236 237 } 238 239 bool? _enableComments; 240 bool EnableComments() 241 { 242 if (!_enableComments.HasValue) 243 { 244 _enableComments = GetCustomUserField<bool>("AccessUser_EnableCommentOnLine"); 245 } 246 return _enableComments.Value; 247 } 248 249 bool? _enableMinimumCCQuantity; 250 bool EnableMinimumCCQuantity() 251 { 252 if (!_enableMinimumCCQuantity.HasValue) 253 { 254 _enableMinimumCCQuantity = GetCustomUserField<bool>("AccessUser_EnableMinimumCCQuantity"); 255 } 256 return _enableMinimumCCQuantity.Value; 257 } 258 bool? _enableFullCCCheck; 259 bool EnableFullCCCheck() 260 { 261 if (!_enableFullCCCheck.HasValue) 262 { 263 _enableFullCCCheck = GetCustomUserField<bool>("AccessUser_EnableFullCCCheck"); 264 } 265 return _enableFullCCCheck.Value; 266 } 267 268 bool? _enableDisplayGrossMargin; 269 bool EnableDisplayOfGrossMargin() 270 { 271 if (DisablePrices()) 272 return false; 273 274 if (!_enableDisplayGrossMargin.HasValue) 275 { 276 _enableDisplayGrossMargin = GetCustomUserField<bool>("AccessUser_DisplayGrossMargin"); 277 } 278 return _enableDisplayGrossMargin.Value; 279 } 280 281 string GetGrossMargin(double retailPrice, double salesPrice) 282 { 283 var resultValue = ((retailPrice - salesPrice) * 100) / retailPrice; 284 return Converter.ToString(Math.Round(resultValue, 2)) + "%"; 285 } 286 287 288 double? _minimumCCQuantity; 289 double MinimumCCQuantity(string flag = "") 290 { 291 if (!_minimumCCQuantity.HasValue) 292 { 293 _minimumCCQuantity = GetCustomUserField<double>("AccessUser_MinimumCCQuantity" + flag.ToUpper()); 294 } 295 return _minimumCCQuantity.Value; 296 } 297 298 bool? _disablePrices; 299 bool DisablePrices() 300 { 301 if (!_disablePrices.HasValue) 302 { 303 _disablePrices = GetCustomUserField<bool>("AccessUser_DisablePrices"); 304 } 305 return _disablePrices.Value; 306 } 307 308 double? _fullCCCheckDeviation; 309 double FullCCCheckDeviation() 310 { 311 if (!_fullCCCheckDeviation.HasValue) 312 { 313 _fullCCCheckDeviation = GetCustomUserField<double>("AccessUser_FullCCCheckDeviation"); 314 } 315 316 return _fullCCCheckDeviation.Value; 317 } 318 319 //bool HasReachedMinimumQuantity() 320 //{ 321 // if (!EnableMinimumCCQuantity()) 322 // { 323 // return true; 324 // } 325 326 // var orderlinesGroupByCode = GetLoop("OrderLines").GroupBy(o => o.GetString("Ecom:Product:Field.NavCompanyCode")) 327 // .Select(o => new { 328 // Flag = o.FirstOrDefault().GetString("Ecom:Product:Field.NavCompanyCode"), 329 // CCRate = o.Sum(f => f.GetInteger("Ecom:Order:OrderLine.Quantity") * f.GetDouble("CustomerSpecificProductInformation.CCRate")) 330 // }); 331 332 // if (orderlinesGroupByCode.Count() == orderlinesGroupByCode.Where(o => o.CCRate >= MinimumCCQuantity(o.Flag)).Count()) 333 // { 334 // return true; 335 // } 336 337 // return false; 338 //} 339 340 //bool HasPassedFullCCCheckDeviationCheck() 341 //{ 342 // if (!EnableFullCCCheck()) 343 // { 344 // return true; 345 // } 346 347 // var orderlinesGroupByCode = GetLoop("OrderLines").GroupBy(o => o.GetString("Ecom:Product:Field.NavCompanyCode")) 348 // .Select(o => new { CCRate = o.Sum(f => f.GetInteger("Ecom:Order:OrderLine.Quantity") * f.GetDouble("CustomerSpecificProductInformation.CCRate")) }); 349 350 // if (orderlinesGroupByCode.Count() == orderlinesGroupByCode.Where(o => (o.CCRate % 1) == 0 || LessOrEqual((o.CCRate % 1), FullCCCheckDeviation()) || LessOrEqual(Math.Abs(1 - (o.CCRate % 1)), FullCCCheckDeviation())).Count()) 351 // { 352 // return true; 353 // } 354 355 // return false; 356 //} 357 358 //AE: Workaround for comparing doubles 359 bool LessOrEqual(double d1, double d2) 360 { 361 return d1 < d2 || Math.Abs(d1 - d2) <= 0.0000001; 362 } 363 364 /* 365 bool DisableComments() 366 { 367 User user = User.get_Current(PagePermissionLevels.Frontend); 368 369 return GetCustomField<bool>(user, "AccessUser_EnableCommentOnLine"); 370 } 371 */ 372 //static T GetCustomOrderLineField<T>(OrderLine orderLine, string customSystemFieldName) 373 //{ 374 // OrderLineFieldValue myFieldValue = 375 // orderLine.OrderLineFieldValues.FirstOrDefault(cfv => cfv.OrderLineFieldSystemName == customSystemFieldName); 376 377 // if (myFieldValue != null) 378 // { 379 // return (T)Convert.ChangeType(myFieldValue.Value, typeof(T)); 380 // } 381 382 // // Return default(T) which means you'll return null 383 // return default(T); 384 //} 385 386 //static T GetCustomOrderLineField<T>(LoopItem orderLine, string customSystemFieldName) 387 //{ 388 // var template = 389 // orderLine.GetLoop("Order.OrderLineFields").FirstOrDefault(o => o.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") == customSystemFieldName); 390 391 // if (template != null) 392 // { 393 // return (T)Convert.ChangeType(template.GetValue("Ecom:Order:OrderLine.OrderLineField.Value.Clean"), typeof(T)); 394 // } 395 396 // // Return default(T) which means you'll return null 397 // return default(T); 398 //} 399 400 Dynamicweb.Security.UserManagement.User _user = null; 401 T GetCustomUserField<T>(string customSystemFieldName) 402 { 403 if (_user == null) 404 { 405 _user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 406 } 407 408 if (_user != null) 409 { 410 CustomFieldValue myFieldValue = _user.CustomFieldValues.FirstOrDefault(cfv => cfv.CustomField.SystemName == customSystemFieldName); 411 412 try 413 { 414 if (myFieldValue != null) 415 { 416 return (T)Convert.ChangeType(myFieldValue.Value, typeof(T)); 417 } 418 } 419 catch (Exception) 420 { 421 return default(T); 422 } 423 } 424 425 // Return default(T) which means you'll return null 426 return default(T); 427 } 428 429 430 ICollection<Dynamicweb.Ecommerce.Orders.OrderLineField> SortOrderLineFields(ICollection<Dynamicweb.Ecommerce.Orders.OrderLineField> loop) 431 { 432 return loop 433 .OrderByDescending(o => o.SystemName == "OrderLineComment") 434 .ThenByDescending(o => o.SystemName == "OrderLineRetailPrice") 435 .ThenByDescending(o => o.SystemName == "OrderLineItemNumber") 436 .ThenByDescending(o => o.SystemName == "OrderLineEAN").ToList(); 437 } 438 439 bool IsInCart(ProductViewModel product) 440 { 441 var cart = Dynamicweb.Ecommerce.Common.Context.Cart; 442 if (cart != null) 443 { 444 foreach (var ol in cart.OrderLines) 445 { 446 if (ol.ProductId == product.Id) 447 { 448 return true; 449 } 450 } 451 } 452 return false; 453 } 454 455 string GetProductInfoValue(ProductInformation productInfo, string key) 456 { 457 if (productInfo.Values != null) 458 { 459 object value; 460 if (productInfo.Values.TryGetValue(key, out value)) 461 { 462 if (!string.IsNullOrEmpty(Converter.ToString(value))) 463 { 464 return Converter.ToString(value); 465 } 466 } 467 } 468 return string.Empty; 469 } 470 471 } 472 473 474 @* html helpers section *@ 475 476 477 @helper renderToolTip() 478 { 479 var jsSuggestionStock = "<span class='js-suggestion-stock'></span>"; 480 <div class="hide js-tooltip-content quantity-tooltip-content"> 481 <h4 class="title"> 482 @Translate("Smartpage:Product.PackageSizeCeiled", "Antallet vil blive opskrevet til") <span class="js-package-size-quantity"></span> <a href="#" data-toggle="tooltip" data-placement="top" class="js-package-size-single package-size-single" title='@Translate("Smartpage:Product.PackageSizeCeiled.singleProduct.Text", "Det ønskede antal vare stemmer ikke overens med kollistørrelsen")'><i class="glyphicon glyphicon-info-sign"></i></a> 483 </h4> 484 <button class="btn btn-xs btn-info js-package-size-cancel" data-toggle="clickover"><i class="glyphicon glyphicon-remove"></i></button> 485 <button class="btn btn-xs btn-primary js-package-size-ok" data-toggle="clickover"><i class="glyphicon glyphicon-ok"></i></button> 486 </div> 487 488 <div class="hide js-tooltip-smaller-quantity quantity-tooltip-content"> 489 <h4 class="title"> 490 @Translate("Smartpage:Popover.OutOfStockText.LessQuantity", "Varen blev ikke tilføjet til kurven, forsøg med et mindre antal") 491 </h4> 492 <button class="btn btn-xs btn-info js-close-out-of-stock" data-toggle="clickover"><i class="glyphicon glyphicon-ok"></i></button> 493 </div> 494 495 <div class="hide js-tooltip-stock-content quantity-tooltip-content"> 496 <h4 class="title"> 497 @Translate("Smartpage:Popover.OutOfStockText", "Varen blev ikke tilføjet til kurven, fordi vi har ikke flere på lager") 498 </h4> 499 <button class="btn btn-xs btn-info js-close-out-of-stock" data-toggle="clickover"><i class="glyphicon glyphicon-ok"></i></button> 500 </div> 501 502 <div class="hide js-tooltip-stock-suggestion quantity-tooltip-content"> 503 <h4 class="title"> 504 @Translate("Smartpage:Popover.OutOfStockText.Suggestion", String.Format("Vi har kun {0} på lager. Vil du ændre antal?", jsSuggestionStock)) 505 </h4> 506 <button class="btn btn-xs btn-info js-cancel-out-of-stock" data-toggle="clickover"><i class="glyphicon glyphicon-remove"></i></button> 507 <button class="btn btn-xs btn-info js-accept-out-of-stock" data-toggle="clickover"><i class="glyphicon glyphicon-ok"></i></button> 508 </div> 509 } 510 511 512 @helper AddedToCart(ProductViewModel i, string cssClass) 513 { 514 var cart = Dynamicweb.Ecommerce.Common.Context.Cart; 515 string cssIsInCart = !IsInCart(i) ? "hide" : ""; 516 517 if (cart != null) 518 { 519 foreach (var ol in cart.OrderLines) 520 { 521 if (ol.ProductId == i.Id) 522 { 523 cssIsInCart = "hide"; 524 } 525 } 526 } 527 528 <span class='label label-success js-in-cart in-cart @cssClass @cssIsInCart'><i class="glyphicon glyphicon-shopping-cart"></i> @Translate("Smartpage:AddedInCart", "added")</span> 529 } 530 531 @helper SingleAddedToCart(ProductViewModel product) 532 { 533 string cssIsInCart = !IsInCart(product) ? "hide" : ""; 534 <span class='label label-success in-cart js-in-cart product @cssIsInCart'><i class="glyphicon glyphicon-shopping-cart"></i> @Translate("Smartpage:AddedInCart", "added")</span> 535 } 536 537 @helper SingleStockStatus(ProductViewModel product) 538 { 539 bool outOfStock = product.StockLevel <= 0; 540 bool isServiceProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(product.Id, product.VariantId, true).Type == Dynamicweb.Ecommerce.Products.ProductType.Service; 541 542 <div class='stock-status single-product'> 543 @if (outOfStock && !isServiceProduct) 544 { 545 <span class="label label-danger js-out-of-stock">@Translate("Smartpage:OutOfStock", "Ikke på lager")</span> 546 } 547 </div> 548 } 549 550 @helper ListStockStatus(ProductViewModel i, string currentViewMode) 551 { 552 bool outOfStock = i.StockLevel <= 0; 553 bool isServiceProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(i.Id, i.VariantId, true).Type == Dynamicweb.Ecommerce.Products.ProductType.Service; 554 555 <div class='stock-status @currentViewMode'> 556 @if (outOfStock && !isServiceProduct) 557 { 558 <span class="label label-danger js-out-of-stock">@Translate("Smartpage:OutOfStock", "Ikke på lager")</span> 559 } 560 @if (!isServiceProduct && !outOfStock) { 561 <span class='label label-success'>@i.StockLevel @Translate("GASA.LeftOnStock", "left on stock")</span> 562 } 563 </div> 564 } 565 566 567 @helper PricesWithVATStatus(string positionCSS) { 568 if (DisplayPricesInclVat()) 569 { 570 <p class='vat-message text-muted text-center @positionCSS'>@Translate("Smartpage:PricesIncludeVAT.Message", "Alle priser er inkl. Moms")</p> 571 } 572 else 573 { 574 <p class='vat-message text-muted text-center @positionCSS'>@Translate("Smartpage:PricesDoNotIncludeVAT.Message", "Alle priser er ekskl. Moms")</p> 575 } 576 } 577 578 @helper RenderManufacturer(string manufacturerId, string manufacturerName, string manufacturerWebsiteUrl) 579 { 580 if (EnableManufacturerFiltering()) 581 { 582 var name = manufacturerName + "/" + manufacturerId; 583 if (!string.IsNullOrEmpty(manufacturerWebsiteUrl)) 584 { 585 <a class="manufacturer-info-link" href="@manufacturerWebsiteUrl" target="_blank">@name</a> 586 } 587 else 588 { 589 <span class="manufacturer-info">@name</span> 590 } 591 } 592 } 593 @inherits ViewModelTemplate<ProductListViewModel> 594 @using System.Web 595 @using Dynamicweb; 596 @using Dynamicweb.Rendering; 597 @using Dynamicweb.Ecommerce.ProductCatalog; 598 599 @helper RenderSearch() 600 { 601 @SnippetStart("NavigationGroups") 602 603 var originalLink = "/Default.aspx?ID=" + HttpContext.Current.Request["id"].ToString(); 604 605 string groupId = System.Web.HttpContext.Current.Request["GroupId"]; 606 string groupName = string.Empty; 607 608 if (!string.IsNullOrEmpty(groupId)) 609 { 610 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(groupId); 611 if (group != null) 612 { 613 groupName = group.Name; 614 } 615 } 616 617 <button type="button" class="btn btn-default btn-square dropdown-toggle js-select-group-dropdown" id="js-search-filters" data-toggle="dropdown" aria-expanded="false" data-whole-site="false"><span class="js-text-label hidden-xs hidden-sm">@Translate("Smartpage:Search.Select.InCategory", "in") @groupName</span> <span class="caret"></span></button> 618 <ul class="dropdown-menu js-search-dropdown-menu" role="menu" id="js-search-filters"> 619 <li><a class="js-search-group-choice" href='@originalLink' data-whole-site="true">@Translate("Smartpage:Search.WholeSite", "Whole site")</a></li> 620 <li><a class="js-search-group-choice" href='@("/Default.aspx?ID=" + Pageview.Page.ID + "&GroupId=" + groupId)' data-whole-site="false">@Translate("Smartpage:Search.Select.InCategory", "in") @groupName</a></li> 621 </ul> 622 623 @SnippetEnd("NavigationGroups") 624 } 625 626 @inherits ViewModelTemplate<ProductListViewModel> 627 @using Dynamicweb; 628 @using Dynamicweb.Core; 629 @using Dynamicweb.Environment; 630 @using Dynamicweb.Rendering; 631 @using Dynamicweb.Ecommerce.ProductCatalog; 632 @using System.Linq; 633 @using Gasa.ProductInformation; 634 @using Gasa.PriceInformation; 635 @using Gasa.ProductInformation.Helpers; 636 @using Dynamicweb.Ecommerce.Prices; 637 638 @helper RenderListView() 639 { 640 <form method="post" class="js-basket-add js-set-tabindex js-product-form-container" autocomplete="false" data-submit-url='@Pageview.Area.Item["JsonCart"]'> 641 <input type="hidden" name="CartCmd" value="addmulti" /> 642 @{ 643 644 int pageNum = Math.Max(Dynamicweb.Context.Current.Request.GetInt32("PageNum"), 1); 645 var isLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 646 var defaultImage = !string.IsNullOrWhiteSpace(Converter.ToString(Pageview.Area.Item["DefaultImage"])) ? Converter.ToString(Pageview.Area.Item["DefaultImage"]) : "/Files/images/default-image.png"; 647 648 var baseLoopCounter = Model.PageSize * (pageNum - 1); 649 int productLoopCounter = 0; 650 651 var productService = Dynamicweb.Ecommerce.Services.Products; 652 var helperService = new CustomProductFieldHelpers(); 653 string currentPageLink = "/Default.aspx?ID=" + Pageview.Page.ID; 654 string host = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Frontend.PageView.Current().Area.IsCdnActive) ? Dynamicweb.Frontend.PageView.Current().Area.CdnImageHost : string.Empty; 655 } 656 <div class="clearfix"></div> 657 <div class="col-sm-12"> 658 <div class="product-list list-group js-grid-group"> 659 660 @foreach (var i in Model.Products) 661 { 662 productLoopCounter++; 663 664 var manufacturerName = i.Manufacturer.Name; 665 var manufacturerWebsiteUrl = i.Manufacturer.Web; 666 var manufacturerId = i.Manufacturer.Id; 667 668 var product = productService.GetProductById(i.Id, i.VariantId, true); 669 var productInfo = new ProductInformation(product, Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser().CustomerNumber); 670 var priceInformation = new PriceInformation(product, productInfo); 671 672 string productLink = currentPageLink + "&amp;GroupId=" + product.PrimaryGroupId + "&amp;ProductID=" + product.Id; 673 674 var images = i.ImagePatternImages; 675 string image = defaultImage; 676 677 if (images.Any()) 678 { 679 image = images.FirstOrDefault().Value; 680 } 681 682 int minQty = Converter.ToInt32(helperService.GetFieldValue("MinimumPurchaseQuantityLimit", i.ProductFields)); 683 if (minQty == 0) 684 { 685 switch (Converter.ToString(helperService.GetFieldValue("MinimumPurchaseQuantity", i.ProductFields)).ToLower().Trim()) 686 { 687 case "layer": 688 minQty = productInfo.ColliPerLayer; 689 break; 690 case "cc": 691 minQty = productInfo.ColliPerCc; 692 break; 693 default: 694 minQty = 1; 695 break; 696 } 697 } 698 699 bool isDeliverable = string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) && Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.Price) > 0; 700 701 string cssIDSelector = "js-" + i.Id; 702 703 <div class="list-group-item row js-product border-bottom js-grid-product" data-min-quantity='@minQty' id="@cssIDSelector" data-page-num="@pageNum"> 704 <div class="col-md-1 col-sm-2 list-group-item-img"> 705 @{ 706 var previewImageUrl = host + "/Admin/Public/getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=500&amp;Height=500&amp;Crop=5&fillcanvas=true"; 707 var preImage = "data:image/gif;base64,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"; 708 } 709 <div class="c-pointer" onclick="spOpenImage(this)" data-title="@i.Name" data-preview="@previewImageUrl"> 710 <img src="@preImage" data-src="@previewImageUrl" alt="@HttpUtility.HtmlEncode(i.Name)" class="img-responsive b-lazy" /> 711 </div> 712 713 @if (images.Count > 1) 714 { 715 <span class="label label-info label-amount-pictures"><i class="glyphicon glyphicon-picture"></i> @images.Count</span> 716 } 717 </div> 718 <div class="col-md-3 col-sm-4"> 719 720 <h2 class="grid-item-name grid-item-name-list"> 721 <a href="@productLink" class="js-product-title">@i.Name</a> 722 @if (Converter.ToBoolean(helperService.GetFieldValue("NewProduct", i.ProductFields))) 723 { 724 <span class="label label-warning">@Translate("Smartpage:NewProduct", "NEW")</span> 725 } 726 @if (Converter.ToBoolean(helperService.GetFieldValue("Bestseller", i.ProductFields))) 727 { 728 <span class="label label-warning">@Translate("Smartpage:Bestseller", "BESTSELLER")</span> 729 } 730 @if (!string.IsNullOrEmpty(Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)))) 731 { 732 var flagImgPath = "/Admin/Images/Flags/Small/flag_" + Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)) + ".png"; 733 <img src='@flagImgPath' alt='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' title='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' /> 734 } 735 </h2> 736 737 <div class="shortdescription"> 738 @AddedToCart(i, "standard") 739 <p>@i.ShortDescription</p> 740 @ListStockStatus(i, "list") 741 </div> 742 <div class="manufacturer-website hidden-sm hidden-xs"> 743 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) <br /> 744 @if (product.Height > 0) 745 { 746 @FormatDiameter("H: " + product.Height + " cm") 747 } 748 </div> 749 750 </div> 751 752 <div class="col-md-1 col-sm-5"> 753 <div class="potsize text-right hidden-sm hidden-xs "> 754 @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields))) cm 755 </div> 756 <div class="hidden-md hidden-lg"> 757 @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields))) 758 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) <br /> 759 @if (product.Height > 0) 760 { 761 @FormatDiameter("H: " + product.Height + " cm") 762 } 763 </div> 764 </div> 765 766 <div class="clearfix visible-sm"></div> 767 <div class="col-md-4 col-sm-6"> 768 @if (isLoggedIn) 769 { 770 <div class="product-price"> 771 <table class="table"> 772 <tbody> 773 <tr> 774 <td> 775 @Translate("Pcs", "Stk") 776 </td> 777 <td> 778 1 &times; 779 @productInfo.ColliSize 780 </td> 781 <td> 782 <span class="js-colli-per-layer">@productInfo.ColliPerLayer</span> 783 &times; @productInfo.ColliSize 784 </td> 785 <td> 786 <span class="js-colli-per-cc">@productInfo.ColliPerCc</span> 787 &times; @productInfo.ColliSize 788 </td> 789 </tr> 790 @if (!DisablePrices()) 791 { 792 793 <tr> 794 <td> 795 @Translate("price", "Pris") 796 </td> 797 <td class="js-product-field-price js-product-field-price-colli"> 798 @if (DisplayPricesInclVat()) 799 { 800 if (Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.PriceWithVAT) > 0) 801 { 802 @:@priceInformation.Prices.PricePerColliUnit.PriceWithVAT.ToString("0.00") 803 } 804 805 } 806 else 807 { 808 if (Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT) > 0) 809 { 810 @:@priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT.ToString("0.00") 811 } 812 } 813 </td> 814 <td class="js-product-field-price js-product-field-price-layer"> 815 @if (DisplayPricesInclVat()) 816 { 817 if (Converter.ToDouble(priceInformation.Prices.PricePerLayerUnit.PriceWithVAT) > 0) 818 { 819 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithVAT.ToString("0.00") 820 } 821 } 822 else 823 { 824 if (Converter.ToDouble(priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT) > 0) 825 { 826 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT.ToString("0.00") 827 } 828 } 829 </td> 830 <td class="js-product-field-price js-product-field-price-cc"> 831 @if (DisplayPricesInclVat()) 832 { 833 if (Converter.ToDouble(priceInformation.Prices.PricePerCcUnit.PriceWithVAT) > 0) 834 { 835 @:@priceInformation.Prices.PricePerCcUnit.PriceWithVAT.ToString("0.00") 836 } 837 } 838 else 839 { 840 if (Converter.ToDouble(priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT) > 0) 841 { 842 @:@priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT.ToString("0.00") 843 } 844 } 845 </td> 846 </tr> 847 } 848 </tbody> 849 </table> 850 </div> 851 } 852 </div> 853 <br class="hidden-sm hidden-md hidden-lg" /> 854 <div class="col-md-3 col-sm-6"> 855 @if (isLoggedIn && product.VariantCount == 0) 856 { 857 var loopCounter = productLoopCounter + baseLoopCounter; 858 var nameProductLoopCounter = "ProductLoopCounter" + loopCounter; 859 var nameProductIdCounter = "ProductID" + loopCounter; 860 var nameVariantIdCounter = "VariantID" + loopCounter; 861 var nameUnitIdCounter = "UnitID" + loopCounter; 862 var namewishListIdCounter = "wishListID" + loopCounter; 863 var priceRetailValue = productInfo.CustomerRetailPrice; 864 var priceRetail = new PriceCalculated(new PriceRaw(priceRetailValue, Dynamicweb.Ecommerce.Common.Context.Currency)); 865 var retailPriceValue = DisplayPricesInclVat() ? Converter.ToString(priceRetail.PriceWithVAT) : Converter.ToString(priceRetail.PriceWithoutVAT); 866 retailPriceValue = Converter.ToInt32(retailPriceValue) == 0 ? "" : FormatPrice(retailPriceValue); 867 868 <input type="hidden" value='@loopCounter' name='@nameProductLoopCounter'> 869 <input type="hidden" class="js-product-id" value='@i.Id' name="@nameProductIdCounter"> 870 <input type="hidden" value="" name="@nameVariantIdCounter"> 871 <input type="hidden" value="" name="@nameUnitIdCounter"> 872 <input type="hidden" value="0" name="@namewishListIdCounter"> 873 874 if (isDeliverable) 875 { 876 <div class="row"> 877 @renderToolTip() 878 <div class="col-xs-3 js-quantity-tooltip" data-placement="right" data-toggle="popover" data-trigger="manual"> 879 @{ 880 var quantityFieldName = "Quantity" + loopCounter; 881 bool isServiceProduct = product.Type == Dynamicweb.Ecommerce.Products.ProductType.Service; 882 883 var placeholder = minQty > 0 ? String.Format("min. {0}", minQty) : minQty.ToString(); 884 885 <div class="product-list-number"> 886 <input type="number" min="0" name='@quantityFieldName' tabindex='@loopCounter' data-is-service="@isServiceProduct" data-stock-status='@i.StockLevel' class="form-control js-quantity text-right" placeholder="@placeholder" /> 887 </div> 888 } 889 </div> 890 891 <div class="col-xs-9"> 892 @foreach (var o in product.OrderLineFields) 893 { 894 var inputName = "EcomOrderLineFieldInput_" + o.Name + loopCounter; 895 string placeholderText = o.Name; 896 switch (o.SystemName) 897 { 898 case "OrderLineComment": 899 if (EnableComments()) 900 { 901 placeholderText = Translate("LineComment", "Comment"); 902 <input type="text" class="form-control" maxlength="80" name="@inputName" placeholder="@placeholderText" /> 903 } 904 break; 905 case "OrderLineColliSize": 906 <input type="hidden" name="@inputName" value='@productInfo.ColliSize' /> 907 break; 908 case "OrderLineColliPerLayer": 909 <input type="hidden" name="@inputName" value='@productInfo.ColliPerLayer' /> 910 break; 911 case "OrderLineColliPerCC": 912 <input type="hidden" name="@inputName" value='@productInfo.ColliPerCc' /> 913 break; 914 case "OrderLineRetailPrice": 915 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Add retail price"); 916 <div class="hidden"> 917 <input type="text" id="js-retail-price-@loopCounter" class="form-control js-retail-price-input js-product-field-replace text-right" data-replace-target=".js-product-field-retail-price" name="@inputName" value='@retailPriceValue' placeholder="@placeholderText" /> 918 </div> 919 break; 920 case "OrderLineItemNumber": 921 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no."); 922 <div class="hidden"> 923 <input type="text" id="js-item-number-@loopCounter" class="form-control js-product-field-replace text-right" data-replace-target=".js-product-field-item-number" name="@inputName" value='@productInfo.CustomerItemNumber.Trim()' placeholder="@placeholderText" /> 924 </div> 925 break; 926 case "OrderLineEAN": 927 placeholderText = Translate("Deres_EAN_nummer-short", "EAN"); 928 929 <div class="hidden"> 930 <div class="editable" data-placeholder="my placeholder"> 931 <input type="text" id="js-ean-number-@loopCounter" class="form-control js-product-field-replace text-right" data-replace-target=".js-product-field-ean" name="@inputName" value='@productInfo.EAN.Trim()' placeholder="@placeholderText" /> 932 </div> 933 </div> 934 935 break; 936 default: 937 <text>@inputName</text> 938 break; 939 } 940 } 941 </div> 942 </div> 943 } 944 945 if (EnableDisplayOfGrossMargin() && isDeliverable) 946 { 947 var pricePerColliUnit = priceInformation.Prices.PricePerColliUnit; 948 double customerSalesPrice = DisplayPricesInclVat() ? pricePerColliUnit.PriceWithVAT : pricePerColliUnit.PriceWithoutVAT; 949 950 <div class="row"> 951 <div class="col-sm-12 col-md-12 col-lg-offset-3 col-lg-9 text-right product-retail-price product-gross-margin-list"> 952 <i class="js-product-field-gross-margin text-muted"> 953 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.GrossMargin", "Gross margin")</span> 954 <span class="pull-right js-gross-margin-value"> 955 @if (priceRetail.Price > 0) 956 { 957 @GetGrossMargin(priceRetail.Price, customerSalesPrice); 958 } 959 else 960 { 961 @Translate("Smartpage:ecom:CustomerSpecificInfo.GrossMargin.NA", "N/A") 962 } 963 </span> 964 </i> 965 </div> 966 </div> 967 } 968 969 if (EnableCustomerRetailPrice() && isDeliverable) 970 { 971 <div class="row"> 972 <div class="col-sm-12 col-md-12 col-lg-offset-3 col-lg-9 text-right product-retail-price product-editable-area"> 973 974 @if (EnableEditableRetailPrice() && isDeliverable && !String.IsNullOrEmpty(Converter.ToString(priceRetail.Price))) 975 { 976 <div class="product-selectable-edit pull-right"> 977 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-retail-price-@loopCounter"></i> 978 </div> 979 } 980 <div class="js-product-field-retail-price"> 981 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Retail price")</span> 982 <span class="pull-right">@retailPriceValue</span> 983 </div> 984 </div> 985 </div> 986 } 987 988 if (EnableCustomerItemNumber()) 989 { 990 <div class="row"> 991 992 <div class="col-sm-12 col-md-12 col-lg-offset-3 col-lg-9 text-right product-item-number product-editable-area"> 993 994 @if (EnableEditableItemNumber() && isDeliverable) 995 { 996 <div class="product-selectable-edit pull-right"> 997 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-item-number-@loopCounter"></i> 998 </div> 999 } 1000 <div class="js-product-field-item-number text-left"> 1001 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no.")</span> 1002 <span class="pull-right">@productInfo.CustomerItemNumber</span> 1003 </div> 1004 </div> 1005 </div> 1006 } 1007 <div class="row"> 1008 <div class="hidden-xs col-sm-3 hidden-md hidden-lg"></div> 1009 <div class="col-sm-12 col-md-12 col-lg-offset-3 col-lg-9 text-right product-editable-area"> 1010 @if (EnableEditableBarcode() && isDeliverable && !String.IsNullOrEmpty(productInfo.EAN)) 1011 { 1012 <div class="product-selectable-edit pull-right"> 1013 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-ean-number-@loopCounter"></i> 1014 </div> 1015 } 1016 @if (EnableCustomerBarcode() && !String.IsNullOrEmpty(productInfo.EAN)) 1017 { 1018 <div class="js-product-field-ean text-left"> 1019 <span class="pull-left">@Translate("Deres_EAN_nummer-short", "EAN")</span> 1020 <span class="pull-right">@productInfo.EAN</span> 1021 </div> 1022 } 1023 </div> 1024 </div> 1025 1026 if (!isDeliverable) 1027 { 1028 <div class="row"> 1029 <div class="hidden-xs col-sm-3 hidden-md hidden-lg"></div> 1030 <div class="col-sm-9 col-md-12 col-lg-offset-3 col-lg-9 product-editable-area"> 1031 <p>@Translate("Smartpage:Ecom.LeadDaysWarning", "Available on") <span class="label label-warning">@(!string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) ? AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields))) : helperService.GetFieldValue("SpAvailableFrom", i.ProductFields))</span></p> 1032 </div> 1033 </div> 1034 } 1035 1036 } 1037 </div> 1038 </div> 1039 } 1040 </div> 1041 1042 </div> 1043 1044 <input type="submit" value="Add to basket" class="sr-only" /> 1045 1046 @if (isLoggedIn) 1047 { 1048 @SnippetStart("SmartpageAddToBasket") 1049 <button class="btn btn-primary btn-block btn-lg js-submit-form" data-form-selector=".js-basket-add">@Translate("Smartpage:eCom.AddToCart", "Læg i kurven")</button> 1050 @SnippetEnd("SmartpageAddToBasket") 1051 } 1052 </form> 1053 } 1054 1055 @inherits ViewModelTemplate<ProductListViewModel> 1056 @using Dynamicweb; 1057 @using Dynamicweb.Core; 1058 @using Dynamicweb.Environment; 1059 @using Dynamicweb.Rendering; 1060 @using Dynamicweb.Ecommerce.ProductCatalog; 1061 @using System.Linq; 1062 @using Gasa.ProductInformation; 1063 @using Gasa.PriceInformation; 1064 @using Gasa.ProductInformation.Helpers; 1065 @using Dynamicweb.Ecommerce.Prices; 1066 1067 @helper RenderPhotoView() 1068 { 1069 <form method="post" class="js-basket-add js-set-tabindex row js-product-form-container" autocomplete="false" data-submit-url='@Pageview.Area.Item["JsonCart"]'> 1070 <input type="hidden" name="CartCmd" value="addmulti" /> 1071 @{ 1072 1073 var isLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 1074 var pagenum = 1; 1075 var defaultImage = !string.IsNullOrWhiteSpace(Converter.ToString(Pageview.Area.Item["DefaultImage"])) ? Converter.ToString(Pageview.Area.Item["DefaultImage"]) : "/Files/images/default-image.png"; 1076 1077 if (Dynamicweb.Context.Current.Request.GetInt32("pagenum") > 0) 1078 { 1079 pagenum = Dynamicweb.Context.Current.Request.GetInt32("pagenum"); 1080 } 1081 1082 var baseLoopCounter = Model.PageSize * (pagenum - 1); 1083 int productLoopCounter = 0; 1084 1085 var productService = Dynamicweb.Ecommerce.Services.Products; 1086 var helperService = new CustomProductFieldHelpers(); 1087 string currentPageLink = "/Default.aspx?ID=" + Pageview.Page.ID; 1088 string host = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Frontend.PageView.Current().Area.IsCdnActive) ? Dynamicweb.Frontend.PageView.Current().Area.CdnImageHost : string.Empty; 1089 } 1090 <div class="col-xs-12"> 1091 <div class="product-grid photo-group js-grid-group"> 1092 @foreach (var i in Model.Products) 1093 { 1094 productLoopCounter++; 1095 1096 var manufacturerName = i.Manufacturer.Name; 1097 var manufacturerWebsiteUrl = i.Manufacturer.Web; 1098 var manufacturerId = i.Manufacturer.Id; 1099 1100 var product = productService.GetProductById(i.Id, i.VariantId, true); 1101 var productInfo = new ProductInformation(product, Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser().CustomerNumber); 1102 var priceInformation = new PriceInformation(product, productInfo); 1103 1104 string productLink = currentPageLink + "&amp;GroupId=" + product.PrimaryGroupId + "&amp;ProductID=" + product.Id; 1105 1106 var images = i.ImagePatternImages; 1107 string image = defaultImage; 1108 1109 if (images.Any()) 1110 { 1111 image = images.FirstOrDefault().Value; 1112 } 1113 1114 int minQty = Converter.ToInt32(helperService.GetFieldValue("MinimumPurchaseQuantityLimit", i.ProductFields)); 1115 if (minQty == 0) 1116 { 1117 switch (Converter.ToString(helperService.GetFieldValue("MinimumPurchaseQuantity", i.ProductFields)).ToLower().Trim()) 1118 { 1119 case "layer": 1120 minQty = productInfo.ColliPerLayer; 1121 break; 1122 case "cc": 1123 minQty = productInfo.ColliPerCc; 1124 break; 1125 default: 1126 minQty = 1; 1127 break; 1128 } 1129 } 1130 1131 bool isDeliverable = string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) && Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.Price) > 0; 1132 string cssIDSelector = "js-" + i.Id; 1133 1134 <div class='photo-group-item col-xs-12 clearfix js-product js-grid-product' data-min-quantity="@minQty" id="@cssIDSelector"> 1135 <div class="col-sm-6 col-md-3"> 1136 <div class="photo-group-item-img"> 1137 @{ 1138 var previewImageUrl = host + "/Admin/Public/getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=500&amp;Height=500&amp;Crop=5&fillcanvas=true"; 1139 var preImage = "data:image/gif;base64,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"; 1140 } 1141 <div class="c-pointer" onclick="spOpenImage(this)" data-title="@i.Name" data-preview="@previewImageUrl"> 1142 <span class="ms-layer ms-btn fullscreen-btn"><i class="glyphicon glyphicon-fullscreen"></i></span> 1143 <img src="@preImage" data-src="@previewImageUrl" alt="@HttpUtility.HtmlEncode(i.Name)" class="img-responsive b-lazy" /> 1144 </div> 1145 @if (images.Count > 1) 1146 { 1147 <span class="label label-info label-amount-pictures"><i class="glyphicon glyphicon-picture"></i> @images.Count</span> 1148 } 1149 @AddedToCart(i, "absolute") 1150 </div> 1151 </div> 1152 1153 <div class="col-sm-6 col-md-4 photo-group-item-details"> 1154 <h2 class="grid-item-name grid-item-name-photo"> 1155 <a href="@productLink" class="js-product-title">@i.Name</a> 1156 @if (Converter.ToBoolean(helperService.GetFieldValue("NewProduct", i.ProductFields))) 1157 { 1158 <span class="label label-warning">@Translate("Smartpage:NewProduct", "NEW")</span> 1159 } 1160 @if (Converter.ToBoolean(helperService.GetFieldValue("Bestseller", i.ProductFields))) 1161 { 1162 <span class="label label-warning">@Translate("Smartpage:Bestseller", "BESTSELLER")</span> 1163 } 1164 @if (!string.IsNullOrEmpty(Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)))) 1165 { 1166 var flagImgPath = "/Admin/Images/Flags/Small/flag_" + Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)) + ".png"; 1167 <img src="@flagImgPath" alt="@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))" title="@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))" /> 1168 } 1169 </h2> 1170 <div class="product-description"> 1171 @i.ShortDescription 1172 @ListStockStatus(i, "photo") 1173 </div> 1174 <div class="product-unit"> 1175 &Oslash; @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields)) + " cm H: " + product.Height) cm <br /> 1176 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) 1177 </div> 1178 1179 @if (isLoggedIn) 1180 { 1181 <div class="product-price"> 1182 <table class="table"> 1183 <thead> 1184 <tr> 1185 <td>&nbsp;</td> 1186 <th> 1187 <div class="pictogram"> 1188 <div class="pictogram-box"></div> 1189 </div> 1190 </th> 1191 <th> 1192 <div class="pictogram"> 1193 <div class="pictogram-layer"></div> 1194 </div> 1195 </th> 1196 <th> 1197 <div class="pictogram"> 1198 <div class="pictogram-container"></div> 1199 </div> 1200 </th> 1201 </tr> 1202 </thead> 1203 <tbody> 1204 <tr> 1205 <td> 1206 @Translate("Pcs", "Stk") 1207 </td> 1208 <td> 1209 1 &times; 1210 @productInfo.ColliSize 1211 </td> 1212 <td> 1213 <span class="js-colli-per-layer">@productInfo.ColliPerLayer</span> 1214 &times; @productInfo.ColliSize 1215 </td> 1216 <td> 1217 <span class="js-colli-per-cc">@productInfo.ColliPerCc</span> 1218 &times; @productInfo.ColliSize 1219 </td> 1220 </tr> 1221 @if (!DisablePrices()) 1222 { 1223 1224 <tr> 1225 <td> 1226 @Translate("price", "Pris") 1227 </td> 1228 <td class="js-product-field-price js-product-field-price-colli"> 1229 @if (DisplayPricesInclVat()) 1230 { 1231 if (Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.PriceWithVAT) > 0) 1232 { 1233 @:@priceInformation.Prices.PricePerColliUnit.PriceWithVAT.ToString("0.00") 1234 } 1235 1236 } 1237 else 1238 { 1239 if (Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT) > 0) 1240 { 1241 @:@priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT.ToString("0.00") 1242 } 1243 } 1244 </td> 1245 <td class="js-product-field-price js-product-field-price-layer"> 1246 @if (DisplayPricesInclVat()) 1247 { 1248 if (Converter.ToDouble(priceInformation.Prices.PricePerLayerUnit.PriceWithVAT) > 0) 1249 { 1250 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithVAT.ToString("0.00") 1251 } 1252 } 1253 else 1254 { 1255 if (Converter.ToDouble(priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT) > 0) 1256 { 1257 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT.ToString("0.00") 1258 } 1259 } 1260 </td> 1261 <td class="js-product-field-price js-product-field-price-cc"> 1262 @if (DisplayPricesInclVat()) 1263 { 1264 if (Converter.ToDouble(priceInformation.Prices.PricePerCcUnit.PriceWithVAT) > 0) 1265 { 1266 @:@priceInformation.Prices.PricePerCcUnit.PriceWithVAT.ToString("0.00") 1267 } 1268 } 1269 else 1270 { 1271 if (Converter.ToDouble(priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT) > 0) 1272 { 1273 @:@priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT.ToString("0.00") 1274 } 1275 } 1276 </td> 1277 </tr> 1278 } 1279 </tbody> 1280 </table> 1281 </div> 1282 } 1283 </div> 1284 1285 <div class="clearfix visible-sm visible-xs"></div> 1286 <div class="col-md-5 col-sm-6 hidden-xs"></div> 1287 <div class="col-md-5 col-sm-6 col-xs-12"> 1288 <div class="product-informations"> 1289 @{ 1290 string customerSpecificRemark = GetProductInfoValue(productInfo, "CustomerSpecificRemark"); 1291 1292 if (!string.IsNullOrWhiteSpace(customerSpecificRemark)) 1293 { 1294 <span class="detail-info"> 1295 @Translate("Deres_bemaerkning", "Your Comment"): @customerSpecificRemark 1296 </span> 1297 } 1298 } 1299 <br /> 1300 </div> 1301 <div class="product-photo-price"> 1302 @if (isLoggedIn) 1303 { 1304 var loopCounter = productLoopCounter + baseLoopCounter; 1305 var nameProductLoopCounter = "ProductLoopCounter" + loopCounter; 1306 var nameProductIdCounter = "ProductID" + loopCounter; 1307 var nameVariantIdCounter = "VariantID" + loopCounter; 1308 var nameUnitIdCounter = "UnitID" + loopCounter; 1309 var namewishListIdCounter = "wishListID" + loopCounter; 1310 var cssIsAvailable = isDeliverable ? "available" : "not-available"; 1311 var priceRetailValue = productInfo.CustomerRetailPrice; 1312 var priceRetail = new PriceCalculated(new PriceRaw(priceRetailValue, Dynamicweb.Ecommerce.Common.Context.Currency)); 1313 var retailPriceValue = DisplayPricesInclVat() ? Converter.ToString(priceRetail.PriceWithVAT) : Converter.ToString(priceRetail.PriceWithoutVAT); 1314 retailPriceValue = Converter.ToInt32(retailPriceValue) == 0 ? "" : FormatPrice(retailPriceValue); 1315 1316 <input type="hidden" value='@loopCounter' name='@nameProductLoopCounter'> 1317 <input type="hidden" value='@i.Id' name="@nameProductIdCounter"> 1318 <input type="hidden" value="" name="@nameVariantIdCounter"> 1319 <input type="hidden" value="" name="@nameUnitIdCounter"> 1320 <input type="hidden" value="0" name="@namewishListIdCounter"> 1321 1322 <div class='row product-photo-price-element @cssIsAvailable'> 1323 1324 @if (EnableDisplayOfGrossMargin() && isDeliverable) 1325 { 1326 var pricePerColliUnit = priceInformation.Prices.PricePerColliUnit; 1327 double customerSalesPrice = DisplayPricesInclVat() ? pricePerColliUnit.PriceWithVAT : pricePerColliUnit.PriceWithoutVAT; 1328 <div class="col-xs-9 col-xs-offset-3 product-editable-area"> 1329 <i class="js-product-field-gross-margin text-muted"> 1330 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.GrossMargin", "Gross margin")</span> 1331 <span class="pull-right js-gross-margin-value"> 1332 @if (priceRetail.Price > 0) 1333 { 1334 @GetGrossMargin(priceRetail.Price, customerSalesPrice); 1335 } 1336 else 1337 { 1338 @Translate("Smartpage:ecom:CustomerSpecificInfo.GrossMargin.NA", "N/A") 1339 } 1340 </span> 1341 </i> 1342 </div> 1343 } 1344 1345 @if (EnableCustomerRetailPrice() && isDeliverable) 1346 { 1347 var formattedRetailPrice = DisplayPricesInclVat() ? priceRetail.PriceWithVATFormatted : priceRetail.PriceWithoutVATFormatted; 1348 formattedRetailPrice = Converter.ToDouble(formattedRetailPrice) == 0.00 ? "" : formattedRetailPrice; 1349 <div class="col-xs-9 col-xs-offset-3 product-editable-area"> 1350 1351 @if (EnableEditableRetailPrice() && isDeliverable && !String.IsNullOrEmpty(Converter.ToString(priceRetailValue))) 1352 { 1353 <div class="product-selectable-edit pull-right"> 1354 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-retail-price-@loopCounter"></i> 1355 </div> 1356 } 1357 <div class="js-product-field-retail-price"> 1358 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Retail price")</span> 1359 <span class="pull-right">@retailPriceValue</span> 1360 </div> 1361 </div> 1362 } 1363 1364 @if (EnableCustomerItemNumber()) 1365 { 1366 <div class="col-xs-9 col-xs-offset-3 product-editable-area"> 1367 1368 @if (EnableEditableItemNumber() && isDeliverable) 1369 { 1370 <div class="product-selectable-edit pull-right"> 1371 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-item-number-@loopCounter"></i> 1372 </div> 1373 } 1374 <div class="js-product-field-item-number text-left"> 1375 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no.")</span> 1376 <span class="pull-right">@productInfo.CustomerItemNumber</span> 1377 </div> 1378 </div> 1379 } 1380 1381 1382 <div class="col-xs-9 col-xs-offset-3 product-editable-area"> 1383 @if (EnableEditableBarcode() && isDeliverable) 1384 { 1385 <div class="pull-right product-selectable-edit"> 1386 <i class="glyphicon glyphicon-edit pull-right js-product-fields-edit product-fields-edit" data-source="#js-ean-number-@loopCounter"></i> 1387 </div> 1388 } 1389 @if (EnableCustomerBarcode() && !String.IsNullOrEmpty(productInfo.EAN)) 1390 { 1391 <div class="js-product-field-ean text-left"> 1392 <span class="pull-left">@Translate("Deres_EAN_nummer", "EAN")</span> 1393 <span class="pull-right">@productInfo.EAN</span> 1394 </div> 1395 } 1396 </div> 1397 1398 @if (isDeliverable) 1399 { 1400 var placeholder = minQty > 0 ? String.Format("min. {0}", minQty) : minQty.ToString(); 1401 1402 <div class="col-xs-3 js-quantity-tooltip" data-placement="top" data-toggle="popover" data-trigger="manual"> 1403 @renderToolTip() 1404 @{ 1405 var quantityFieldName = "Quantity" + loopCounter; 1406 bool isServiceProduct = product.Type == Dynamicweb.Ecommerce.Products.ProductType.Service; 1407 1408 <div class="form-group"> 1409 <input type="number" min="0" name='@quantityFieldName' tabindex='@loopCounter' data-is-service="@isServiceProduct" data-stock-status='@i.StockLevel' class="form-control text-right js-quantity" placeholder="@placeholder" /> 1410 </div> 1411 } 1412 </div> 1413 <div class="col-xs-9"> 1414 @foreach (Dynamicweb.Ecommerce.Orders.OrderLineField o in SortOrderLineFields(product.OrderLineFields)) 1415 { 1416 var inputName = "EcomOrderLineFieldInput_" + o.Name + loopCounter; 1417 string placeholderText = o.Name; 1418 1419 switch (o.SystemName) 1420 { 1421 case "OrderLineComment": 1422 if (EnableComments()) 1423 { 1424 placeholderText = Translate("LineComment", "Comment"); 1425 <div class="form-group"> 1426 <input type="text" class="form-control" maxlength="80" name="@inputName" placeholder="@placeholderText" /> 1427 </div> 1428 } 1429 break; 1430 case "OrderLineColliSize": 1431 <input type="hidden" name="@inputName" value='@productInfo.ColliSize' /> 1432 break; 1433 case "OrderLineColliPerLayer": 1434 <input type="hidden" name="@inputName" value='@productInfo.ColliPerLayer' /> 1435 break; 1436 case "OrderLineColliPerCC": 1437 <input type="hidden" name="@inputName" value='@productInfo.ColliPerCc' /> 1438 break; 1439 case "OrderLineRetailPrice": 1440 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Add retail price"); 1441 <div class="hidden"> 1442 <input type="text" id="js-retail-price-@loopCounter" class="form-control js-product-field-replace js-retail-price-input text-right" data-replace-target=".js-product-field-retail-price" name="@inputName" value='@retailPriceValue' placeholder="@placeholderText" /> 1443 </div> 1444 break; 1445 case "OrderLineItemNumber": 1446 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no."); 1447 <div class="hidden"> 1448 <input type="text" id="js-item-number-@loopCounter" class="form-control js-product-field-replace text-right" data-replace-target=".js-product-field-item-number" name="@inputName" value='@productInfo.CustomerItemNumber.Trim()' placeholder="@placeholderText" /> 1449 </div> 1450 break; 1451 case "OrderLineEAN": 1452 placeholderText = Translate("Deres_EAN_nummer-short", "EAN"); 1453 <div class="hidden"> 1454 <input type="text" class="form-control js-product-field-replace text-right" id="js-ean-number-@loopCounter" data-replace-target=".js-product-field-ean" name="@inputName" value='@productInfo.EAN.Trim()' placeholder="@placeholderText" /> 1455 </div> 1456 break; 1457 } 1458 } 1459 </div> 1460 } 1461 else 1462 { 1463 <div class="col-xs-9 col-xs-offset-3"> 1464 <span class="pull-left">@Translate("Smartpage:Ecom.LeadDaysWarning.Short", "Available on")</span> <span class="label label-warning pull-right not-deliverable">@(!string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) ? AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields))) : helperService.GetFieldValue("SpAvailableFrom", i.ProductFields))</span> 1465 </div> 1466 } 1467 </div> 1468 } 1469 </div> 1470 </div> 1471 </div> 1472 } 1473 </div> 1474 </div> 1475 1476 <input type="submit" value="Add to basket" class="sr-only" /> 1477 1478 @if (isLoggedIn) 1479 { 1480 @SnippetStart("SmartpageAddToBasket") 1481 <button class="btn btn-primary btn-block btn-lg js-submit-form" data-form-selector=".js-basket-add">@Translate("Smartpage:eCom.AddToCart", "Læg i kurven")</button> 1482 @SnippetEnd("SmartpageAddToBasket") 1483 } 1484 </form> 1485 } 1486 1487 1488 @inherits ViewModelTemplate<ProductListViewModel> 1489 @using Dynamicweb; 1490 @using Dynamicweb.Core; 1491 @using Dynamicweb.Environment; 1492 @using Dynamicweb.Rendering; 1493 @using Dynamicweb.Ecommerce.ProductCatalog; 1494 @using System.Linq; 1495 @using Gasa.ProductInformation; 1496 @using Gasa.PriceInformation; 1497 @using Gasa.ProductInformation.Helpers; 1498 @using Dynamicweb.Ecommerce.Prices; 1499 1500 @helper RenderQuicklistView() 1501 { 1502 <form method="post" class="js-basket-add js-set-tabindex js-product-form-container" autocomplete="false" data-submit-url='@Pageview.Area.Item["JsonCart"]'> 1503 <input type="hidden" name="CartCmd" value="addmulti" /> 1504 @{ 1505 1506 int pageNum = Math.Max(Dynamicweb.Context.Current.Request.GetInt32("PageNum"), 1); 1507 var isLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 1508 var pagenum = 1; 1509 var defaultImage = !string.IsNullOrWhiteSpace(Converter.ToString(Pageview.Area.Item["DefaultImage"])) ? Converter.ToString(Pageview.Area.Item["DefaultImage"]) : "/Files/images/default-image.png"; 1510 1511 if (Dynamicweb.Context.Current.Request.GetInt32("pagenum") > 0) 1512 { 1513 pagenum = Dynamicweb.Context.Current.Request.GetInt32("pagenum"); 1514 } 1515 1516 var baseLoopCounter = Model.PageSize * (pageNum - 1); 1517 int productLoopCounter = 0; 1518 1519 var productService = Dynamicweb.Ecommerce.Services.Products; 1520 var helperService = new CustomProductFieldHelpers(); 1521 string currentPageLink = "/Default.aspx?ID=" + Pageview.Page.ID; 1522 string host = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Frontend.PageView.Current().Area.IsCdnActive) ? Dynamicweb.Frontend.PageView.Current().Area.CdnImageHost : string.Empty; 1523 } 1524 <div class="clearfix"></div> 1525 <div class="col-sm-12"> 1526 <div class="product-list list-group js-grid-group"> 1527 1528 @foreach (var i in Model.Products) 1529 { 1530 1531 productLoopCounter++; 1532 1533 var manufacturerName = i.Manufacturer.Name; 1534 var manufacturerWebsiteUrl = i.Manufacturer.Web; 1535 var manufacturerId = i.Manufacturer.Id; 1536 1537 var product = productService.GetProductById(i.Id, i.VariantId, true); 1538 var productInfo = new ProductInformation(product, Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser().CustomerNumber); 1539 var priceInformation = new PriceInformation(product, productInfo); 1540 1541 string productLink = currentPageLink + "&amp;GroupId=" + product.PrimaryGroupId + "&amp;ProductID=" + product.Id; 1542 1543 var images = i.ImagePatternImages; 1544 string image = defaultImage; 1545 1546 if (images.Any()) 1547 { 1548 image = images.FirstOrDefault().Value; 1549 } 1550 1551 int minQty = Converter.ToInt32(helperService.GetFieldValue("MinimumPurchaseQuantityLimit", i.ProductFields)); 1552 if (minQty == 0) 1553 { 1554 switch (Converter.ToString(helperService.GetFieldValue("MinimumPurchaseQuantity", i.ProductFields)).ToLower().Trim()) 1555 { 1556 case "layer": 1557 minQty = productInfo.ColliPerLayer; 1558 break; 1559 case "cc": 1560 minQty = productInfo.ColliPerCc; 1561 break; 1562 default: 1563 minQty = 1; 1564 break; 1565 } 1566 } 1567 1568 bool isDeliverable = string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) && Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.Price) > 0; 1569 1570 string cssIDSelector = "js-" + i.Id; 1571 1572 <div class="list-group-item row js-product border-bottom js-grid-product" data-min-quantity='@minQty' id="@cssIDSelector" data-page-num="@pageNum"> 1573 1574 <div class="col-sm-4"> 1575 1576 <h2 class="grid-item-name-list grid-item-name"> 1577 @{ 1578 var previewImageUrl = host + "/Admin/Public/getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=500&amp;Height=500&amp;Crop=5&amp;fillcanvas=true&amp;AlternativeImage=" + defaultImage; 1579 var preImage = "data:image/gif;base64,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"; 1580 } 1581 <div class="c-pointer" onclick="spOpenImage(this)" data-title="@i.Name" data-preview="@previewImageUrl" style="display: inline-block;"> 1582 <img src="@preImage" data-src="@previewImageUrl" alt="@HttpUtility.HtmlEncode(i.Name)" class="img-responsive b-lazy" style="width: 15px; height: 15px; display:inline-block;border:1px solid #8ec13c;" /> 1583 </div> 1584 1585 <a href="@productLink" class="js-product-title">@i.Name</a> 1586 1587 @if (Converter.ToBoolean(helperService.GetFieldValue("NewProduct", i.ProductFields))) 1588 { 1589 <span class="label label-warning">@Translate("Smartpage:NewProduct", "NEW")</span> 1590 } 1591 @if (Converter.ToBoolean(helperService.GetFieldValue("Bestseller", i.ProductFields))) 1592 { 1593 <span class="label label-warning">@Translate("Smartpage:Bestseller", "BESTSELLER")</span> 1594 } 1595 @if (!string.IsNullOrEmpty(Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)))) 1596 { 1597 var flagImgPath = "/Admin/Images/Flags/Small/flag_" + Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)) + ".png"; 1598 <img src='@flagImgPath' alt='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' title='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' /> 1599 } 1600 1601 </h2> 1602 1603 <div class="shortdescription"> 1604 @AddedToCart(i, "standard") 1605 <p style="margin:0;">@i.ShortDescription</p> 1606 @ListStockStatus(i, "list") 1607 </div> 1608 1609 <div class="manufacturer-website hidden-sm hidden-xs"> 1610 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) <br /> 1611 </div> 1612 1613 </div> 1614 <div class="col-md-1 col-sm-5"> 1615 <div class="potsize text-right hidden-sm hidden-xs "> 1616 @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields)) + " cm ") 1617 </div> 1618 <div class="hidden-md hidden-lg"> 1619 @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields))) cm 1620 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) <br /> 1621 </div> 1622 </div> 1623 <div class="clearfix visible-sm"></div> 1624 <div class="col-md-4 col-sm-6"> 1625 @if (isLoggedIn) 1626 { 1627 <div class="product-price"> 1628 <table class="table"> 1629 1630 <tbody> 1631 <tr> 1632 <td> 1633 @Translate("Pcs", "Stk") 1634 </td> 1635 <td> 1636 1 &times; 1637 @productInfo.ColliSize 1638 </td> 1639 <td> 1640 <span class="js-colli-per-layer">@productInfo.ColliPerLayer</span> 1641 &times; @productInfo.ColliSize 1642 </td> 1643 <td> 1644 <span class="js-colli-per-cc">@productInfo.ColliPerCc</span> 1645 &times; @productInfo.ColliSize 1646 </td> 1647 </tr> 1648 @if (!DisablePrices()) 1649 { 1650 <tr> 1651 <td> 1652 @Translate("price", "Pris") 1653 </td> 1654 <td class="js-product-field-price js-product-field-price-colli"> 1655 @if (DisplayPricesInclVat()) 1656 { 1657 if (Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.PriceWithVAT) > 0) 1658 { 1659 @:@priceInformation.Prices.PricePerColliUnit.PriceWithVAT.ToString("0.00") 1660 } 1661 1662 } 1663 else 1664 { 1665 if (Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT) > 0) 1666 { 1667 @:@priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT.ToString("0.00") 1668 } 1669 } 1670 </td> 1671 <td class="js-product-field-price js-product-field-price-layer"> 1672 @if (DisplayPricesInclVat()) 1673 { 1674 if (Converter.ToDouble(priceInformation.Prices.PricePerLayerUnit.PriceWithVAT) > 0) 1675 { 1676 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithVAT.ToString("0.00") 1677 } 1678 } 1679 else 1680 { 1681 if (Converter.ToDouble(priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT) > 0) 1682 { 1683 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT.ToString("0.00") 1684 } 1685 } 1686 </td> 1687 <td class="js-product-field-price js-product-field-price-cc"> 1688 @if (DisplayPricesInclVat()) 1689 { 1690 if (Converter.ToDouble(priceInformation.Prices.PricePerCcUnit.PriceWithVAT) > 0) 1691 { 1692 @:@priceInformation.Prices.PricePerCcUnit.PriceWithVAT.ToString("0.00") 1693 } 1694 } 1695 else 1696 { 1697 if (Converter.ToDouble(priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT) > 0) 1698 { 1699 @:@priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT.ToString("0.00") 1700 } 1701 } 1702 </td> 1703 </tr> 1704 } 1705 </tbody> 1706 </table> 1707 </div> 1708 } 1709 </div> 1710 <br class="hidden-sm hidden-md hidden-lg" /> 1711 <div class="col-md-3 col-sm-6"> 1712 @if (isLoggedIn && product.VariantCount == 0) 1713 { 1714 1715 var loopCounter = productLoopCounter + baseLoopCounter; 1716 var nameProductLoopCounter = "ProductLoopCounter" + loopCounter; 1717 var nameProductIdCounter = "ProductID" + loopCounter; 1718 var nameVariantIdCounter = "VariantID" + loopCounter; 1719 var nameUnitIdCounter = "UnitID" + loopCounter; 1720 var namewishListIdCounter = "wishListID" + loopCounter; 1721 var priceRetailValue = productInfo.CustomerRetailPrice; 1722 var priceRetail = new PriceCalculated(new PriceRaw(priceRetailValue, Dynamicweb.Ecommerce.Common.Context.Currency)); 1723 var retailPriceValue = DisplayPricesInclVat() ? Converter.ToString(priceRetail.PriceWithVAT) : Converter.ToString(priceRetail.PriceWithoutVAT); 1724 retailPriceValue = Converter.ToInt32(retailPriceValue) == 0 ? "" : FormatPrice(retailPriceValue); 1725 1726 <input type="hidden" value='@loopCounter' name='@nameProductLoopCounter'> 1727 <input type="hidden" class="js-product-id" value='@i.Id' name="@nameProductIdCounter"> 1728 <input type="hidden" value="" name="@nameVariantIdCounter"> 1729 <input type="hidden" value="" name="@nameUnitIdCounter"> 1730 <input type="hidden" value="0" name="@namewishListIdCounter"> 1731 1732 if (isDeliverable) 1733 { 1734 <div class="row"> 1735 @renderToolTip() 1736 <div class="col-xs-3 js-quantity-tooltip" data-placement="right" data-toggle="popover" data-trigger="manual"> 1737 @{ 1738 var quantityFieldName = "Quantity" + loopCounter; 1739 bool isServiceProduct = product.Type == Dynamicweb.Ecommerce.Products.ProductType.Service; 1740 1741 var placeholder = minQty > 0 ? String.Format("min. {0}", minQty) : minQty.ToString(); 1742 1743 <div class="product-list-number"> 1744 <input type="number" min="0" name='@quantityFieldName' tabindex='@loopCounter' data-is-service="@isServiceProduct" data-stock-status='@i.StockLevel' class="form-control js-quantity text-right" placeholder="@placeholder" /> 1745 </div> 1746 } 1747 </div> 1748 1749 <div class="col-xs-9"> 1750 @foreach (var o in product.OrderLineFields) 1751 { 1752 var inputName = "EcomOrderLineFieldInput_" + o.Name + loopCounter; 1753 string placeholderText = o.Name; 1754 switch (o.SystemName) 1755 { 1756 case "OrderLineComment": 1757 if (EnableComments()) 1758 { 1759 placeholderText = Translate("LineComment", "Comment"); 1760 <input type="text" class="form-control" maxlength="80" name="@inputName" placeholder="@placeholderText" /> 1761 } 1762 break; 1763 case "OrderLineColliSize": 1764 <input type="hidden" name="@inputName" value='@productInfo.ColliSize' /> 1765 break; 1766 case "OrderLineColliPerLayer": 1767 <input type="hidden" name="@inputName" value='@productInfo.ColliPerLayer' /> 1768 break; 1769 case "OrderLineColliPerCC": 1770 <input type="hidden" name="@inputName" value='@productInfo.ColliPerCc' /> 1771 break; 1772 case "OrderLineRetailPrice": 1773 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Add retail price"); 1774 <div class="hidden"> 1775 <input type="text" id="js-retail-price-@loopCounter" class="form-control js-retail-price-input js-product-field-replace text-right" data-replace-target=".js-product-field-retail-price" name="@inputName" value='@retailPriceValue' placeholder="@placeholderText" /> 1776 </div> 1777 break; 1778 case "OrderLineItemNumber": 1779 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no."); 1780 <div class="hidden"> 1781 <input type="text" id="js-item-number-@loopCounter" class="form-control js-product-field-replace text-right" data-replace-target=".js-product-field-item-number" name="@inputName" value='@productInfo.CustomerItemNumber.Trim()' placeholder="@placeholderText" /> 1782 </div> 1783 break; 1784 case "OrderLineEAN": 1785 placeholderText = Translate("Deres_EAN_nummer-short", "EAN"); 1786 1787 <div class="hidden"> 1788 <div class="editable" data-placeholder="my placeholder"> 1789 <input type="text" id="js-ean-number-@loopCounter" class="form-control js-product-field-replace text-right" data-replace-target=".js-product-field-ean" name="@inputName" value='@productInfo.EAN.Trim()' placeholder="@placeholderText" /> 1790 </div> 1791 </div> 1792 1793 break; 1794 default: 1795 <text>@inputName</text> 1796 break; 1797 } 1798 } 1799 </div> 1800 </div> 1801 } 1802 1803 if (!isDeliverable) 1804 { 1805 <div class="row"> 1806 <div class="hidden-xs col-sm-3 hidden-md hidden-lg"></div> 1807 <div class="col-sm-9 col-md-12 col-lg-offset-3 col-lg-9 product-editable-area"> 1808 <p>@Translate("Smartpage:Ecom.LeadDaysWarning", "Available on") <span class="label label-warning">@(!string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) ? AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields))) : helperService.GetFieldValue("SpAvailableFrom", i.ProductFields))</span></p> 1809 </div> 1810 </div> 1811 } 1812 1813 } 1814 </div> 1815 </div> 1816 } 1817 </div> 1818 1819 </div> 1820 1821 <input type="submit" value="Add to basket" class="sr-only" /> 1822 1823 @if (isLoggedIn) 1824 { 1825 @SnippetStart("SmartpageAddToBasket") 1826 <button class="btn btn-primary btn-block btn-lg js-submit-form" data-form-selector=".js-basket-add">@Translate("Smartpage:eCom.AddToCart", "Læg i kurven")</button> 1827 @SnippetEnd("SmartpageAddToBasket") 1828 } 1829 </form> 1830 } 1831 1832 @inherits ViewModelTemplate<ProductListViewModel> 1833 @using Dynamicweb; 1834 @using Dynamicweb.Core; 1835 @using Dynamicweb.Environment; 1836 @using Dynamicweb.Rendering; 1837 @using Dynamicweb.Ecommerce.ProductCatalog; 1838 @using System.Linq; 1839 @using Gasa.ProductInformation; 1840 @using Gasa.PriceInformation; 1841 @using Gasa.ProductInformation.Helpers; 1842 @using Dynamicweb.Ecommerce.Prices; 1843 1844 @helper RenderTilesView() 1845 { 1846 <form method="post" class="js-basket-add js-set-tabindex row js-product-form-container" autocomplete="false" data-submit-url='@Pageview.Area.Item["JsonCart"]'> 1847 <input type="hidden" name="CartCmd" value="addmulti" /> 1848 @{ 1849 1850 string pageNum = Dynamicweb.Context.Current.Request["PageNum"]; 1851 var isLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 1852 var pagenum = 1; 1853 var defaultImage = !string.IsNullOrWhiteSpace(Converter.ToString(Pageview.Area.Item["DefaultImage"])) ? Converter.ToString(Pageview.Area.Item["DefaultImage"]) : "/Files/images/default-image.png"; 1854 1855 if (Dynamicweb.Context.Current.Request.GetInt32("pagenum") > 0) 1856 { 1857 pagenum = Dynamicweb.Context.Current.Request.GetInt32("pagenum"); 1858 } 1859 1860 var baseLoopCounter = Model.PageSize * (pagenum - 1); 1861 1862 int productLoopCounter = 0; 1863 1864 var productService = Dynamicweb.Ecommerce.Services.Products; 1865 var helperService = new CustomProductFieldHelpers(); 1866 string currentPageLink = "/Default.aspx?ID=" + Pageview.Page.ID; 1867 string host = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Frontend.PageView.Current().Area.IsCdnActive) ? Dynamicweb.Frontend.PageView.Current().Area.CdnImageHost : string.Empty; 1868 } 1869 <div class="col-xs-12"> 1870 <div class="product-grid grid-group js-grid-group"> 1871 @foreach (var i in Model.Products) 1872 { 1873 productLoopCounter++; 1874 var manufacturerName = i.Manufacturer.Name; 1875 var manufacturerWebsiteUrl = i.Manufacturer.Web; 1876 var manufacturerId = i.Manufacturer.Id; 1877 1878 var product = productService.GetProductById(i.Id, i.VariantId, true); 1879 var productInfo = new ProductInformation(product, Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser().CustomerNumber); 1880 var priceInformation = new PriceInformation(product, productInfo); 1881 1882 string productLink = currentPageLink + "&amp;GroupId=" + product.PrimaryGroupId + "&amp;ProductID=" + product.Id; 1883 1884 var images = i.ImagePatternImages; 1885 string image = defaultImage; 1886 1887 if (images.Any()) 1888 { 1889 image = images.FirstOrDefault().Value; 1890 } 1891 1892 int minQty = Converter.ToInt32(helperService.GetFieldValue("MinimumPurchaseQuantityLimit", i.ProductFields)); 1893 if (minQty == 0) 1894 { 1895 switch (Converter.ToString(helperService.GetFieldValue("MinimumPurchaseQuantity", i.ProductFields)).ToLower().Trim()) 1896 { 1897 case "layer": 1898 minQty = productInfo.ColliPerLayer; 1899 break; 1900 case "cc": 1901 minQty = productInfo.ColliPerCc; 1902 break; 1903 default: 1904 minQty = 1; 1905 break; 1906 } 1907 } 1908 1909 bool isDeliverable = string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) && Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.Price) > 0; 1910 string cssIDSelector = "js-" + i.Id; 1911 1912 <div class="grid-group-item col-xs-12 col-sm-6 col-md-4 col-lg-3 clearfix js-product js-grid-product" data-min-quantity='@minQty' id="@cssIDSelector" data-page-num="@pageNum"> 1913 <div class="grid-group-item-img"> 1914 @{ 1915 var previewImageUrl = host + "/Admin/Public/getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=500&amp;Height=500&amp;Crop=5&amp;fillcanvas=True"; 1916 var preImage = "data:image/gif;base64,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"; 1917 } 1918 <div class="c-pointer" onclick="spOpenImage(this)" data-title="@i.Name" data-preview="@previewImageUrl"> 1919 <span class="ms-layer ms-btn fullscreen-btn"><i class="glyphicon glyphicon-fullscreen"></i></span> 1920 <img src="@preImage" data-src="@previewImageUrl" alt="@HttpUtility.HtmlEncode(i.Name)" class="img-responsive b-lazy" /> 1921 </div> 1922 @if (images.Count > 1) 1923 { 1924 <span class="label label-info label-amount-pictures"><i class="glyphicon glyphicon-picture"></i> @images.Count</span> 1925 } 1926 1927 @AddedToCart(i, "absolute") 1928 </div> 1929 1930 <div class="item-description-gallery-view"> 1931 <h2> 1932 <a href="@productLink" class="js-product-title">@i.Name</a> 1933 @if (Converter.ToBoolean(helperService.GetFieldValue("NewProduct", i.ProductFields))) 1934 { 1935 <span class="label label-warning">@Translate("Smartpage:NewProduct", "NEW")</span> 1936 } 1937 @if (Converter.ToBoolean(helperService.GetFieldValue("Bestseller", i.ProductFields))) 1938 { 1939 <span class="label label-warning">@Translate("Smartpage:Bestseller", "BESTSELLER")</span> 1940 } 1941 @if (!string.IsNullOrEmpty(Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)))) 1942 { 1943 var flagImgPath = "/Admin/Images/Flags/Small/flag_" + Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)) + ".png"; 1944 <img src='@flagImgPath' alt='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' title='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' /> 1945 } 1946 1947 </h2> 1948 <div class="product-description"> 1949 @ListStockStatus(i, "tiles") 1950 @i.ShortDescription 1951 </div> 1952 <div class="product-unit"> 1953 &Oslash; @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields)) + " cm H: " + product.Height) cm <br /> 1954 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) 1955 </div> 1956 1957 </div> 1958 1959 <div class="product-grid-price"> 1960 @if (isLoggedIn) 1961 { 1962 <div class="product-price"> 1963 <table class="table"> 1964 <thead> 1965 <tr> 1966 <td>&nbsp;</td> 1967 <th> 1968 <div class="pictogram"> 1969 <div class="pictogram-box"></div> 1970 </div> 1971 </th> 1972 <th> 1973 <div class="pictogram"> 1974 <div class="pictogram-layer"></div> 1975 </div> 1976 </th> 1977 <th> 1978 <div class="pictogram"> 1979 <div class="pictogram-container"></div> 1980 </div> 1981 </th> 1982 </tr> 1983 </thead> 1984 <tbody> 1985 <tr> 1986 <td> 1987 @Translate("Pcs", "Stk") 1988 </td> 1989 <td> 1990 1 &times; 1991 @productInfo.ColliSize 1992 </td> 1993 <td> 1994 <span class="js-colli-per-layer">@productInfo.ColliPerLayer</span> 1995 &times; @productInfo.ColliSize 1996 </td> 1997 <td> 1998 <span class="js-colli-per-cc">@productInfo.ColliPerCc</span> 1999 &times; @productInfo.ColliSize 2000 </td> 2001 </tr> 2002 2003 @if (!DisablePrices()) 2004 { 2005 <tr> 2006 <td> 2007 @Translate("price", "Pris") 2008 </td> 2009 <td class="js-product-field-price js-product-field-price-colli"> 2010 @if (DisplayPricesInclVat()) 2011 { 2012 if (Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.PriceWithVAT) > 0) 2013 { 2014 @:@priceInformation.Prices.PricePerColliUnit.PriceWithVAT.ToString("0.00") 2015 } 2016 2017 } 2018 else 2019 { 2020 if (Converter.ToDouble(priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT) > 0) 2021 { 2022 @:@priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT.ToString("0.00") 2023 } 2024 } 2025 </td> 2026 <td class="js-product-field-price js-product-field-price-layer"> 2027 @if (DisplayPricesInclVat()) 2028 { 2029 if (Converter.ToDouble(priceInformation.Prices.PricePerLayerUnit.PriceWithVAT) > 0) 2030 { 2031 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithVAT.ToString("0.00") 2032 } 2033 } 2034 else 2035 { 2036 if (Converter.ToDouble(priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT) > 0) 2037 { 2038 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT.ToString("0.00") 2039 } 2040 } 2041 </td> 2042 <td class="js-product-field-price js-product-field-price-cc"> 2043 @if (DisplayPricesInclVat()) 2044 { 2045 if (Converter.ToDouble(priceInformation.Prices.PricePerCcUnit.PriceWithVAT) > 0) 2046 { 2047 @:@priceInformation.Prices.PricePerCcUnit.PriceWithVAT.ToString("0.00") 2048 } 2049 } 2050 else 2051 { 2052 if (Converter.ToDouble(priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT) > 0) 2053 { 2054 @:@priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT.ToString("0.00") 2055 } 2056 } 2057 </td> 2058 </tr> 2059 } 2060 </tbody> 2061 </table> 2062 </div> 2063 <div class="row"> 2064 <div class="editable-area-wrap-tile"> 2065 @if (isLoggedIn) 2066 { 2067 var loopCounter = productLoopCounter + baseLoopCounter; 2068 bool isServiceProduct = product.Type == Dynamicweb.Ecommerce.Products.ProductType.Service; 2069 var nameProductLoopCounter = "ProductLoopCounter" + loopCounter; 2070 var nameProductIdCounter = "ProductID" + loopCounter; 2071 var nameVariantIdCounter = "VariantID" + loopCounter; 2072 var nameUnitIdCounter = "UnitID" + loopCounter; 2073 var namewishListIdCounter = "wishListID" + loopCounter; 2074 var quantityFieldName = "Quantity" + loopCounter; 2075 var priceRetailValue = productInfo.CustomerRetailPrice; 2076 var priceRetail = new PriceCalculated(new PriceRaw(priceRetailValue, Dynamicweb.Ecommerce.Common.Context.Currency)); 2077 var retailPriceValue = DisplayPricesInclVat() ? Converter.ToString(priceRetail.PriceWithVAT) : Converter.ToString(priceRetail.PriceWithoutVAT); 2078 retailPriceValue = Converter.ToInt32(retailPriceValue) == 0 ? "" : FormatPrice(retailPriceValue); 2079 2080 <input type="hidden" value='@loopCounter' name='@nameProductLoopCounter'> 2081 <input type="hidden" value='@i.Id' name="@nameProductIdCounter"> 2082 <input type="hidden" value="" name="@nameVariantIdCounter"> 2083 <input type="hidden" value="" name="@nameUnitIdCounter"> 2084 <input type="hidden" value="0" name="@namewishListIdCounter"> 2085 2086 <!-- ::::::product-editable-area::::::: --> 2087 2088 if (EnableDisplayOfGrossMargin() && isDeliverable) 2089 { 2090 var pricePerColliUnit = priceInformation.Prices.PricePerColliUnit; 2091 double customerSalesPrice = DisplayPricesInclVat() ? pricePerColliUnit.PriceWithVAT : pricePerColliUnit.PriceWithoutVAT; 2092 2093 <div class="col-xs-12 product-editable-area"> 2094 <i class="js-product-field-gross-margin text-muted"> 2095 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.GrossMargin", "Gross margin")</span> 2096 <span class="pull-right js-gross-margin-value"> 2097 @if (priceRetail.Price > 0) 2098 { 2099 @GetGrossMargin(priceRetail.Price, customerSalesPrice); 2100 } 2101 else 2102 { 2103 @Translate("Smartpage:ecom:CustomerSpecificInfo.GrossMargin.NA", "N/A") 2104 } 2105 </span> 2106 </i> 2107 </div> 2108 } 2109 2110 if (EnableCustomerRetailPrice() && isDeliverable) 2111 { 2112 var formattedRetailPrice = DisplayPricesInclVat() ? priceRetail.PriceWithVATFormatted : priceRetail.PriceWithoutVATFormatted; 2113 formattedRetailPrice = Converter.ToDouble(formattedRetailPrice) == 0.00 ? "" : formattedRetailPrice; 2114 <div class="col-xs-12 product-editable-area"> 2115 2116 @if (EnableEditableRetailPrice() && isDeliverable && !String.IsNullOrEmpty(Converter.ToString(priceRetailValue))) 2117 { 2118 <div class="product-selectable-edit pull-right"> 2119 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-retail-price-@loopCounter"></i> 2120 </div> 2121 } 2122 <div class="js-product-field-retail-price"> 2123 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Retail price")</span> 2124 <span class="pull-right">@retailPriceValue</span> 2125 </div> 2126 </div> 2127 } 2128 2129 2130 if (EnableCustomerItemNumber()) 2131 { 2132 <div class="col-xs-12 product-editable-area"> 2133 2134 @if (EnableEditableItemNumber() && isDeliverable) 2135 { 2136 <div class="product-selectable-edit pull-right"> 2137 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-item-number-@loopCounter"></i> 2138 </div> 2139 } 2140 <div class="js-product-field-item-number text-left"> 2141 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no.")</span> 2142 <span class="pull-right">@productInfo.CustomerItemNumber</span> 2143 </div> 2144 </div> 2145 } 2146 2147 <div class="col-xs-12 product-editable-area push-last-row"> 2148 @if (EnableEditableBarcode() && isDeliverable) 2149 { 2150 <div class="pull-right product-selectable-edit"> 2151 <i class="glyphicon glyphicon-edit pull-right js-product-fields-edit product-fields-edit" data-source="#js-ean-number-@loopCounter"></i> 2152 </div> 2153 } 2154 @if (EnableCustomerBarcode() && !String.IsNullOrEmpty(productInfo.EAN)) 2155 { 2156 <div class="js-product-field-ean text-left"> 2157 <span class="pull-left">@Translate("Deres_EAN_nummer", "EAN")</span> 2158 <span class="pull-right">@productInfo.EAN</span> 2159 </div> 2160 } 2161 </div> 2162 2163 <!-- ::::::product-editable-area::::::: --> 2164 2165 if (isDeliverable) 2166 { 2167 var placeholder = minQty > 0 ? String.Format("min. {0}", minQty) : minQty.ToString(); 2168 2169 <div class="col-xs-4 js-quantity-tooltip" data-placement="top" data-toggle="popover" data-trigger="manual" style="padding-right:0;"> 2170 @renderToolTip() 2171 <div class="form-group"> 2172 <input type="number" min="0" data-is-service="@isServiceProduct" data-stock-status='@i.StockLevel' name='@quantityFieldName' tabindex='@loopCounter' class="form-control text-right js-quantity" placeholder="@placeholder" /> 2173 </div> 2174 </div> 2175 foreach (Dynamicweb.Ecommerce.Orders.OrderLineField o in SortOrderLineFields(product.OrderLineFields)) 2176 { 2177 var inputName = "EcomOrderLineFieldInput_" + o.Name + loopCounter; 2178 string placeholderText = o.Name; 2179 2180 switch (o.SystemName) 2181 { 2182 case "OrderLineComment": 2183 if (EnableComments()) 2184 { 2185 placeholderText = Translate("LineComment", "Comment"); 2186 <div class="col-xs-8"> 2187 <div class="form-group"> 2188 <input type="text" class="form-control" name='@inputName' maxlength="80" placeholder='@placeholderText' /> 2189 </div> 2190 </div> 2191 } 2192 break; 2193 case "OrderLineColliSize": 2194 <input type="hidden" name="@inputName" value='@productInfo.ColliSize' /> 2195 break; 2196 case "OrderLineColliPerLayer": 2197 <input type="hidden" name="@inputName" value='@productInfo.ColliPerLayer' /> 2198 break; 2199 case "OrderLineColliPerCC": 2200 <input type="hidden" name="@inputName" value='@productInfo.ColliPerCc' /> 2201 break; 2202 case "OrderLineEAN": 2203 placeholderText = Translate("Deres_EAN_nummer-short", "EAN"); 2204 <div class="hidden"> 2205 <input type="text" class="form-control js-product-field-replace text-right" id="js-ean-number-@loopCounter" data-replace-target=".js-product-field-ean" name="@inputName" value='@productInfo.EAN.Trim()' placeholder="@placeholderText" /> 2206 </div> 2207 break; 2208 case "OrderLineRetailPrice": 2209 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Add retail price"); 2210 <div class="hidden"> 2211 <input type="text" id="js-retail-price-@loopCounter" class="form-control js-product-field-replace js-retail-price-input text-right" data-replace-target=".js-product-field-retail-price" name="@inputName" value='@retailPriceValue' placeholder="@placeholderText" /> 2212 </div> 2213 break; 2214 case "OrderLineItemNumber": 2215 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no."); 2216 <div class="hidden"> 2217 <input type="text" id="js-item-number-@loopCounter" class="form-control js-product-field-replace text-right" data-replace-target=".js-product-field-item-number" name="@inputName" value='@productInfo.CustomerItemNumber.Trim()' placeholder="@placeholderText" /> 2218 </div> 2219 break; 2220 } 2221 } 2222 } 2223 else 2224 { 2225 <div class="col-sm-12 text-center product-not-available"> 2226 <p>@Translate("Smartpage:Ecom.LeadDaysWarning.Short", "Available on") <span class="label label-warning">@(!string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) ? AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields))) : helperService.GetFieldValue("SpAvailableFrom", i.ProductFields))</span></p> 2227 </div> 2228 } 2229 } 2230 </div> 2231 </div> 2232 } 2233 </div> 2234 <div class="clearfix"></div> 2235 </div> 2236 2237 2238 } 2239 </div> 2240 </div> 2241 2242 <input type="submit" value="Add to basket" class="sr-only" /> 2243 @if (isLoggedIn) 2244 { 2245 @SnippetStart("SmartpageAddToBasket") 2246 <button class="btn btn-primary btn-block btn-lg js-submit-form" data-form-selector=".js-basket-add">@Translate("Smartpage:eCom.AddToCart", "Læg i kurven")</button> 2247 @SnippetEnd("SmartpageAddToBasket") 2248 } 2249 </form> 2250 } 2251 2252 2253 @{ 2254 string listLink = LinkHelper.ReplaceQueryString("viewmode", "list"); 2255 string gridLink = LinkHelper.ReplaceQueryString("viewmode", "grid"); 2256 string photoLink = LinkHelper.ReplaceQueryString("viewmode", "photo"); 2257 string quicklistLink = LinkHelper.ReplaceQueryString("viewmode", "quicklist"); 2258 2259 2260 string urlParamView = Dynamicweb.Context.Current.Request.GetString("viewmode"); 2261 Cookie cookieViewMode = Dynamicweb.Environment.CookieManager.GetCookie("viewmode"); 2262 string cookieValue = String.Empty; 2263 2264 string currentQuery = "/Default.aspx?" + System.Web.HttpContext.Current.Request.QueryString.ToString(); 2265 var queryString = "?" + System.Web.HttpContext.Current.Request.QueryString.ToString(); 2266 2267 2268 string productEmptySortUrl = LinkHelper.ReplaceQueryString(queryString, "sortby", ""); 2269 string productNameURL = LinkHelper.ReplaceQueryString(queryString, "sortby", "productname"); 2270 string productNameLinkAsc = LinkHelper.ReplaceQueryString(productNameURL, "sortorder", "asc"); 2271 string productNameLinkDesc = LinkHelper.ReplaceQueryString(productNameURL, "sortorder", "desc"); 2272 2273 2274 var isNameAscSelected = (currentQuery.ToLower().Contains("&sortby=productname") && currentQuery.ToLower().Contains("&sortorder=asc")); 2275 var isNameDescSelected = (currentQuery.ToLower().Contains("&sortby=productname") && currentQuery.ToLower().Contains("&sortorder=desc")); 2276 2277 string potSizeURL = LinkHelper.ReplaceQueryString(queryString, "sortby", "CustomField_ProductPotSize"); 2278 string potSizeLinkAsc = LinkHelper.ReplaceQueryString(potSizeURL, "sortorder", "asc"); 2279 string potSizeLinkDesc = LinkHelper.ReplaceQueryString(potSizeURL, "sortorder", "desc"); 2280 2281 var isPotSizeAscSelected = (currentQuery.ToLower().Contains("&sortby=customfield_productpotsize") && currentQuery.ToLower().Contains("&sortorder=asc")); 2282 var isPotSizeDescSelected = (currentQuery.ToLower().Contains("&sortby=customfield_productpotsize") && currentQuery.ToLower().Contains("&sortorder=desc")); 2283 2284 2285 var currentUser = Dynamicweb.Frontend.PageView.Current().User; 2286 2287 var excelField = currentUser.CustomFieldValues.Where(x => x.CustomField.SystemName == "AccessUser_ProductFieldExport").FirstOrDefault(); 2288 2289 bool enableExcelExport = !string.IsNullOrEmpty(Converter.ToString(excelField.Value)); 2290 var excelDownloadUrl = LinkHelper.ReplaceQueryString("excel", "true") + "&pagesize=10000"; 2291 var baseURL = "/Files/Templates/Designs/" + Pageview.Layout.Design.Name.TrimEnd('/'); //GetString("Template:DesignBaseUrl").TrimEnd('/'); 2292 2293 bool isMobile = Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:Device.IsMobile").Value); 2294 2295 var helperService = new CustomProductFieldHelpers(); 2296 } 2297 2298 @if (cookieViewMode != null) 2299 { 2300 cookieValue = cookieViewMode.Value; 2301 } 2302 2303 @{ 2304 string viewMode = urlParamView == "grid" ? "grid" : urlParamView == "list" ? "list" : urlParamView == "photo" ? "photo" : urlParamView == "quicklist" ? "quicklist" : 2305 cookieValue == "grid" ? "grid" : cookieValue == "list" ? "list" : cookieValue == "photo" ? "photo" : cookieValue == "quicklist" ? "quicklist" : String.Empty; 2306 2307 if (String.IsNullOrEmpty(viewMode)) 2308 { 2309 viewMode = Converter.ToString(Pageview.Area.Item["DefaultProductView"]); 2310 } 2311 else 2312 { 2313 Dynamicweb.Environment.CookieManager.SetCookie("viewmode", viewMode, DateTime.Now.AddDays(30)); 2314 } 2315 2316 if (String.IsNullOrEmpty(viewMode) || isMobile) 2317 { 2318 viewMode = "grid"; 2319 } 2320 } 2321 2322 @RenderSearch() 2323 2324 <div class="clearfix"></div> 2325 2326 @PricesWithVATStatus("top") 2327 2328 <div class="page-header"> 2329 <h1 class="page-header-h1 pull-left col-sm-3"> 2330 @{ 2331 string groupId = System.Web.HttpContext.Current.Request["GroupId"]; 2332 string currentParagraphHeader = Pageview.CurrentParagraph.Header; 2333 2334 if (!string.IsNullOrEmpty(groupId)) 2335 { 2336 var group = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(groupId); 2337 if (group != null) 2338 { 2339 @group.Name 2340 } 2341 else 2342 { 2343 @currentParagraphHeader 2344 } 2345 } 2346 else 2347 { 2348 @currentParagraphHeader 2349 } 2350 } 2351 </h1> 2352 <div class="col-sm-9"> 2353 <div class="row"> 2354 @if (!isMobile) 2355 { 2356 <div class="hidden-xs col-sm-5 col-md-3"> 2357 <div class="filter-product-list"> 2358 <select class="form-control js-select-filter-products select-filter-products"> 2359 <option value="@productEmptySortUrl" data-label-select="true">@Translate("Smartpage:ProductList.Filter.Text", "Sort by")</option> 2360 <option value='@productNameLinkAsc' selected='@isNameAscSelected'>@Translate("Smartpage:ProductList.Filter.ProductName.Asc", "Alphabetical A-Z")</option> 2361 <option value='@productNameLinkDesc' selected='@isNameDescSelected'>@Translate("Smartpage:ProductList.Filter.ProductName.Desc", "Alphabetical Z-A")</option> 2362 <option value='@potSizeLinkAsc' selected='@isPotSizeAscSelected'>@Translate("Smartpage:ProductList.Filter.PotSize.Asc", "Pot size ascending")</option> 2363 <option value='@potSizeLinkDesc' selected='@isPotSizeDescSelected'>@Translate("Smartpage:ProductList.Filter.PotSize.Desc", "Pot size descending")</option> 2364 </select> 2365 </div> 2366 </div> 2367 } 2368 2369 @if (viewMode == "list" || viewMode == "quicklist") 2370 { 2371 <div class="hidden-xs hidden-sm"> 2372 <div class="col-md-offset-1 col-md-1 text-right list-dia"> 2373 &Oslash; 2374 </div> 2375 <div class="col-md-4"> 2376 <div class="product-price row"> 2377 <table class="table table-pictogram"> 2378 <thead> 2379 <tr> 2380 <td>&nbsp;</td> 2381 <th> 2382 <div class="pictogram"> 2383 <div class="pictogram-box"></div> 2384 </div> 2385 </th> 2386 <th> 2387 <div class="pictogram"> 2388 <div class="pictogram-layer"></div> 2389 </div> 2390 </th> 2391 <th> 2392 <div class="pictogram"> 2393 <div class="pictogram-container"></div> 2394 </div> 2395 </th> 2396 </tr> 2397 </thead> 2398 </table> 2399 </div> 2400 </div> 2401 </div> 2402 } 2403 2404 @if (!isMobile) 2405 { 2406 <div class="viewmode pull-right"> 2407 @if (enableExcelExport) 2408 { 2409 <a href="@excelDownloadUrl" class="btn btn-default" title='@Translate("Smartpage:eCom.ExcelExport", "Download as Excel-file")'><img src="@baseURL/Assets/Images/Excel-icon-grey.png" alt='@Translate("Smartpage:ProductList.DownloadAsExcel","Hent som excel")' /></a> 2410 } 2411 <div class="btn-group" role="group"> 2412 @{ 2413 var listActiveLink = String.Empty; 2414 if (viewMode == "list") 2415 { 2416 listActiveLink = "active"; 2417 } 2418 <a class="js-listview js-view-change js-tooltips listview-link view-link btn btn-default @listActiveLink" href="@listLink" data-toggle="tooltip" data-placement="top" data-container=".viewmode" title='@Translate("Smartpage:ProductList.Tooltip.ViewMode.List", "View as list")'><i class="glyphicon glyphicon-list"></i></a> 2419 } 2420 @{ 2421 listActiveLink = String.Empty; 2422 if (viewMode == "grid") 2423 { 2424 listActiveLink = "active"; 2425 } 2426 <a class="js-gridview js-view-change js-tooltips gridview-link view-link btn btn-default @listActiveLink" href="@gridLink" data-toggle="tooltip" data-placement="top" data-container=".viewmode" title='@Translate("Smartpage:ProductList.Tooltip.ViewMode.Grid", "View as grid")'><i class="glyphicon glyphicon-th-large"></i></a> 2427 } 2428 @{ 2429 listActiveLink = String.Empty; 2430 if (viewMode == "photo") 2431 { 2432 listActiveLink = "active"; 2433 } 2434 <a class="js-photoview js-view-change js-tooltips photoview-link view-link btn btn-default @listActiveLink" href="@photoLink" data-toggle="tooltip" data-placement="top" data-container=".viewmode" title='@Translate("Smartpage:ProductList.Tooltip.ViewMode.Photos","View as photos")'><i class="glyphicon glyphicon-th-list"></i></a> 2435 } 2436 @{ 2437 listActiveLink = String.Empty; 2438 if (viewMode == "quicklist") 2439 { 2440 listActiveLink = "active"; 2441 } 2442 <a class="js-quicklistview js-view-change js-tooltips quicklistview-link view-link btn btn-default @listActiveLink" href="@quicklistLink" data-toggle="tooltip" data-placement="top" data-container=".viewmode" title='@Translate("Smartpage:ProductList.Tooltip.ViewMode.Quicklist","View as quick list")'><i class="glyphicon glyphicon-align-justify"></i></a> 2443 } 2444 </div> 2445 </div> 2446 } 2447 2448 </div> 2449 2450 </div> 2451 <div class="clearfix"></div> 2452 </div> 2453 <div class="border-bottom-box"> 2454 <div class="clearfix"></div> 2455 <div class="productlistnavigation navigation-top hidden"> 2456 2457 <span class="productcount"> 2458 @Model.TotalProductsCount 2459 @Translate("SmartPage:Product.Paging.ProductsFound", "produkter fundet") 2460 </span> 2461 2462 <span class="pagenavigation pull-right js-product-pagination" data-url="@System.Web.HttpContext.Current.Request.RawUrl"> 2463 @{ 2464 string groupIdQueryParameter = string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["GroupID"]) 2465 ? string.Empty 2466 : "&amp;GroupID=" + Dynamicweb.Context.Current.Request["GroupID"]; 2467 string currentPageLink = "/Default.aspx?ID=" + Pageview.Page.ID + groupIdQueryParameter; 2468 2469 string currentPageNumber = string.IsNullOrWhiteSpace(HttpContext.Current.Request["PageNum"]) ? "1" : HttpContext.Current.Request["PageNum"]; 2470 2471 if (Converter.ToInt32(currentPageNumber) > Model.PageCount) 2472 { 2473 currentPageLink = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString(Dynamicweb.Context.Current.Request.Url.PathAndQuery, "PageNum", Converter.ToString(Converter.ToInt32(currentPageNumber) - 1)); 2474 <a class="prevpage js-prev-page" href="@currentPageLink">@Translate("SmartPage:Product.Paging.Previous", "Forrige")</a> 2475 } 2476 if (Converter.ToInt32(currentPageNumber) < Model.PageCount) 2477 { 2478 currentPageLink = Dynamicweb.Environment.Helpers.LinkHelper.ReplaceQueryString(Dynamicweb.Context.Current.Request.Url.PathAndQuery, "PageNum", Converter.ToString(Converter.ToInt32(currentPageNumber) + 1)); 2479 if (!currentPageLink.Contains("LayoutTemplate")) 2480 { 2481 currentPageLink += "&LayoutTemplate=NoLayout.html"; 2482 } 2483 <a class="nextpage js-next-page" href="@currentPageLink">@Translate("SmartPage:Product.Paging.Next", "Næste")</a> 2484 } 2485 } 2486 <br /> 2487 </span> 2488 </div> 2489 <div class="col-sm-3"> 2490 @if (isMobile) 2491 { 2492 <div class="row"> 2493 <div class="col-xs-12 filter-product-list"> 2494 <select class="form-control js-select-filter-products select-filter-products"> 2495 <option value="@productEmptySortUrl" data-label-select="true">@Translate("Smartpage:ProductList.Filter.Text", "Sort by")</option> 2496 <option value='@productNameLinkAsc' @isNameAscSelected>@Translate("Smartpage:ProductList.Filter.ProductName.Asc", "Alphabetical A-Z")</option> 2497 <option value='@productNameLinkDesc' @isNameDescSelected>@Translate("Smartpage:ProductList.Filter.ProductName.Desc", "Alphabetical Z-A")</option> 2498 <option value='@potSizeLinkAsc' @isPotSizeAscSelected>@Translate("Smartpage:ProductList.Filter.PotSize.Asc", "Pot size ascending")</option> 2499 <option value='@potSizeLinkDesc' @isPotSizeDescSelected>@Translate("Smartpage:ProductList.Filter.PotSize.Desc", "Pot size descending")</option> 2500 </select> 2501 </div> 2502 </div> 2503 } 2504 2505 @inherits ViewModelTemplate<ProductListViewModel> 2506 @using Dynamicweb; 2507 @using Dynamicweb.Frontend; 2508 @using Dynamicweb.Rendering; 2509 @using Dynamicweb.Ecommerce.ProductCatalog; 2510 @using System.Linq; 2511 @using Dynamicweb.Core; 2512 2513 @{ 2514 var designBaseUrl = "/Files/Templates/Designs/" + Pageview.Layout.Design.Name.TrimEnd('/');//GetString("Template:DesignBaseUrl").TrimEnd('/'); 2515 } 2516 2517 <form name="EcomSearch" class="form-filters js-form-filters" method="get" action='@SearchEngineFriendlyURLs.GetFriendlyUrl(Converter.ToInt32(Pageview.Page.ID))'> 2518 @*<input type="hidden" name="ID" value='@Converter.ToInt32(Pageview.Page.ID)' />*@ 2519 @* start - enable ajax loading *@ 2520 <input type="hidden" id="js-ajax-filter-enabled" value="true" /> 2521 @* end - enable ajax loading *@ 2522 @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["SortBy"])) 2523 { 2524 <input type="hidden" name="SortBy" value='@Dynamicweb.Context.Current.Request["SortBy"]' /> 2525 } 2526 @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["SortOrder"])) 2527 { 2528 <input type="hidden" name="SortOrder" value='@Dynamicweb.Context.Current.Request["SortOrder"]' /> 2529 } 2530 @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["GroupID"])) 2531 { 2532 <input type="hidden" name="GroupID" value='@Dynamicweb.Context.Current.Request["GroupID"]' /> 2533 } 2534 @if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["q"])) 2535 { 2536 <input type="hidden" name="q" value='@Dynamicweb.Context.Current.Request["q"]' /> 2537 } 2538 2539 <input type="submit" class="sr-only"> 2540 2541 <div class="filter-range"> 2542 <h3>@Translate("Potsize", "Pot size")</h3> 2543 @{ 2544 var potsizes = HttpContext.Current.Request.QueryString.GetValues("potsize"); 2545 if (potsizes == null) // Try to get from post instead 2546 { 2547 potsizes = HttpContext.Current.Request.Form.GetValues("potsize"); 2548 } 2549 var potsizeMin = 0; 2550 var potsizeMax = 0; 2551 if (potsizes != null) 2552 { 2553 if (potsizes.Length == 1) 2554 { 2555 potsizes = potsizes.First().Split(','); 2556 } 2557 2558 if (potsizes.Length == 2) 2559 { 2560 potsizeMin = Converter.ToInt32(potsizes.First()); 2561 potsizeMax = Converter.ToInt32(potsizes.Last()); 2562 } 2563 } 2564 } 2565 <div class="row filter-range-inputs"> 2566 <div class="col-xs-4"> 2567 <label>@Translate("Smartpage:Min", "min")</label> 2568 <input type="number" class="form-control js-min-value" name="potsize" data-is-minimum="true" value='@potsizeMin' /> 2569 </div> 2570 <div class="col-xs-4 pull-right"> 2571 <label>@Translate("Smartpage:Max", "max")</label> 2572 @{ 2573 if (potsizeMax == 0 || potsizeMax == 9999) 2574 { 2575 potsizeMax = 30; 2576 } 2577 } 2578 <input type="number" class="form-control js-max-value" data-system-max="9999" data-visual-max="30" name="potsize" value='@potsizeMax' /> 2579 </div> 2580 <br /> 2581 </div> 2582 <div class="filter-range-slider js-filter-range-slider"> 2583 <input id="slider-input" type="text" value="@(potsizeMin + "-" + potsizeMax)" data-slider-min='0' data-slider-max='30' data-slider-value='[@potsizeMin,@potsizeMax]' class="sr-only" /> 2584 <div class="clearfix"></div> 2585 <div class="min-value pull-left">0</div> 2586 <div class="max-value pull-right">30+</div> 2587 </div> 2588 </div> 2589 2590 <div class="clearfix"></div> 2591 2592 <div class="filter-range"> 2593 <h3>@Translate("Height", "Height")</h3> 2594 @{ 2595 var heights = HttpContext.Current.Request.QueryString.GetValues("height"); 2596 if (heights == null) // Try to get from post instead 2597 { 2598 heights = HttpContext.Current.Request.Form.GetValues("height"); 2599 } 2600 var heightMin = 0; 2601 var heightMax = 0; 2602 if (heights != null) 2603 { 2604 if (heights.Length == 1) 2605 { 2606 heights = heights.First().Split(','); 2607 } 2608 2609 if (heights.Length == 2) 2610 { 2611 heightMin = Converter.ToInt32(heights.First()); 2612 heightMax = Converter.ToInt32(heights.Last()); 2613 } 2614 } 2615 } 2616 <div class="row filter-range-inputs"> 2617 <div class="col-xs-4"> 2618 <label>@Translate("Smartpage:Min", "min")</label> 2619 <input type="number" class="form-control js-min-value" name="height" data-is-minimum="true" value='@heightMin' /> 2620 </div> 2621 <div class="col-xs-4 pull-right"> 2622 <label>@Translate("Smartpage:Max", "max")</label> 2623 @{ 2624 if (heightMax == 0 || heightMax == 9999) 2625 { 2626 heightMax = 200; 2627 } 2628 } 2629 <input type="number" class="form-control js-max-value" data-system-max="9999" data-visual-max="200" name="height" value='@heightMax' /> 2630 </div> 2631 <br /> 2632 </div> 2633 <div class="filter-range-slider js-filter-range-slider"> 2634 <input id="slider-input" type="text" value="@(heightMin + "-" + heightMax)" data-slider-min='0' data-slider-max='200' data-slider-value='[@heightMin,@heightMax]' class="sr-only" /> 2635 <div class="clearfix"></div> 2636 <div class="min-value pull-left">0</div> 2637 <div class="max-value pull-right">200+</div> 2638 </div> 2639 </div> 2640 2641 <div class="clearfix"></div> 2642 2643 @{ 2644 var facets = Model.FacetGroups.FirstOrDefault(); 2645 if (facets != null) 2646 { 2647 var colors = facets.Facets.FirstOrDefault(g => g.QueryParameter == "color"); 2648 if (colors != null && colors.Options.Any()) 2649 { 2650 <div class="filter-color filter-container clearfix"> 2651 <h3>@Translate("Color", "Color")</h3> 2652 <ul class="list-unstyled"> 2653 @foreach (var i in colors.Options) 2654 { 2655 <li class="col-md-6 col-sm-12"> 2656 <label class="filter-color-item row"> 2657 <input type="checkbox" class="js-select-filter-option" name='@colors.QueryParameter' value='@i.Value' checked='@i.Selected' /> 2658 &nbsp; 2659 @{ 2660 if (i.Value != "XXXXXX") 2661 { 2662 var backgroundColor = "#" + i.Value; 2663 <span class="filter-color" style="background-color: @backgroundColor" title='@i.Label'> 2664 &nbsp; 2665 </span> 2666 } 2667 else 2668 { 2669 <span class="filter-color" title='@i.Label'> 2670 <img src="/Files/images/multi-color.png" class="img-responsive" title='@i.Label' alt='@i.Label' /> 2671 </span> 2672 } 2673 } 2674 &nbsp;<span>(@i.Count)</span> 2675 </label> 2676 </li> 2677 } 2678 </ul> 2679 </div> 2680 } 2681 2682 var categories = facets.Facets.FirstOrDefault(g => g.QueryParameter == "category"); 2683 2684 if (categories != null && categories.Options.Any()) 2685 { 2686 var totalResults = categories.OptionResultTotalCount; 2687 <h3>@Translate("Filters.Categories", "Categories")</h3> 2688 if (totalResults < 10) 2689 { 2690 // show checkboxes 2691 foreach (var i in categories.Options) 2692 { 2693 2694 var isselected = i.Selected ? "checked" : ""; 2695 var inputID = i.Value; 2696 <div class="checkbox"> 2697 <label> 2698 <input type='checkbox' name='@categories.QueryParameter' class='js-select-filter-option' value='@i.Value' @isselected /> @i.Label (@i.Count) 2699 </label> 2700 </div> 2701 } 2702 } 2703 else 2704 { 2705 // show select 2706 <select class="select2 js-select-filter-option js-select2-filter" name='@categories.QueryParameter' multiple="multiple" data-placeholder="@Translate("Smartpage:Ecom.SelectCategory", "Select category...")"> 2707 @foreach (var i in categories.Options) 2708 { 2709 var isselected = i.Selected ? "selected" : ""; 2710 <option class='js-select-filter-option' value='@i.Value' @isselected>@i.Label (@i.Count)</option> 2711 } 2712 </select> 2713 } 2714 2715 } 2716 2717 2718 if (EnableManufacturerFiltering()) 2719 { 2720 var manufacturers = facets.Facets.FirstOrDefault(g => g.QueryParameter == "manuid"); 2721 if (manufacturers != null) 2722 { 2723 var dwManufacturers = Dynamicweb.Ecommerce.Common.Context.Manufacturers; 2724 var manufacturersResults = manufacturers.OptionResultTotalCount; 2725 2726 <div class="filter-manufacturer filter-container clearfix"> 2727 <h3>@Translate("Grower", "Grower")</h3> 2728 2729 @if (manufacturersResults < 10) 2730 { 2731 foreach (var i in manufacturers.Options) 2732 { 2733 2734 bool isChecked = i.Selected; 2735 var inputID = i.Value; 2736 <div class="checkbox"> 2737 <label> 2738 <input type='checkbox' name='@manufacturers.QueryParameter' class='js-select-filter-option' value='@i.Value' checked="@isChecked" /> @i.Label (@i.Count) 2739 </label> 2740 </div> 2741 } 2742 2743 } 2744 else 2745 { 2746 <select class="select2 js-select-filter-option js-select2-filter" name='@manufacturers.QueryParameter' multiple="multiple" data-placeholder="@Translate("Smartpage:Ecom.SelectGrower", "Select grower...")"> 2747 @foreach (var i in manufacturers.Options) 2748 { 2749 var isselected = i.Selected ? "selected" : ""; 2750 var manufacturer = dwManufacturers.FirstOrDefault(m => m.Id == i.Value); 2751 var manufacturerLink = ""; 2752 if (manufacturer != null && !string.IsNullOrEmpty(manufacturer.Web)) 2753 { 2754 manufacturerLink = manufacturer.Web; 2755 if (!manufacturerLink.StartsWith("http", StringComparison.InvariantCultureIgnoreCase)) 2756 { 2757 manufacturerLink = "http://" + manufacturerLink; 2758 } 2759 } 2760 var manufacturerDescription = i.Label + "/" + i.Value; 2761 @*<pre>@string.Join("\n", i.Values.Select(e => string.Format("{0}: {1}", e.Key, System.Web.HttpUtility.HtmlEncode(e.Value))).ToArray())</pre>*@ 2762 2763 <option value='@i.Value' data-link="@manufacturerLink" @isselected>@manufacturerDescription (@i.Count)</option> 2764 } 2765 </select> 2766 } 2767 </div> 2768 } 2769 } 2770 2771 var news = facets.Facets.FirstOrDefault(g => g.QueryParameter == "new"); 2772 if (news != null && news.Options.Any(i => Dynamicweb.Core.Converter.ToBoolean(i.Value))) 2773 { 2774 <div class="clearfix"></div> 2775 <div class="filter-color filter-container"> 2776 <h3>@Translate("Smartpage:NewProduct", "New")</h3> 2777 <ul class="list-unstyled"> 2778 @foreach (var i in news.Options) 2779 { 2780 if (Dynamicweb.Core.Converter.ToBoolean(i.Value)) 2781 { 2782 <li class="col-md-6 col-sm-12"> 2783 <label class="filter-color-item row"> 2784 <input type="checkbox" class="js-select-filter-option" name='@news.QueryParameter' value='@i.Value' checked='@i.Selected' /> 2785 &nbsp;<span title='@i.Value'> 2786 @Translate("show all", "Show all")&nbsp;(@i.Count) 2787 </span> 2788 </label> 2789 </li> 2790 } 2791 } 2792 </ul> 2793 </div> 2794 } 2795 } 2796 } 2797 </form> 2798 2799 2800 @*@Snippet Start("StyleSheet") 2801 <link href="@designBaseUrl/Assets/plugins/bootstrap-slider/dist/css/bootstrap-slider.min.css" rel="stylesheet" /> 2802 <link href="@designBaseUrl/Assets/plugins/selectize.js/dist/css/selectize.css" rel="stylesheet" /> 2803 <link href="@designBaseUrl/Assets/plugins/selectize.js/dist/css/selectize.bootstrap3.css" rel="stylesheet" /> 2804 <link href="@designBaseUrl/Assets/plugins/select2/select2-3.5.4/select2.css" rel="stylesheet" /> 2805 @Snippet End("StyleSheet")*@ 2806 2807 <div class="clearfix">&nbsp;</div> 2808 </div> 2809 <div class="col-sm-9"> 2810 <div class="js-products border-left row"> 2811 @if (Model.TotalProductsCount == 0) 2812 { 2813 <div class="col-sm-12"> 2814 @Translate("Smartpage:eCom.SearchNoProducts", "Ingen produkter matcher dine søgekriterier") 2815 </div> 2816 } 2817 else 2818 { 2819 if (viewMode == "list" || String.IsNullOrEmpty(viewMode)) 2820 { 2821 @RenderListView() 2822 } 2823 else if (viewMode == "grid") 2824 { 2825 @RenderTilesView() 2826 } 2827 else if (viewMode == "photo") 2828 { 2829 @RenderPhotoView() 2830 } 2831 else if (viewMode == "quicklist") 2832 { 2833 @RenderListView() 2834 } 2835 } 2836 2837 </div> 2838 </div> 2839 <div class="clearfix"></div> 2840 </div> 2841 <div class="productlistnavigation navigation-bottom"> 2842 <span class="productcount"> 2843 @Model.TotalProductsCount 2844 @Translate("SmartPage:Product.Paging.ProductsFound", "produkter fundet") 2845 </span> 2846 2847 @{ 2848 currentPageNumber = string.IsNullOrWhiteSpace(HttpContext.Current.Request["PageNum"]) ? "1" : HttpContext.Current.Request["PageNum"]; 2849 if (Converter.ToInt32(currentPageNumber) <= Model.PageCount && Model.PageCount > 0) 2850 { 2851 <input type="hidden" class="current-page js-current-page-number" value='@currentPageNumber' /> 2852 } 2853 } 2854 2855 </div> 2856 2857 <div class="clearfix"></div> 2858 @PricesWithVATStatus("bottom") 2859 2860 2861 <div id="js-list-modal-full" class="modal fade product-list-modal" tabindex="-1" role="dialog"> 2862 <div class="modal-dialog"> 2863 <div class="modal-content"> 2864 <div class="modal-header"> 2865 <button type="button" class="close custom-close-modal" onclick="$('#js-list-modal-full').modal('hide');"><span aria-hidden="true">&times;</span></button> 2866 <h4 class="modal-title js-modal-title"></h4> 2867 </div> 2868 <div class="modal-body"> 2869 <div class="row"> 2870 <div class="col-sm-12"> 2871 <img src="" class="js-modal-image" /> 2872 </div> 2873 </div> 2874 </div> 2875 </div> 2876 </div> 2877 </div> 2878