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_7144d2e39b044431a9ce2b3f5b2c1df4.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 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.ToInt32(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 = "/Admin/Public/getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=500&amp;Height=500&amp;Crop=5"; 707 } 708 <a class="js-preview js-product-title" href='@productLink' data-preview='@previewImageUrl'> 709 @{ 710 var imageUrl = "/Admin/Public/getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=50&amp;Height=50&amp;Crop=5&amp;altFmImage_path=" + defaultImage; 711 } 712 <img src="@imageUrl" alt='@HttpUtility.HtmlEncode(i.Name)' class="img-responsive" /> 713 </a> 714 715 @if (images.Count > 1) 716 { 717 <span class="label label-info label-amount-pictures"><i class="glyphicon glyphicon-picture"></i> @images.Count</span> 718 } 719 </div> 720 <div class="col-md-3 col-sm-4"> 721 722 <h2 class="grid-item-name grid-item-name-list"> 723 <a href="@productLink" class="js-product-title">@i.Name</a> 724 @if (Converter.ToBoolean(helperService.GetFieldValue("NewProduct", i.ProductFields))) 725 { 726 <span class="label label-warning">@Translate("Smartpage:NewProduct", "NEW")</span> 727 } 728 @if (Converter.ToBoolean(helperService.GetFieldValue("Bestseller", i.ProductFields))) 729 { 730 <span class="label label-warning">@Translate("Smartpage:Bestseller", "BESTSELLER")</span> 731 } 732 @if (!string.IsNullOrEmpty(Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)))) 733 { 734 var flagImgPath = "/Admin/Images/Flags/Small/flag_" + Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)) + ".png"; 735 <img src='@flagImgPath' alt='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' title='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' /> 736 } 737 </h2> 738 739 <div class="shortdescription"> 740 @AddedToCart(i, "standard") 741 <p>@i.ShortDescription</p> 742 @ListStockStatus(i, "list") 743 </div> 744 <div class="manufacturer-website hidden-sm hidden-xs"> 745 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) <br /> 746 @if (product.Height > 0) 747 { 748 @FormatDiameter("H: " + product.Height + " cm") 749 } 750 </div> 751 752 </div> 753 754 <div class="col-md-1 col-sm-5"> 755 <div class="potsize text-right hidden-sm hidden-xs "> 756 @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields))) cm 757 </div> 758 <div class="hidden-md hidden-lg"> 759 @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields))) 760 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) <br /> 761 @if (product.Height > 0) 762 { 763 @FormatDiameter("H: " + product.Height + " cm") 764 } 765 </div> 766 </div> 767 768 <div class="clearfix visible-sm"></div> 769 <div class="col-md-4 col-sm-6"> 770 @if (isLoggedIn) 771 { 772 <div class="product-price"> 773 <table class="table"> 774 <tbody> 775 <tr> 776 <td> 777 @Translate("Pcs", "Stk") 778 </td> 779 <td> 780 1 &times; 781 @productInfo.ColliSize 782 </td> 783 <td> 784 <span class="js-colli-per-layer">@productInfo.ColliPerLayer</span> 785 &times; @productInfo.ColliSize 786 </td> 787 <td> 788 <span class="js-colli-per-cc">@productInfo.ColliPerCc</span> 789 &times; @productInfo.ColliSize 790 </td> 791 </tr> 792 @if (!DisablePrices()) 793 { 794 795 <tr> 796 <td> 797 @Translate("price", "Pris") 798 </td> 799 <td class="js-product-field-price js-product-field-price-colli"> 800 @if (DisplayPricesInclVat()) 801 { 802 if (Converter.ToInt32(priceInformation.Prices.PricePerColliUnit.PriceWithVAT) > 0) 803 { 804 @:@priceInformation.Prices.PricePerColliUnit.PriceWithVAT.ToString("0.00") 805 } 806 807 } 808 else 809 { 810 if (Converter.ToInt32(priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT) > 0) 811 { 812 @:@priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT.ToString("0.00") 813 } 814 } 815 </td> 816 <td class="js-product-field-price js-product-field-price-layer"> 817 @if (DisplayPricesInclVat()) 818 { 819 if (Converter.ToInt32(priceInformation.Prices.PricePerLayerUnit.PriceWithVAT) > 0) 820 { 821 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithVAT.ToString("0.00") 822 } 823 } 824 else 825 { 826 if (Converter.ToInt32(priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT) > 0) 827 { 828 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT.ToString("0.00") 829 } 830 } 831 </td> 832 <td class="js-product-field-price js-product-field-price-cc"> 833 @if (DisplayPricesInclVat()) 834 { 835 if (Converter.ToInt32(priceInformation.Prices.PricePerCcUnit.PriceWithVAT) > 0) 836 { 837 @:@priceInformation.Prices.PricePerCcUnit.PriceWithVAT.ToString("0.00") 838 } 839 } 840 else 841 { 842 if (Converter.ToInt32(priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT) > 0) 843 { 844 @:@priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT.ToString("0.00") 845 } 846 } 847 </td> 848 </tr> 849 } 850 </tbody> 851 </table> 852 </div> 853 } 854 </div> 855 <br class="hidden-sm hidden-md hidden-lg" /> 856 <div class="col-md-3 col-sm-6"> 857 @if (isLoggedIn && product.VariantCount == 0) 858 { 859 var loopCounter = productLoopCounter + baseLoopCounter; 860 var nameProductLoopCounter = "ProductLoopCounter" + loopCounter; 861 var nameProductIdCounter = "ProductID" + loopCounter; 862 var nameVariantIdCounter = "VariantID" + loopCounter; 863 var nameUnitIdCounter = "UnitID" + loopCounter; 864 var namewishListIdCounter = "wishListID" + loopCounter; 865 var priceRetailValue = productInfo.CustomerRetailPrice; 866 var priceRetail = new PriceCalculated(new PriceRaw(priceRetailValue, Dynamicweb.Ecommerce.Common.Context.Currency)); 867 var retailPriceValue = DisplayPricesInclVat() ? Converter.ToString(priceRetail.PriceWithVAT) : Converter.ToString(priceRetail.PriceWithoutVAT); 868 retailPriceValue = Converter.ToInt32(retailPriceValue) == 0 ? "" : FormatPrice(retailPriceValue); 869 870 <input type="hidden" value='@loopCounter' name='@nameProductLoopCounter'> 871 <input type="hidden" class="js-product-id" value='@i.Id' name="@nameProductIdCounter"> 872 <input type="hidden" value="" name="@nameVariantIdCounter"> 873 <input type="hidden" value="" name="@nameUnitIdCounter"> 874 <input type="hidden" value="0" name="@namewishListIdCounter"> 875 876 if (isDeliverable) 877 { 878 <div class="row"> 879 @renderToolTip() 880 <div class="col-xs-3 js-quantity-tooltip" data-placement="right" data-toggle="popover" data-trigger="manual"> 881 @{ 882 var quantityFieldName = "Quantity" + loopCounter; 883 bool isServiceProduct = product.Type == Dynamicweb.Ecommerce.Products.ProductType.Service; 884 885 var placeholder = minQty > 0 ? String.Format("min. {0}", minQty) : minQty.ToString(); 886 887 <div class="product-list-number"> 888 <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" /> 889 </div> 890 } 891 </div> 892 893 <div class="col-xs-9"> 894 @foreach (var o in product.OrderLineFields) 895 { 896 var inputName = "EcomOrderLineFieldInput_" + o.Name + loopCounter; 897 string placeholderText = o.Name; 898 switch (o.SystemName) 899 { 900 case "OrderLineComment": 901 if (EnableComments()) 902 { 903 placeholderText = Translate("LineComment", "Comment"); 904 <input type="text" class="form-control" maxlength="80" name="@inputName" placeholder="@placeholderText" /> 905 } 906 break; 907 case "OrderLineColliSize": 908 <input type="hidden" name="@inputName" value='@productInfo.ColliSize' /> 909 break; 910 case "OrderLineColliPerLayer": 911 <input type="hidden" name="@inputName" value='@productInfo.ColliPerLayer' /> 912 break; 913 case "OrderLineColliPerCC": 914 <input type="hidden" name="@inputName" value='@productInfo.ColliPerCc' /> 915 break; 916 case "OrderLineRetailPrice": 917 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Add retail price"); 918 <div class="hidden"> 919 <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" /> 920 </div> 921 break; 922 case "OrderLineItemNumber": 923 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no."); 924 <div class="hidden"> 925 <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" /> 926 </div> 927 break; 928 case "OrderLineEAN": 929 placeholderText = Translate("Deres_EAN_nummer-short", "EAN"); 930 931 <div class="hidden"> 932 <div class="editable" data-placeholder="my placeholder"> 933 <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" /> 934 </div> 935 </div> 936 937 break; 938 default: 939 <text>@inputName</text> 940 break; 941 } 942 } 943 </div> 944 </div> 945 } 946 947 if (EnableDisplayOfGrossMargin() && isDeliverable) 948 { 949 var pricePerColliUnit = priceInformation.Prices.PricePerColliUnit; 950 double customerSalesPrice = DisplayPricesInclVat() ? pricePerColliUnit.PriceWithVAT : pricePerColliUnit.PriceWithoutVAT; 951 952 <div class="row"> 953 <div class="col-sm-12 col-md-12 col-lg-offset-3 col-lg-9 text-right product-retail-price product-gross-margin-list"> 954 <i class="js-product-field-gross-margin text-muted"> 955 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.GrossMargin", "Gross margin")</span> 956 <span class="pull-right js-gross-margin-value"> 957 @if (priceRetail.Price > 0) 958 { 959 @GetGrossMargin(priceRetail.Price, customerSalesPrice); 960 } 961 else 962 { 963 @Translate("Smartpage:ecom:CustomerSpecificInfo.GrossMargin.NA", "N/A") 964 } 965 </span> 966 </i> 967 </div> 968 </div> 969 } 970 971 if (EnableCustomerRetailPrice() && isDeliverable) 972 { 973 <div class="row"> 974 <div class="col-sm-12 col-md-12 col-lg-offset-3 col-lg-9 text-right product-retail-price product-editable-area"> 975 976 @if (EnableEditableRetailPrice() && isDeliverable && !String.IsNullOrEmpty(Converter.ToString(priceRetail.Price))) 977 { 978 <div class="product-selectable-edit pull-right"> 979 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-retail-price-@loopCounter"></i> 980 </div> 981 } 982 <div class="js-product-field-retail-price"> 983 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Retail price")</span> 984 <span class="pull-right">@retailPriceValue</span> 985 </div> 986 </div> 987 </div> 988 } 989 990 if (EnableCustomerItemNumber()) 991 { 992 <div class="row"> 993 994 <div class="col-sm-12 col-md-12 col-lg-offset-3 col-lg-9 text-right product-item-number product-editable-area"> 995 996 @if (EnableEditableItemNumber() && isDeliverable) 997 { 998 <div class="product-selectable-edit pull-right"> 999 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-item-number-@loopCounter"></i> 1000 </div> 1001 } 1002 <div class="js-product-field-item-number text-left"> 1003 <span class="pull-left">@Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no.")</span> 1004 <span class="pull-right">@productInfo.CustomerItemNumber</span> 1005 </div> 1006 </div> 1007 </div> 1008 } 1009 <div class="row"> 1010 <div class="hidden-xs col-sm-3 hidden-md hidden-lg"></div> 1011 <div class="col-sm-12 col-md-12 col-lg-offset-3 col-lg-9 text-right product-editable-area"> 1012 @if (EnableEditableBarcode() && isDeliverable && !String.IsNullOrEmpty(productInfo.EAN)) 1013 { 1014 <div class="product-selectable-edit pull-right"> 1015 <i class="glyphicon glyphicon-edit js-product-fields-edit product-fields-edit" data-source="#js-ean-number-@loopCounter"></i> 1016 </div> 1017 } 1018 @if (EnableCustomerBarcode() && !String.IsNullOrEmpty(productInfo.EAN)) 1019 { 1020 <div class="js-product-field-ean text-left"> 1021 <span class="pull-left">@Translate("Deres_EAN_nummer-short", "EAN")</span> 1022 <span class="pull-right">@productInfo.EAN</span> 1023 </div> 1024 } 1025 </div> 1026 </div> 1027 1028 if (!isDeliverable) 1029 { 1030 <div class="row"> 1031 <div class="hidden-xs col-sm-3 hidden-md hidden-lg"></div> 1032 <div class="col-sm-9 col-md-12 col-lg-offset-3 col-lg-9 product-editable-area"> 1033 <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> 1034 </div> 1035 </div> 1036 } 1037 1038 } 1039 </div> 1040 </div> 1041 } 1042 </div> 1043 1044 </div> 1045 1046 <input type="submit" value="Add to basket" class="sr-only" /> 1047 1048 @if (isLoggedIn) 1049 { 1050 @SnippetStart("SmartpageAddToBasket") 1051 <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> 1052 @SnippetEnd("SmartpageAddToBasket") 1053 } 1054 </form> 1055 } 1056 1057 @inherits ViewModelTemplate<ProductListViewModel> 1058 @using Dynamicweb; 1059 @using Dynamicweb.Core; 1060 @using Dynamicweb.Environment; 1061 @using Dynamicweb.Rendering; 1062 @using Dynamicweb.Ecommerce.ProductCatalog; 1063 @using System.Linq; 1064 @using Gasa.ProductInformation; 1065 @using Gasa.PriceInformation; 1066 @using Gasa.ProductInformation.Helpers; 1067 @using Dynamicweb.Ecommerce.Prices; 1068 1069 @helper RenderPhotoView() 1070 { 1071 <form method="post" class="js-basket-add js-set-tabindex row js-product-form-container" autocomplete="false" data-submit-url='@Pageview.Area.Item["JsonCart"]'> 1072 <input type="hidden" name="CartCmd" value="addmulti" /> 1073 @{ 1074 1075 var isLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 1076 var pagenum = 1; 1077 var defaultImage = !string.IsNullOrWhiteSpace(Converter.ToString(Pageview.Area.Item["DefaultImage"])) ? Converter.ToString(Pageview.Area.Item["DefaultImage"]) : "/Files/images/default-image.png"; 1078 1079 if (Dynamicweb.Context.Current.Request.GetInt32("pagenum") > 0) 1080 { 1081 pagenum = Dynamicweb.Context.Current.Request.GetInt32("pagenum"); 1082 } 1083 1084 var baseLoopCounter = Model.PageSize * (pagenum - 1); 1085 int productLoopCounter = 0; 1086 1087 var productService = Dynamicweb.Ecommerce.Services.Products; 1088 var helperService = new CustomProductFieldHelpers(); 1089 string currentPageLink = "/Default.aspx?ID=" + Pageview.Page.ID; 1090 1091 } 1092 <div class="col-xs-12"> 1093 <div class="product-grid photo-group js-grid-group"> 1094 @foreach (var i in Model.Products) 1095 { 1096 productLoopCounter++; 1097 1098 var manufacturerName = i.Manufacturer.Name; 1099 var manufacturerWebsiteUrl = i.Manufacturer.Web; 1100 var manufacturerId = i.Manufacturer.Id; 1101 1102 var product = productService.GetProductById(i.Id, i.VariantId, true); 1103 var productInfo = new ProductInformation(product, Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser().CustomerNumber); 1104 var priceInformation = new PriceInformation(product, productInfo); 1105 1106 string productLink = currentPageLink + "&amp;GroupId=" + product.PrimaryGroupId + "&amp;ProductID=" + product.Id; 1107 1108 var images = i.ImagePatternImages; 1109 string image = defaultImage; 1110 1111 if (images.Any()) 1112 { 1113 image = images.FirstOrDefault().Value; 1114 } 1115 1116 int minQty = Converter.ToInt32(helperService.GetFieldValue("MinimumPurchaseQuantityLimit", i.ProductFields)); 1117 if (minQty == 0) 1118 { 1119 switch (Converter.ToString(helperService.GetFieldValue("MinimumPurchaseQuantity", i.ProductFields)).ToLower().Trim()) 1120 { 1121 case "layer": 1122 minQty = productInfo.ColliPerLayer; 1123 break; 1124 case "cc": 1125 minQty = productInfo.ColliPerCc; 1126 break; 1127 default: 1128 minQty = 1; 1129 break; 1130 } 1131 } 1132 1133 bool isDeliverable = string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) && Converter.ToInt32(priceInformation.Prices.PricePerColliUnit.Price) > 0; 1134 string cssIDSelector = "js-" + i.Id; 1135 1136 <div class='photo-group-item col-xs-12 clearfix js-product js-grid-product' data-min-quantity="@minQty" id="@cssIDSelector"> 1137 <div class="col-sm-6 col-md-3"> 1138 <div class="photo-group-item-img"> 1139 <a href='@productLink' class="js-product-title"> 1140 @{ 1141 var imageUrl = "/Admin/Public/getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=190&amp;Height=190&amp;Crop=5&amp;altFmImage_path=" + defaultImage; 1142 } 1143 <img src="@imageUrl" alt='@HttpUtility.HtmlEncode(i.Name)' class="img-responsive" /> 1144 </a> 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.ToInt32(priceInformation.Prices.PricePerColliUnit.PriceWithVAT) > 0) 1232 { 1233 @:@priceInformation.Prices.PricePerColliUnit.PriceWithVAT.ToString("0.00") 1234 } 1235 1236 } 1237 else 1238 { 1239 if (Converter.ToInt32(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.ToInt32(priceInformation.Prices.PricePerLayerUnit.PriceWithVAT) > 0) 1249 { 1250 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithVAT.ToString("0.00") 1251 } 1252 } 1253 else 1254 { 1255 if (Converter.ToInt32(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.ToInt32(priceInformation.Prices.PricePerCcUnit.PriceWithVAT) > 0) 1265 { 1266 @:@priceInformation.Prices.PricePerCcUnit.PriceWithVAT.ToString("0.00") 1267 } 1268 } 1269 else 1270 { 1271 if (Converter.ToInt32(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 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.ToInt32(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 @{ 1579 var previewImageUrl = "/Admin/Public/Getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=500&amp;Height=500&amp;Crop=5&amp;AlternativeImage=" + defaultImage; 1580 var imageUrl = "/Admin/Public/Getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=15&amp;Height=15&amp;Crop=5&amp;AlternativeImage=" + defaultImage; 1581 } 1582 1583 <a class="js-preview" href='@productLink' data-preview='@previewImageUrl'> 1584 <img src="@imageUrl" alt='@HttpUtility.HtmlEncode(i.Name)' class="img-responsive" style="display:inline-block;border:1px solid #8ec13c;" /> 1585 </a> 1586 1587 <a href="@productLink" class="js-product-title">@i.Name</a> 1588 1589 @if (Converter.ToBoolean(helperService.GetFieldValue("NewProduct", i.ProductFields))) 1590 { 1591 <span class="label label-warning">@Translate("Smartpage:NewProduct", "NEW")</span> 1592 } 1593 @if (Converter.ToBoolean(helperService.GetFieldValue("Bestseller", i.ProductFields))) 1594 { 1595 <span class="label label-warning">@Translate("Smartpage:Bestseller", "BESTSELLER")</span> 1596 } 1597 @if (!string.IsNullOrEmpty(Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)))) 1598 { 1599 var flagImgPath = "/Admin/Images/Flags/Small/flag_" + Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields)) + ".png"; 1600 <img src='@flagImgPath' alt='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' title='@Converter.ToString(helperService.GetFieldValue("NavCompanyCode", i.ProductFields))' /> 1601 } 1602 1603 </h2> 1604 1605 <div class="shortdescription"> 1606 @AddedToCart(i, "standard") 1607 <p style="margin:0;">@i.ShortDescription</p> 1608 @ListStockStatus(i, "list") 1609 </div> 1610 1611 <div class="manufacturer-website hidden-sm hidden-xs"> 1612 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) <br /> 1613 </div> 1614 1615 </div> 1616 <div class="col-md-1 col-sm-5"> 1617 <div class="potsize text-right hidden-sm hidden-xs "> 1618 @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields)) + " cm ") 1619 </div> 1620 <div class="hidden-md hidden-lg"> 1621 @FormatDiameter(Converter.ToString(helperService.GetFieldValue("ProductPotSize", i.ProductFields))) cm 1622 @RenderManufacturer(manufacturerId, manufacturerName, manufacturerWebsiteUrl) <br /> 1623 </div> 1624 </div> 1625 <div class="clearfix visible-sm"></div> 1626 <div class="col-md-4 col-sm-6"> 1627 @if (isLoggedIn) 1628 { 1629 <div class="product-price"> 1630 <table class="table"> 1631 1632 <tbody> 1633 <tr> 1634 <td> 1635 @Translate("Pcs", "Stk") 1636 </td> 1637 <td> 1638 1 &times; 1639 @productInfo.ColliSize 1640 </td> 1641 <td> 1642 <span class="js-colli-per-layer">@productInfo.ColliPerLayer</span> 1643 &times; @productInfo.ColliSize 1644 </td> 1645 <td> 1646 <span class="js-colli-per-cc">@productInfo.ColliPerCc</span> 1647 &times; @productInfo.ColliSize 1648 </td> 1649 </tr> 1650 @if (!DisablePrices()) 1651 { 1652 <tr> 1653 <td> 1654 @Translate("price", "Pris") 1655 </td> 1656 <td class="js-product-field-price js-product-field-price-colli"> 1657 @if (DisplayPricesInclVat()) 1658 { 1659 if (Converter.ToInt32(priceInformation.Prices.PricePerColliUnit.PriceWithVAT) > 0) 1660 { 1661 @:@priceInformation.Prices.PricePerColliUnit.PriceWithVAT.ToString("0.00") 1662 } 1663 1664 } 1665 else 1666 { 1667 if (Converter.ToInt32(priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT) > 0) 1668 { 1669 @:@priceInformation.Prices.PricePerColliUnit.PriceWithoutVAT.ToString("0.00") 1670 } 1671 } 1672 </td> 1673 <td class="js-product-field-price js-product-field-price-layer"> 1674 @if (DisplayPricesInclVat()) 1675 { 1676 if (Converter.ToInt32(priceInformation.Prices.PricePerLayerUnit.PriceWithVAT) > 0) 1677 { 1678 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithVAT.ToString("0.00") 1679 } 1680 } 1681 else 1682 { 1683 if (Converter.ToInt32(priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT) > 0) 1684 { 1685 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithoutVAT.ToString("0.00") 1686 } 1687 } 1688 </td> 1689 <td class="js-product-field-price js-product-field-price-cc"> 1690 @if (DisplayPricesInclVat()) 1691 { 1692 if (Converter.ToInt32(priceInformation.Prices.PricePerCcUnit.PriceWithVAT) > 0) 1693 { 1694 @:@priceInformation.Prices.PricePerCcUnit.PriceWithVAT.ToString("0.00") 1695 } 1696 } 1697 else 1698 { 1699 if (Converter.ToInt32(priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT) > 0) 1700 { 1701 @:@priceInformation.Prices.PricePerCcUnit.PriceWithoutVAT.ToString("0.00") 1702 } 1703 } 1704 </td> 1705 </tr> 1706 } 1707 </tbody> 1708 </table> 1709 </div> 1710 } 1711 </div> 1712 <br class="hidden-sm hidden-md hidden-lg" /> 1713 <div class="col-md-3 col-sm-6"> 1714 @if (isLoggedIn && product.VariantCount == 0) 1715 { 1716 1717 var loopCounter = productLoopCounter + baseLoopCounter; 1718 var nameProductLoopCounter = "ProductLoopCounter" + loopCounter; 1719 var nameProductIdCounter = "ProductID" + loopCounter; 1720 var nameVariantIdCounter = "VariantID" + loopCounter; 1721 var nameUnitIdCounter = "UnitID" + loopCounter; 1722 var namewishListIdCounter = "wishListID" + loopCounter; 1723 var priceRetailValue = productInfo.CustomerRetailPrice; 1724 var priceRetail = new PriceCalculated(new PriceRaw(priceRetailValue, Dynamicweb.Ecommerce.Common.Context.Currency)); 1725 var retailPriceValue = DisplayPricesInclVat() ? Converter.ToString(priceRetail.PriceWithVAT) : Converter.ToString(priceRetail.PriceWithoutVAT); 1726 retailPriceValue = Converter.ToInt32(retailPriceValue) == 0 ? "" : FormatPrice(retailPriceValue); 1727 1728 <input type="hidden" value='@loopCounter' name='@nameProductLoopCounter'> 1729 <input type="hidden" class="js-product-id" value='@i.Id' name="@nameProductIdCounter"> 1730 <input type="hidden" value="" name="@nameVariantIdCounter"> 1731 <input type="hidden" value="" name="@nameUnitIdCounter"> 1732 <input type="hidden" value="0" name="@namewishListIdCounter"> 1733 1734 if (isDeliverable) 1735 { 1736 <div class="row"> 1737 @renderToolTip() 1738 <div class="col-xs-3 js-quantity-tooltip" data-placement="right" data-toggle="popover" data-trigger="manual"> 1739 @{ 1740 var quantityFieldName = "Quantity" + loopCounter; 1741 bool isServiceProduct = product.Type == Dynamicweb.Ecommerce.Products.ProductType.Service; 1742 1743 var placeholder = minQty > 0 ? String.Format("min. {0}", minQty) : minQty.ToString(); 1744 1745 <div class="product-list-number"> 1746 <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" /> 1747 </div> 1748 } 1749 </div> 1750 1751 <div class="col-xs-9"> 1752 @foreach (var o in product.OrderLineFields) 1753 { 1754 var inputName = "EcomOrderLineFieldInput_" + o.Name + loopCounter; 1755 string placeholderText = o.Name; 1756 switch (o.SystemName) 1757 { 1758 case "OrderLineComment": 1759 if (EnableComments()) 1760 { 1761 placeholderText = Translate("LineComment", "Comment"); 1762 <input type="text" class="form-control" maxlength="80" name="@inputName" placeholder="@placeholderText" /> 1763 } 1764 break; 1765 case "OrderLineColliSize": 1766 <input type="hidden" name="@inputName" value='@productInfo.ColliSize' /> 1767 break; 1768 case "OrderLineColliPerLayer": 1769 <input type="hidden" name="@inputName" value='@productInfo.ColliPerLayer' /> 1770 break; 1771 case "OrderLineColliPerCC": 1772 <input type="hidden" name="@inputName" value='@productInfo.ColliPerCc' /> 1773 break; 1774 case "OrderLineRetailPrice": 1775 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.RetailPrice", "Add retail price"); 1776 <div class="hidden"> 1777 <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" /> 1778 </div> 1779 break; 1780 case "OrderLineItemNumber": 1781 placeholderText = Translate("Smartpage:eCom:CustomerSpecificInfo.ItemNumber", "Item no."); 1782 <div class="hidden"> 1783 <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" /> 1784 </div> 1785 break; 1786 case "OrderLineEAN": 1787 placeholderText = Translate("Deres_EAN_nummer-short", "EAN"); 1788 1789 <div class="hidden"> 1790 <div class="editable" data-placeholder="my placeholder"> 1791 <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" /> 1792 </div> 1793 </div> 1794 1795 break; 1796 default: 1797 <text>@inputName</text> 1798 break; 1799 } 1800 } 1801 </div> 1802 </div> 1803 } 1804 1805 if (!isDeliverable) 1806 { 1807 <div class="row"> 1808 <div class="hidden-xs col-sm-3 hidden-md hidden-lg"></div> 1809 <div class="col-sm-9 col-md-12 col-lg-offset-3 col-lg-9 product-editable-area"> 1810 <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> 1811 </div> 1812 </div> 1813 } 1814 1815 } 1816 </div> 1817 </div> 1818 } 1819 </div> 1820 1821 </div> 1822 1823 <input type="submit" value="Add to basket" class="sr-only" /> 1824 1825 @if (isLoggedIn) 1826 { 1827 @SnippetStart("SmartpageAddToBasket") 1828 <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> 1829 @SnippetEnd("SmartpageAddToBasket") 1830 } 1831 </form> 1832 } 1833 1834 @inherits ViewModelTemplate<ProductListViewModel> 1835 @using Dynamicweb; 1836 @using Dynamicweb.Core; 1837 @using Dynamicweb.Environment; 1838 @using Dynamicweb.Rendering; 1839 @using Dynamicweb.Ecommerce.ProductCatalog; 1840 @using System.Linq; 1841 @using Gasa.ProductInformation; 1842 @using Gasa.PriceInformation; 1843 @using Gasa.ProductInformation.Helpers; 1844 @using Dynamicweb.Ecommerce.Prices; 1845 1846 @helper RenderTilesView() 1847 { 1848 <form method="post" class="js-basket-add js-set-tabindex row js-product-form-container" autocomplete="false" data-submit-url='@Pageview.Area.Item["JsonCart"]'> 1849 <input type="hidden" name="CartCmd" value="addmulti" /> 1850 @{ 1851 1852 string pageNum = Dynamicweb.Context.Current.Request["PageNum"]; 1853 var isLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 1854 var pagenum = 1; 1855 var defaultImage = !string.IsNullOrWhiteSpace(Converter.ToString(Pageview.Area.Item["DefaultImage"])) ? Converter.ToString(Pageview.Area.Item["DefaultImage"]) : "/Files/images/default-image.png"; 1856 1857 if (Dynamicweb.Context.Current.Request.GetInt32("pagenum") > 0) 1858 { 1859 pagenum = Dynamicweb.Context.Current.Request.GetInt32("pagenum"); 1860 } 1861 1862 var baseLoopCounter = Model.PageSize * (pagenum - 1); 1863 1864 int productLoopCounter = 0; 1865 1866 var productService = Dynamicweb.Ecommerce.Services.Products; 1867 var helperService = new CustomProductFieldHelpers(); 1868 string currentPageLink = "/Default.aspx?ID=" + Pageview.Page.ID; 1869 1870 } 1871 <div class="col-xs-12"> 1872 <div class="product-grid grid-group js-grid-group"> 1873 @foreach (var i in Model.Products) 1874 { 1875 productLoopCounter++; 1876 var manufacturerName = i.Manufacturer.Name; 1877 var manufacturerWebsiteUrl = i.Manufacturer.Web; 1878 var manufacturerId = i.Manufacturer.Id; 1879 1880 var product = productService.GetProductById(i.Id, i.VariantId, true); 1881 var productInfo = new ProductInformation(product, Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser().CustomerNumber); 1882 var priceInformation = new PriceInformation(product, productInfo); 1883 1884 string productLink = currentPageLink + "&amp;GroupId=" + product.PrimaryGroupId + "&amp;ProductID=" + product.Id; 1885 1886 var images = i.ImagePatternImages; 1887 string image = defaultImage; 1888 1889 if (images.Any()) 1890 { 1891 image = images.FirstOrDefault().Value; 1892 } 1893 1894 int minQty = Converter.ToInt32(helperService.GetFieldValue("MinimumPurchaseQuantityLimit", i.ProductFields)); 1895 if (minQty == 0) 1896 { 1897 switch (Converter.ToString(helperService.GetFieldValue("MinimumPurchaseQuantity", i.ProductFields)).ToLower().Trim()) 1898 { 1899 case "layer": 1900 minQty = productInfo.ColliPerLayer; 1901 break; 1902 case "cc": 1903 minQty = productInfo.ColliPerCc; 1904 break; 1905 default: 1906 minQty = 1; 1907 break; 1908 } 1909 } 1910 1911 bool isDeliverable = string.IsNullOrEmpty(AvailableDeliveryDay(Converter.ToInt32(helperService.GetFieldValue("LeadDays", i.ProductFields)))) && Converter.ToInt32(priceInformation.Prices.PricePerColliUnit.Price) > 0; 1912 string cssIDSelector = "js-" + i.Id; 1913 1914 <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"> 1915 <div class="grid-group-item-img"> 1916 <a href='@productLink' class="js-product-title"> 1917 @{ 1918 var imageUrl = "/Admin/Public/getimage.ashx?Image=" + image + "&amp;Resolution=75&amp;Compression=70&amp;Width=190&amp;Height=190&amp;Crop=5&amp;AlternativeImage=" + defaultImage; 1919 } 1920 <img src="@imageUrl" alt='@HttpUtility.HtmlEncode(i.Name)' class="img-responsive" /> 1921 </a> 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.ToInt32(priceInformation.Prices.PricePerColliUnit.PriceWithVAT) > 0) 2013 { 2014 @:@priceInformation.Prices.PricePerColliUnit.PriceWithVAT.ToString("0.00") 2015 } 2016 2017 } 2018 else 2019 { 2020 if (Converter.ToInt32(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.ToInt32(priceInformation.Prices.PricePerLayerUnit.PriceWithVAT) > 0) 2030 { 2031 @:@priceInformation.Prices.PricePerLayerUnit.PriceWithVAT.ToString("0.00") 2032 } 2033 } 2034 else 2035 { 2036 if (Converter.ToInt32(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.ToInt32(priceInformation.Prices.PricePerCcUnit.PriceWithVAT) > 0) 2046 { 2047 @:@priceInformation.Prices.PricePerCcUnit.PriceWithVAT.ToString("0.00") 2048 } 2049 } 2050 else 2051 { 2052 if (Converter.ToInt32(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 @RenderQuicklistView() 2834 } 2835 } 2836 </div> 2837 </div> 2838 <div class="clearfix"></div> 2839 </div> 2840 <div class="productlistnavigation navigation-bottom"> 2841 <span class="productcount"> 2842 @Model.TotalProductsCount 2843 @Translate("SmartPage:Product.Paging.ProductsFound", "produkter fundet") 2844 </span> 2845 2846 @{ 2847 currentPageNumber = string.IsNullOrWhiteSpace(HttpContext.Current.Request["PageNum"]) ? "1": HttpContext.Current.Request["PageNum"]; 2848 if (Converter.ToInt32(currentPageNumber) <= Model.PageCount && Model.PageCount > 0) 2849 { 2850 <input type="hidden" class="current-page js-current-page-number" value='@currentPageNumber' /> 2851 } 2852 } 2853 2854 </div> 2855 2856 2857 2858 <div class="clearfix"></div> 2859 @PricesWithVATStatus("bottom") 2860 2861