Stole er en af vores kernekompetencer, og er et område som vi har mange års erfaring med og ekspertise i. Der stilles mange krav til en stol - den skal både tage hensyn til menneskers adfærd og til det rum, den skal stå i. Ideelt set evner stolen at gøre rummet smukkere – og at gøre livet mere behageligt for de mennesker, der er i rummet.
Exception in template (eCom/Productlist/ProductList.cshtml): System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at CompiledRazorTemplates.Dynamic.abaeafadcbaa.Execute() at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context) at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag) at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName) at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName) at Dynamicweb.Rendering.Template.Output()
@inherits RazorTemplateBase<RazorTemplateModel<Template>> @using System; @using System.Web; @using System.Linq; @using Dynamicweb.Rendering; @using ff.CustomModules; @using ff.CustomModules.Classes; @using Newtonsoft.Json @{ bool isSearch = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["search"]); bool isMobile = (GetGlobalValue("Global:Device.IsMobile") == "True") ? true : false; } @if (isSearch) { <div id="productsearchresult" class="grey"> <p> @if (GetInteger("Ecom:ProductList.PageProdCnt") < 2) { @String.Format(Translate("SearchResultSingular", "Your search for \"{0}\" gave {1} result"), HttpContext.Current.Request.QueryString["search"], GetString("Ecom:ProductList.PageProdCnt")) } else { @String.Format(Translate("SearchResultPlural", "Your search for \"{0}\" gave {1} results"), HttpContext.Current.Request.QueryString["search"], GetString("Ecom:ProductList.PageProdCnt")) } </p> </div> } <div id="group-name" style="display:none"></div> @{ var designerGroups = Dynamicweb.eCommerce.Products.Group.GetGroupByID(Pageview.Area.Item["ByDesignerGroupId"].ToString()).SubgroupsDefaultLanguage; Dictionary<string, int> designerSorting = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < designerGroups.Count; i++) { // key = designer name in lower case stripped of all that is not number or letter, to make sure there isn't any difference string s = FFUtilities.GetOnlyLetters(designerGroups[i].Name); designerSorting.Add(s, i); } var collections = GetLoop("Products") .Where(x => x.GetString("Ecom:Product:Field.Master") == "MASTER") .GroupBy(x => x.GetString("Ecom:Product:Field.Collection")); var dwCollectionGroups = Dynamicweb.eCommerce.Products.Group.GetGroupByID("9999").Subgroups; List<ProductListCollection> productListCollections = new List<ProductListCollection>(); foreach (var collection in collections) { var designers = (from product in collection select product.GetString("Ecom:Product:Field.Designer")) .Union(from product in collection select product.GetString("Ecom:Product:Field.SecondDesigner")) .Where(x => !String.IsNullOrEmpty(x)) .Distinct(); Dynamicweb.eCommerce.Products.Group dwCollectionGroup = null; int collectionSort = 0; for (int i = 0; i < dwCollectionGroups.Count; i++) { if (dwCollectionGroups[i].Name == collection.Key) { dwCollectionGroup = dwCollectionGroups[i]; collectionSort = i; break; } } if (dwCollectionGroup != null) { foreach (var designer in designers) { string designerKey = FFUtilities.GetOnlyLetters(designer); ProductListCollection plc = new ProductListCollection { OrderInCollections = collectionSort, DesignerOrder = designerSorting[designerKey], CollectionName = collection.Key, Designer = designer, DesignerKey = designerKey, Products = collection.OrderBy(x => dwCollectionGroup.Products.IndexOf(x.GetString("Ecom:Product.ID"))).ToList() }; productListCollections.Add(plc); } } } LoopItem designerGroup = null; string currentDesigner = null; foreach (var collection in productListCollections.OrderBy(x => x.DesignerOrder)) { // New designer if (currentDesigner != collection.Designer) { currentDesigner = collection.Designer; <div class="designer-name" id="[email protected]" style="display:none" data-designerkey="@HttpUtility.HtmlAttributeEncode(collection.DesignerKey)" data-designerorder="@collection.DesignerOrder"> @collection.Designer </div> } } //Test <input id="myHidden" type="hidden" value="@collections.Count()" /> //End Test foreach (var collection in productListCollections.OrderBy(x => x.OrderInCollections)) { designerGroup = null; var designers = (from c in productListCollections where c.CollectionName == collection.CollectionName select c.Designer) .Distinct() .ToArray(); string alreadyDisplayedClass = string.Empty; string display = string.Empty; if (productListCollections.Any(x => x.CollectionName == collection.CollectionName && x.DesignerOrder < collection.DesignerOrder)) { alreadyDisplayedClass = "collection-secondary"; display = "display:none"; } <div class="collectioncontainer @alreadyDisplayedClass" id="[email protected](collection.CollectionName)" style="@display" data-designerkey="@HttpUtility.HtmlAttributeEncode(collection.DesignerKey)" data-collectionorder="@collection.OrderInCollections" data-designerorder="@collection.DesignerOrder"> <div class="container container1015"> <h2 class="anchor">@(string.IsNullOrEmpty(collection.CollectionName) ? "No collection name" : collection.CollectionName)</h2> @if (!designers.Contains("Fredericia")) { <div class="collection-by"><h5>@Translate("By", "By") @String.Join(" - ", designers)</h5></div> } <div class="products"> @foreach (var product in collection.Products) { if (designerGroup == null) { designerGroup = product.GetLoop("AssociatedGroups").FirstOrDefault(x => x.GetString("Ecom:Group:Field.GroupType.Value") == "designer"); } List<string> groups = new List<string>(); foreach (var group in product.GetLoop("AssociatedGroups")) { groups.Add(group.GetString("Ecom:Group.ID")); } <div class="inline product-container" data-groups="@String.Join("|", groups.ToArray())" data-filters="@product.GetString("Ecom:Product:Field.Filters")" data-designerkey="@HttpUtility.HtmlAttributeEncode(FFUtilities.GetOnlyLetters(product.GetString("Ecom:Product:Field.Designer")))"> @{ string separator = product.GetString("Ecom:Product.LinkGroup.Clean.PID").Contains('?') ? "&" : "?"; string url = product.GetString("Ecom:Product.LinkGroup.Clean.PID") + separator + "catid=" + product.GetString("Ecom:Product.PrimaryGroupID"); string imageRatio = product.GetString("Ecom:Product:Field.ImageRatio"); string classRatio = "ratio-single"; if (!string.IsNullOrWhiteSpace(imageRatio) && imageRatio != "1") { if (imageRatio == "2") { classRatio = "ratio-double"; } else { var ratio = Math.Round(product.GetDouble("Ecom:Product:Field.ImageRatio")); if (ratio > 1) { classRatio = "ratio-double"; } } } } <div class="product @classRatio visible"> <a href="@url"> <div class="productimgbox @classRatio"> @{ var imageWidth = "550"; var imageHeight = "275"; if (isMobile) { imageWidth = "145"; imageHeight = "145"; } var altText = product.GetString("Ecom:Product.Name"); var image = Pageview.Area.Item["PerfionApiUrl"] + "/Perfion/Image.aspx?id=" + product.GetString("Ecom:Product:Field.ListImage") + "&size=" + imageWidth + "x" + imageHeight + "&format=png&fit=fit"; string imageUrl = "https://test.fredericia.com/cdn-cgi/image/width=" + imageWidth + ",quality=80,f=auto/" + image; <picture> <source srcset="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-srcset="@imageUrl" width="@imageWidth" height="@imageHeight" title="@altText" type="image/webp"> <source srcset="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-srcset="@image" title="@altText" width="@imageWidth" height="@imageHeight" type="image/png"> <img class="img img-responsive b-lazy" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="@image" alt="@altText" width="@imageWidth" height="@imageHeight"> </picture> } </div> <div class="name">@product.GetString("Ecom:Product.Name")</div> <div class="name-mobile hidden-over768 "><p>@product.GetString("Ecom:Product.Name")</p></div> </a> </div> </div> } </div> @if (designerGroup != null) { <div class="view-collection" style="display:none"> <span class="view-collection-link">@Translate("ViewCollection", "View collection")</span> </div> } </div> </div> } } <script type="text/javascript"> // Don't scroll if there is an anchor (scrolling is done in the js) if (location.hash) { // do the test straight away window.scrollTo(0, 0); // execute it straight away setTimeout(function() { window.scrollTo(0, 0); // run it a bit later also for browser compatibility }, 1); } IsSearch = @(isSearch.ToString().ToLower() + ';') </script> <script src="/Files/Templates/Designs/Fredericia/Assets/js/pages/Products.min.js" defer="defer"></script>