RC Car & Truck Bearings

RC Car & Truck Bearings | TEKNO

RC Car & Truck Bearings | TEKNO

Whether you're a competitive RC Car & Truck enthusiast or just someone who enjoys beating the pants off your buddies, we've got the RC bearings for you! We stock bearings for both electric or gas powered RC vehicles and have consistently been ahead of the pack with new and innovative solutions for your RC needs.

Reducing rolling resistance and conserving energy has been our hallmark. We offer a full line of standard & ceramic hybrid bearings specifically suited to RC Cars & Trucks. Various ABEC tolerances, radial plays, retainer styles and seal/shield configurations are available. To make things easier for you we have compiled bearing kits and listed them according to the manufacturer and model of the RC Car & Truck that the bearings will fit. Just click on Search By RC Car Model or use the Model Search at the top of any page. 

You can also print (on regular printer paper), our RC bearing size chart HERE and use it to match and find the size of your bearings. 

RC Car & Truck Articles:

(More RC Car & Truck Articles)

Check out our new ceramic hybrid Go Series HERE

If you are looking for RC Engine Bearings go HERE, if you are looking for Brushless Motor Bearings go HERE, and if you are looking for RC Helicopter Bearings go HERE.

Not finding bearings for your Make/Model RC car or truck? We can help! Click HERE to get assistance from one of our bearing experts. 



  • Search by Bearing Series
Exception in template (Designs\BocaBearings\eCom/Productlist/genericProductList.cshtml): System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
   at Dynamicweb.Database.CreateDataSet(IDbDataAdapter dataAdapter, Boolean withSchema)
   at Dynamicweb.Database.CreateDataSet(String sql, IDbConnection connection, IDbTransaction transaction, Boolean withSchema, Dictionary`2 sqlParams)
   at Dynamicweb.Database.CreateDataSet(String sql, String database, IDbConnection connection, IDbTransaction transaction, Boolean withSchema, Dictionary`2 sqlParams)
   at Dynamicweb.Database.CreateDataSet(String sql)
   at CompiledRazorTemplates.Dynamic.ddfceeeadec.<>c__DisplayClass51.b__4f(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.ddfceeeadec.<>c__DisplayClass4d.b__4c(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.ddfceeeadec.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()
ClientConnectionId:c9ffc8c0-87fd-408f-a1a5-7a9d64bea954
Error Number:-2,State:0,Class:11
@using System.Collections; @using System.Data; @using Dynamicweb.eCommerce.Products; @using System.IO; @using System.Web; @using System.Text; @using System.Text.RegularExpressions; @functions { public List<LoopItem> getFacetOptions(string facetName) { List<LoopItem> facetOptions = null; foreach(var t in GetLoop("FacetGroups")) { var fct = t.GetLoop("Facets").FirstOrDefault(f => f.GetString("Facet.Field") == facetName); if(fct != null) { facetOptions = fct.GetLoop("FacetOptions"); break; } } return facetOptions; } public static string GetFirstUserGroupID(object[] userGroups, List<string> productPricesGroups) { string userFirstGroup = ""; foreach (var userGroup in userGroups) { if (productPricesGroups.Contains(userGroup.ToString())) { userFirstGroup = userGroup.ToString(); break; } } return userFirstGroup; } public string RenderParentEcomNav(Dynamicweb.eCommerce.Products.Group group) { if (group.ParentGroupsDefaultLanguage != null && group.ParentGroupsDefaultLanguage.Count > 0) { string parent_id = group.ParentGroupsDefaultLanguage[0].ID; Dynamicweb.eCommerce.Products.Group parent = Dynamicweb.eCommerce.Products.Group.GetGroupByID(parent_id); if (parent != null) { return RenderParentEcomNav(parent); } } return group.ID; } public static string GetImage(string str_source, int num_width, int num_height, int num_widthTablet = 0, int num_heightTablet = 0, int num_widthMobile = 0, int num_heightMobile = 0, string str_format = "", int num_compression = 0, int num_crop = 5) { Dynamicweb.Frontend.PageView obj_currentPageview = Dynamicweb.Frontend.PageView.Current(); string str_currDevice = obj_currentPageview.Device.ToString(); string str_alternativeImage = obj_currentPageview.Area.Item["NoImage"] != null ? obj_currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/BocaBearings/images/alternativeImage.jpg"; string str_width = ""; string str_height = ""; int num_getImageWidth = num_width != 0 ? num_width : 0; int num_getImageHeight = num_height != 0 ? num_height : 0; string str_getImageFormat = str_format != "" ? "&amp;Format=" + str_format : ""; string str_getImageCompression = num_compression != 0 ? "&amp;Compression=" + num_compression : ""; if (str_currDevice == Dynamicweb.Frontend.PageView.DeviceType.Tablet.ToString()) { num_getImageWidth = num_widthTablet != 0 ? num_widthTablet : num_getImageWidth; num_getImageHeight = num_heightTablet != 0 ? num_heightTablet : num_getImageHeight; } else if (str_currDevice == Dynamicweb.Frontend.PageView.DeviceType.Mobile.ToString()) { num_getImageWidth = num_widthMobile != 0 ? num_widthMobile : num_getImageWidth; num_getImageHeight = num_heightMobile != 0 ? num_heightMobile : num_getImageHeight; } if (num_getImageWidth != 0) { str_width = "&amp;Width=" + num_getImageWidth; } if (num_getImageHeight != 0) { str_height = "&amp;Height=" + num_getImageHeight; } string str_output = "/Admin/Public/GetImage.ashx?Image=" + str_source + str_width + str_height + "&amp;altFmImage_path=" + str_alternativeImage + str_getImageFormat + str_getImageCompression + "&amp;Crop=" + num_crop; return str_output; } static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; static string SizeSuffix(Int64 value) { if (value < 0) { return "-" + SizeSuffix(-value); } int i = 0; decimal dValue = (decimal)value; while (Math.Round(dValue / 1024) >= 1) { dValue /= 1024; i++; } return string.Format("{0:n1} {1}", dValue, SizeSuffixes[i]); } public static string GetFriendlyUrl(int num_pageId) { var output = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(num_pageId); return output; } public static object GetParagraph(int num_paragraphId) { var output = Dynamicweb.Content.Paragraph.GetParagraphById(num_paragraphId); return output; } public static string StripHtml(string source) { return Regex.Replace(source, "<.*?>", string.Empty); } public static string GetRequest(string str_param = "") { string str_output = System.Web.HttpContext.Current.Request.QueryString[str_param]; return str_output; } public static string GetParam(string str_param = "") { string str_output = System.Web.HttpContext.Current.Request.Params[str_param]; return str_output; } public static void AddCookie(string str_name = "", string str_value = "") { var obj_cookie = new System.Web.HttpCookie(str_name); obj_cookie.Value = str_value; System.Web.HttpContext.Current.Response.Cookies.Add(obj_cookie); } public static void RemoveCookie(string str_name = "") { var obj_cookie = new System.Web.HttpCookie(str_name); obj_cookie.Expires = DateTime.Now.AddDays(-1d); System.Web.HttpContext.Current.Response.Cookies.Add(obj_cookie); } public static string GetCookie(string str_name = "") { string str_output = ""; if(System.Web.HttpContext.Current.Request.Cookies[str_name] != null ){ str_output = System.Web.HttpContext.Current.Request.Cookies[str_name].Value; } return str_output; } public static bool ExistCookie(string str_name = "") { bool bol_output = false; if(System.Web.HttpContext.Current.Request.Cookies[str_name] != null ){ bol_output = true; } return bol_output; } public static void Redirect(string str_url = "") { System.Web.HttpContext.Current.Response.Redirect(Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(str_url)); } /*example: Redirect("/Default.aspx?ID=12")*/ public static IHtmlString EncodeJS(string input) { StringBuilder builder = new StringBuilder(); // Open the double quotes builder.Append("\""); // Then add each character properly escaping them foreach (char c in input) { switch (c) { //First check whether it's one of the defined escape sequences case '\'': //single quote builder.Append("\\\'"); break; case '\"': //double quote builder.Append("\\\""); break; case '\\': //backslash builder.Append("\\\\"); break; case '\0': //Unicode character 0 builder.Append("\\0"); break; case '\a': //Alert (character 7) builder.Append("\\a"); break; case '\b': //Backspace (character 8) builder.Append("\\b"); break; case '\f': //Form feed (character 12) builder.Append("\\f"); break; case '\n': //New line (character 10) builder.Append("\\n"); break; case '\r': //Carriage return (character 13) builder.Append("\\r"); break; case '\t': //Horizontal tab (character 9) builder.Append("\\t"); break; case '\v': //Vertical quote (character 11) builder.Append("\\v"); break; default: // If it's none of the defined escape sequences, convert the character to an int and check the code int i = (int)c; if (i >= 32 && i <= 127) { // if it's a displayable ASCII character, just write the character builder.Append(c); } else { // otherwise write the Unicode escape sequence for the character with hex value builder.AppendFormat("\\u{0:X04}", i); } break; } } // Close the double quotes builder.Append("\""); // You have to return an IHtmlString otherwise an HTML escape will be performed e.g. < will be replaced by &lt; return new HtmlString(builder.ToString()); } } @functions{ public string RenderDimensions(string dimension){ return dimension; if(!string.IsNullOrEmpty(dimension)){ string dimensionClean = dimension; string[] cleanUpDictionary = {"Metric","Inch","es","Millimeters"," "}; foreach(string dictionary in cleanUpDictionary){ dimensionClean = dimensionClean.Replace(dictionary,""); } dimensionClean = dimensionClean.ToLower(); string[] dimensions = (dimensionClean ?? "").Split(new [] { 'x' },StringSplitOptions.RemoveEmptyEntries); if(dimensions.Any()){ dimensionClean =""; foreach(string d in dimensions){ var dimensionDouble = Double.Parse(d); var hasDecimals = (int)dimensionDouble != dimensionDouble; string str_d = hasDecimals ? dimensionDouble.ToString("#,##0.0000") : dimensionDouble.ToString("#,##0"); dimensionClean = dimensionClean + " x " + str_d ; } dimensionClean = dimensionClean.Substring(3); } return dimensionClean; } } } @helper RenderMakes(List<LoopItem> makes,Dictionary<string, string> products,bool isBrowseAll) { string currentUrl = System.Web.HttpContext.Current.Request.Url.AbsolutePath; foreach (string qp in System.Web.HttpContext.Current.Request.QueryString.AllKeys) { if(!qp.Equals("ItemMakes") && !qp.Equals("ItemModels") && !qp.Equals("ItemFeatures")) { currentUrl += String.Format("{0}{1}={2}", currentUrl.Contains("?") ? "&" : "?", qp, System.Web.HttpContext.Current.Request.QueryString[qp]); } } Dictionary<string, List<LoopItem>> groupedDictionary = null; if(makes != null) { groupedDictionary = makes.GroupBy(g => g.GetString("FacetOption.Value").Substring(0, 1)).ToDictionary(g => g.Key, g => g.ToList()); } else { List<LoopItem> dummyList = new List<LoopItem>(); groupedDictionary = new Dictionary<string, List<LoopItem>>(); foreach(string s in products.Keys){ string key = s.Substring(0, 1); if(!groupedDictionary.ContainsKey(key)){ groupedDictionary.Add(key, dummyList); } } } if(makes != null && makes.Any() || products != null && products.Any()) { List<string> specialChars = new List<string>(new string[] { "#", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }); string specialCharsClass = "inactive"; foreach (string item in groupedDictionary.Keys) { if (specialChars.Contains(item)) { specialCharsClass = "active"; break; } } <div class="row"> <div class="col-xs-12 "> <ul id="ABC-filter" class="hidden-xs"> <li><a href="javascript:void(0);" class="@specialCharsClass" data-filter="0-9">@Translate("0-9", "0-9")</a></li> @for (char c = 'A'; c <= 'Z'; c++) { string letter = c.ToString(), liClass = groupedDictionary.ContainsKey(letter) ? "active" : "inactive"; <li><a href="javascript:void(0);" class="@liClass" data-filter="@letter">@letter</a></li> } </ul> </div> </div> <div class="row"> <div class="col-xs-12"> <ul class="ModelsList"> @if(makes != null) { foreach (var letter in groupedDictionary.OrderBy(p => p.Key)) { string firstLetter = specialChars.Contains(letter.Key) ? "0-9" : letter.Key; <li data-a="aaaa"> <h3 class="h1" data-filter="@firstLetter">@letter.Key.ToUpper()</h3> <div class="row"> @foreach (LoopItem product in letter.Value.OrderBy(p => p.GetString("FacetOption.Value"))) { string currentItemMakeEncoded = product.GetString("FacetOption.Value").Replace(",","|").Replace(" ", "_").Replace("'","*"); <div class="col-xs-12 col-sm-4 col-md-3"> <a href="/@currentUrl&ItemMakes=@currentItemMakeEncoded">@product.GetString("FacetOption.Value").Replace("|", ",").Replace("_", " ").Replace("*", "'").ToUpper()</a> </div> } </div> </li> } } else { foreach (var letter in groupedDictionary) { string firstLetter = specialChars.Contains(letter.Key) ? "0-9" : letter.Key; var keys = products.Keys.Where(x => x.Substring(0,1) == letter.Key); keys = keys.Distinct().ToList(); <li> <h3 class="h1" data-filter="@firstLetter">@letter.Key</h3> <div class="row"> @foreach(var key in keys) { string make = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) ? "" : System.Web.HttpContext.Current.Request["ItemMakes"].ToString(); string[] modelFeature = key.Split('|'); string url = String.Format("{0}&ItemMakes={1}&ItemModels={2}&ItemFeatures={3}", currentUrl, make, modelFeature[0].Replace(",","|").Replace(" ", "_").Replace("'","*"),modelFeature[1].Replace(",","|").Replace(" ", "_").Replace("'","*")); url = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(url); <div class="col-xs-12 col-sm-4 col-md-3"> <a href="@url">@key.Replace("_"," ").Replace("*","'")</a> </div> } </div> </li> } } </ul> </div> </div> } else { <h2>@Translate("noProductsAvailable","No products available.")</h2> } } @helper RenderPriceContainer(LoopItem product,Dynamicweb.Content.Items.Item item) { List<LoopItem> productPrices = product.GetLoop("Product.Prices"); string str_productID = product.GetString("Ecom:Product.ID"); bool bol_userLogged = Pageview.User.LoggedIn; string userGroupID = (!bol_userLogged) ? (item["Retail"] ?? "").ToString() : GetFirstUserGroupID(Pageview.User.Groups.ToArray(), productPrices.Select(p => p.GetString("Ecom:Product.Prices.GroupID")).Distinct().ToList()); string str_urlReq = "/Default.aspx?ID=" + item["RequestQuote"].ToString() + "&prodID=" + str_productID; List<LoopItem> lst_quantityPrices = productPrices.Where(x => x.GetString("Ecom:Product.Prices.GroupID") == userGroupID && x.GetInteger("Ecom:Product.Prices.Quantity") < 100).OrderByDescending(p => p.GetInteger("Ecom:Product.Prices.Quantity")).ToList(); string containerClass = lst_quantityPrices.Any() ? "quantityContainer" : "noMultiplePrice"; string priceTitle = lst_quantityPrices.Any() ? Translate("listPrice") : Translate("yourPrice"); <div class="col-xs-12 col-sm-4"> <div class="qty-pricing"> <div id="@containerClass" class="col-xs-12 noPadding"> <ul> <li class="list-price"><span class="col-xs-5 noPadding" data-price='@product.GetValue("Ecom:Product.Price")'>&nbsp;@priceTitle</span><span class="col-xs-7 whiteText priceSize_0">@product.GetValue("Ecom:Product.Price")</span></li> @if(lst_quantityPrices.Any()) { List<string> lst_quantityPricesOrdered = new List<string>(); int lastQuantity = 100, numPrices = lst_quantityPrices.Count - 1; foreach (LoopItem price in lst_quantityPrices) { int _quantity = price.GetInteger("Ecom:Product.Prices.Quantity"); _quantity = _quantity == 0 ? 1 : _quantity; string htmlResult = "<li class=whiteBG><span class=\"blackTextImportant col-sm-5 col-xs-6 noPaddingLeft\">" + Translate("Qty", "Qty") + " " + _quantity + " - " + (lastQuantity - 1) + "</span><span class=\"col-sm-7 col-xs-6 greenTextImportant priceSize_" + numPrices + "\">" + price.GetString("Ecom:Product.Prices.PriceWithoutVATFormatted") + "</span></li>"; lst_quantityPricesOrdered.Add(htmlResult); numPrices--; lastQuantity = price.GetInteger("Ecom:Product.Prices.Quantity"); } lst_quantityPricesOrdered.Reverse(); <li class="your-price"><span class="col-xs-5 noPadding">&nbsp;Your Price</span><span class="col-xs-7 whiteText priceSize_0">@product.GetValue("Ecom:Product.Price")</span></li> foreach (string liHtml in lst_quantityPricesOrdered) { @liHtml } <li> <span class="pull-left col-sm-5 col-xs-6 noPaddingLeft">@Translate("Qty", "Qty") @Translate("100+", "100 +")</span> <a class="min-btn btn-blue generalButton underline pull-right" href="@str_urlReq">@Translate("requestQuote", "Request Quote")</a> </li> } </ul> </div> </div> </div> } @helper CheckStock(Dynamicweb.Content.Items.Item item,string str_productID,string str_productVariantID,LoopItem product) { string inquirePage = (item["InquireAboutAvailability"] ?? "").ToString(); string str_myMiniCart = (Pageview.Area.Item["MiniCart"] ?? "").ToString(); <div class="col-xs-12 col-sm-2 noPaddingLeft"> <div class="cart-controls pull-right"> @if(product.GetInteger("Ecom:Product.Stock") > 0){ <span class="qty-label">Qty</span> <input class="quantity" name="Quantity" type="number" value="1" maxlength="4" min="1"/><br/> } </div> <div class="cart-controls text-right"> @if(product.GetInteger("Ecom:Product.Stock") > 0){ <a rel="nofollow" class="addToCart generalButton pull-right addToCartTracking" href="/Default.aspx?ID=@str_myMiniCart&productid=@str_productID&amp;variantID=@str_productVariantID&amp;cartcmd=add"><i class="fa fa-shopping-cart"></i>&nbsp;@Translate("Add to Cart")</a> } else { <a rel="nofollow" class="btn-softBlue pull-right inquireAboutAvailability" href="/Default.aspx?ID=@inquirePage&prodID=@str_productID"><i class="fa fa-comment fa-2x"></i> @Translate("Inquire")</a> } </div> </div> } @helper CheckStock_(Dynamicweb.Content.Items.Item item,string str_productID,string str_productVariantID,LoopItem product) { string inquirePage = (item["InquireAboutAvailability"] ?? "").ToString(); string str_myMiniCart = (Pageview.Area.Item["MiniCart"] ?? "").ToString(); <form class="col-xs-12 col-sm-2 noPaddingLeft"> <input type="hidden" name="cartcmd" value="add"/> <input type="hidden" name="productid" value="@str_productID"/> <input type="hidden" name="variantID" value="@str_productVariantID"/> @* added to allow post to Minicart and Facebook Tracking *@ <input type="hidden" name="ID" value="@str_myMiniCart"/> <div class="cart-controls pull-right"> @if(product.GetInteger("Ecom:Product.Stock") > 0){ <span class="qty-label">Qty</span> <input class="quantity" name="Quantity" type="number" value="1" maxlength="4" min="1"/><br/> } </div> <div class="cart-controls text-right"> @if(product.GetInteger("Ecom:Product.Stock") > 0){ <button class="addToCart generalButton pull-right addToCartTracking" type="submit"> <i class="fa fa-shopping-cart"></i>&nbsp;@Translate("Add to Cart") </button> } else { <a rel="nofollow" class="btn-softBlue pull-right inquireAboutAvailability" href="/Default.aspx?ID=@inquirePage&prodID=@str_productID"><i class="fa fa-comment fa-2x"></i> @Translate("Inquire")</a> } </div> </form> } @functions{ bool haveKits; } @{ var itemArea = Pageview.Area.Item; List<LoopItem> facetGroups = GetLoop("FacetGroups"); int num_currPage = GetInteger("Ecom:ProductList.CurrentPage"); int page_size = GetInteger("Ecom:ProductList.PageSize"); int num_totalPages = GetInteger("Ecom:ProductList.TotalPages"); var products = GetLoop("Products"); string groupID = GetString("Ecom:Group.ID"), parentGroup = "", make = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) ? "" : System.Web.HttpContext.Current.Request["ItemMakes"].ToString().Replace("-"," "), model = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemModels"]) ? "" : System.Web.HttpContext.Current.Request["ItemModels"].ToString().Replace("-"," "), feature = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemFeatures"]) ? "" : System.Web.HttpContext.Current.Request["ItemFeatures"].ToString().Replace("-"," "), prodType = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ProductType"]) ? "" : System.Web.HttpContext.Current.Request["ProductType"].ToString(), makesTitle = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) ? Translate("chooseMakes","Choose your Manufacturer") : Translate("chooseModel","Choose your Model"), query = ""; @* Snippet Section *@ string productPageId = itemArea["ProductPage"] != null ? itemArea["ProductPage"].ToString() : ""; string prodTypes = System.Web.HttpContext.Current.Request["ProductType"] != null ? System.Web.HttpContext.Current.Request["ProductType"].ToString() : ""; string isMakeActives = (prodTypes.Equals("2") || String.IsNullOrEmpty(prodTypes)) && System.Web.HttpContext.Current.Request["loadseries"] == null ? "active" : "", isSeriesActive = isMakeActives.Equals("") && System.Web.HttpContext.Current.Request["searchSize"] == null && GetLoop("Childgroups").Where(x => x.GetBoolean("Ecom:Group.ShowInMenu")).ToList().Any() && !GetBoolean("Ecom:Group:Field.NoSubgroups") && String.IsNullOrEmpty(model) && String.IsNullOrEmpty(feature) ? "active" : "", isSizeActives = isSeriesActive.Equals("") && prodTypes.Equals("0") ? "active" : ""; if(System.Web.HttpContext.Current.Request["loadResults"] != null){ isSeriesActive = ""; isSizeActives = "active"; } string searchByMakesModelsLink = !prodType.Equals("2") ? String.Format("/Default.aspx?ID={0}&groupId={1}&ProductType=2",productPageId,groupID) : "javascript:void(0)"; string searchBySizesLink = !prodType.Equals("0") ? String.Format("/Default.aspx?ID={0}&groupId={1}&ProductType=0&searchSize=true",productPageId,groupID) : "javascript:void(0)"; if(!String.IsNullOrEmpty(groupID)) { Dynamicweb.eCommerce.Products.Group actualGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID(groupID); parentGroup = RenderParentEcomNav(actualGroup); } bool first = true; List<LoopItem> productsList = products.Where(x => x.GetString("Ecom:Product.Type") != "2").ToList(); List<LoopItem> productsListKits = products.Where(x => x.GetString("Ecom:Product.Type") == "2").ToList(); haveKits = productsListKits.Any(); int productCount = GetBoolean("Ecom:Group:Field.Multipack") ? productsListKits.Count : productsList.Count; int startValue = ((num_currPage - 1) * page_size) + 1; int toValue = page_size * num_currPage; int total = GetInteger("Ecom:ProductList.PageProdCnt");//(page_size * num_totalPages); if(productCount < page_size){ toValue = total; } string classDiv = "col-md-12"; /* Dynamicweb.eCommerce.Products.Group currentGroup = null; if(products.Any() && products.FirstOrDefault() != null) { Product firstProduct = Product.GetProductByID(products.First().GetString("Ecom:Product.ID")); currentGroup = Dynamicweb.eCommerce.Products.Group.GetGroupsByProduct(firstProduct).FirstOrDefault(); } */ foreach(var parameter in GetLoop("Query.Parameters")) { string parameterName = parameter.GetString("Parameter.Name"); string parameterValue = parameter.GetString("Parameter.Value"); if(!String.IsNullOrEmpty(parameterValue) && !parameterName.Equals("GroupID") && !parameterName.Equals("ParentID")) { query += "&" + parameterName + "=" + parameterValue; } } } @* Show models and sizes (products that are not kits) *@ @if (products != null && products.Any()) { if(GetBoolean("Ecom:Group:Field.Multipack") || (!haveKits && productsList.Any())){ classDiv = "col-md-10"; var lst_parameters = GetLoop("Query.Parameters"); string str_parentID = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["parentID"]) ? System.Web.HttpContext.Current.Request.Params["parentID"].ToString() : ""; string str_prodtype = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["ProductType"]) ? System.Web.HttpContext.Current.Request.Params["ProductType"].ToString() : ""; ArrayList composedFacets = new ArrayList(); composedLabels = new Dictionary<string, string>(); composedLabels.Add("equal", Translate("equalTo", "Equal to")); composedLabels.Add("lower", Translate("lessTo", "Less or Equal to")); composedLabels.Add("greater", Translate("greaterTo", "Greater or Equal to")); Dynamicweb.eCommerce.Products.Group currGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID(GetString("Ecom:Group.ID")); string parent = currGroup != null ? RenderParentEcomNav(currGroup) : ""; bool isMultipack = GetBoolean("Ecom:Group:Field.Multipack") && str_prodtype.Equals("2"); List<LoopItem> filteredFacetGroups = isMultipack ? facetGroups.Where(fg => fg.GetString("FacetGroup.Name").Equals("Multipack.facets")).ToList() : facetGroups.Where(fg => !fg.GetString("FacetGroup.Name").Equals("Multipack.facets")).ToList(); <div id="filtersContainer" class="col-xs-12 col-md-2 noPadding"> <div class="orange-heading"> <h2>@Translate("filterHeading", "Filter Your Results")</h2> </div> <form id="filtersForm" class="filtersBody"> <input type="hidden" name="loadResults" value="true"/> <!-- <input type="hidden" name="parentID" value="@str_parentID"/> --> <input type="hidden" name="ProductType" value="@str_prodtype"/> @foreach(LoopItem fg in filteredFacetGroups) { var facets = fg.GetLoop("Facets"); @* Do not show Makes/Models/Features in bearing and ball types tree *@ if(parent.Equals("L1BEARINGBALLTYPES")) { facets = facets.Where(x => x.GetString("Facet.Name") != "Makes" && x.GetString("Facet.Name") != "Models" && x.GetString("Facet.Name") != "Features").ToList(); } string groupName = fg.GetString("FacetGroup.Name"); var count = facets.Sum(x => x.GetInteger("Facet.OptionWithResultCount")); foreach (LoopItem i in facets) { bool facetAdded = false; var parameters = lst_parameters.Where(x => x.GetString("Parameter.Name") == i.GetString("Facet.QueryParameter")).FirstOrDefault(); string str_parameterType = parameters != null ? parameters.GetString("Parameter.Type") : ""; string str_templateOutput = "string"; if((i.GetString("Facet.QueryParameter") == "P_Id_equal" || i.GetString("Facet.QueryParameter") == "P_DimensionType" ) && !hasHighlightedFilters /*&& !isMultipack*/){ hasHighlightedFilters = true; @:<div class="highlightedFilters"> @RenderSnippet("DimensionType") } if(str_parameterType.Contains("[]")){ switch (i.GetString("Facet.Name")) { case "Applications": str_templateOutput = "selectApplications"; break; case "Bearing Types": str_templateOutput = "selectBearingTypes"; break; case "Models": str_templateOutput = "selectModel"; break; case "Features": str_templateOutput = "selectFeature"; break; case "fieldName": str_templateOutput = "multiselect"; break; case "fieldName2": str_templateOutput = "checkboxes"; break; default: str_templateOutput = "select"; break; } } else if(str_parameterType.Contains("Boolean")){ switch (i.GetString("Facet.Name")) { case "fieldName": str_templateOutput = "select"; break; case "fieldName2": str_templateOutput = "radio"; break; default: str_templateOutput = "checkbox"; break; } } else if(i.GetInteger("Facet.OptionWithResultCount") > 0) { string facetName = i.GetString("Facet.Name"); string facetField = i.GetString("Facet.Field"); string parameter = i.GetString("Facet.QueryParameter"); var options = i.GetLoop("FacetOptions").Where(x => x.GetString("FacetOption.Value") != "0").ToList(); if(facetName.Contains("Composed") && options.Any() ) { string[] facetSplit = facetName.Split('_'); string param = parameter.Substring(0,parameter.LastIndexOf("_")); string s = facetName.Substring(0,facetName.LastIndexOf("_")); var filtered = facets.Where(f => f.GetString("Facet.Field").Contains(facetField)).ToList(); if(!composedFacets.Contains(s)) { composedFacets.Add(s); facetAdded = true; } if (facetAdded && filtered.Any()) { @createOptions(filtered,param,facetSplit[1],options, i.GetString("Facet.Type").Equals("Term")) } <input type="hidden" name="@parameter" value="" disabled /> } else { switch (i.GetString("Facet.Name")) { case "fieldName3": str_templateOutput = "multiselect"; break; case "DimensionType": //str_templateOutput = "hidden"; str_templateOutput = "select"; break; default: str_templateOutput = "select"; break; } } } else if(i.GetString("Facet.Field").Contains("Weight_Options")) { string facetName = i.GetString("Facet.Name"); string facetField = i.GetString("Facet.Field"); string parameter = i.GetString("Facet.QueryParameter"); var options = i.GetLoop("FacetOptions"); if(facetName.Contains("Composed")) { string[] facetSplit = facetName.Split('_'); string param = parameter.Substring(0,parameter.LastIndexOf("_")); string s = facetName.Substring(0,facetName.LastIndexOf("_")); var filtered = facets.Where(f => f.GetString("Facet.Field").Contains(facetField)).ToList(); if(!composedFacets.Contains(s)) { composedFacets.Add(s); facetAdded = true; } if (facetAdded && filtered.Any()) { @createOptions(filtered,param,facetSplit[1],options, i.GetString("Facet.Type").Equals("Term")) } <input type="hidden" name="@parameter" value="" disabled /> } } else { switch (i.GetString("Facet.Name")) { case "fieldName": str_templateOutput = "autocomplete"; break; case "Stock": str_templateOutput = "stockCheck"; break; case "Fitments": str_templateOutput = "hidden"; break; default: str_templateOutput = "select"; break; } } if(!i.GetString("Facet.Name").Contains("Composed")) { @field(i, str_parameterType, str_templateOutput) } if(i.GetString("Facet.QueryParameter") == "P_Width_greater" && hasHighlightedFilters /*&& !isMultipack*/){ @:</div> } } } <a href="@HttpContext.Current.Request.RawUrl.Split('?')[0].ToString()" class="btn-blue generalButton applyFilter">@Translate("reset", "Reset")</a> </form> </div> @helper field(LoopItem i , string str_parameterType, string str_templateOutput ) { string str_parameter = i.GetString("Facet.QueryParameter"); string str_name = i.GetString("Facet.Name"); bool isTerm = i.GetString("Facet.Type").Equals("Term"); List<LoopItem> facetOptions = i.GetLoop("FacetOptions").Where(x => x.GetString("FacetOption.Value") != "0").ToList(); var isSingleFacetOption = facetOptions.Count == 1; var isDimensionType = i.GetString("Facet.Name") == "DimensionType"; switch (str_templateOutput) { case "stockCheck": bool isChecked = !String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["Stock"]) && System.Web.HttpContext.Current.Request["Stock"].ToString().Equals("0"); <fieldset class="col-xs-12 noPadding" data-type="@str_parameterType"> <legend class="h3 bold col-xs-8 noPadding">@Translate("inStock","In Stock Only"):</legend> <input checked="@isChecked" type="checkbox" id="inStock" value="-1" name="Stock"/> </fieldset> break; case "multiselect": if(facetOptions.Any()) { <fieldset class="col"> <legend class="h3 bold">@str_name.Replace("_"," "):</legend> <select data-size="8" name="@str_parameter" multiple> <option value="">@Translate("all","All")</option> @foreach(LoopItem option in facetOptions.OrderBy(o => o.GetInteger("FacetOption.Label"))) { bool bol_checked = option.GetBoolean("FacetOption.Selected"); string str_value = option.GetString("FacetOption.Value"); string str_nameOption = option.GetString("FacetOption.Name"); string str_label = isTerm ? str_value : option.GetString("FacetOption.Label"); <option selected="@bol_checked" value="@str_value">@str_label.Replace("_"," ")</option> } </select> </fieldset> } break; case "checkboxes": if(facetOptions.Any()) { <fieldset class="col-xs-12 noPadding" data-type="@str_parameterType"> <legend class="h3 bold">@str_name.Replace("_"," ") :</legend> <div class="filtersContainer hide"> @foreach(LoopItem option in facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label"))) { bool bol_checked = option.GetBoolean("FacetOption.Selected"); string str_value = option.GetString("FacetOption.Value"); string str_nameOption = option.GetString("FacetOption.Name"); string str_label = isTerm ? str_value : option.GetString("FacetOption.Label"); <label><input checked="@bol_checked" type="checkbox" value="@str_value" name="@str_parameter"> @str_label (@option.GetString("FacetOption.Count"))</label> } </div> </fieldset> } break; case "selectFeature": case "select": if(facetOptions.Any()) { if (isDimensionType) { @:@SnippetStart("DimensionType") } string facetOption = GetQueryParameter(str_parameter); <fieldset class="col-xs-12 noPadding"> <legend class="h3 bold">@str_name.Replace("_"," "):</legend> <select data-size="8" name="@str_parameter" @string.Format("{0}", isSingleFacetOption ? "class=\"singleFacetOption\"" : string.Empty)> <option value="">@Translate("all","All")</option> @foreach(LoopItem option in facetOptions.OrderByDescending(o => o.GetInteger("FacetOption.Label"))) { string str_value = option.GetString("FacetOption.Value"); string str_nameOption = option.GetString("FacetOption.Name"); string str_label = isTerm ? str_value : option.GetString("FacetOption.Label"); bool isSelected = str_value == facetOption; <option selected="@isSelected" value="@str_value">@str_label.Replace("_"," ")</option> } </select> </fieldset> if (isDimensionType) { @:@SnippetEnd("DimensionType") } } break; case "selectApplications": case "selectBearingTypes": string currApp = System.Web.HttpContext.Current.Request["ParentID"] != null ? System.Web.HttpContext.Current.Request["ParentID"].ToString() : ""; string defaultApp = ""; string defaultType = "L2-RADIALB"; if (str_name.ToLower().Contains("application")) { currApp = !String.IsNullOrEmpty(currApp) ? currApp : defaultApp; } else { currApp = !String.IsNullOrEmpty(currApp) ? currApp : defaultType; } if (facetOptions.Any()) { Dictionary<string, string> allGroups = GetAllApplications(String.Format("'{0}'", String.Join("','", facetOptions.Select(fo => fo.GetString("FacetOption.Value")).Distinct().ToArray()))); <fieldset class="col-xs-12 noPadding sameFilter"> <legend class="h3 bold">@str_name:</legend> <select data-size="8" name="@str_parameter" @string.Format("{0}", isSingleFacetOption ? "class=\"singleFacetOption\"" : string.Empty)> <option value="">All</option> @foreach (LoopItem option in facetOptions) { string appValue = option.GetString("FacetOption.Value").ToUpper(), appLabel = allGroups.ContainsKey(appValue) ? allGroups[appValue] : option.GetString("FacetOption.Name"); bool appIsChecked = currApp == appValue; <option selected="@appIsChecked" value="@appValue">@appLabel</option> } </select> </fieldset> } break; case "selectModel": string currentModel = ""; List<string> models = new List<string>(); if (!String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) && !String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ParentID"])) { string make = System.Web.HttpContext.Current.Request["ItemMakes"].ToString(); currentModel = (System.Web.HttpContext.Current.Request["ItemModels"] ?? "").ToString(); models = GetModels((System.Web.HttpContext.Current.Request["ParentID"] ?? "").ToString(), make.Replace("|", ",").Replace("_", " ").Replace("*", "'")); } var isSingleModelOption = models.Count == 1; <fieldset class="col-xs-12 noPadding"> <legend class="h3 bold">@str_name:</legend> <select data-size="8" name="@str_parameter" @string.Format("{0}", isSingleModelOption ? "class=\"singleFacetOption\"" : string.Empty)> <option value="">All</option> @foreach (string modelOption in models) { var isSelected = modelOption.Replace(",", "|").Replace(" ","_").Replace("'", "*").Equals(currentModel); <option selected="@isSelected" value="@(modelOption.Replace(",", "|").Replace(" ","_").Replace("'", "*"))">@modelOption</option> } </select> </fieldset> break; /*case "___selectFeature": <fieldset class="col-xs-12 noPadding"> <legend class="h3 bold">@str_name:</legend> <select data-size="8" name="@str_parameter"> <option value="">All</option> @if(!String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) && !String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ParentID"])) { string make = System.Web.HttpContext.Current.Request["ItemMakes"].ToString(); string model = (System.Web.HttpContext.Current.Request["ItemModels"] ?? "").ToString(); string currentFeature = (System.Web.HttpContext.Current.Request["ItemFeatures"] ?? "").ToString(); List<string> features = GetFeatures(make,model.Replace("|", ",").Replace("_"," ").Replace("*","'")); bool isSelected = false; foreach (string featureOption in features) { isSelected = featureOption.Replace(",", "|").Replace(" ","_").Equals(currentFeature); <option selected="@isSelected" value="@(featureOption.Replace(",", "|").Replace(" ","_"))">@featureOption</option> } } </select> </fieldset> break;*/ case "checkbox": if(facetOptions.Any()) { <fieldset data-type="@str_parameterType"> @foreach(LoopItem option in facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label"))) { bool bol_checked = option.GetBoolean("FacetOption.Selected"); string str_value = option.GetString("FacetOption.Value") == "True" ? "True" : ""; string str_nameOption = option.GetString("FacetOption.Name"); if(str_value == "True") { <legend class="h3 bold">@str_name.Replace("_"," "):</legend> <div class="filtersContainer hide"> <label><input checked="@bol_checked" type="checkbox" value="@str_value" name="@str_parameter"> @str_name (@option.GetString("FacetOption.Count"))</label> </div> } } </fieldset> } break; case "radio": break; case "radios": break; case "autocomplete": break; case "text": <fieldset class="col-xs-12 noPadding" data-name="@str_name"> <legend class="h3 bold">@str_name.Replace("_"," "):</legend> <input type="text" name="@str_parameter" /> </fieldset> break; case "textComposed": <fieldset class="col-xs-12 noPadding composedSet" data-name="@str_name"> <legend class="h3 bold">@str_name.Replace("_"," "):</legend> <input class="composed" type="text" name="@str_name" /> </fieldset> break; case "hidden": <fieldset class="col-xs-12 noPadding hidden" data-name="@str_name"> <legend class="h3 bold">@str_name:</legend> <input type="hidden" name="@str_parameter" id="@str_parameter" value="" /> </fieldset> break; default: <fieldset class="col-xs-12 noPadding" data-type="@str_parameterType"> <legend class="h3 bold">@str_name.Replace("_"," "):</legend> <div class="filtersContainer"> <input type="text" name="@str_parameter" value="" /> </div> </fieldset> break; } } @functions { System.Collections.Specialized.NameValueCollection allRequestParams = System.Web.HttpContext.Current.Request.Params; Dictionary<string, string> composedLabels; bool hasHighlightedFilters = false; public string GetQueryParameter(string queryParameter) { return (System.Web.HttpContext.Current.Request[queryParameter] ?? "").ToString(); } } @functions{ public Dictionary<string, string> GetAllApplications(string filterGroups) { Dictionary<string, string> groups = new Dictionary<string, string>(); DataSet allGroups = Dynamicweb.Database.CreateDataSet("SELECT GroupID, GroupName FROM EcomGroups WHERE GroupID IN (" + filterGroups + ")"); if (allGroups.Tables.Count > 0 && allGroups.Tables[0].Rows.Count > 0) { foreach (DataRow group in allGroups.Tables[0].Rows) { string groupID = (group["GroupID"] ?? "").ToString(), groupName = (group["GroupName"] ?? "").ToString(); if (!String.IsNullOrWhiteSpace(groupID) && !String.IsNullOrWhiteSpace(groupName) && !groups.ContainsKey(groupID)) groups.Add(groupID, groupName); } } return groups; } public List<string> GetModels(string parentGroupID, string make) { List<string> modelNames = new List<string>(); using (var s = Dynamicweb.Database.CreateConnection()) { var cmd = s.CreateCommand(); cmd.CommandText = "SELECT DISTINCT m_mf.Model FROM ItemType_Make_ModelAnd_Features m_mf INNER JOIN ItemType_Fitments f ON CHARINDEX(m_mf.id, f.Fits) > 0 and f.Product_ID IN (SELECT ProductID FROM EcomProducts WHERE ProductID IN (SELECT DISTINCT GroupProductRelationProductID from EcomGroupProductRelation WHERE GroupProductRelationGroupID IN (SELECT GroupRelationsGroupID FROM EcomGroupRelations WHERE GroupRelationsParentID=@application OR GroupRelationsParentID IN (SELECT GroupRelationsGroupID FROM EcomGroupRelations WHERE GroupRelationsParentID=@application)))) WHERE m_mf.Make=@make"; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "application", SqlDbType = System.Data.SqlDbType.NVarChar, Value = parentGroupID }); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "make", SqlDbType = System.Data.SqlDbType.NVarChar, Value = make }); var reader = cmd.ExecuteReader(); while(reader.Read()) { modelNames.Add(reader["Model"].ToString()); } s.Close(); } return modelNames; } /*public List<string> GetFeatures(string make, string model) { List<string> featureNames = new List<string>(); using (var s = Dynamicweb.Database.CreateConnection()) { var cmd = s.CreateCommand(); cmd.CommandText = "Select distinct(Feature) from ItemType_Make_ModelAnd_Features where Make=@make and Model=@model"; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "make", SqlDbType = System.Data.SqlDbType.NVarChar, Value = make }); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "model", SqlDbType = System.Data.SqlDbType.NVarChar, Value = model }); var reader = cmd.ExecuteReader(); while(reader.Read()) { featureNames.Add(reader["Feature"].ToString()); } s.Close(); } return featureNames; }*/ } @helper createOptions(List<LoopItem> facets, string name, string title, List<LoopItem> facetOptions, bool isTerm) { string currentFacetParam = "", selectedFilter = "", selectedOption = ""; foreach(string k in allRequestParams.AllKeys) { if(k.StartsWith(String.Format("{0}_", name))) { currentFacetParam = k; selectedFilter = k.Replace(String.Format("{0}_", name), ""); selectedOption = allRequestParams[k].ToString(); break; } } <fieldset class="col-xs-12 noPadding composedSet" data-name="@name"> <legend class="h3 bold">@title:</legend> @if (facetOptions != null && facetOptions.Any()) { string[] dimensionIDs = {"P_Id","P_Od","P_Width"}; bool isDimension = dimensionIDs.Any(d => d.Contains(name)); var optionsSorted = facetOptions.Where(x => x.GetString("FacetOption.Value") != "0").OrderBy(x => x.GetDouble("FacetOption.Value")); <select data-size="8" class="composed" @isDimension> <option value="">@Translate("all","All")</option> @foreach (LoopItem o in optionsSorted) { string optionValue = String.Format("{0}", isTerm ? o.GetString("FacetOption.Value") : o.GetString("FacetOption.Label")); <option selected="@(selectedOption == o.GetString("FacetOption.Value"))" value="@(o.GetString("FacetOption.Value"))"> @if(isDimension){ @:@FormatDimension(optionValue) } else { @:@optionValue } </option> } </select> } else { <input class="composed" type="text" value="@selectedOption" /> } <select data-size="8" class="composed pull-right"> @foreach (LoopItem option in facets.Where(x => x.GetString("FacetOption.Value") != "0")) { string optionFacetName = option.GetString("Facet.Name"); string optionFacetFilter = optionFacetName.Substring(optionFacetName.LastIndexOf('_') + 1,optionFacetName.Length - optionFacetName.LastIndexOf('_') - 1); string optionFacetFilterLabel = composedLabels.ContainsKey(optionFacetFilter.ToLower()) ? composedLabels[optionFacetFilter.ToLower()] : optionFacetFilter; <option selected="@(selectedFilter == optionFacetFilter)" value="@optionFacetFilter">@optionFacetFilterLabel</option> } </select> </fieldset> } @helper FormatDimension(string dimension){ if(!string.IsNullOrEmpty(dimension)){ string str_d = dimension.Contains(".") ? Double.Parse(dimension).ToString("#,##0.0000") : Double.Parse(dimension).ToString("#,##0"); @:@str_d } } @SnippetStart("jsOnLoad") @:onLoadFilters() @SnippetEnd("jsOnLoad") } if (!haveKits) { @* if (productsList.Any()) { Include("Includes/filters.cshtml") }*@ string isHidden = "", ids = "("; foreach (var t in productsList) { ids += "'" + t.GetString("Ecom:Product.ID") + "'" + ","; } ids = ids.Remove(ids.Length - 1, 1) + ")"; @* Show the three types of dimension type available *@ <div class="@isHidden @classDiv noPadding products" data-kits="@haveKits"> <div class="col-xs-12 noPaddingRight"> @if(productsList.Any()) { List<LoopItem> inchProducts = productsList.Where(x => x.GetString("Ecom:Product:Field.DimensionType").Equals("Inch")).ToList(), metricProducts = productsList.Where(x => x.GetString("Ecom:Product:Field.DimensionType").Equals("Metric")).ToList(), noTypeProducts = productsList.Where(x => !x.GetString("Ecom:Product:Field.DimensionType").Equals("Metric") && !x.GetString("Ecom:Product:Field.DimensionType").Equals("Inch")).ToList(), noDimensionProducts = productsList.Where(x => x.GetString("Ecom:Product:Field.Dimensions.Value").Equals("")).ToList(); if(noDimensionProducts.Count() == productsList.Count()) { <div class="blueBackgroundStripes col-xs-12"> <h2 class="col-xs-3 noPaddingLeft">@String.Format("{0} to {1} of {2}", startValue, toValue, total)</h2> @RenderPagination() </div> @CreateTable(noDimensionProducts, make, ids, false,first,"",true) <div class="blueBackgroundStripes col-xs-12"> @RenderPagination() </div> } else { <div class="blueBackgroundStripes col-xs-12"> <h2 class="col-xs-3 noPaddingLeft">@String.Format("{0} to {1} of {2}", startValue , toValue , total)</h2> @RenderPagination() </div> if(inchProducts.Any()) { @CreateTable(inchProducts, make, ids,false,first,Translate("inch","Inch"),false) first = false; } if(metricProducts.Any()) { @CreateTable(metricProducts, make, ids,true,first,Translate("metric","Metric"),false) } if(noTypeProducts.Any()) { @CreateTable(noTypeProducts, make, ids,false,first,"",false) } <div class="blueBackgroundStripes col-xs-12"> @RenderPagination() </div> } } </div> </div> } else { List<LoopItem> facetOptions = getFacetOptions("ItemMakes"); if(String.IsNullOrEmpty(make) && facetOptions != null && facetOptions.Any()) { <div class="col-xs-12 noPadding" id="makes"> <h2 id="productListTitle">@makesTitle</h2> @RenderMakes(facetOptions,null,false) </div> } else if(!String.IsNullOrEmpty(make) && String.IsNullOrEmpty(model) && String.IsNullOrEmpty(feature)) { <h2 id="productListTitle">@makesTitle</h2> @RenderMakesOptions(products,make, groupID) } else { <div id="results-list" class="@classDiv"> @if(GetBoolean("Ecom:Group:Field.Multipack")){ <div class="blueBackgroundStripes col-xs-12"> <h2 class="col-xs-3 noPaddingLeft">@String.Format("{0} to {1} of {2}", startValue , toValue , total)</h2> @RenderPagination() </div> } <div class="col-xs-12 noPaddingRight"> @RenderProductsListView(products) </div> @if(GetBoolean("Ecom:Group:Field.Multipack")){ <div class="blueBackgroundStripes col-xs-12"> <h2 class="col-xs-3 noPaddingLeft">@String.Format("{0} to {1} of {2}", startValue , toValue , total)</h2> @RenderPagination() </div> } </div> } } } else { <h2>No Products Available</h2> } @helper RenderMakesOptions(List<LoopItem> products,string make, string groupID) { //DataSet productsDataSet = Dynamicweb.Database.CreateDataSet(String.Format("SELECT ProductID FROM EcomProducts WHERE ProductType = '{0}' AND ProductID IN(SELECT DISTINCT GroupProductRelationProductID from EcomGroupProductRelation WHERE GroupProductRelationGroupID IN (SELECT GroupRelationsGroupID FROM EcomGroupRelations WHERE GroupRelationsParentID = '{1}' OR GroupRelationsParentID IN(SELECT GroupRelationsGroupID FROM EcomGroupRelations WHERE GroupRelationsParentID = '{1}')))", (System.Web.HttpContext.Current.Request["ProductType"] ?? "").ToString(), groupID)); DataSet productsDataSet = Dynamicweb.Database.CreateDataSet(String.Format("SELECT ProductID FROM EcomProducts WHERE ProductType = '{0}' AND ProductID IN(SELECT DISTINCT GroupProductRelationProductID from EcomGroupProductRelation WHERE GroupProductRelationGroupID IN (SELECT GroupRelationsGroupID FROM EcomGroupRelations WHERE GroupRelationsGroupID = '{1}' OR GroupRelationsParentID = '{1}' OR GroupRelationsParentID IN(SELECT GroupRelationsGroupID FROM EcomGroupRelations WHERE GroupRelationsParentID = '{1}')))", (System.Web.HttpContext.Current.Request["ProductType"] ?? "").ToString(), groupID)); string prodIds = ""; if (productsDataSet.Tables.Count > 0) { foreach (DataRow r in productsDataSet.Tables[0].Rows) { prodIds += String.Format("'{0}',", r["ProductID"].ToString()); } prodIds = "(" + prodIds.Remove(prodIds.Length - 1, 1) + ")"; } @CreateTable(products, make, prodIds, false,false,"",false) } @helper CreateTable(List<LoopItem> products, string makes,string ids,bool isMetric,bool isFirst,string title,bool hideDimension) { var page = Pageview.Area.Item; System.Data.DataSet result = null; if(!String.IsNullOrEmpty(makes) && !String.IsNullOrEmpty(ids)) { string getModelsAndFeatures = String.Format("SELECT DISTINCT m_mf.Model, m_mf.Feature, f.Product_ID FROM ItemType_Make_ModelAnd_Features m_mf inner join ItemType_Fitments f on CHARINDEX(m_mf.id, f.Fits) > 0 and f.Product_ID IN {0} where m_mf.Make = '{1}'",ids,makes.Replace("_"," ").Replace(",","|").Replace("*","''")); result = Dynamicweb.Database.CreateDataSet(getModelsAndFeatures); } var str_myMiniCart = (Pageview.Area.Item["MiniCart"] ?? "").ToString(); string classDiv = !String.IsNullOrEmpty(makes) ? "noPadding" : "noPadding noPaddingRight", urlBrowse = page["BrowseAll"].ToString(), parentID = (System.Web.HttpContext.Current.Request["parentID"] ?? "").ToString(), parameter = !String.IsNullOrEmpty(parentID) ? "parentID=" + parentID : "GroupID=" + GetString("Ecom:Group.ID"), prodTypeParameter = (System.Web.HttpContext.Current.Request["ProductType"] ?? "").ToString(), currentPage = "/Default.aspx?ID=" + Pageview.Page.ID + "&amp;" + parameter + String.Format("{0}", !String.IsNullOrWhiteSpace(prodTypeParameter) ? String.Format("&amp;ProductType={0}", prodTypeParameter) : ""), sortby = (System.Web.HttpContext.Current.Request["sortby"] ?? "").ToString(), sortorder = (System.Web.HttpContext.Current.Request["sortorder"] ?? "").ToString(), sortByDimension = String.Format("{0}&amp;sortby=CustomField_Id&sortorder={1}", currentPage, sortby == "CustomField_Id" && sortorder == "desc" ? "asc" : "desc"), sortByPart = String.Format("{0}&amp;sortby=Name&sortorder={1}", currentPage, sortby == "Name" && sortorder == "desc" ? "asc" : "desc"), sortByPrice = String.Format("{0}&amp;sortby=Price&sortorder={1}", currentPage, sortby == "Price" && sortorder == "desc" ? "asc" : "desc"), inquirePage = (page["InquireAboutAvailability"] ?? "").ToString(), groupID = GetString("Ecom:Group.ID"), browseMetric = String.Format("{0}&parentID={1}&DimensionType=metric",urlBrowse,groupID), browseInch = String.Format("{0}&parentID={1}&DimensionType=inch",urlBrowse,groupID), prodTitle = !String.IsNullOrEmpty(makes) ? Translate("modelFeature","Model / Feature"): Translate("part#", "Part #"), nameColumnWidth = hideDimension ? "7" : "4"; //Dynamicweb.eCommerce.Products.Group currentGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID(groupID); <div class="col-xs-12 noPadding newType"> <div class="col-xs-12 @classDiv"> @if(!haveKits){ <div id="productListTable"> @*@if(isFirst) { isFirst = false; <div> <div class="row"> @foreach(LoopItem i in GetLoop("FacetGroups").Where(fc => fc.GetString("FacetGroup.Name") == "All.facets")) { // todo review this!!! foreach(LoopItem f in i.GetLoop("Facets").Where(fn => fn.GetString("Facet.Name") == "DimensionType")) { List<LoopItem> facetOptions = f.GetLoop("FacetOptions"); int facetOptionsCount = f.GetLoop("FacetOptions").Count; if(facetOptionsCount > 0) { <div class="col-xs-12"> @if(facetOptionsCount > 1) { <div id="dimensionTypeRadio"> <label><input type="radio" name="DimensionType" value="" checked>All</label> @foreach(LoopItem fo in facetOptions) { string foValue = fo.GetString("FacetOption.Value"); bool foSelected = fo.GetBoolean("FacetOption.Selected"); <label><input type="radio" name="DimensionType" id="DimensionType" value="@foValue" checked="@foSelected">@foValue.ToUpper()</label> } </div> } </div> } break; } } </div> </div> }*@ <p>@title</p> <div class="table-list-header"> <div class="row hidden-xs"> @if(!hideDimension) { <div class="col-xs-12 col-sm-3 noPaddingRight">@Translate("dimension", "Dimension") <a href="@sortByDimension"><i class="fa fa-sort"></i></a></div> } <div class="col-xs-12 col-sm-@(nameColumnWidth)">@prodTitle <a href="@sortByPart"><i class="fa fa-sort"></i></a></div> <div class="col-xs-12 col-sm-1 text-right noPadding">@Translate("price", "Price") <a href="@sortByPrice"><i class="fa fa-sort"></i></a></div> <div class="col-xs-12 col-sm-4 ">&nbsp;</div> </div> </div> </div> } <ul id="productsHolder" class="productList col-xs-12 list-view noPadding"> @if(String.IsNullOrEmpty(makes)) { foreach (var product in products) { string variant_ID = product.GetString("Ecom:Product.VariantID"), str_productName = product.GetString("Ecom:Product.Name"), str_productID = product.GetString("Ecom:Product.ID"), str_productLink = product.GetString("Ecom:Product.Link.Clean"), str_productDimensions = product.GetString("Ecom:Product:Field.Dimensions.Value").Replace("Metric","").Replace("Inch","").Replace("es","").Replace("Millimeters",""), str_productInnerDimension = product.GetString("Ecom:Product:Field.ID.Value"), str_productOuterDimension = product.GetString("Ecom:Product:Field.OD.Value"), str_productWidth = product.GetString("Ecom:Product:Field.Width.Value"), price = product.GetString("Ecom:Product.Price"), addToCartUrl = "/Default.aspx?productid=" + str_productID + "&amp;cartcmd=add"; str_productDimensions = RenderDimensions(str_productDimensions).ToString(); @RenderProductRow(str_productDimensions,str_productName,price,product.GetInteger("Ecom:Product.Stock"), str_myMiniCart,str_productID,str_productLink,variant_ID,inquirePage,groupID,parentID,hideDimension) } } else { if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) { Dictionary<string,string> relation = new Dictionary<string,string>(); foreach (DataRow info in result.Tables[0].Rows) { string prodID = info["Product_Id"].ToString(), str_productName = info["Model"].ToString() + "|" + info["Feature"].ToString(); if (!relation.ContainsKey(str_productName)) { relation.Add(str_productName,str_productName); } var product = products.Where( x => x.GetString("Ecom:Product.ID").Equals(prodID)).FirstOrDefault(); if(product == null){ continue; } string str_productDimensions = product.GetString("Ecom:Product:Field.Dimensions.Value").Replace("Metric","").Replace("Inch","").Replace("es","").Replace("Millimeters",""), variant_ID = product.GetString("Ecom:Product.VariantID"), str_productLink = product.GetString("Ecom:Product.Link.Clean"), price = product.GetString("Ecom:Product.Price"), addToCartUrl = "/Default.aspx?productid=" + prodID + "&amp;cartcmd=add"; str_productDimensions = RenderDimensions(str_productDimensions).ToString(); if(!haveKits) { @RenderProductRow(str_productDimensions,str_productName,price,product.GetInteger("Ecom:Product.Stock"), currentPage,prodID,str_productLink,variant_ID,inquirePage,groupID,parentID,hideDimension) } } @RenderMakes(null,relation,false) } } </ul> </div> </div> } @helper RenderProductRow(string dimension, string name,string price,int stock, string str_myMiniCart, string productId,string prodLink, string variant,string inquirePage,string groupID,string parentID, bool hideDimension) { string addToCartClass = stock > 0 ? "" : "noStockAvailable"; string nameColumnWidth = hideDimension ? "7" : "4"; <li class="row"> @if(!hideDimension) { <div class="col-xs-11 col-sm-3"> <div class="dimensions">@dimension</div> </div> } <div class="col-xs-12 col-sm-@(nameColumnWidth)"> <h2><a href="@prodLink">@name</a></h2> </div> <div class="col-xs-12 col-sm-1 noPadding"> <div class="pull-right" itemprop="price">@price</div> </div> <div class="col-xs-12 col-sm-4 addForm"> <div class="pull-right @addToCartClass"> @if(stock > 0){ <form name="addToCart" class="add-to-cart form-fields" action="/@str_myMiniCart" method="post"> <input type="hidden" name="cartcmd" value="add" /> <input type="hidden" name="redirect" value="false" /> <input type="hidden" name="productID" value="@productId" /> <input type="hidden" name="variantID" id="variantID" value="@variant" @((String.IsNullOrEmpty(variant)) ? "disabled='disabled'" : "") /> <span class="qty-label">Qty</span> <input class="quantity" name="Quantity" type="number" value="1" maxlength="4" min="1" /> <a class='btn-blue generalButton btn-action pull-right addToCartSubmit'> @Translate("addToCart", "Add to Cart") <i class="fa fa-shopping-cart"></i> </a> </form> } else { <a class="btn-softBlue pull-right inquireAboutAvailability" href="/Default.aspx?ID=@inquirePage&prodID=@productId">@Translate("Inquire") <i class="fa fa-comment fa-2x"></i></a> } </div> </div> </li> } @SnippetStart("jsOnLoad") onLoadGenericProductList(); @SnippetEnd("jsOnLoad") @helper RenderPagination() { if(GetInteger("Ecom:ProductList.TotalPages") > 1) { string prevPage = GetString("Ecom:ProductList.PrevPage.Clean"), str_nextPage = GetString("Ecom:ProductList.NextPage.Clean"), prevClass = String.IsNullOrEmpty(str_nextPage) ? "pull-right" : ""; prevPage += !String.IsNullOrEmpty(prevPage) && !prevPage.Contains("searchSize=") ? "&amp;searchSize=true" : ""; str_nextPage += !String.IsNullOrEmpty(str_nextPage) && !str_nextPage.Contains("searchSize=") ? "&amp;searchSize=true" : ""; <ul class="pull-right col-sm-4 col-xs-9 paging"> @if(!String.IsNullOrEmpty(prevPage)) { <li class="col-xs-6 col-sm-6 col-sm-offset-2 col-md-offset-0 noPadding @prevClass"> <a href="@prevPage"><< @Translate("Previous","Previous")</a> </li> } @if(!String.IsNullOrEmpty(str_nextPage)) { <li class="col-xs-6 col-sm-3 noPadding pull-right"> <a href="@str_nextPage">@Translate("Next","Next") >></a> </li> } </ul> } } @SnippetStart("ProductType") @if(facetGroups != null && facetGroups.Any()){ bool isMakesAvailable = false; bool isSizesAvailable = false; var prodTypeFacet = facetGroups.FirstOrDefault().GetLoop("Facets").Where(f => f.GetString("Facet.Name").Equals("ProductType")).FirstOrDefault(); if(prodTypeFacet != null){ var prodTypeFacetOptions = prodTypeFacet.GetLoop("FacetOptions"); isMakesAvailable = prodTypeFacetOptions.Any(x => x.GetString("FacetOption.Value").Equals("2")); isSizesAvailable = prodTypeFacetOptions.Any(x => x.GetString("FacetOption.Value").Equals("0")); if(prodTypeFacetOptions.Any()) { bool isMultipack = GetBoolean("Ecom:Group:Field.Multipack"); string modelText = isMultipack ? Translate("searchMultipacks", "Search by Multipacks") : Translate("searchMakesModels", "Search by Manufacturer/Model"); string sizeText = isMultipack ? Translate("searchSingleBearings", "Single Bearings") : Translate("searchSize", "Search by Size"); if(isMakesAvailable){ <li data-id="makesSearch" class="makesSearch @isMakeActives"><a href="@searchByMakesModelsLink">@modelText</a></li> } if(isSizesAvailable){ <li data-id="sizeSearch" class="sizeSearch @isSizeActives"><a href="@searchBySizesLink">@sizeText</a></li> } } } if(String.IsNullOrEmpty(prodTypes) && !groupID.Contains("L1")) { string str_redirect = isMakesAvailable ? HttpContext.Current.Request.Url.AbsoluteUri + "&ProductType=2" : HttpContext.Current.Request.Url.AbsoluteUri + "&ProductType=0"; System.Web.HttpContext.Current.Response.Redirect(str_redirect); } } @SnippetEnd("ProductType") @using System @helper RenderProductsListView(List<LoopItem> productsListView) { string str_imagesFolder = "/Files/Files/BocaBearing/Products/images/"; <ul id="productsHolder" class="productList list-view"> @foreach (LoopItem product in productsListView){ string str_imagePattern = str_imagesFolder + product.GetString("Ecom:Product.Number") + ".jpg"; //string str_imagePattern = str_imagesFolder + product.GetString("Ecom:Product.Number") + ".jpg"; string str_image = !string.IsNullOrEmpty(product.GetString("Ecom:Product.ImageSmall.Default.Clean")) ? product.GetString("Ecom:Product.ImageSmall.Default.Clean") : !string.IsNullOrEmpty(product.GetString("Ecom:Product.ImageMedium.Default.Clean")) ? product.GetString("Ecom:Product.ImageMedium.Default.Clean") : !string.IsNullOrEmpty(product.GetString("Ecom:Product.ImageLarge.Default.Clean")) ? product.GetString("Ecom:Product.ImageLarge.Default.Clean") : str_imagePattern; str_image = str_image.Replace("/Files/files/files/", "/Files/files/"); string groupId = product.GetString("Ecom:Product.PrimaryGroupID"); string str_productName = product.GetString("Ecom:Product.Name"); string str_productID = product.GetString("Ecom:Product.ID"); string str_productVariantID = product.GetString("Ecom:Product.VariantID"); string str_link = ""; bool bol_userLogged = Pageview.User.LoggedIn; string itemMakes = (System.Web.HttpContext.Current.Request["ItemMakes"] ?? "").ToString(), ItemModels = (System.Web.HttpContext.Current.Request["ItemModels"] ?? "").ToString(), ItemFeatures = (System.Web.HttpContext.Current.Request["ItemFeatures"] ?? "").ToString(); string dimensions = product.GetString("Ecom:Product:Field.Dimensions.Value"); str_link = "/Default.aspx?ID=" + Pageview.Area.Item["ProductPage"].ToString() + "&amp;productid=" + str_productID; str_link += !String.IsNullOrWhiteSpace(itemMakes) ? String.Format("&amp;make={0}", itemMakes.Replace("_", " ")) : ""; str_link += !String.IsNullOrWhiteSpace(ItemModels) ? String.Format("&amp;model={0}", ItemModels.Replace("_", " ")) : ""; str_link += !String.IsNullOrWhiteSpace(ItemFeatures) ? String.Format("&amp;feature={0}", ItemFeatures.Replace("_", " ")) : ""; @*if (!string.IsNullOrEmpty(product.GetString("Ecom:Product.PrimaryOrFirstGroupID"))) { Dynamicweb.eCommerce.Products.Group obj_primaryGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID(product.GetString("Ecom:Product.PrimaryOrFirstGroupID")); string str_groupPage = obj_primaryGroup.Meta.PrimaryPage.ToString(); if (!string.IsNullOrEmpty(str_groupPage)) { str_link = "/" + str_groupPage; } else { str_link = "/Default.aspx?ID=" + GetGlobalValue("Global:Page.ID"); } str_link += "&amp;groupid="+product.GetString("Ecom:Product.PrimaryOrFirstGroupID")+"&amp;productid="+str_productID+ "&amp;make=brand&model=XPTO&feature=wheel"; } else { str_link = product.GetString("Ecom:Product.LinkGroup.Clean"); }*@ <li class="row"> <h2 class="product-long-name col-xs-12"><a itemprop="name" href="@str_link">@product.GetString("Ecom:Product.Name")</a></h2> <div class="col-xs-11 col-sm-2"> <figure class="text-center"> <a href="@str_link"> <img src="@GetImage(str_image, 0, 116, 0, 0, 0, 0, "jpg")" alt="@str_productName" title="@str_productName" class="img-responsive" /> </a> </figure> </div> <div class="col-xs-12 col-sm-4 noPaddingLeft productInfo"> <p> <strong>@Translate("sku","SKU"):</strong> @str_productName </p> @if(!String.IsNullOrEmpty(dimensions)) { double inner = product.GetDouble("Ecom:Product:Field.ID.Value.Raw"); double outer = product.GetDouble("Ecom:Product:Field.OD.Value.Raw"); double width = product.GetDouble("Ecom:Product:Field.Width.Value.Raw"); string dimension = product.GetString("Ecom:Product:Field.Dimensions.Value").Replace("Metric","").Replace("Inch","").Replace("es","").Replace("Millimeters",""); <p>@Translate("dimension", "Dimension"): @RenderDimensions(dimension)</p> @*<p>@String.Format("ID {0} x OD {1} x Width {2}",inner,outer,width)</p>*@ } <p> @if (str_productName.StartsWith("#")){ <div class="module line-clamp">@product.GetString("Ecom:Product.LongDescription")</div> } <a class="more-info" href="@str_link">@Translate("moreInfo","More Info")</a> </p> </div> @RenderPriceContainer(product,Pageview.Area.Item) @CheckStock(Pageview.Area.Item,str_productID,str_productVariantID,product) </li> <hr/> } </ul> }