RC Engine Bearings

RC Engine Bearings | SUPER TIGRE

RC Engine Bearings | SUPER TIGRE

The Boca Bearing Company have been an industry leader in RC Engine bearing replacement since 1987. Reducing rolling resistance and conserving energy has been our hallmark. We offer a full line of standard & ceramic hybrid bearings specifically designed for today's demanding RC Engines. 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 RC Engine manufacturer and model. Just click on Search By RC Engine Brand or use the Brand Search at the top of any page.



  • Search by Bearing Series
Error compiling template "Designs/BocaBearings/eCom/Productlist/genericProductList.cshtml"
Line 259: ; expected

1 @using System.Collections; 2 @using System.Data; 3 @using Dynamicweb.eCommerce.Products; 4 @using System.IO; 5 @using System.Web; 6 @using System.Text; 7 @using System.Text.RegularExpressions; 8 9 @functions { 10 public List<LoopItem> getFacetOptions(string facetName) { 11 List<LoopItem> facetOptions = null; 12 foreach(var t in GetLoop("FacetGroups")) { 13 var fct = t.GetLoop("Facets").FirstOrDefault(f => f.GetString("Facet.Field") == facetName); 14 if(fct != null) { 15 facetOptions = fct.GetLoop("FacetOptions"); 16 break; 17 } 18 } 19 return facetOptions; 20 } 21 22 public static string GetFirstUserGroupID(object[] userGroups, List<string> productPricesGroups) 23 { 24 string userFirstGroup = ""; 25 foreach (var userGroup in userGroups) 26 { 27 if (productPricesGroups.Contains(userGroup.ToString())) 28 { 29 userFirstGroup = userGroup.ToString(); 30 break; 31 } 32 } 33 return userFirstGroup; 34 } 35 36 public string RenderParentEcomNav(Dynamicweb.eCommerce.Products.Group group) 37 { 38 if (group.ParentGroupsDefaultLanguage != null && group.ParentGroupsDefaultLanguage.Count > 0) 39 { 40 string parent_id = group.ParentGroupsDefaultLanguage[0].ID; 41 Dynamicweb.eCommerce.Products.Group parent = Dynamicweb.eCommerce.Products.Group.GetGroupByID(parent_id); 42 if (parent != null) 43 { 44 return RenderParentEcomNav(parent); 45 } 46 } 47 return group.ID; 48 } 49 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) 50 { 51 Dynamicweb.Frontend.PageView obj_currentPageview = Dynamicweb.Frontend.PageView.Current(); 52 string str_currDevice = obj_currentPageview.Device.ToString(); 53 string str_alternativeImage = obj_currentPageview.Area.Item["NoImage"] != null ? obj_currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/BocaBearings/images/alternativeImage.jpg"; 54 55 string str_width = ""; 56 string str_height = ""; 57 int num_getImageWidth = num_width != 0 ? num_width : 0; 58 int num_getImageHeight = num_height != 0 ? num_height : 0; 59 string str_getImageFormat = str_format != "" ? "&amp;Format=" + str_format : ""; 60 string str_getImageCompression = num_compression != 0 ? "&amp;Compression=" + num_compression : ""; 61 62 if (str_currDevice == Dynamicweb.Frontend.PageView.DeviceType.Tablet.ToString()) 63 { 64 num_getImageWidth = num_widthTablet != 0 ? num_widthTablet : num_getImageWidth; 65 num_getImageHeight = num_heightTablet != 0 ? num_heightTablet : num_getImageHeight; 66 } 67 else if (str_currDevice == Dynamicweb.Frontend.PageView.DeviceType.Mobile.ToString()) 68 { 69 num_getImageWidth = num_widthMobile != 0 ? num_widthMobile : num_getImageWidth; 70 num_getImageHeight = num_heightMobile != 0 ? num_heightMobile : num_getImageHeight; 71 } 72 73 if (num_getImageWidth != 0) 74 { 75 str_width = "&amp;Width=" + num_getImageWidth; 76 } 77 if (num_getImageHeight != 0) 78 { 79 str_height = "&amp;Height=" + num_getImageHeight; 80 } 81 82 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; 83 return str_output; 84 } 85 86 static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; 87 88 static string SizeSuffix(Int64 value) 89 { 90 if (value < 0) { return "-" + SizeSuffix(-value); } 91 92 int i = 0; 93 decimal dValue = (decimal)value; 94 while (Math.Round(dValue / 1024) >= 1) 95 { 96 dValue /= 1024; 97 i++; 98 } 99 100 return string.Format("{0:n1} {1}", dValue, SizeSuffixes[i]); 101 } 102 103 public static string GetFriendlyUrl(int num_pageId) 104 { 105 var output = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(num_pageId); 106 return output; 107 } 108 109 public static object GetParagraph(int num_paragraphId) 110 { 111 var output = Dynamicweb.Content.Paragraph.GetParagraphById(num_paragraphId); 112 return output; 113 } 114 115 public static string StripHtml(string source) 116 { 117 return Regex.Replace(source, "<.*?>", string.Empty); 118 } 119 120 public static string GetRequest(string str_param = "") 121 { 122 string str_output = System.Web.HttpContext.Current.Request.QueryString[str_param]; 123 return str_output; 124 } 125 126 public static string GetParam(string str_param = "") 127 { 128 string str_output = System.Web.HttpContext.Current.Request.Params[str_param]; 129 return str_output; 130 } 131 132 public static void AddCookie(string str_name = "", string str_value = "") 133 { 134 var obj_cookie = new System.Web.HttpCookie(str_name); 135 obj_cookie.Value = str_value; 136 System.Web.HttpContext.Current.Response.Cookies.Add(obj_cookie); 137 } 138 139 public static void RemoveCookie(string str_name = "") 140 { 141 var obj_cookie = new System.Web.HttpCookie(str_name); 142 obj_cookie.Expires = DateTime.Now.AddDays(-1d); 143 System.Web.HttpContext.Current.Response.Cookies.Add(obj_cookie); 144 } 145 146 public static string GetCookie(string str_name = "") 147 { 148 string str_output = ""; 149 if(System.Web.HttpContext.Current.Request.Cookies[str_name] != null ){ 150 str_output = System.Web.HttpContext.Current.Request.Cookies[str_name].Value; 151 } 152 return str_output; 153 } 154 155 public static bool ExistCookie(string str_name = "") 156 { 157 bool bol_output = false; 158 if(System.Web.HttpContext.Current.Request.Cookies[str_name] != null ){ 159 bol_output = true; 160 } 161 return bol_output; 162 } 163 164 public static void Redirect(string str_url = "") 165 { 166 System.Web.HttpContext.Current.Response.Redirect(Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(str_url)); 167 } 168 /*example: Redirect("/Default.aspx?ID=12")*/ 169 170 public static IHtmlString EncodeJS(string input) 171 { 172 StringBuilder builder = new StringBuilder(); 173 // Open the double quotes 174 builder.Append("\""); 175 // Then add each character properly escaping them 176 foreach (char c in input) 177 { 178 switch (c) 179 { 180 //First check whether it's one of the defined escape sequences 181 case '\'': //single quote 182 builder.Append("\\\'"); 183 break; 184 case '\"': //double quote 185 builder.Append("\\\""); 186 break; 187 case '\\': //backslash 188 builder.Append("\\\\"); 189 break; 190 case '\0': //Unicode character 0 191 builder.Append("\\0"); 192 break; 193 case '\a': //Alert (character 7) 194 builder.Append("\\a"); 195 break; 196 case '\b': //Backspace (character 8) 197 builder.Append("\\b"); 198 break; 199 case '\f': //Form feed (character 12) 200 builder.Append("\\f"); 201 break; 202 case '\n': //New line (character 10) 203 builder.Append("\\n"); 204 break; 205 case '\r': //Carriage return (character 13) 206 builder.Append("\\r"); 207 break; 208 case '\t': //Horizontal tab (character 9) 209 builder.Append("\\t"); 210 break; 211 case '\v': //Vertical quote (character 11) 212 builder.Append("\\v"); 213 break; 214 default: 215 // If it's none of the defined escape sequences, convert the character to an int and check the code 216 int i = (int)c; 217 if (i >= 32 && i <= 127) 218 { 219 // if it's a displayable ASCII character, just write the character 220 builder.Append(c); 221 } 222 else 223 { 224 // otherwise write the Unicode escape sequence for the character with hex value 225 builder.AppendFormat("\\u{0:X04}", i); 226 } 227 break; 228 } 229 } 230 // Close the double quotes 231 builder.Append("\""); 232 // You have to return an IHtmlString otherwise an HTML escape will be performed e.g. < will be replaced by &lt; 233 return new HtmlString(builder.ToString()); 234 } 235 236 } 237 @helper RenderDimensions(string dimension) 238 { 239 if(!string.IsNullOrEmpty(dimension)){ 240 string dimensionClean = dimension; 241 string[] cleanUpDictionary = {"Metric","Inch","es","Millimeters"," "}; 242 243 foreach(string dictionary in cleanUpDictionary){ 244 dimensionClean = dimensionClean.Replace(dictionary,""); 245 } 246 dimensionClean = dimensionClean.ToLower(); 247 string[] dimensions = (dimensionClean ?? "").Split(new [] { 'x' },StringSplitOptions.RemoveEmptyEntries); 248 if(dimensions.Any()){ 249 dimensionClean =""; 250 foreach(string d in dimensions){ 251 var dimensionDouble = Double.Parse(d); 252 var hasDecimals = (int)dimensionDouble != dimensionDouble; 253 string str_d = hasDecimals ? dimensionDouble.ToString("#,##0.0000") : dimensionDouble.ToString("#,##0"); 254 dimensionClean = dimensionClean + " x " + str_d ; 255 } 256 dimensionClean = dimensionClean.Substring(3); 257 } 258 @*dimensionClean*@ 259 dimension 260 } 261 } 262 @helper RenderMakes(List<LoopItem> makes,Dictionary<string, string> products,bool isBrowseAll) 263 { 264 string currentUrl = System.Web.HttpContext.Current.Request.Url.AbsolutePath; 265 266 foreach (string qp in System.Web.HttpContext.Current.Request.QueryString.AllKeys) 267 { 268 if(!qp.Equals("ItemMakes") && !qp.Equals("ItemModels") && !qp.Equals("ItemFeatures")) 269 { 270 currentUrl += String.Format("{0}{1}={2}", currentUrl.Contains("?") ? "&" : "?", qp, System.Web.HttpContext.Current.Request.QueryString[qp]); 271 } 272 } 273 274 Dictionary<string, List<LoopItem>> groupedDictionary = null; 275 276 if(makes != null) { 277 groupedDictionary = makes.GroupBy(g => g.GetString("FacetOption.Value").Substring(0, 1)).ToDictionary(g => g.Key, g => g.ToList()); 278 } 279 else { 280 List<LoopItem> dummyList = new List<LoopItem>(); 281 groupedDictionary = new Dictionary<string, List<LoopItem>>(); 282 foreach(string s in products.Keys){ 283 string key = s.Substring(0, 1); 284 285 if(!groupedDictionary.ContainsKey(key)){ 286 groupedDictionary.Add(key, dummyList); 287 } 288 } 289 } 290 291 if(makes != null && makes.Any() || products != null && products.Any()) { 292 List<string> specialChars = new List<string>(new string[] { "#", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }); 293 string specialCharsClass = "inactive"; 294 foreach (string item in groupedDictionary.Keys) 295 { 296 if (specialChars.Contains(item)) 297 { 298 specialCharsClass = "active"; 299 break; 300 } 301 } 302 <div class="row"> 303 <div class="col-xs-12 "> 304 <ul id="ABC-filter" class="hidden-xs"> 305 <li><a href="javascript:void(0);" class="@specialCharsClass" data-filter="0-9">@Translate("0-9", "0-9")</a></li> 306 @for (char c = 'A'; c <= 'Z'; c++) 307 { 308 string letter = c.ToString(), 309 liClass = groupedDictionary.ContainsKey(letter) ? "active" : "inactive"; 310 <li><a href="javascript:void(0);" class="@liClass" data-filter="@letter">@letter</a></li> 311 } 312 </ul> 313 </div> 314 </div> 315 <div class="row"> 316 <div class="col-xs-12"> 317 <ul class="ModelsList"> 318 @if(makes != null) 319 { 320 foreach (var letter in groupedDictionary.OrderBy(p => p.Key)) 321 { 322 string firstLetter = specialChars.Contains(letter.Key) ? "0-9" : letter.Key; 323 <li data-a="aaaa"> 324 <h3 class="h1" data-filter="@firstLetter">@letter.Key.ToUpper()</h3> 325 <div class="row"> 326 @foreach (LoopItem product in letter.Value.OrderBy(p => p.GetString("FacetOption.Value"))) 327 { 328 string currentItemMakeEncoded = product.GetString("FacetOption.Value").Replace(",","|").Replace(" ", "_").Replace("'","*"); 329 <div class="col-xs-12 col-sm-4 col-md-3"> 330 <a href="/@currentUrl&ItemMakes=@currentItemMakeEncoded">@product.GetString("FacetOption.Value").Replace("|", ",").Replace("_", " ").Replace("*", "'").ToUpper()</a> 331 </div> 332 } 333 </div> 334 </li> 335 } 336 } 337 else { 338 foreach (var letter in groupedDictionary) 339 { 340 string firstLetter = specialChars.Contains(letter.Key) ? "0-9" : letter.Key; 341 var keys = products.Keys.Where(x => x.Substring(0,1) == letter.Key); 342 keys = keys.Distinct().ToList(); 343 <li> 344 <h3 class="h1" data-filter="@firstLetter">@letter.Key</h3> 345 <div class="row"> 346 @foreach(var key in keys) { 347 string make = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) ? "" : System.Web.HttpContext.Current.Request["ItemMakes"].ToString(); 348 string[] modelFeature = key.Split('|'); 349 string url = String.Format("{0}&ItemMakes={1}&ItemModels={2}&ItemFeatures={3}", currentUrl, make, modelFeature[0].Replace(",","|").Replace(" ", "_").Replace("'","*"),modelFeature[1].Replace(",","|").Replace(" ", "_").Replace("'","*")); 350 url = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(url); 351 <div class="col-xs-12 col-sm-4 col-md-3"> 352 <a href="@url">@key.Replace("_"," ").Replace("*","'")</a> 353 </div> 354 } 355 </div> 356 </li> 357 } 358 } 359 </ul> 360 </div> 361 </div> 362 } 363 else { 364 <h2>@Translate("noProductsAvailable","No products available.")</h2> 365 } 366 } 367 368 @helper RenderPriceContainer(LoopItem product,Dynamicweb.Content.Items.Item item) { 369 List<LoopItem> productPrices = product.GetLoop("Product.Prices"); 370 string str_productID = product.GetString("Ecom:Product.ID"); 371 bool bol_userLogged = Pageview.User.LoggedIn; 372 string userGroupID = (!bol_userLogged) ? (item["Retail"] ?? "").ToString() : GetFirstUserGroupID(Pageview.User.Groups.ToArray(), productPrices.Select(p => p.GetString("Ecom:Product.Prices.GroupID")).Distinct().ToList()); 373 string str_urlReq = "/Default.aspx?ID=" + item["RequestQuote"].ToString() + "&prodID=" + str_productID; 374 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(); 375 string containerClass = lst_quantityPrices.Any() ? "quantityContainer" : "noMultiplePrice"; 376 string priceTitle = lst_quantityPrices.Any() ? Translate("listPrice") : Translate("yourPrice"); 377 <div class="col-xs-12 col-sm-4"> 378 <div class="qty-pricing"> 379 <div id="@containerClass" class="col-xs-12 noPadding"> 380 <ul> 381 <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> 382 @if(lst_quantityPrices.Any()) { 383 List<string> lst_quantityPricesOrdered = new List<string>(); 384 int lastQuantity = 100, 385 numPrices = lst_quantityPrices.Count - 1; 386 387 foreach (LoopItem price in lst_quantityPrices) 388 { 389 int _quantity = price.GetInteger("Ecom:Product.Prices.Quantity"); 390 _quantity = _quantity == 0 ? 1 : _quantity; 391 392 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>"; 393 394 lst_quantityPricesOrdered.Add(htmlResult); 395 396 numPrices--; 397 lastQuantity = price.GetInteger("Ecom:Product.Prices.Quantity"); 398 } 399 lst_quantityPricesOrdered.Reverse(); 400 401 <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> 402 foreach (string liHtml in lst_quantityPricesOrdered) 403 { 404 @liHtml 405 } 406 407 <li> 408 <span class="pull-left col-sm-5 col-xs-6 noPaddingLeft">@Translate("Qty", "Qty") @Translate("100+", "100 +")</span> 409 <a class="min-btn btn-blue generalButton underline pull-right" href="@str_urlReq">@Translate("requestQuote", "Request Quote")</a> 410 </li> 411 } 412 413 </ul> 414 </div> 415 </div> 416 </div> 417 } 418 419 @helper CheckStock(Dynamicweb.Content.Items.Item item,string str_productID,string str_productVariantID,LoopItem product) { 420 string inquirePage = (item["InquireAboutAvailability"] ?? "").ToString(); 421 string str_myMiniCart = (Pageview.Area.Item["MiniCart"] ?? "").ToString(); 422 423 424 <div class="col-xs-12 col-sm-2 noPaddingLeft"> 425 <div class="cart-controls pull-right"> 426 @if(product.GetInteger("Ecom:Product.Stock") > 0){ 427 <span class="qty-label">Qty</span> 428 <input class="quantity" name="Quantity" type="number" value="1" maxlength="4" min="1"/><br/> 429 } 430 </div> 431 <div class="cart-controls text-right"> 432 @if(product.GetInteger("Ecom:Product.Stock") > 0){ 433 <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> 434 } 435 else 436 { 437 <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> 438 } 439 </div> 440 </div> 441 } 442 443 @helper CheckStock_(Dynamicweb.Content.Items.Item item,string str_productID,string str_productVariantID,LoopItem product) { 444 string inquirePage = (item["InquireAboutAvailability"] ?? "").ToString(); 445 string str_myMiniCart = (Pageview.Area.Item["MiniCart"] ?? "").ToString(); 446 <form class="col-xs-12 col-sm-2 noPaddingLeft"> 447 <input type="hidden" name="cartcmd" value="add"/> 448 <input type="hidden" name="productid" value="@str_productID"/> 449 <input type="hidden" name="variantID" value="@str_productVariantID"/> 450 @* added to allow post to Minicart and Facebook Tracking *@ 451 <input type="hidden" name="ID" value="@str_myMiniCart"/> 452 <div class="cart-controls pull-right"> 453 @if(product.GetInteger("Ecom:Product.Stock") > 0){ 454 <span class="qty-label">Qty</span> 455 <input class="quantity" name="Quantity" type="number" value="1" maxlength="4" min="1"/><br/> 456 } 457 </div> 458 <div class="cart-controls text-right"> 459 @if(product.GetInteger("Ecom:Product.Stock") > 0){ 460 <button class="addToCart generalButton pull-right addToCartTracking" type="submit"> 461 <i class="fa fa-shopping-cart"></i>&nbsp;@Translate("Add to Cart") 462 </button> 463 } 464 else 465 { 466 467 <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> 468 } 469 </div> 470 </form> 471 } 472 473 474 475 @functions{ 476 bool haveKits; 477 } 478 @{ 479 var itemArea = Pageview.Area.Item; 480 List<LoopItem> facetGroups = GetLoop("FacetGroups"); 481 482 int num_currPage = GetInteger("Ecom:ProductList.CurrentPage"); 483 int page_size = GetInteger("Ecom:ProductList.PageSize"); 484 int num_totalPages = GetInteger("Ecom:ProductList.TotalPages"); 485 486 var products = GetLoop("Products"); 487 string groupID = GetString("Ecom:Group.ID"), parentGroup = "", 488 make = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) ? "" : System.Web.HttpContext.Current.Request["ItemMakes"].ToString().Replace("-"," "), 489 model = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemModels"]) ? "" : System.Web.HttpContext.Current.Request["ItemModels"].ToString().Replace("-"," "), 490 feature = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemFeatures"]) ? "" : System.Web.HttpContext.Current.Request["ItemFeatures"].ToString().Replace("-"," "), 491 prodType = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ProductType"]) ? "" : System.Web.HttpContext.Current.Request["ProductType"].ToString(), 492 makesTitle = String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) ? Translate("chooseMakes","Choose your Manufacturer") : Translate("chooseModel","Choose your Model"), 493 query = ""; 494 495 @* Snippet Section *@ 496 string productPageId = itemArea["ProductPage"] != null ? itemArea["ProductPage"].ToString() : ""; 497 string prodTypes = System.Web.HttpContext.Current.Request["ProductType"] != null ? System.Web.HttpContext.Current.Request["ProductType"].ToString() : ""; 498 string isMakeActives = (prodTypes.Equals("2") || String.IsNullOrEmpty(prodTypes)) && System.Web.HttpContext.Current.Request["loadseries"] == null ? "active" : "", 499 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" : "", 500 isSizeActives = isSeriesActive.Equals("") && prodTypes.Equals("0") ? "active" : ""; 501 502 if(System.Web.HttpContext.Current.Request["loadResults"] != null){ 503 isSeriesActive = ""; 504 isSizeActives = "active"; 505 } 506 507 string searchByMakesModelsLink = !prodType.Equals("2") ? String.Format("/Default.aspx?ID={0}&groupId={1}&ProductType=2",productPageId,groupID) : "javascript:void(0)"; 508 string searchBySizesLink = !prodType.Equals("0") ? String.Format("/Default.aspx?ID={0}&groupId={1}&ProductType=0&searchSize=true",productPageId,groupID) : "javascript:void(0)"; 509 510 if(!String.IsNullOrEmpty(groupID)) { 511 Dynamicweb.eCommerce.Products.Group actualGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID(groupID); 512 parentGroup = RenderParentEcomNav(actualGroup); 513 } 514 bool first = true; 515 516 517 List<LoopItem> productsList = products.Where(x => x.GetString("Ecom:Product.Type") != "2").ToList(); 518 List<LoopItem> productsListKits = products.Where(x => x.GetString("Ecom:Product.Type") == "2").ToList(); 519 haveKits = productsListKits.Any(); 520 521 522 int productCount = GetBoolean("Ecom:Group:Field.Multipack") ? productsListKits.Count : productsList.Count; 523 int startValue = ((num_currPage - 1) * page_size) + 1; 524 int toValue = page_size * num_currPage; 525 int total = GetInteger("Ecom:ProductList.PageProdCnt");//(page_size * num_totalPages); 526 527 if(productCount < page_size){ 528 toValue = total; 529 } 530 531 string classDiv = "col-md-12"; 532 /* 533 Dynamicweb.eCommerce.Products.Group currentGroup = null; 534 if(products.Any() && products.FirstOrDefault() != null) { 535 Product firstProduct = Product.GetProductByID(products.First().GetString("Ecom:Product.ID")); 536 currentGroup = Dynamicweb.eCommerce.Products.Group.GetGroupsByProduct(firstProduct).FirstOrDefault(); 537 } 538 */ 539 540 foreach(var parameter in GetLoop("Query.Parameters")) { 541 string parameterName = parameter.GetString("Parameter.Name"); 542 string parameterValue = parameter.GetString("Parameter.Value"); 543 if(!String.IsNullOrEmpty(parameterValue) && !parameterName.Equals("GroupID") && !parameterName.Equals("ParentID")) { 544 query += "&" + parameterName + "=" + parameterValue; 545 } 546 } 547 } 548 @* Show models and sizes (products that are not kits) *@ 549 @if (products != null && products.Any()) 550 { 551 if(GetBoolean("Ecom:Group:Field.Multipack") || (!haveKits && productsList.Any())){ 552 classDiv = "col-md-10"; 553 var lst_parameters = GetLoop("Query.Parameters"); 554 string str_parentID = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["parentID"]) ? System.Web.HttpContext.Current.Request.Params["parentID"].ToString() : ""; 555 string str_prodtype = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["ProductType"]) ? System.Web.HttpContext.Current.Request.Params["ProductType"].ToString() : ""; 556 ArrayList composedFacets = new ArrayList(); 557 composedLabels = new Dictionary<string, string>(); 558 composedLabels.Add("equal", Translate("equalTo", "Equal to")); 559 composedLabels.Add("lower", Translate("lessTo", "Less or Equal to")); 560 composedLabels.Add("greater", Translate("greaterTo", "Greater or Equal to")); 561 Dynamicweb.eCommerce.Products.Group currGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID(GetString("Ecom:Group.ID")); 562 string parent = currGroup != null ? RenderParentEcomNav(currGroup) : ""; 563 bool isMultipack = GetBoolean("Ecom:Group:Field.Multipack") && str_prodtype.Equals("2"); 564 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(); 565 566 <div id="filtersContainer" class="col-xs-12 col-md-2 noPadding"> 567 <div class="orange-heading"> 568 <h2>@Translate("filterHeading", "Filter Your Results")</h2> 569 </div> 570 <form id="filtersForm" class="filtersBody"> 571 <input type="hidden" name="loadResults" value="true"/> 572 <!-- <input type="hidden" name="parentID" value="@str_parentID"/> --> 573 <input type="hidden" name="ProductType" value="@str_prodtype"/> 574 @foreach(LoopItem fg in filteredFacetGroups) 575 { 576 var facets = fg.GetLoop("Facets"); 577 578 @* Do not show Makes/Models/Features in bearing and ball types tree *@ 579 if(parent.Equals("L1BEARINGBALLTYPES")) { 580 facets = facets.Where(x => x.GetString("Facet.Name") != "Makes" && x.GetString("Facet.Name") != "Models" && x.GetString("Facet.Name") != "Features").ToList(); 581 } 582 string groupName = fg.GetString("FacetGroup.Name"); 583 var count = facets.Sum(x => x.GetInteger("Facet.OptionWithResultCount")); 584 585 foreach (LoopItem i in facets) 586 { 587 bool facetAdded = false; 588 var parameters = lst_parameters.Where(x => x.GetString("Parameter.Name") == i.GetString("Facet.QueryParameter")).FirstOrDefault(); 589 string str_parameterType = parameters != null ? parameters.GetString("Parameter.Type") : ""; 590 string str_templateOutput = "string"; 591 592 if((i.GetString("Facet.QueryParameter") == "P_Id_equal" || i.GetString("Facet.QueryParameter") == "P_DimensionType" ) && !hasHighlightedFilters /*&& !isMultipack*/){ 593 hasHighlightedFilters = true; 594 @:<div class="highlightedFilters"> 595 @RenderSnippet("DimensionType") 596 } 597 598 if(str_parameterType.Contains("[]")){ 599 switch (i.GetString("Facet.Name")) 600 { 601 case "Applications": 602 str_templateOutput = "selectApplications"; 603 break; 604 case "Bearing Types": 605 str_templateOutput = "selectBearingTypes"; 606 break; 607 case "Models": 608 str_templateOutput = "selectModel"; 609 break; 610 case "Features": 611 str_templateOutput = "selectFeature"; 612 break; 613 case "fieldName": 614 str_templateOutput = "multiselect"; 615 break; 616 case "fieldName2": 617 str_templateOutput = "checkboxes"; 618 break; 619 default: 620 str_templateOutput = "select"; 621 break; 622 } 623 } 624 else if(str_parameterType.Contains("Boolean")){ 625 switch (i.GetString("Facet.Name")) 626 { 627 case "fieldName": 628 str_templateOutput = "select"; 629 break; 630 case "fieldName2": 631 str_templateOutput = "radio"; 632 break; 633 default: 634 str_templateOutput = "checkbox"; 635 break; 636 } 637 } 638 else if(i.GetInteger("Facet.OptionWithResultCount") > 0) { 639 string facetName = i.GetString("Facet.Name"); 640 string facetField = i.GetString("Facet.Field"); 641 string parameter = i.GetString("Facet.QueryParameter"); 642 var options = i.GetLoop("FacetOptions").Where(x => x.GetString("FacetOption.Value") != "0").ToList(); 643 if(facetName.Contains("Composed") && options.Any() ) { 644 string[] facetSplit = facetName.Split('_'); 645 string param = parameter.Substring(0,parameter.LastIndexOf("_")); 646 string s = facetName.Substring(0,facetName.LastIndexOf("_")); 647 648 var filtered = facets.Where(f => f.GetString("Facet.Field").Contains(facetField)).ToList(); 649 if(!composedFacets.Contains(s)) { 650 composedFacets.Add(s); 651 facetAdded = true; 652 } 653 654 if (facetAdded && filtered.Any()) 655 { 656 @createOptions(filtered,param,facetSplit[1],options, i.GetString("Facet.Type").Equals("Term")) 657 } 658 659 <input type="hidden" name="@parameter" value="" disabled /> 660 } 661 else { 662 switch (i.GetString("Facet.Name")) 663 { 664 case "fieldName3": 665 str_templateOutput = "multiselect"; 666 break; 667 case "DimensionType": 668 //str_templateOutput = "hidden"; 669 str_templateOutput = "select"; 670 break; 671 default: 672 str_templateOutput = "select"; 673 break; 674 } 675 } 676 } 677 else if(i.GetString("Facet.Field").Contains("Weight_Options")) { 678 string facetName = i.GetString("Facet.Name"); 679 string facetField = i.GetString("Facet.Field"); 680 string parameter = i.GetString("Facet.QueryParameter"); 681 var options = i.GetLoop("FacetOptions"); 682 if(facetName.Contains("Composed")) { 683 string[] facetSplit = facetName.Split('_'); 684 string param = parameter.Substring(0,parameter.LastIndexOf("_")); 685 string s = facetName.Substring(0,facetName.LastIndexOf("_")); 686 687 var filtered = facets.Where(f => f.GetString("Facet.Field").Contains(facetField)).ToList(); 688 if(!composedFacets.Contains(s)) { 689 composedFacets.Add(s); 690 facetAdded = true; 691 } 692 693 if (facetAdded && filtered.Any()) 694 { 695 @createOptions(filtered,param,facetSplit[1],options, i.GetString("Facet.Type").Equals("Term")) 696 } 697 698 <input type="hidden" name="@parameter" value="" disabled /> 699 } 700 } 701 else { 702 switch (i.GetString("Facet.Name")) 703 { 704 case "fieldName": 705 str_templateOutput = "autocomplete"; 706 break; 707 case "Stock": 708 str_templateOutput = "stockCheck"; 709 break; 710 case "Fitments": 711 str_templateOutput = "hidden"; 712 break; 713 default: 714 str_templateOutput = "select"; 715 break; 716 } 717 718 } 719 if(!i.GetString("Facet.Name").Contains("Composed")) { 720 @field(i, str_parameterType, str_templateOutput) 721 } 722 723 if(i.GetString("Facet.QueryParameter") == "P_Width_greater" && hasHighlightedFilters /*&& !isMultipack*/){ 724 @:</div> 725 } 726 } 727 } 728 729 <a href="@HttpContext.Current.Request.RawUrl.Split('?')[0].ToString()" class="btn-blue generalButton applyFilter">@Translate("reset", "Reset")</a> 730 731 </form> 732 </div> 733 734 @helper field(LoopItem i , string str_parameterType, string str_templateOutput ) { 735 string str_parameter = i.GetString("Facet.QueryParameter"); 736 string str_name = i.GetString("Facet.Name"); 737 bool isTerm = i.GetString("Facet.Type").Equals("Term"); 738 List<LoopItem> facetOptions = i.GetLoop("FacetOptions").Where(x => x.GetString("FacetOption.Value") != "0").ToList(); 739 var isSingleFacetOption = facetOptions.Count == 1; 740 var isDimensionType = i.GetString("Facet.Name") == "DimensionType"; 741 742 743 switch (str_templateOutput) 744 { 745 case "stockCheck": 746 bool isChecked = !String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["Stock"]) && System.Web.HttpContext.Current.Request["Stock"].ToString().Equals("0"); 747 <fieldset class="col-xs-12 noPadding" data-type="@str_parameterType"> 748 <legend class="h3 bold col-xs-8 noPadding">@Translate("inStock","In Stock Only"):</legend> 749 <input checked="@isChecked" type="checkbox" id="inStock" value="-1" name="Stock"/> 750 </fieldset> 751 break; 752 753 case "multiselect": 754 if(facetOptions.Any()) { 755 <fieldset class="col"> 756 <legend class="h3 bold">@str_name.Replace("_"," "):</legend> 757 <select data-size="8" name="@str_parameter" multiple> 758 <option value="">@Translate("all","All")</option> 759 @foreach(LoopItem option in facetOptions.OrderBy(o => o.GetInteger("FacetOption.Label"))) 760 { 761 bool bol_checked = option.GetBoolean("FacetOption.Selected"); 762 string str_value = option.GetString("FacetOption.Value"); 763 string str_nameOption = option.GetString("FacetOption.Name"); 764 string str_label = isTerm ? str_value : option.GetString("FacetOption.Label"); 765 766 <option selected="@bol_checked" value="@str_value">@str_label.Replace("_"," ")</option> 767 } 768 </select> 769 </fieldset> 770 } 771 break; 772 773 case "checkboxes": 774 if(facetOptions.Any()) { 775 <fieldset class="col-xs-12 noPadding" data-type="@str_parameterType"> 776 <legend class="h3 bold">@str_name.Replace("_"," ") :</legend> 777 <div class="filtersContainer hide"> 778 @foreach(LoopItem option in facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label"))) 779 { 780 bool bol_checked = option.GetBoolean("FacetOption.Selected"); 781 string str_value = option.GetString("FacetOption.Value"); 782 string str_nameOption = option.GetString("FacetOption.Name"); 783 string str_label = isTerm ? str_value : option.GetString("FacetOption.Label"); 784 <label><input checked="@bol_checked" type="checkbox" value="@str_value" name="@str_parameter"> @str_label (@option.GetString("FacetOption.Count"))</label> 785 } 786 </div> 787 </fieldset> 788 } 789 break; 790 case "selectFeature": 791 case "select": 792 if(facetOptions.Any()) 793 { 794 if (isDimensionType) 795 { 796 @:@SnippetStart("DimensionType") 797 } 798 string facetOption = GetQueryParameter(str_parameter); 799 <fieldset class="col-xs-12 noPadding"> 800 <legend class="h3 bold">@str_name.Replace("_"," "):</legend> 801 <select data-size="8" name="@str_parameter" @string.Format("{0}", isSingleFacetOption ? "class=\"singleFacetOption\"" : string.Empty)> 802 <option value="">@Translate("all","All")</option> 803 @foreach(LoopItem option in facetOptions.OrderByDescending(o => o.GetInteger("FacetOption.Label"))) 804 { 805 string str_value = option.GetString("FacetOption.Value"); 806 string str_nameOption = option.GetString("FacetOption.Name"); 807 string str_label = isTerm ? str_value : option.GetString("FacetOption.Label"); 808 bool isSelected = str_value == facetOption; 809 <option selected="@isSelected" value="@str_value">@str_label.Replace("_"," ")</option> 810 } 811 </select> 812 </fieldset> 813 if (isDimensionType) 814 { 815 @:@SnippetEnd("DimensionType") 816 } 817 } 818 break; 819 820 case "selectApplications": 821 case "selectBearingTypes": 822 string currApp = System.Web.HttpContext.Current.Request["ParentID"] != null ? System.Web.HttpContext.Current.Request["ParentID"].ToString() : ""; 823 string defaultApp = ""; 824 string defaultType = "L2-RADIALB"; 825 if (str_name.ToLower().Contains("application")) 826 { 827 currApp = !String.IsNullOrEmpty(currApp) ? currApp : defaultApp; 828 } 829 else 830 { 831 currApp = !String.IsNullOrEmpty(currApp) ? currApp : defaultType; 832 } 833 834 if (facetOptions.Any()) 835 { 836 Dictionary<string, string> allGroups = GetAllApplications(String.Format("'{0}'", String.Join("','", facetOptions.Select(fo => fo.GetString("FacetOption.Value")).Distinct().ToArray()))); 837 <fieldset class="col-xs-12 noPadding sameFilter"> 838 <legend class="h3 bold">@str_name:</legend> 839 <select data-size="8" name="@str_parameter" @string.Format("{0}", isSingleFacetOption ? "class=\"singleFacetOption\"" : string.Empty)> 840 <option value="">All</option> 841 @foreach (LoopItem option in facetOptions) 842 { 843 string appValue = option.GetString("FacetOption.Value").ToUpper(), 844 appLabel = allGroups.ContainsKey(appValue) ? allGroups[appValue] : option.GetString("FacetOption.Name"); 845 bool appIsChecked = currApp == appValue; 846 <option selected="@appIsChecked" value="@appValue">@appLabel</option> 847 } 848 </select> 849 </fieldset> 850 } 851 break; 852 853 case "selectModel": 854 string currentModel = ""; 855 List<string> models = new List<string>(); 856 857 if (!String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) && !String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ParentID"])) 858 { 859 string make = System.Web.HttpContext.Current.Request["ItemMakes"].ToString(); 860 currentModel = (System.Web.HttpContext.Current.Request["ItemModels"] ?? "").ToString(); 861 models = GetModels((System.Web.HttpContext.Current.Request["ParentID"] ?? "").ToString(), make.Replace("|", ",").Replace("_", " ").Replace("*", "'")); 862 } 863 864 var isSingleModelOption = models.Count == 1; 865 866 <fieldset class="col-xs-12 noPadding"> 867 <legend class="h3 bold">@str_name:</legend> 868 <select data-size="8" name="@str_parameter" @string.Format("{0}", isSingleModelOption ? "class=\"singleFacetOption\"" : string.Empty)> 869 <option value="">All</option> 870 @foreach (string modelOption in models) 871 { 872 var isSelected = modelOption.Replace(",", "|").Replace(" ","_").Replace("'", "*").Equals(currentModel); 873 <option selected="@isSelected" value="@(modelOption.Replace(",", "|").Replace(" ","_").Replace("'", "*"))">@modelOption</option> 874 } 875 </select> 876 </fieldset> 877 break; 878 /*case "___selectFeature": 879 <fieldset class="col-xs-12 noPadding"> 880 <legend class="h3 bold">@str_name:</legend> 881 <select data-size="8" name="@str_parameter"> 882 <option value="">All</option> 883 @if(!String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ItemMakes"]) && !String.IsNullOrEmpty(System.Web.HttpContext.Current.Request["ParentID"])) { 884 string make = System.Web.HttpContext.Current.Request["ItemMakes"].ToString(); 885 string model = (System.Web.HttpContext.Current.Request["ItemModels"] ?? "").ToString(); 886 string currentFeature = (System.Web.HttpContext.Current.Request["ItemFeatures"] ?? "").ToString(); 887 List<string> features = GetFeatures(make,model.Replace("|", ",").Replace("_"," ").Replace("*","'")); 888 bool isSelected = false; 889 foreach (string featureOption in features) 890 { 891 isSelected = featureOption.Replace(",", "|").Replace(" ","_").Equals(currentFeature); 892 <option selected="@isSelected" value="@(featureOption.Replace(",", "|").Replace(" ","_"))">@featureOption</option> 893 } 894 } 895 </select> 896 </fieldset> 897 break;*/ 898 899 900 case "checkbox": 901 if(facetOptions.Any()) { 902 <fieldset data-type="@str_parameterType"> 903 @foreach(LoopItem option in facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label"))) 904 { 905 bool bol_checked = option.GetBoolean("FacetOption.Selected"); 906 string str_value = option.GetString("FacetOption.Value") == "True" ? "True" : ""; 907 string str_nameOption = option.GetString("FacetOption.Name"); 908 909 if(str_value == "True") { 910 <legend class="h3 bold">@str_name.Replace("_"," "):</legend> 911 <div class="filtersContainer hide"> 912 <label><input checked="@bol_checked" type="checkbox" value="@str_value" name="@str_parameter"> @str_name (@option.GetString("FacetOption.Count"))</label> 913 </div> 914 } 915 } 916 </fieldset> 917 } 918 break; 919 920 case "radio": 921 break; 922 923 case "radios": 924 break; 925 926 case "autocomplete": 927 break; 928 929 case "text": 930 <fieldset class="col-xs-12 noPadding" data-name="@str_name"> 931 <legend class="h3 bold">@str_name.Replace("_"," "):</legend> 932 <input type="text" name="@str_parameter" /> 933 </fieldset> 934 break; 935 936 case "textComposed": 937 <fieldset class="col-xs-12 noPadding composedSet" data-name="@str_name"> 938 <legend class="h3 bold">@str_name.Replace("_"," "):</legend> 939 <input class="composed" type="text" name="@str_name" /> 940 </fieldset> 941 break; 942 943 case "hidden": 944 <fieldset class="col-xs-12 noPadding hidden" data-name="@str_name"> 945 <legend class="h3 bold">@str_name:</legend> 946 <input type="hidden" name="@str_parameter" id="@str_parameter" value="" /> 947 </fieldset> 948 break; 949 950 default: 951 <fieldset class="col-xs-12 noPadding" data-type="@str_parameterType"> 952 <legend class="h3 bold">@str_name.Replace("_"," "):</legend> 953 <div class="filtersContainer"> 954 <input type="text" name="@str_parameter" value="" /> 955 </div> 956 </fieldset> 957 break; 958 } 959 } 960 961 @functions { 962 System.Collections.Specialized.NameValueCollection allRequestParams = System.Web.HttpContext.Current.Request.Params; 963 Dictionary<string, string> composedLabels; 964 bool hasHighlightedFilters = false; 965 966 public string GetQueryParameter(string queryParameter) { 967 return (System.Web.HttpContext.Current.Request[queryParameter] ?? "").ToString(); 968 } 969 } 970 @functions{ 971 public Dictionary<string, string> GetAllApplications(string filterGroups) 972 { 973 Dictionary<string, string> groups = new Dictionary<string, string>(); 974 DataSet allGroups = Dynamicweb.Database.CreateDataSet("SELECT GroupID, GroupName FROM EcomGroups WHERE GroupID IN (" + filterGroups + ")"); 975 976 if (allGroups.Tables.Count > 0 && allGroups.Tables[0].Rows.Count > 0) 977 { 978 foreach (DataRow group in allGroups.Tables[0].Rows) 979 { 980 string groupID = (group["GroupID"] ?? "").ToString(), 981 groupName = (group["GroupName"] ?? "").ToString(); 982 983 if (!String.IsNullOrWhiteSpace(groupID) && !String.IsNullOrWhiteSpace(groupName) && !groups.ContainsKey(groupID)) groups.Add(groupID, groupName); 984 } 985 } 986 return groups; 987 } 988 public List<string> GetModels(string parentGroupID, string make) { 989 List<string> modelNames = new List<string>(); 990 using (var s = Dynamicweb.Database.CreateConnection()) 991 { 992 var cmd = s.CreateCommand(); 993 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"; 994 995 cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter() 996 { 997 ParameterName = "application", 998 SqlDbType = System.Data.SqlDbType.NVarChar, 999 Value = parentGroupID 1000 }); 1001 1002 cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter() 1003 { 1004 ParameterName = "make", 1005 SqlDbType = System.Data.SqlDbType.NVarChar, 1006 Value = make 1007 }); 1008 var reader = cmd.ExecuteReader(); 1009 while(reader.Read()) 1010 { 1011 modelNames.Add(reader["Model"].ToString()); 1012 } 1013 s.Close(); 1014 } 1015 return modelNames; 1016 } 1017 1018 1019 /*public List<string> GetFeatures(string make, string model) { 1020 List<string> featureNames = new List<string>(); 1021 using (var s = Dynamicweb.Database.CreateConnection()) 1022 { 1023 var cmd = s.CreateCommand(); 1024 cmd.CommandText = "Select distinct(Feature) from ItemType_Make_ModelAnd_Features where Make=@make and Model=@model"; 1025 cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter() 1026 { 1027 ParameterName = "make", 1028 SqlDbType = System.Data.SqlDbType.NVarChar, 1029 Value = make 1030 }); 1031 cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter() 1032 { 1033 ParameterName = "model", 1034 SqlDbType = System.Data.SqlDbType.NVarChar, 1035 Value = model 1036 }); 1037 var reader = cmd.ExecuteReader(); 1038 while(reader.Read()) 1039 { 1040 featureNames.Add(reader["Feature"].ToString()); 1041 } 1042 s.Close(); 1043 } 1044 return featureNames; 1045 }*/ 1046 } 1047 @helper createOptions(List<LoopItem> facets, string name, string title, List<LoopItem> facetOptions, bool isTerm) 1048 { 1049 1050 string currentFacetParam = "", selectedFilter = "", selectedOption = ""; 1051 1052 foreach(string k in allRequestParams.AllKeys) 1053 { 1054 if(k.StartsWith(String.Format("{0}_", name))) 1055 { 1056 currentFacetParam = k; 1057 selectedFilter = k.Replace(String.Format("{0}_", name), ""); 1058 selectedOption = allRequestParams[k].ToString(); 1059 break; 1060 } 1061 } 1062 1063 <fieldset class="col-xs-12 noPadding composedSet" data-name="@name"> 1064 <legend class="h3 bold">@title:</legend> 1065 @if (facetOptions != null && facetOptions.Any()) 1066 { 1067 var isSingleFacetOption = facetOptions.Count == 1; 1068 string[] dimensionIDs = {"P_Id","P_Od","P_Width"}; 1069 bool isDimension = dimensionIDs.Any(d => d.Contains(name)); 1070 var optionsSorted = facetOptions.Where(x => x.GetString("FacetOption.Value") != "0").OrderBy(x => x.GetDouble("FacetOption.Value")); 1071 <select data-size="8" class="composed @string.Format("{0}", isSingleFacetOption ? "singleFacetOption" : string.Empty)" @isDimension> 1072 <option value="">@Translate("all","All")</option> 1073 @foreach (LoopItem o in optionsSorted) 1074 { 1075 string optionValue = String.Format("{0}", isTerm ? o.GetString("FacetOption.Value") : o.GetString("FacetOption.Label")); 1076 <option selected="@(selectedOption == o.GetString("FacetOption.Value"))" value="@(o.GetString("FacetOption.Value"))"> 1077 @if(isDimension){ 1078 @:@FormatDimension(optionValue) 1079 } else { 1080 @:@optionValue 1081 } 1082 </option> 1083 } 1084 </select> 1085 } 1086 else 1087 { 1088 <input class="composed" type="text" value="@selectedOption" /> 1089 } 1090 1091 <select data-size="8" class="composed pull-right"> 1092 @foreach (LoopItem option in facets.Where(x => x.GetString("FacetOption.Value") != "0")) 1093 { 1094 string optionFacetName = option.GetString("Facet.Name"); 1095 string optionFacetFilter = optionFacetName.Substring(optionFacetName.LastIndexOf('_') + 1,optionFacetName.Length - optionFacetName.LastIndexOf('_') - 1); 1096 string optionFacetFilterLabel = composedLabels.ContainsKey(optionFacetFilter.ToLower()) ? composedLabels[optionFacetFilter.ToLower()] : optionFacetFilter; 1097 <option selected="@(selectedFilter == optionFacetFilter)" value="@optionFacetFilter">@optionFacetFilterLabel</option> 1098 } 1099 </select> 1100 </fieldset> 1101 } 1102 1103 @helper FormatDimension(string dimension){ 1104 if(!string.IsNullOrEmpty(dimension)){ 1105 string str_d = dimension.Contains(".") ? Double.Parse(dimension).ToString("#,##0.0000") : Double.Parse(dimension).ToString("#,##0"); 1106 @:@str_d 1107 } 1108 1109 } 1110 1111 @SnippetStart("jsOnLoad") 1112 @:onLoadFilters() 1113 @SnippetEnd("jsOnLoad") 1114 } 1115 if (!haveKits) 1116 { 1117 @* if (productsList.Any()) 1118 { 1119 Include("Includes/filters.cshtml") 1120 }*@ 1121 1122 string isHidden = "", ids = "("; 1123 foreach (var t in productsList) 1124 { 1125 ids += "'" + t.GetString("Ecom:Product.ID") + "'" + ","; 1126 } 1127 ids = ids.Remove(ids.Length - 1, 1) + ")"; 1128 1129 @* Show the three types of dimension type available *@ 1130 <div class="@isHidden @classDiv noPadding products" data-kits="@haveKits"> 1131 <div class="col-xs-12 noPaddingRight"> 1132 1133 @if(productsList.Any()) { 1134 List<LoopItem> inchProducts = productsList.Where(x => x.GetString("Ecom:Product:Field.DimensionType").Equals("Inch")).ToList(), 1135 metricProducts = productsList.Where(x => x.GetString("Ecom:Product:Field.DimensionType").Equals("Metric")).ToList(), 1136 noTypeProducts = productsList.Where(x => !x.GetString("Ecom:Product:Field.DimensionType").Equals("Metric") && !x.GetString("Ecom:Product:Field.DimensionType").Equals("Inch")).ToList(), 1137 noDimensionProducts = productsList.Where(x => x.GetString("Ecom:Product:Field.Dimensions.Value").Equals("")).ToList(); 1138 1139 if(noDimensionProducts.Count() == productsList.Count()) { 1140 <div class="blueBackgroundStripes col-xs-12"> 1141 <h2 class="col-xs-3 noPaddingLeft">@String.Format("{0} to {1} of {2}", startValue, toValue, total)</h2> 1142 @RenderPagination() 1143 </div> 1144 @CreateTable(noDimensionProducts, make, ids, false,first,"",true) 1145 <div class="blueBackgroundStripes col-xs-12"> 1146 @RenderPagination() 1147 </div> 1148 } 1149 else { 1150 <div class="blueBackgroundStripes col-xs-12"> 1151 <h2 class="col-xs-3 noPaddingLeft">@String.Format("{0} to {1} of {2}", startValue , toValue , total)</h2> 1152 @RenderPagination() 1153 </div> 1154 if(inchProducts.Any()) { 1155 @CreateTable(inchProducts, make, ids,false,first,Translate("inch","Inch"),false) 1156 first = false; 1157 } 1158 if(metricProducts.Any()) { 1159 @CreateTable(metricProducts, make, ids,true,first,Translate("metric","Metric"),false) 1160 } 1161 if(noTypeProducts.Any()) { 1162 @CreateTable(noTypeProducts, make, ids,false,first,"",false) 1163 } 1164 <div class="blueBackgroundStripes col-xs-12"> 1165 @RenderPagination() 1166 </div> 1167 } 1168 } 1169 1170 </div> 1171 </div> 1172 } 1173 else { 1174 List<LoopItem> facetOptions = getFacetOptions("ItemMakes"); 1175 1176 if(String.IsNullOrEmpty(make) && facetOptions != null && facetOptions.Any()) { 1177 <div class="col-xs-12 noPadding" id="makes"> 1178 <h2 id="productListTitle">@makesTitle</h2> 1179 @RenderMakes(facetOptions,null,false) 1180 </div> 1181 } 1182 else if(!String.IsNullOrEmpty(make) && String.IsNullOrEmpty(model) && String.IsNullOrEmpty(feature)) 1183 { 1184 <h2 id="productListTitle">@makesTitle</h2> 1185 @RenderMakesOptions(products,make, groupID) 1186 } 1187 else 1188 { 1189 <div id="results-list" class="@classDiv"> 1190 @if(GetBoolean("Ecom:Group:Field.Multipack")){ 1191 <div class="blueBackgroundStripes col-xs-12"> 1192 <h2 class="col-xs-3 noPaddingLeft">@String.Format("{0} to {1} of {2}", startValue , toValue , total)</h2> 1193 @RenderPagination() 1194 </div> 1195 } 1196 <div class="col-xs-12 noPaddingRight"> 1197 @RenderProductsListView(products) 1198 </div> 1199 @if(GetBoolean("Ecom:Group:Field.Multipack")){ 1200 <div class="blueBackgroundStripes col-xs-12"> 1201 <h2 class="col-xs-3 noPaddingLeft">@String.Format("{0} to {1} of {2}", startValue , toValue , total)</h2> 1202 @RenderPagination() 1203 </div> 1204 } 1205 </div> 1206 } 1207 } 1208 } 1209 else 1210 { 1211 <h2>No Products Available</h2> 1212 } 1213 1214 @helper RenderMakesOptions(List<LoopItem> products,string make, string groupID) { 1215 //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)); 1216 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)); 1217 string prodIds = ""; 1218 1219 if (productsDataSet.Tables.Count > 0) { 1220 foreach (DataRow r in productsDataSet.Tables[0].Rows) { 1221 prodIds += String.Format("'{0}',", r["ProductID"].ToString()); 1222 } 1223 prodIds = "(" + prodIds.Remove(prodIds.Length - 1, 1) + ")"; 1224 } 1225 1226 @CreateTable(products, make, prodIds, false,false,"",false) 1227 } 1228 1229 @helper CreateTable(List<LoopItem> products, string makes,string ids,bool isMetric,bool isFirst,string title,bool hideDimension) { 1230 var page = Pageview.Area.Item; 1231 System.Data.DataSet result = null; 1232 if(!String.IsNullOrEmpty(makes) && !String.IsNullOrEmpty(ids)) { 1233 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("*","''")); 1234 result = Dynamicweb.Database.CreateDataSet(getModelsAndFeatures); 1235 } 1236 1237 string classDiv = !String.IsNullOrEmpty(makes) ? "noPadding" : "noPadding noPaddingRight", 1238 urlBrowse = page["BrowseAll"].ToString(), 1239 parentID = (System.Web.HttpContext.Current.Request["parentID"] ?? "").ToString(), 1240 parameter = !String.IsNullOrEmpty(parentID) ? "parentID=" + parentID : "GroupID=" + GetString("Ecom:Group.ID"), 1241 prodTypeParameter = (System.Web.HttpContext.Current.Request["ProductType"] ?? "").ToString(), 1242 currentPage = "/Default.aspx?ID=" + Pageview.Page.ID + "&amp;" + parameter + String.Format("{0}", !String.IsNullOrWhiteSpace(prodTypeParameter) ? String.Format("&amp;ProductType={0}", prodTypeParameter) : ""), 1243 sortby = (System.Web.HttpContext.Current.Request["sortby"] ?? "").ToString(), 1244 sortorder = (System.Web.HttpContext.Current.Request["sortorder"] ?? "").ToString(), 1245 sortByDimension = String.Format("{0}&amp;sortby=CustomField_Id&sortorder={1}", currentPage, sortby == "CustomField_Id" && sortorder == "desc" ? "asc" : "desc"), 1246 sortByPart = String.Format("{0}&amp;sortby=Name&sortorder={1}", currentPage, sortby == "Name" && sortorder == "desc" ? "asc" : "desc"), 1247 sortByPrice = String.Format("{0}&amp;sortby=Price&sortorder={1}", currentPage, sortby == "Price" && sortorder == "desc" ? "asc" : "desc"), 1248 inquirePage = (page["InquireAboutAvailability"] ?? "").ToString(), 1249 groupID = GetString("Ecom:Group.ID"), 1250 browseMetric = String.Format("{0}&parentID={1}&DimensionType=metric",urlBrowse,groupID), 1251 browseInch = String.Format("{0}&parentID={1}&DimensionType=inch",urlBrowse,groupID), 1252 prodTitle = !String.IsNullOrEmpty(makes) ? Translate("modelFeature","Model / Feature"): Translate("part#", "Part #"), 1253 nameColumnWidth = hideDimension ? "7" : "4"; 1254 1255 //Dynamicweb.eCommerce.Products.Group currentGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID(groupID); 1256 <div class="col-xs-12 noPadding newType"> 1257 <div class="col-xs-12 @classDiv"> 1258 @if(!haveKits){ 1259 <div id="productListTable"> 1260 @*@if(isFirst) { 1261 isFirst = false; 1262 <div> 1263 <div class="row"> 1264 @foreach(LoopItem i in GetLoop("FacetGroups").Where(fc => fc.GetString("FacetGroup.Name") == "All.facets")) 1265 { 1266 // todo review this!!! 1267 foreach(LoopItem f in i.GetLoop("Facets").Where(fn => fn.GetString("Facet.Name") == "DimensionType")) 1268 { 1269 List<LoopItem> facetOptions = f.GetLoop("FacetOptions"); 1270 int facetOptionsCount = f.GetLoop("FacetOptions").Count; 1271 if(facetOptionsCount > 0) 1272 { 1273 <div class="col-xs-12"> 1274 @if(facetOptionsCount > 1) 1275 { 1276 <div id="dimensionTypeRadio"> 1277 <label><input type="radio" name="DimensionType" value="" checked>All</label> 1278 @foreach(LoopItem fo in facetOptions) { 1279 string foValue = fo.GetString("FacetOption.Value"); 1280 bool foSelected = fo.GetBoolean("FacetOption.Selected"); 1281 <label><input type="radio" name="DimensionType" id="DimensionType" value="@foValue" checked="@foSelected">@foValue.ToUpper()</label> 1282 } 1283 </div> 1284 } 1285 </div> 1286 } 1287 break; 1288 } 1289 } 1290 </div> 1291 </div> 1292 }*@ 1293 <p>@title</p> 1294 <div class="table-list-header"> 1295 <div class="row hidden-xs"> 1296 @if(!hideDimension) { 1297 <div class="col-xs-12 col-sm-3 noPaddingRight">@Translate("dimension", "Dimension") <a href="@sortByDimension"><i class="fa fa-sort"></i></a></div> 1298 } 1299 <div class="col-xs-12 col-sm-@(nameColumnWidth)">@prodTitle <a href="@sortByPart"><i class="fa fa-sort"></i></a></div> 1300 <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> 1301 <div class="col-xs-12 col-sm-4 ">&nbsp;</div> 1302 </div> 1303 </div> 1304 </div> 1305 } 1306 <ul id="productsHolder" class="productList col-xs-12 list-view noPadding"> 1307 @if(String.IsNullOrEmpty(makes)) { 1308 foreach (var product in products) 1309 { 1310 string variant_ID = product.GetString("Ecom:Product.VariantID"), 1311 str_productName = product.GetString("Ecom:Product.Name"), 1312 str_productID = product.GetString("Ecom:Product.ID"), 1313 str_productLink = product.GetString("Ecom:Product.Link.Clean"), 1314 str_productDimensions = product.GetString("Ecom:Product:Field.Dimensions.Value").Replace("Metric","").Replace("Inch","").Replace("es","").Replace("Millimeters",""), 1315 str_productInnerDimension = product.GetString("Ecom:Product:Field.ID.Value"), 1316 str_productOuterDimension = product.GetString("Ecom:Product:Field.OD.Value"), 1317 str_productWidth = product.GetString("Ecom:Product:Field.Width.Value"), 1318 price = product.GetString("Ecom:Product.Price"), 1319 addToCartUrl = "/Default.aspx?productid=" + str_productID + "&amp;cartcmd=add"; 1320 @RenderProductRow(str_productDimensions,str_productName,price,product.GetInteger("Ecom:Product.Stock"), 1321 currentPage,str_productID,str_productLink,variant_ID,inquirePage,groupID,parentID,hideDimension) 1322 } 1323 } 1324 else { 1325 if (result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0) { 1326 Dictionary<string,string> relation = new Dictionary<string,string>(); 1327 foreach (DataRow info in result.Tables[0].Rows) { 1328 string prodID = info["Product_Id"].ToString(), 1329 str_productName = info["Model"].ToString() + "|" + info["Feature"].ToString(); 1330 1331 if (!relation.ContainsKey(str_productName)) { 1332 relation.Add(str_productName,str_productName); 1333 } 1334 1335 var product = products.Where( x => x.GetString("Ecom:Product.ID").Equals(prodID)).FirstOrDefault(); 1336 if(product == null){ 1337 continue; 1338 } 1339 1340 string str_productDimensions = product.GetString("Ecom:Product:Field.Dimensions.Value").Replace("Metric","").Replace("Inch","").Replace("es","").Replace("Millimeters",""), 1341 variant_ID = product.GetString("Ecom:Product.VariantID"), 1342 str_productLink = product.GetString("Ecom:Product.Link.Clean"), 1343 price = product.GetString("Ecom:Product.Price"), 1344 addToCartUrl = "/Default.aspx?productid=" + prodID + "&amp;cartcmd=add"; 1345 1346 if(!haveKits) { 1347 @RenderProductRow(str_productDimensions,str_productName,price,product.GetInteger("Ecom:Product.Stock"), 1348 currentPage,prodID,str_productLink,variant_ID,inquirePage,groupID,parentID,hideDimension) 1349 } 1350 } 1351 @RenderMakes(null,relation,false) 1352 } 1353 } 1354 </ul> 1355 </div> 1356 </div> 1357 } 1358 1359 @helper RenderProductRow(string dimension, string name,string price,int stock, string currentPage, string productId,string prodLink, 1360 string variant,string inquirePage,string groupID,string parentID, bool hideDimension) { 1361 1362 string addToCartClass = stock > 0 ? "" : "noStockAvailable"; 1363 string nameColumnWidth = hideDimension ? "7" : "4"; 1364 <li class="row"> 1365 @if(!hideDimension) { 1366 <div class="col-xs-11 col-sm-3"> 1367 <div class="dimensions">@dimension</div> 1368 </div> 1369 } 1370 <div class="col-xs-12 col-sm-@(nameColumnWidth)"> 1371 <h2><a href="@prodLink">@name</a></h2> 1372 </div> 1373 <div class="col-xs-12 col-sm-1 noPadding"> 1374 <div class="pull-right" itemprop="price">@price</div> 1375 </div> 1376 <div class="col-xs-12 col-sm-4 addForm"> 1377 <div class="pull-right @addToCartClass"> 1378 @if(stock > 0){ 1379 <form name="addToCart" class="add-to-cart form-fields" action="@currentPage" method="post"> 1380 <input type="hidden" name="cartcmd" value="add" /> 1381 <input type="hidden" name="productID" value="@productId" /> 1382 <input type="hidden" name="variantID" id="variantID" value="@variant" @((String.IsNullOrEmpty(variant)) ? "disabled='disabled'" : "") /> 1383 <span class="qty-label">Qty</span> 1384 <input class="quantity" name="Quantity" type="number" value="1" maxlength="4" min="1" /> 1385 <a class='btn-blue generalButton btn-action pull-right addToCartSubmit'> 1386 @Translate("addToCart", "Add to Cart") <i class="fa fa-shopping-cart"></i> 1387 </a> 1388 1389 </form> 1390 } 1391 else 1392 { 1393 <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> 1394 } 1395 1396 </div> 1397 </div> 1398 </li> 1399 } 1400 1401 @SnippetStart("jsOnLoad") 1402 onLoadGenericProductList(); 1403 @SnippetEnd("jsOnLoad") 1404 @helper RenderPagination() { 1405 if(GetInteger("Ecom:ProductList.TotalPages") > 1) { 1406 string prevPage = GetString("Ecom:ProductList.PrevPage.Clean"), 1407 str_nextPage = GetString("Ecom:ProductList.NextPage.Clean"), 1408 prevClass = String.IsNullOrEmpty(str_nextPage) ? "pull-right" : ""; 1409 1410 prevPage += !String.IsNullOrEmpty(prevPage) && !prevPage.Contains("searchSize=") ? "&amp;searchSize=true" : ""; 1411 str_nextPage += !String.IsNullOrEmpty(str_nextPage) && !str_nextPage.Contains("searchSize=") ? "&amp;searchSize=true" : ""; 1412 1413 <ul class="pull-right col-sm-4 col-xs-9 paging"> 1414 @if(!String.IsNullOrEmpty(prevPage)) { 1415 <li class="col-xs-6 col-sm-6 col-sm-offset-2 col-md-offset-0 noPadding @prevClass"> 1416 <a href="@prevPage"><< @Translate("Previous","Previous")</a> 1417 </li> 1418 } 1419 @if(!String.IsNullOrEmpty(str_nextPage)) { 1420 <li class="col-xs-6 col-sm-3 noPadding pull-right"> 1421 <a href="@str_nextPage">@Translate("Next","Next") >></a> 1422 </li> 1423 } 1424 </ul> 1425 } 1426 } 1427 1428 @SnippetStart("ProductType") 1429 @if(facetGroups != null && facetGroups.Any()){ 1430 bool isMakesAvailable = false; 1431 bool isSizesAvailable = false; 1432 var prodTypeFacet = facetGroups.FirstOrDefault().GetLoop("Facets").Where(f => f.GetString("Facet.Name").Equals("ProductType")).FirstOrDefault(); 1433 1434 if(prodTypeFacet != null){ 1435 var prodTypeFacetOptions = prodTypeFacet.GetLoop("FacetOptions"); 1436 isMakesAvailable = prodTypeFacetOptions.Any(x => x.GetString("FacetOption.Value").Equals("2")); 1437 isSizesAvailable = prodTypeFacetOptions.Any(x => x.GetString("FacetOption.Value").Equals("0")); 1438 if(prodTypeFacetOptions.Any()) { 1439 bool isMultipack = GetBoolean("Ecom:Group:Field.Multipack"); 1440 string modelText = isMultipack ? Translate("searchMultipacks", "Search by Multipacks") : Translate("searchMakesModels", "Search by Manufacturer/Model"); 1441 string sizeText = isMultipack ? Translate("searchSingleBearings", "Single Bearings") : Translate("searchSize", "Search by Size"); 1442 1443 if(isMakesAvailable){ 1444 <li data-id="makesSearch" class="makesSearch @isMakeActives"><a href="@searchByMakesModelsLink">@modelText</a></li> 1445 } 1446 if(isSizesAvailable){ 1447 <li data-id="sizeSearch" class="sizeSearch @isSizeActives"><a href="@searchBySizesLink">@sizeText</a></li> 1448 } 1449 } 1450 } 1451 1452 if(String.IsNullOrEmpty(prodTypes) && !groupID.Contains("L1")) { 1453 string str_redirect = isMakesAvailable ? HttpContext.Current.Request.Url.AbsoluteUri + "&ProductType=2" : HttpContext.Current.Request.Url.AbsoluteUri + "&ProductType=0"; 1454 System.Web.HttpContext.Current.Response.Redirect(str_redirect); 1455 } 1456 } 1457 @SnippetEnd("ProductType") 1458 @using System 1459 @helper RenderProductsListView(List<LoopItem> productsListView) 1460 { 1461 string str_imagesFolder = "/Files/Files/BocaBearing/Products/images/"; 1462 1463 <ul id="productsHolder" class="productList list-view"> 1464 @foreach (LoopItem product in productsListView){ 1465 string str_imagePattern = str_imagesFolder + product.GetString("Ecom:Product.Number") + ".jpg"; 1466 //string str_imagePattern = str_imagesFolder + product.GetString("Ecom:Product.Number") + ".jpg"; 1467 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; 1468 str_image = str_image.Replace("/Files/files/files/", "/Files/files/"); 1469 1470 string groupId = product.GetString("Ecom:Product.PrimaryGroupID"); 1471 string str_productName = product.GetString("Ecom:Product.Name"); 1472 string str_productID = product.GetString("Ecom:Product.ID"); 1473 string str_productVariantID = product.GetString("Ecom:Product.VariantID"); 1474 string str_link = ""; 1475 bool bol_userLogged = Pageview.User.LoggedIn; 1476 string itemMakes = (System.Web.HttpContext.Current.Request["ItemMakes"] ?? "").ToString(), 1477 ItemModels = (System.Web.HttpContext.Current.Request["ItemModels"] ?? "").ToString(), 1478 ItemFeatures = (System.Web.HttpContext.Current.Request["ItemFeatures"] ?? "").ToString(); 1479 string dimensions = product.GetString("Ecom:Product:Field.Dimensions.Value"); 1480 str_link = "/Default.aspx?ID=" + Pageview.Area.Item["ProductPage"].ToString() + "&amp;productid=" + str_productID; 1481 str_link += !String.IsNullOrWhiteSpace(itemMakes) ? String.Format("&amp;make={0}", itemMakes.Replace("_", " ")) : ""; 1482 str_link += !String.IsNullOrWhiteSpace(ItemModels) ? String.Format("&amp;model={0}", ItemModels.Replace("_", " ")) : ""; 1483 str_link += !String.IsNullOrWhiteSpace(ItemFeatures) ? String.Format("&amp;feature={0}", ItemFeatures.Replace("_", " ")) : ""; 1484 1485 @*if (!string.IsNullOrEmpty(product.GetString("Ecom:Product.PrimaryOrFirstGroupID"))) 1486 { 1487 Dynamicweb.eCommerce.Products.Group obj_primaryGroup = Dynamicweb.eCommerce.Products.Group.GetGroupByID(product.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 1488 string str_groupPage = obj_primaryGroup.Meta.PrimaryPage.ToString(); 1489 if (!string.IsNullOrEmpty(str_groupPage)) 1490 { 1491 str_link = "/" + str_groupPage; 1492 } 1493 else { 1494 str_link = "/Default.aspx?ID=" + GetGlobalValue("Global:Page.ID"); 1495 } 1496 str_link += "&amp;groupid="+product.GetString("Ecom:Product.PrimaryOrFirstGroupID")+"&amp;productid="+str_productID+ "&amp;make=brand&model=XPTO&feature=wheel"; 1497 } 1498 else { 1499 str_link = product.GetString("Ecom:Product.LinkGroup.Clean"); 1500 }*@ 1501 1502 <li class="row"> 1503 <h2 class="product-long-name col-xs-12"><a itemprop="name" href="@str_link">@product.GetString("Ecom:Product.Name")</a></h2> 1504 <div class="col-xs-11 col-sm-2"> 1505 <figure class="text-center"> 1506 <a href="@str_link"> 1507 <img src="@GetImage(str_image, 0, 116, 0, 0, 0, 0, "jpg")" alt="@str_productName" title="@str_productName" class="img-responsive" /> 1508 </a> 1509 </figure> 1510 1511 </div> 1512 <div class="col-xs-12 col-sm-4 noPaddingLeft productInfo"> 1513 <p> 1514 <strong>@Translate("sku","SKU"):</strong> @str_productName 1515 </p> 1516 @if(!String.IsNullOrEmpty(dimensions)) { 1517 double inner = product.GetDouble("Ecom:Product:Field.ID.Value.Raw"); 1518 double outer = product.GetDouble("Ecom:Product:Field.OD.Value.Raw"); 1519 double width = product.GetDouble("Ecom:Product:Field.Width.Value.Raw"); 1520 string dimension = String.Format("{0} x {1} x {2}",inner,outer,width); 1521 1522 <p>@Translate("dimension", "Dimension"): @RenderDimensions(dimension)</p> 1523 @*<p>@String.Format("ID {0} x OD {1} x Width {2}",inner,outer,width)</p>*@ 1524 } 1525 1526 <p> 1527 @if (str_productName.StartsWith("#")){ 1528 <div class="module line-clamp">@product.GetString("Ecom:Product.LongDescription")</div> 1529 } 1530 <a class="more-info" href="@str_link">@Translate("moreInfo","More Info")</a> 1531 </p> 1532 </div> 1533 @RenderPriceContainer(product,Pageview.Area.Item) 1534 @CheckStock(Pageview.Area.Item,str_productID,str_productVariantID,product) 1535 1536 </li> 1537 <hr/> 1538 } 1539 </ul> 1540 } 1541