Click here to provide feedback on your website experience.

CPR Training Supplies

 
CPR Training Supplies
Exception in template (Designs\EMS\eCom/Productlist/ProductList.cshtml): System.NullReferenceException: Object reference not set to an instance of an object.
   at Dynamicweb.eCommerce.Assortments.AssortmentProductRelation.GetAssortmentRelationsByProduct(String productID, String productVariantID)
   at System.Linq.Enumerable.d__23`3.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at CompiledRazorTemplates.Dynamic.dfdceaebfeaf.GetGroups(IEnumerable`1 groupCollection)
   at CompiledRazorTemplates.Dynamic.dfdceaebfeaf.b__1b(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.dfdceaebfeaf.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@inherits RazorTemplateBase<RazorTemplateModel<Template>> @using System @using System.Collections.Generic @using System.Linq @using Dynamicweb.Rendering @using Dynamicweb @using Dynamicweb.eCommerce.Assortments @using Dynamicweb.eCommerce.Products @using Dynamicweb.Frontend @using Dynamicweb.Notifications @using System.Data @using Ems.CrmDataAccess.Extensions @using System.Xml @{ string designName = GetString("Template:DesignBaseUrl").Replace("/Files/Templates/Designs/", "").Replace("/", ""); }@functions{ public static string GetImage(string sourceString, int imageWidth, int imageHeight, int imageWidthTablet = 0, int imageHeightTablet = 0, int imageWidthMobile = 0, int imageHeightMobile = 0, string imageFormat = "jpg", int imageCompression = 0, int imageCrop = 5, string background = "", string designName = "DesignFolder") { Dynamicweb.Frontend.PageView currentPageview = Dynamicweb.Frontend.PageView.Current(); string currDevice = currentPageview.Device.ToString(), alternativeImage = currentPageview.Area.Item["NoImage"] != null ? currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/"+ designName + "/images/alternativeImage.jpg", widthString = "", heightString = "", getImageFormat = imageFormat != "jpg" ? "&amp;Format=" + imageFormat : "", getImageCompression = imageCompression != 0 ? "&amp;Compression=" + imageCompression : "", bgColor = !string.IsNullOrEmpty(background) ? "&amp;backgroud="+background : ""; int getImageWidth = imageWidth != 0 ? imageWidth : 0, getImageHeight = imageHeight != 0 ? imageHeight : 0; if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Tablet.ToString()) { getImageWidth = imageWidthTablet != 0 ? imageWidthTablet : getImageWidth; getImageHeight = imageHeightTablet != 0 ? imageHeightTablet : getImageHeight; } else if (currDevice == Dynamicweb.Frontend.PageView.DeviceType.Mobile.ToString()) { getImageWidth = imageWidthMobile != 0 ? imageWidthMobile : getImageWidth; getImageHeight = imageHeightMobile != 0 ? imageHeightMobile : getImageHeight; } if (getImageWidth != 0) { widthString = "&amp;Width=" + getImageWidth; } if (getImageHeight != 0) { heightString = "&amp;Height=" + getImageHeight; } string output = "/Admin/Public/GetImage.ashx?Image=" + sourceString + widthString + heightString + "&amp;altFmImage_path=" + alternativeImage + getImageFormat + getImageCompression + "&amp;Crop=" + imageCrop + bgColor; return output; } } @inherits RazorTemplateBase<RazorTemplateModel<Template>> @using Dynamicweb.Rendering; @functions{ private string GetImagePathUrl(string small, string medium, string large, string pattern) { string imagePath; if (!string.IsNullOrEmpty(small)) imagePath = small; else if (!string.IsNullOrEmpty(medium)) imagePath = medium; else if (!string.IsNullOrEmpty(large)) imagePath = large; else imagePath = pattern; return imagePath; } } @{ Dynamicweb.Content.Items.Item item = Pageview.Area.Item; List<LoopItem> prodLoop = GetLoop("Products"); int totalPagesNum = GetInteger("Ecom:ProductList.TotalPages"), curPage = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["PageNum"]) ? Convert.ToInt32(System.Web.HttpContext.Current.Request.Params["PageNum"].ToString()) : 1; bool noResults = false, isLoggedIn = Pageview.User.LoggedIn, isFrontEnd = Dynamicweb.ExecutingContext.IsFrontEnd(), showQuantity = item["ShowQuantityField"].ToString() == "True" ? true : false, suspendedInstructor = isLoggedIn ? (Dynamicweb.Modules.UserManagement.User.GetCurrentUser().CustomFieldValues.Find(x => x.CustomField.SystemName == "AccessUser_Suspended_Instructor").Value.ToString() == "True") : false; string currentPageId = Pageview.Page.ID.ToString(), imagesFolder = "/Files/Images/" + designName + "/Products/", totalPages = GetString("Ecom:ProductList.TotalPages"), nextPage = GetString("Ecom:ProductList.NextPage"), pagingHref = "", sortBy = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["sortby"]) ? System.Web.HttpContext.Current.Request.Params["sortby"] : "", sortOrder = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["SortOrder"]) ? System.Web.HttpContext.Current.Request.Params["SortOrder"] : "", minPrice = prodLoop.OrderBy(s => s.GetDouble("Ecom:Product.Price.Price")).First().GetString("Ecom:Product.Price.Price"), maxPrice = prodLoop.OrderByDescending(s => s.GetDouble("Ecom:Product.Price.Price")).First().GetString("Ecom:Product.Price.Price"), qString = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["q"]) ? System.Web.HttpContext.Current.Request.Params["q"] : "", dataView = System.Web.HttpContext.Current.Request.Cookies["EMS_dataList"] != null ? System.Web.HttpContext.Current.Request.Cookies["EMS_dataList"].Value : "", groupsIds = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["groupid"]) ? System.Web.HttpContext.Current.Request.Params["groupid"] : ""; var groupsList = GetLoop("Childgroups").Where(g => g.GetBoolean("Ecom:Group.ShowInMenu")).ToList(); GroupCollection groupsById = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["groupid"]) ? Group.GetGroupByID(System.Web.HttpContext.Current.Request.Params["groupid"].ToString()).Subgroups : new GroupCollection(); } @if ((System.Web.HttpContext.Current.Request.Params["groupid"] == null || groupsById.Any()) && string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["q"])) { var groupCollection = new Dynamicweb.eCommerce.Shops.Shop((string) PageView.Current() .Area.get_Value("AreaEcomShopID")) .get_TopLevelGroups((string) PageView.Current() .Area.get_Value("AreaEcomLanguageID")).Where(g => g.NavigationShowInSiteMap).ToList(); if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["groupid"])) { groupCollection = groupsById.ToList(); } var groupsInAssortments = GetGroups(groupCollection); if (groupsInAssortments.Any()) { <ul class="row groupsList"> @foreach (var group in groupCollection.Where(g => groupsInAssortments.Contains(g.ID) || groupsInAssortments.Any(x => g.ParentGroups.Select(pg => pg.ID).Any(x.Equals)))) { string url = string.Format("/Default.aspx?ID={0}&GroupID={1}", Pageview.Page.ID, group.ID); string name = group.Name; string image = GetImagePathUrl(group.LargeImage, group.SmallImage, "", ""); string color = group.ProductGroupFieldValues.FirstOrDefault(f => f.ProductGroupField.SystemName == "LabelColor").Value.ToString(); <li class="col-lg-3 col-md-4 col-sm-6 col-xs-12"> <figure class="col-xs-12 noPadding"> <a href="@url"> <img class="img-responsive" src="@GetImage(image, 1200, 0)" title="@name" alt="@name"/> </a> </figure> <h2 class="@color"> <a href="@url">@name</a> </h2> </li> } </ul> } else if (groupsList.Any()) { // GROUPS string mainImage = GetImagePathUrl(GetString("Ecom:Group.LargeImage"), GetString("Ecom:Group.SmallImage"), "", ""); string mainGroupName = GetString("Ecom:Group.Name"); string description = GetString("Ecom:Group.Description"); <div class="col-xs-12 noPadding"> <div class="col-xs-12 noPadding groupHeader"> @if (mainImage != "") { <figure class="col-xs-12 col-sm-5 noPadding"> <img class="img-responsive" src="@GetImage(mainImage, 800, 0)" title="@mainGroupName" alt="@mainGroupName"/> </figure> } <div class="col-xs-12 @(mainImage != "" ? "col-sm-6 col-sm-offset-1" : "col-xs-12 noPadding")"> <h2 class="col-xs-12 noPadding">@mainGroupName</h2> @if (!string.IsNullOrWhiteSpace(description)) { <div class="col-xs-12 noPadding">@description</div> } </div> </div> <ul class="row groupsList"> @foreach (var group in groupsList) { string url = group.GetString("Ecom:Group.Link.Clean"); string name = group.GetString("Ecom:Group.Name"); string image = GetImagePathUrl(group.GetString("Ecom:Group.LargeImage"), group.GetString("Ecom:Group.SmallImage"), "", ""); string color = group.GetString("Ecom:Group:Field.LabelColor"); if (string.IsNullOrWhiteSpace(color)) { var getGroup = Group.GetGroupByID(group.GetString("Ecom:Group.ID")); if (getGroup.ParentGroups.Any()) { var parentGroup = getGroup.ParentGroups.FirstOrDefault(); var parentGroupColor = parentGroup.ProductGroupFieldValues.FirstOrDefault(f => f.ProductGroupField.SystemName == "LabelColor").Value.ToString(); color = string.IsNullOrWhiteSpace(color) ? parentGroupColor : color; if (parentGroup.ParentGroups.Any()) { var parentParentGroup = parentGroup.ParentGroups.FirstOrDefault(); var parentParentGroupColor = parentParentGroup.ProductGroupFieldValues.FirstOrDefault(f => f.ProductGroupField.SystemName == "LabelColor").Value.ToString(); color = string.IsNullOrWhiteSpace(color) ? parentParentGroupColor : color; } } } <li class="col-xs-3"> <figure class="col-xs-12 noPadding"> <a href="@url"> <img class="img-responsive" src="@GetImage(image, 1200, 0)" title="@name" alt="@name"/> </a> </figure> <h2 class="@color"> <a href="@url">@name</a> </h2> </li> } </ul> @SnippetStart("jsOnLoad") onLoadGroupsList(); @SnippetEnd("jsOnLoad") </div> } } else { // PRODUCTS <!-- filters --> <div id="filtersContainer" class="col-xs-12 col-sm-3 noPaddingLeft"> @using System @using System.Linq @using Dynamicweb.eCommerce.Assortments @using Dynamicweb.eCommerce.Products @using Dynamicweb.Frontend @using System.Collections.Generic @using Dynamicweb @using System.Data @{ var parametersList = GetLoop("Query.Parameters"); string groupId = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["GroupID"]) ? System.Web.HttpContext.Current.Request.Params["GroupID"].ToString() : ""; string price = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["Price"]) ? System.Web.HttpContext.Current.Request.Params["Price"] : "" ; string pageSizeNum = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["PageSize"]) ? System.Web.HttpContext.Current.Request.Params["PageSize"] : ""; /* Workaroung to get All the option labels */ var filterGroupsWithXML = new Dictionary<string, string>(); using (var connection = Dynamicweb.Database.CreateConnection()) { using (var command = connection.CreateCommand()) { command.CommandText = "SELECT FieldTranslationFieldCategoryId, FieldTranslationFieldId, FieldTranslationFieldOptions FROM EcomProductCategoryFieldTranslation"; using (var reader = command.ExecuteReader()) { if (reader != null) { while (reader.Read()) { filterGroupsWithXML.Add(string.Concat("ProductCategory_", reader["FieldTranslationFieldCategoryId"].ToString(), "_", reader["FieldTranslationFieldId"].ToString()), reader["FieldTranslationFieldOptions"].ToString()); } } } } } } <div class="headerBox filtersHead col-xs-12"> <span>@Translate("filterYourResults", "Filter your results")</span> </div> <form id="filtersForm" class="col-xs-12 noPadding" action="/Default.aspx"> <input type="hidden" name="ID" value="@Pageview.Page.ID" /> <input type="hidden" name="GroupID" value="@groupId" /> @if(sortBy != "") { <input type="hidden" name="sortby" value="@sortBy" /> } @if(sortOrder != "") { <input type="hidden" name="SortOrder" value="@sortOrder" /> } @if(pageSizeNum != "") { <input type="hidden" name="PageSize" value="@pageSizeNum" /> } @if(qString != "") { <input type="hidden" name="q" value="@qString" /> } @foreach (LoopItem facetGroup in GetLoop("FacetGroups")) { foreach (LoopItem facet in facetGroup.GetLoop("Facets")) { string parameterType = parametersList.First(x => x.GetString("Parameter.Name") == facet.GetString("Facet.QueryParameter")).GetString("Parameter.Type"); string templateOutput = "string"; if(parameterType.Contains("[]")){ switch (facet.GetString("Facet.Name")) { case "Category_": templateOutput = "multiselect"; break; case "Price": templateOutput = "radios"; break; default: templateOutput = "checkboxes"; break; } } else if(parameterType.Contains("Boolean")){ switch (facet.GetString("Facet.Name")) { case "fieldName": templateOutput = "select"; break; case "fieldName2": templateOutput = "radio"; break; default: templateOutput = "checkbox"; break; } } else if(!string.IsNullOrWhiteSpace(facet.GetString("Facet.OptionCount"))) { switch (facet.GetString("Facet.Name")) { case "fieldName": templateOutput = "select"; break; case "Price": templateOutput = "radios"; break; case "fieldName3": templateOutput = "multiselect"; break; case "fieldName4": templateOutput = "text"; break; case "fieldName5": templateOutput = "range"; break; default: templateOutput = "checkboxes"; break; } } else { switch (facet.GetString("Facet.Name")) { case "fieldName": templateOutput = "autocomplete"; break; case "Price": templateOutput = "range"; break; default: templateOutput = "text"; break; } } @RenderField(facet, parameterType, templateOutput, noResults, filterGroupsWithXML) } } </form> @helper RenderField(LoopItem loopItem , string parameterType, string templateOutput, bool noResults, Dictionary<string, string> filterGroupsWithXML ) { string parameter = loopItem.GetString("Facet.QueryParameter"); string name = loopItem.GetString("Facet.Name"); List<LoopItem> facetOptionsList = loopItem.GetLoop("FacetOptions"); var facetOptions = noResults ? facetOptionsList.OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label")) : loopItem.GetLoop("FacetOptions").Where(f => f.GetInteger("FacetOption.Count") != 0).OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label")); switch (templateOutput) { case "multiselect": if(loopItem.GetLoop("FacetOptions").Any()) { <fieldset> <legend>@name</legend> <select data-selected-text-format="count" data-live-search="true" data-size="8" name="@parameter" multiple> @foreach(LoopItem option in facetOptionsList.OrderByDescending(o => o.GetInteger("FacetOption.Label"))) { bool facetOptionChecked = option.GetBoolean("FacetOption.Selected"); string value = option.GetString("FacetOption.Value"); <option selected="@facetOptionChecked" value="@value"> @if (filterGroupsWithXML.ContainsKey(loopItem.GetString("Facet.Field"))) { @GetOptionLabel(filterGroupsWithXML[loopItem.GetString("Facet.Field")], option.GetString("FacetOption.Value")) } else { @option.GetString("FacetOption.Label") } </option> } </select> </fieldset> } break; case "checkboxes": if(loopItem.GetLoop("FacetOptions").Where(fo => fo.GetInteger("FacetOption.Count") > 0).Any()) { int count = 0; <fieldset data-type="@parameterType"> <legend class="filterTitle">@name</legend> <div class="filtersContainer hide"> @foreach(LoopItem option in facetOptions) { bool facetOptionChecked = option.GetBoolean("FacetOption.Selected"); string value = option.GetString("FacetOption.Value"); string classString = count > 5 ? "hide" : ""; count++; <label class="checkBoxContainer @classString"><input checked="@facetOptionChecked" type="checkbox" value="@value" name="@parameter"> <span> @if (filterGroupsWithXML.ContainsKey(loopItem.GetString("Facet.Field"))) { @GetOptionLabel(filterGroupsWithXML[loopItem.GetString("Facet.Field")], option.GetString("FacetOption.Value")) } else { @option.GetString("FacetOption.Label") } @if(option.GetInteger("FacetOption.Count") > 0) { string.Format("({0})", option.GetString("FacetOption.Count")); } </span> </label> } @if(loopItem.GetLoop("FacetOptions").Where(f => f.GetInteger("FacetOption.Count") != 0).Count() > 5) { <span class="seeMore" data-more='@Translate("seeMore", "See more")' data-hide='@Translate("only5", "Show only 5")' >@Translate("seeMore", "See more")</span> } </div> </fieldset> } break; case "select": break; case "checkbox": if(loopItem.GetLoop("FacetOptions").Any()) { <fieldset data-type="@parameterType"> @foreach(LoopItem option in facetOptionsList.Where(f => f.GetInteger("FacetOption.Count") != 0).OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label"))) { bool facetOptionChecked = option.GetBoolean("FacetOption.Selected"); string value = option.GetString("FacetOption.Value") == "True" ? "True" : ""; string nameOption = option.GetString("FacetOption.Name"); if(value == "True") { <legend class="filterTitle">@name</legend> <div class="filtersContainer hide"> <label class="checkBoxContainer"><input checked="@facetOptionChecked" type="checkbox" value="@value" name="@parameter"> <span>@name (@option.GetString("FacetOption.Count"))</span></label> </div> } } </fieldset> } break; case "radio": break; case "radios": if(loopItem.GetLoop("FacetOptions").Any()) { <fieldset data-type="@parameterType"> <legend class="filterTitle notClick">@Translate("price", "Price")</legend> <div class="filtersContainer"> @foreach(LoopItem option in facetOptionsList.Where(f => f.GetInteger("FacetOption.Count") != 0)) { bool facetOptionChecked = option.GetBoolean("FacetOption.Selected"); string value = option.GetString("FacetOption.Value").Replace("-", ",").Replace("+", ",9999"); string nameOption = option.GetString("FacetOption.Name"); <label class="radioBoxContainer"><input checked="@((string)System.Web.HttpContext.Current.Request.Params["Price"] == value)" type="radio" value="@value" name="Price"> <span>@nameOption</span></label> } </div> </fieldset> } break; case "autocomplete": break; case "range": break; default: <fieldset data-type="@parameterType"> <legend class="filterTitle">@name</legend> <div class="filtersContainer"> <input type="text" name="@parameter" value="" /> </div> </fieldset> break; } } <div class="headerBox filtersHead col-xs-12"> <span>@Translate("browseCategories", "Browse Categories")</span> </div> <ul class="col-xs-12 categoriesContainer"> @RenderEcomNavigation() </ul> @helper RenderEcomNavigation() { try { } catch (Exception e) { Console.WriteLine(e); throw; } var groupCollection = new Dynamicweb.eCommerce.Shops.Shop((string) PageView.Current() .Area.get_Value("AreaEcomShopID")) .get_TopLevelGroups((string) PageView.Current() .Area.get_Value("AreaEcomLanguageID")).Where(g => g.NavigationShowInSiteMap).ToList(); @*var subpages = Dynamicweb.Content.Page.GetPageById(Pageview.Page.ID).Subpages; if (subpages.Any()) { foreach (var subpage in subpages) { string subpageName = subpage.MenuText; var subpageId = subpage.ID; foreach (var v in subpage.UserManagementPermissions.Frontend.Where(v=>v.Value.ToString()=="Allow").ToList()) { foreach (var group in Pageview.User.Groups) { if (group.ToString() == v.Key.ToString() ) { <li class="col-xs-12 noPadding"> <a class="col-xs-12 noPadding" href="/Default.aspx?ID=@subpageId">@subpageName</a> </li> } } } } }*@ var groupsInAssortments = GetGroups(groupCollection); foreach (var group in groupCollection.Where(g => groupsInAssortments.Contains(g.ID) || groupsInAssortments.Any(x => g.ParentGroups.Select(pg => pg.ID).Any(x.Equals)))) { string groupName = group.Name; string groupId = group.ID; <li class="col-xs-12 noPadding"> <a class="col-xs-12 noPadding" href="/Default.aspx?ID=@Pageview.Page.ID&amp;groupid=@groupId">@groupName</a> </li> } } @functions { // <SUMMARY> Transforms string into a xml and get the Name node </SUMMARY> public string GetOptionLabel(string xml, string value) { try { var SerieOptionsXML = new XmlDocument(); SerieOptionsXML.LoadXml(xml); XmlNodeList SerieOptionsNodesXML = SerieOptionsXML.SelectNodes("Options/Option[@Value='"+value+"']"); return SerieOptionsNodesXML[0].Attributes["Name"] != null ? SerieOptionsNodesXML[0].Attributes["Name"].Value.ToString() : ""; } catch (Exception e) { return value; } } // <summary> Get the related assortment groups </summary> public List<string> GetAssortmentGroups(string mainGroupId, string actualGroupId) { return (from a in AssortmentGroupRelation.GetAssortmentRelationsByGroup(actualGroupId) where AssortmentPermission.GetAssortmentIDsForCurrentUser().Contains(a.AssortmentID) select mainGroupId).ToList(); } // <summary> Get the related assortment groups by products </summary> public List<string> GetAssortmentGroupsByProducts(string mainGroupId, string actualGroupId) { var products = new List<string>(); // The API method GetProductsByGroup don't return products without stock using (var connection = Database.CreateConnection()) { using (var command = connection.CreateCommand()) { command.CommandText = string.Format("SELECT ProductID FROM EcomProducts " + "INNER JOIN EcomGroupProductRelation ON EcomGroupProductRelation.GroupProductRelationProductID = EcomProducts.ProductID AND EcomProducts.ProductActive = 'True' " + "WHERE EcomGroupProductRelation.GroupProductRelationGroupID = ''+@group+''"); command.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "group", SqlDbType = SqlDbType.NVarChar, Value = actualGroupId }); using (var reader = command.ExecuteReader()) { while (reader.Read()) { products.Add(reader["ProductID"].ToString()); } } } } return (from p in products from a in AssortmentProductRelation.GetAssortmentRelationsByProduct(p, "") where AssortmentPermission.GetAssortmentIDsForCurrentUser().Contains(a.AssortmentID) select mainGroupId).ToList(); } // <summary> Get All the Top GroupIDs that are in the user assortment </summary> public List<string> GetGroups(IEnumerable<Group> groupCollection) { var groupsInAssortments = new List<string>(); // Level 1 foreach (var group in groupCollection) { groupsInAssortments.AddRange(GetAssortmentGroups(group.ID, group.ID)); groupsInAssortments.AddRange(GetAssortmentGroupsByProducts(group.ID, group.ID)); // Level 2 foreach (var sb in group.Subgroups) { groupsInAssortments.AddRange(GetAssortmentGroups(group.ID, sb.ID)); groupsInAssortments.AddRange(GetAssortmentGroupsByProducts(group.ID, sb.ID)); // Level 3 foreach (var ssb in sb.Subgroups) { groupsInAssortments.AddRange(GetAssortmentGroups(group.ID, ssb.ID)); groupsInAssortments.AddRange(GetAssortmentGroupsByProducts(group.ID, ssb.ID)); // Level 4 foreach (var sssb in ssb.Subgroups) { groupsInAssortments.AddRange(GetAssortmentGroups(group.ID, sssb.ID)); groupsInAssortments.AddRange(GetAssortmentGroupsByProducts(group.ID, sssb.ID)); // Level 5 foreach (var ssssb in sssb.Subgroups) { groupsInAssortments.AddRange(GetAssortmentGroups(group.ID, ssssb.ID)); groupsInAssortments.AddRange(GetAssortmentGroupsByProducts(group.ID, ssssb.ID)); } } } } } return groupsInAssortments; } } </div> <div id="listContainer" class="col-xs-12 col-sm-9 noPaddingRight"> <!-- SORT AND ORDER --> <div class="headerBox col-xs-12"> <span class="col-sm-2 col-xs-12 noPaddingLeft">@GetString("Ecom:ProductList.PageProdCnt") @Translate(GetInteger("Ecom:ProductList.PageProdCnt") > 1 ? "items" : "item")</span> <form id="orderProdList" class="col-sm-8 col-xs-12 hidden-xs pull-left" action="/" name="ExtUserForm_Main" method="GET"> <input type="hidden" name="ID" value="@Pageview.Page.ID"> <input type="hidden" name="GroupID" value="@(GetGlobalValue("Ecom:ProductList:Page.GroupID"))"> <fieldset class="col-lg-5 col-md-6 col-sm-6 col-xs-6 hidden"> <label class="pull-left">@Translate("sortBy", "Sort by"):</label> <select id="sortSelect" name="sortby"> <option selected="@(sortBy == "Created")" value="Created">@Translate("created", "Created")</option> <option selected="@(sortBy == "Price")" value="Price">@Translate("price", "Price")</option> <option selected="@(sortBy == "Name_sortable")" value="Name_sortable">@Translate("name", "Name")</option> </select> </fieldset> <fieldset class=" col-lg-7 col-md-6 col-sm-6 col-xs-6 hidden"> <label class="pull-left">@Translate("order", "Order"):</label> <select id="orderSelect" name="SortOrder"> <option selected="@(sortOrder == "ASC")" value="ASC">@Translate("asc", "ASC")</option> <option selected="@(sortOrder == "DESC")" value="DESC">@Translate("desc", "DESC")</option> </select> </fieldset> <fieldset class="col-lg-7 col-md-7 col-sm-12 col-xs-6"> <label class="pull-left">@Translate("sort", "Sort"):</label> <select id="sortOrderJoin" name="sortOrderJoin"> <option data-sort="Price" data-order="ASC" selected="@(sortOrder == "ASC" && sortBy == "Price")" value="">@Translate("priceLh", "Price (Low to High)")</option> <option data-sort="Price" data-order="DESC" selected="@(sortOrder == "DESC" && sortBy == "Price")" value="">@Translate("priceHl", "Price (High to Low)")</option> <option data-sort="Name_sortable" data-order="ASC" selected="@(sortOrder == "ASC" && sortBy == "Name_sortable")" value="">@Translate("titleAz", "Title (A - Z)")</option> <option data-sort="Name_sortable" data-order="DESC" selected="@(sortOrder == "DESC" && sortBy == "Name_sortable")" value="">@Translate("titleZa", "Title (Z - A)")</option> </select> </fieldset> <fieldset class="col-lg-5 col-md-5 col-sm-12 col-xs-6 pageSize"> <label for="pageSize">@Translate("pageSize", "Page size"):</label> <select id="pageSize" name="PageSize"> @{ int multipleOf = 12, maxOf = 36; string pageSize = GetString("Ecom:ProductList.PageSize"), selected = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["PageNum"]) ? System.Web.HttpContext.Current.Request.Params["PageNum"].ToString() : pageSize; while (multipleOf <= maxOf) { string selectedOption = selected == multipleOf.ToString() ? "selected" : ""; <option @selectedOption value="@multipleOf">@multipleOf</option> multipleOf = multipleOf + 12; } <option selected="@(selected == "9999")" value="9999">@Translate("all", "All")</option> } </select> </fieldset> </form> <ul class="listMode hidden-xs"> <li data-list="list" class="active"> <i class="fa fa-list-ul"></i> </li> <li data-list="tile"> <i class="fa fa-th"></i> </li> </ul> </div> @if (qString != "") { <form action="/Default.aspx" id="searchFormList"> <input type="hidden" name="ID" value="@(item["SearchResults"])"> <fieldset class="TextInput mandatory"> <label for="searchSubmitList" class="hide">@Translate("search", "Search")</label> <input id="searchSubmitList" data-error='@Translate("searchText", "Search for something")' type="text" name="q" value="@qString"> </fieldset> <button type="submit"> <i class="fa fa-search"></i> </button> </form> } <div class="col-xs-12 removeFiltersContainer"> @foreach (LoopItem facetGroup in GetLoop("FacetGroups")) { foreach (LoopItem facet in facetGroup.GetLoop("Facets")) { if (facet.GetLoop("FacetOptions").Any(r => r.GetBoolean("FacetOption.Selected"))) { <a data-queryname="@(facet.GetString("Facet.QueryParameter"))" class="btn btn-bg" href="#"> @facet.GetString("Facet.Name") <i class="fa fa-times"></i> </a> } } } <a class="removeAll" href="#">@Translate("removeAllFilters", "Remove all filters")</a> </div> <ul data-maxcompare='@Translate("maxCompare", "Maximum to compare: 3")' data-list="@dataView" id="productsList" class="productsList hidden"> @foreach (LoopItem product in prodLoop) { int productStock = product.GetInteger("Ecom:Product.AvailableAmount"); bool productIsFavoriteBool = product.GetBoolean("Ecom:Product.IsProductInFavoriteList"), isFreeShipping = product.GetBoolean("Ecom:Product:Field.FreeShipping"); string productNumber = product.GetString("Ecom:Product.Number"), imagePattern = imagesFolder + productNumber.Replace("/", "-") + "/" + productNumber.Replace("/", "-") + ".jpg", image = GetImagePathUrl(product.GetString("Ecom:Product.ImageSmall.Clean"), product.GetString("Ecom:Product.ImageMedium.Clean"), product.GetString("Ecom:Product.ImageLarge.Clean"), imagePattern), productName = product.GetString("Ecom:Product.Name"), productID = product.GetString("Ecom:Product.ID"), productVariantID = product.GetString("Ecom:Product.VariantID"), productShortDescription = product.GetString("Ecom:Product.ShortDescription"), link = product.GetString("Ecom:Product.Link.Clean"), productLanguage = product.GetString("Ecom:Product.LanguageID"), compareLink = productID + "$" + productLanguage + "$" + productVariantID, variantDefaultId = product.GetString("Ecom:Product.DefaultVariantComboID"), variantCurrentId = product.GetString("Ecom:Product.VariantID"), variantId = (!string.IsNullOrEmpty(variantCurrentId)) ? variantCurrentId : variantDefaultId, productRemoveFromList = "/Default.aspx?Id=" + currentPageId + "&amp;ProductID=" + productID + "&amp;CCRemoveFromMyLists=" + productID + "&amp;CCRemoveFromListVariantID=" + variantDefaultId + "&amp;CCRemoveFromListLanguageID=" + productLanguage, productAddToList = "/Default.aspx?Id=" + currentPageId + "&amp;ProductID=" + productID + "&amp;CCAddToMyLists=" + productID + "&amp;CCAddToListVariantID=" + variantDefaultId + "&amp;CCAddToListLanguageID=" + productLanguage, favoriteUrl = productIsFavoriteBool ? productRemoveFromList : productAddToList; List<LoopItem> variantCombinations = product.GetLoop("VariantCombinations"); <li class="col-xs-12 noPadding border"> <div class="col-xs-12"> <figure class="col-xs-3 noPadding"> <a href="@link"> <img src="@GetImage(image, 400, 0)" alt="@productName" title="@productName" class="img-responsive"/> </a> </figure> <div class="col-xs-9"> <div class="col-xs-8"> <h2> <a itemprop="name" href="@link">@productName</a> </h2> @if (!string.IsNullOrEmpty(productShortDescription)) { <div class="tileHide shortDescription"> @productShortDescription </div> } @if (!string.IsNullOrEmpty(productNumber)) { <div class="tileHide prodNumber"> @Translate("item", "Item #"): @productNumber </div> } @if(isFreeShipping){ <span class="freeShipping"></span> } <!-- <div class="tileHide addToCompare"> <label class="weightNormal" for="addToCompare_@productID"> <input data-link="@compareLink" type="checkbox" id="addToCompare_@productID" name="addToCompare_@productID" value=""/> @Translate("addToCompare", "Add to compare") </label> </div> --> </div> <div class="col-xs-4 noPaddingRight priceContainer"> <form name="addToCart" action="/Default.aspx" method="post" data-outofstock='@Translate("outOfStock", "Out of stock")'> <input type="hidden" name="ID" value="@currentPageId"/> <input type="hidden" name="productid" value="@productID"/> <input type="hidden" name="cartcmd" value="add"/> @if (productStock > 0) { <input class="quantityInput" data-available='@productStock' type="hidden" name="quantity" value="1"/> } <span class="listPrice" itemprop="price">@product.GetString("Ecom:Product.Price")</span> @if (isLoggedIn && isFrontEnd && !variantCombinations.Any()) { string icon = productIsFavoriteBool ? "fa-heart" : "fa-heart-o"; <a title='@Translate("favorites", "Favorites")' class="favorite" data-favorite="@productIsFavoriteBool" data-add="@productAddToList" data-remove="@productRemoveFromList" data-user="@Pageview.User.LoggedIn" href="@favoriteUrl"> <i class="fa @icon"></i> </a> } @if (variantCombinations.Any()) { string sizeSelect = "<fieldset class='Select mandatory'><select data-width='100%' name='variantID'>"; foreach (LoopItem a in variantCombinations.OrderBy(x => x.GetString("Ecom:VariantCombination.VariantID"))) { bool isFavoriteBool = a.GetBoolean("Ecom:Product.IsProductInFavoriteList"); string variantPrice = a.GetString("Ecom:Product.Price"), selectedVariant = a.GetString("Ecom:Product.DefaultVariantComboID") == a.GetString("Ecom:VariantCombination.VariantID") ? "selected" : "", variantCombinationId = a.GetString("Ecom:VariantCombination.VariantID"), showSelectedFavorite = selectedVariant == "selected" ? "" : "hidden", icon = isFavoriteBool ? "fa-heart" : "fa-heart-o", addToList = a.GetString("Ecom:Product.AddToFavorites"), removeFromList = a.GetString("Ecom:Product.RemoveFromFavorites"); favoriteUrl = isFavoriteBool ? removeFromList : addToList; sizeSelect += "<option data-favorite='" + isFavoriteBool.ToString() + "' " + selectedVariant + " data-stock='" + a.GetInteger("Ecom:Product.AvailableAmount") + "' data-price='" + variantPrice + "' id='" + variantCombinationId + "' value='" + variantCombinationId + "'>" + a.GetString("Ecom:VariantCombination.VariantText") + "</option>"; if (isLoggedIn && isFrontEnd && !variantCombinations.Any()) { <a data-add='@addToList' data-remove='@removeFromList' data-variant='@variantCombinationId.Replace(".", "_")' title='@Translate("favorites", "Favorites")' class="favorite @showSelectedFavorite" data-favorite="@isFavoriteBool" data-user="@Pageview.User.LoggedIn" href="@favoriteUrl"> <i class="fa @icon"></i> </a> } } sizeSelect += "</select></fieldset>"; @sizeSelect } @if (!suspendedInstructor) { <a class="addToCart btn btn-bg" href="/Default.aspx?ID=@currentPageId&amp;productid=@productID&amp;variantID=@variantId&amp;cartcmd=add"> <i class="fa fa-shopping-cart"></i> <span data-add='@Translate("addToCart", "Add to cart")' data-added='@Translate("added", "Added")'>@Translate("addToCart", "Add to cart")</span> </a> <input class="hide" type="submit" value="@Translate("addToCart", "Add to cart")"> } </form> </div> </div> </div> </li> } </ul> <div class="footerBox col-xs-12"> <span class="col-xs-6 noPadding">@prodLoop.Count() @Translate("of", "of") @GetString("Ecom:ProductList.PageProdCnt") @Translate(GetInteger("Ecom:ProductList.PageProdCnt") > 1 ? "items" : "item")</span> @if (GetInteger("Ecom:ProductList.TotalPages") > 1) { string active = "", prevPage = GetString("Ecom:ProductList.PrevPage.Clean"), nextListPage = GetString("Ecom:ProductList.NextPage.Clean"), pageText = "&laquo; " + Translate("previous", "Previous") + " ", requestUrl = Pageview.GlobalTags.GetTagByName("Global:Request.Url").Value.ToString(); <ul class="pagination"> @if (prevPage != "") { @PageItem("previous", prevPage, pageText) } @if (curPage > 2 && totalPagesNum > 3) { for (int i = 1; i <= 1; i++) { active = curPage == i ? "class=\"active\"" : ""; pagingHref = requestUrl.Contains("PageNum") ? requestUrl.Replace("PageNum=" + curPage, "PageNum=" + i) : requestUrl + "&PageNum=" + i; @PageItem(active, pagingHref, i.ToString()) } @Ellipsis() } @foreach (LoopItem page in GetLoop("Ecom:ProductList.Pages3")) { string hrefEncoded = page.GetString("Ecom:ProductList.Pages3.Page.UrlHtmlEncoded"), page3Number = page.GetString("Ecom:ProductList.Pages3.Page.Number"); if (page.GetBoolean("Ecom:ProductList.Pages3.Page.IsCurrent")) { @PageItem("active", hrefEncoded, page3Number) } else { @PageItem("", hrefEncoded, page3Number) } } @if (curPage < totalPagesNum - 1 && totalPagesNum > 3) { @Ellipsis() for (int i = totalPagesNum; i <= totalPagesNum; i++) { active = curPage == i ? "class=\"active\"" : ""; pagingHref = requestUrl.Contains("PageNum") ? requestUrl.Replace("PageNum=" + curPage, "PageNum=" + i) : requestUrl + "&PageNum=" + i; @PageItem(active, pagingHref, i.ToString()) } } @if (nextListPage != "") { string nextText = Translate("next", "Next") + "&raquo;"; @PageItem("next", nextListPage, nextText, "data-numPages=\"@totalPagesNum\"") } </ul> } </div> @SnippetStart("jsOnLoad") onLoadProductList("@minPrice.Replace(",", "")", "@maxPrice.Replace(",", "")", "@price", "@groupsIds"); @SnippetEnd("jsOnLoad") </div> } @helper PageItem(string cssClass, string href, string text, string dataAttr = "") { <li @cssClass @dataAttr> <a href="@href">@text</a> </li> } @helper Ellipsis() { <li> <span>...</span> </li> }
add chat to your website