BioLegend - Advanced Search

Filter your results
Keywords
Applications
Product Family
Reactivity
Format
Cell Type
Antibody Host Species
Antibody Type
Target Modification
Regulatory Status
Clear search
Exception in template (Designs\BioLegend\eCom/Productlist/productList.cshtml): System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.Convert.ToInt32(String value)
   at CompiledRazorTemplates.Dynamic.fddcacafed.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@inherits RazorTemplateBase<RazorTemplateModel<Template>> @using Dynamicweb; @using Dynamicweb.Frontend; @using Dynamicweb.Rendering; @using System; @using System.IO; @using System.Web; @using System.Data; @using System.Text; @using System.Text.RegularExpressions; @using DynamicwebNA.eCommerce.LiveIntegration; @using System.Collections.Generic; @using System.Linq; @using System.Collections; @using System.Runtime.Caching; @using System.Collections.Specialized; @functions { public string LocalizeLinksHTML (string HtmlContent){ int areaID = Pageview.Area.ID; var area = Dynamicweb.Content.Area.GetAreaById(areaID); string areaCulture = area.Culture.ToLower(); if(!string.IsNullOrEmpty(HtmlContent)){ if(HtmlContent.IndexOf("dwcountry") > -1){ return HtmlContent.Replace("dwcountry",areaCulture); } else{ return HtmlContent; } } else { return HtmlContent; } } public string LocalizeLinks (string HtmlContent){ int areaID = Pageview.Area.ID; var area = Dynamicweb.Content.Area.GetAreaById(areaID); string areaCulture = area.Culture.ToLower(); if(!string.IsNullOrEmpty(HtmlContent)){ if(HtmlContent.IndexOf("dwcountry") > -1){ return HtmlContent.Replace("dwcountry",areaCulture); } else if (HtmlContent.IndexOf("?ID=") > -1) { //do something string baseHref = String.Format("https://{0}",GetGlobalValue("Global:Request.Host")); HtmlContent = HtmlContent.Contains("http") ? HtmlContent : baseHref + "/" + HtmlContent; var uri = new Uri(HtmlContent,UriKind.RelativeOrAbsolute); var parsedQuery = HttpUtility.ParseQueryString(uri.Query); var pageID = parsedQuery.Get("ID"); string pageVersionID = pageID; string localizedLink = HtmlContent; if (!string.IsNullOrEmpty(pageID)){ var linkPage = Dynamicweb.Content.Page.GetPageBySql("Select * from Page where PageAreaID = '"+areaID+"' and PageMasterPageID = '"+pageID+"'"); pageVersionID = linkPage != null ? linkPage.ID.ToString() : pageID ; localizedLink = ModifyQueryStringValue(HtmlContent,"ID",pageVersionID); } //return string.Join(",", parsedQuery.AllKeys); //return string.Join(HtmlContent,"-",pageVersionID); return localizedLink; } else { return HtmlContent; } }else { return HtmlContent; } } private string ModifyQueryStringValue(string p_query, string p_Name, string p_NewValue) { Uri uri = new Uri(p_query,UriKind.RelativeOrAbsolute); //if(p_query.Contains("http")) //{ //uri = new Uri(p_query); //} else { //uri = new Uri(p_query, UriKind.Relative); //} //uri = new Uri(p_query); var nameValues = HttpUtility.ParseQueryString(uri.Query); nameValues.Set(p_Name, p_NewValue); string url = uri.AbsolutePath + "?" + nameValues.ToString(); return url; } } @{ bool isAValidSearch = true; if ((System.Web.HttpContext.Current.Request.QueryString["Keywords"] != null || System.Web.HttpContext.Current.Request.QueryString["adv1"] != null ) && System.Web.HttpContext.Current.Request.QueryString["k1"] == null && System.Web.HttpContext.Current.Request.QueryString["p1"] == null && System.Web.HttpContext.Current.Request.QueryString["adv1-k1"] == null) { isAValidSearch = ProcessRequest(); } } @functions { public const int numberOfAdvFields = 7; // Number of free text fields (adv) in the advanced search /* This method get all the ADV parameters values and concatenate that values into a string */ public static string GetAllTheAdvValuesFromQuery() { var allAdvValues = string.Empty; for (int adv = 1; adv <= numberOfAdvFields; adv++) { var currentAdv = System.Web.HttpContext.Current.Request.Params["adv" + adv]; if (!string.IsNullOrEmpty(currentAdv)) { allAdvValues += " " + currentAdv; } } return allAdvValues; } /* This method gets the number of kewords per input */ public static List<int> GetNumberOfKeywordsPerInput() { var kewordsCount = new List<int>(); for (int adv = 1; adv <= numberOfAdvFields; adv++) { var currentAdv = System.Web.HttpContext.Current.Request.Params["adv" + adv]; if (string.IsNullOrEmpty(currentAdv)) continue; string[] splitParams = currentAdv.Split(' '); kewordsCount.Add(splitParams.Length); } return kewordsCount; } /* This method returns the parameters from the "thesaurus" named item list */ public static string GetParamsFromThesaurus( bool isLiveSearch, List<string> keywords, int advNumber = 1) { var prefixParameter = isLiveSearch ? string.Format("adv{0}-k", advNumber) : "k"; var parameter = string.Empty; for (var i = 0; i < keywords.Count; i++) { parameter += "&" + prefixParameter + (i + 1) + "=" + keywords[i]; using (var connection = Dynamicweb.Database.CreateConnection()) { using (var commandSearchTerms = connection.CreateCommand()) { commandSearchTerms.CommandText = string.Format("SELECT RelatedTerm FROM {0} WHERE SearchTerm = ''+@keywordSearch+''", "itemtype_thesaurus"); commandSearchTerms.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "keywordSearch", SqlDbType = System.Data.SqlDbType.NVarChar, Value = keywords[i] }); var readerSearch = commandSearchTerms.ExecuteScalar(); if(readerSearch != null && !string.IsNullOrWhiteSpace(readerSearch.ToString())) { parameter += ","+readerSearch; } } } } return parameter; } public bool ProcessRequest() { string id = Pageview.Page.ID.ToString(); string postKeywords = System.Web.HttpContext.Current.Request.QueryString["Keywords"] ?? ""; postKeywords = !string.IsNullOrEmpty(postKeywords) ? postKeywords : GetAllTheAdvValuesFromQuery(); string criteria = ""; bool isLiveSearch = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["isLiveSearch"]) ? Convert.ToBoolean(System.Web.HttpContext.Current.Request.Params["isLiveSearch"]) : false; if (!string.IsNullOrWhiteSpace(postKeywords)) { criteria = System.Web.HttpUtility.HtmlEncode(postKeywords.Trim()); criteria = criteria.Replace("\"", ""); criteria = criteria.Replace("&ldquo;", ""); criteria = criteria.Replace("&rdquo;", ""); criteria = criteria.Replace("“", ""); criteria = criteria.Replace("”;", ""); criteria = criteria.Replace("&#8220;", ""); criteria = criteria.Replace("&#8221;", ""); criteria = criteria.Replace("&#34;", ""); } criteria = Regex.Replace(criteria, "cyclin a", "cyclin.a", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "protein a", "protein.a", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "granzyme a", "granzyme.a", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "buffer set a", "buffer set.a", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "glycophorin a", "glycophorin.a", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "do-7", "DO7", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "and-1", "AND1", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "total%20seq", "totalseq", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "totalseq-a", "totalseqa", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "totalseq-b", "totalseqb", RegexOptions.IgnoreCase); criteria = Regex.Replace(criteria, "totalseq-c", "totalseqc", RegexOptions.IgnoreCase); string tableName = "UrlPath"; string urlToRedirect = ""; using (var connection = Dynamicweb.Database.CreateConnection()) { using (var command = connection.CreateCommand()) { command.CommandText = string.Format("SELECT * FROM {0} WHERE UrlPathPath = ''+@keyword+''", tableName); command.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "keyword", SqlDbType = System.Data.SqlDbType.NVarChar, Value = criteria.ToUpper() }); using (var reader = command.ExecuteReader()) { if (reader != null) { while (reader.Read()) { urlToRedirect = reader["UrlPathRedirect"].ToString(); break; } } } } } if (!string.IsNullOrWhiteSpace(urlToRedirect)) { urlToRedirect = urlToRedirect.Replace("http://www.biolegend.com", "").Replace("PageSize=1", "PageSize=99999"); urlToRedirect = LocalizeLinks(urlToRedirect); // TODO - Confirm friendly URL to avoid 302 redirects BioLegend.Shared.WebUtility.Redirect(Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(urlToRedirect)); } else { string kParameter = ""; string tmpVal = criteria.Replace("chr(169)", "").Replace("chr(194).chr(174)", " ").Replace("chr(206).chr(177)", "") .Replace("chr(206).chr(178)", "&alpha;").Replace("chr(206).chr(179)", "&beta;").Replace("chr(206).chr(180)", "&gamma;") .Replace("chr(206).chr(181)", "&delta;").Replace("chr(206).chr(186)", "&epsilon;").Replace("chr(226).chr(132).chr(162)", "&kappa;") .Replace("anti-biotin", "biotinAb").Replace("anti-PE", "PEab").Replace("anti-APC", "APCab").Replace("anti-streptavidin", "streptavidinab") .Replace("anti-Biotin", "biotinAb").Replace("anti-pe", "PEab").Replace("anti-apc", "APCab").Replace("anti-Streptavidin", "streptavidinab") .Replace("anti-FITC", "FITCab").Replace("anti-fitc", "FITCab").Replace("anti-SAV", "SAVab").Replace("anti-sav", "SAVab").Replace("anti-Sav", "SAVab") .Replace("anti-", " ").Replace("antibody", "").Replace("Antibody", ""); //.Replace("anti", ""); tmpVal = tmpVal == "anti" ? "" : tmpVal; tmpVal = tmpVal.StartsWith("anti") ? tmpVal.Replace("anti", "") : tmpVal; tmpVal = tmpVal.EndsWith("anti") ? tmpVal.Replace("anti", "") : tmpVal; string[] tmpValWords = criteria.Split(' '); if (tmpValWords.Length > 1) { List<string> tmpWords = new List<string>(); foreach (var w in tmpValWords) { string word = w.ToLower(); if (word.StartsWith("anti") || word.EndsWith("anti")) { word = word.Replace("anti", ""); } tmpWords.Add(word); } tmpVal = string.Join(" ", tmpWords.ToArray()); } tmpVal = tmpVal.Replace("%20", " ").Replace("+", " ").Replace(" ", ",").Replace("-", "-").Replace(" / ", ","); // Named Item List var keywords = new List<string>(); char[] splitter = {','}; keywords.AddRange(tmpVal.Split(splitter, System.StringSplitOptions.RemoveEmptyEntries)); if (isLiveSearch) { var tmpKeywords = new List<string>(); tmpKeywords.AddRange(tmpVal.Split(splitter, System.StringSplitOptions.RemoveEmptyEntries)); int advIndex = 1; foreach (var kewordsNumber in GetNumberOfKeywordsPerInput()) { var kewordsPerField = new List<string>(); int tempKeywordsIndex = 1; foreach (var keyword in tmpKeywords) { if( tempKeywordsIndex > kewordsNumber) break; kewordsPerField.Add(keyword); tempKeywordsIndex++; } tmpKeywords.RemoveRange(0, kewordsPerField.Count); kParameter += GetParamsFromThesaurus(true, kewordsPerField, advIndex); advIndex++; } } else { kParameter += GetParamsFromThesaurus(false, keywords); } if (!string.IsNullOrEmpty(criteria)) { string applications, productType, reactivy, format, cellType, regulatoryStatus, companyOld, sortBy, pageSize, paragraphID, redirectToThisUrl = string.Format("{0}?Keywords={1}{2}", Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(id), string.Join(" ", keywords.ToArray()), kParameter); if (isLiveSearch) { applications = System.Web.HttpContext.Current.Request.QueryString["Applications"] ?? ""; productType = System.Web.HttpContext.Current.Request.QueryString["ProductType"] ?? ""; reactivy = System.Web.HttpContext.Current.Request.QueryString["Reactivity"] ?? ""; format = System.Web.HttpContext.Current.Request.QueryString["Format"] ?? ""; cellType = System.Web.HttpContext.Current.Request.QueryString["CellType"] ?? ""; regulatoryStatus = System.Web.HttpContext.Current.Request.QueryString["RegulatoryStatus"] ?? ""; companyOld = System.Web.HttpContext.Current.Request.QueryString["CompanyOld"] ?? ""; sortBy = System.Web.HttpContext.Current.Request.QueryString["SortBy"] ?? ""; pageSize = System.Web.HttpContext.Current.Request.QueryString["PageSize"] ?? ""; paragraphID = System.Web.HttpContext.Current.Request.QueryString["PID"] ?? ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(applications) ? "&Applications=" + applications : ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(productType) ? "&ProductType=" + productType : ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(reactivy) ? "&Reactivity=" + reactivy : ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(format) ? "&Format=" + format : ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(cellType) ? "&CellType=" + cellType : ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(regulatoryStatus) ? "&RegulatoryStatus=" + regulatoryStatus : ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(companyOld) ? "&CompanyOld=" + companyOld : ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(sortBy) ? "&SortBy=" + sortBy : ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(pageSize) ? "&PageSize=" + (pageSize == "1" ? "99999" : pageSize) : ""; redirectToThisUrl += !string.IsNullOrWhiteSpace(paragraphID) ? "&PID=" + paragraphID : ""; } BioLegend.Shared.WebUtility.Redirect(redirectToThisUrl); } } return false; } } @functions { string RoundPrice(double price, bool isPriceInterestPointValue = true) { double priceDouble = price; if(isPriceInterestPointValue) { priceDouble = price * 0.01; } //string roundedPrice = Dynamicweb.eCommerce.Common.Context.Currency.CultureInfo == "ja-JP" ? priceDouble.ToString("#,##") : Math.Round(priceDouble, 0).ToString("#,##.00"); string roundedPrice = Dynamicweb.eCommerce.Common.Context.Currency.CultureInfo == "ja-JP" ? priceDouble.ToString("#,##") : Math.Round(priceDouble, 0).ToString("#,##"); string priceWithSymbol = string.Empty; string currencySymbol = Dynamicweb.eCommerce.Common.Context.Currency.Symbol; int positivePattern = Dynamicweb.eCommerce.Common.Context.Currency.PositivePattern; int symbolPlace = Dynamicweb.eCommerce.Common.Context.Currency.SymbolPlace; if (positivePattern == 3) { priceWithSymbol = String.Format("{0} {1}", currencySymbol, roundedPrice); } else if (positivePattern == 1) { priceWithSymbol = String.Format("{0} {1}", roundedPrice, currencySymbol); } else if (symbolPlace == 0 || positivePattern == 2) { priceWithSymbol = String.Format("{0}{1}", currencySymbol, roundedPrice); } else { priceWithSymbol = String.Format("{0}{1}", roundedPrice, currencySymbol); } return priceWithSymbol; } } @{ // List view by cookie ot parameter string listView = System.Web.HttpContext.Current.Request.Cookies["dataList"] != null ? System.Web.HttpContext.Current.Request.Cookies["dataList"].Value : ""; listView = System.Web.HttpContext.Current.Request.Params["view"] != null ? (System.Web.HttpContext.Current.Request.Params["view"].ToString() == "detail" ? "detailedView" : "") : listView; var item = Pageview.Area.Item; //-- REDIRECT // If is the ExploreNewProducts page, redirect and put some parameters to filter if( Pageview.Page.ID.ToString() != (item["LiveSearchPage"] ?? "").ToString() && Pageview.Page.ID.ToString() == (item["ExploreNewProducts"] ?? "").ToString() && (System.Web.HttpContext.Current.Request.QueryString["DateReleasedMin"] == null || System.Web.HttpContext.Current.Request.QueryString["DateReleasedMax"] == null)){ string redirect = String.Format("Default.aspx?ID={0}&DateReleasedMin={1}&DateReleasedMax={2}", Pageview.Page.ID.ToString(), DateTime.Today.AddMonths(-6).ToString("yyyy-MM-dd"), DateTime.Today.ToString("yyyy-MM-dd")); if(System.Web.HttpContext.Current.Request.Params["view"] == null && !String.IsNullOrEmpty(listView)) { redirect = redirect + "&view=detail"; } BioLegend.Shared.WebUtility.Redirect(Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(redirect)); } var loop_subgroups = GetLoop("Subgroups").OrderBy(o => o.GetString("Ecom:Group.Name")).ToList(); // If have subgroups, redirecto to the groups list page if(loop_subgroups.Any()){ string redirect = "/"+item["GroupsPage"].ToString()+"&GroupID="+System.Web.HttpContext.Current.Request.QueryString["GroupID"].ToString(); BioLegend.Shared.WebUtility.Redirect(redirect); } // If dataList cookie is detailedView, redirect to the detail template if(Pageview.Page.ID.ToString() != (item["LiveSearchPage"] ?? "").ToString() && System.Web.HttpContext.Current.Request.Params["view"] == null && !String.IsNullOrEmpty(listView) ){ BioLegend.Shared.WebUtility.Redirect(Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(GetGlobalValue("Global:Pageview.Url.Raw").ToString().Replace("/Default.aspx", "Default.aspx") + "?view=detail")); } //--- var loopProduct = GetLoop("Products"); string currentPageId = Pageview.Page.ID.ToString(); bool isWebserviceAvailable = TemplatesHelper.IsWebServiceConnectionAvailable(); var contentSearchPage = item["ContentSearchPage"]; // SORT BY string sortByName = "Name_sortable,Price"; string sortByClone = "CustomField_Clone,Name_sortable,Price"; string sortByMatch = "-_score,CustomField_Clone,Name_sortable,Price"; string sortByApplication = "AppAbrvString,Name_sortable,Price"; string sortByRegulatoryStatus = "CustomField_RegulatoryStatus,Name_sortable,Price"; string str_sortOrder = System.Web.HttpContext.Current.Request.Params["SortOrder"] ?? ""; string str_sortBy = System.Web.HttpContext.Current.Request.Params["SortBy"] ?? ""; string str_pageSize = System.Web.HttpContext.Current.Request.Params["PageSize"] ?? "25"; string str_keywordsParam = System.Web.HttpContext.Current.Request.Params["Keywords"] ?? ""; string str_k1 = System.Web.HttpContext.Current.Request.Params["k1"] ?? ""; string str_GeneIDParam = System.Web.HttpContext.Current.Request.Params["GeneID"] ?? ""; string str_SpecificityParam = System.Web.HttpContext.Current.Request.Params["Specificity"] ?? ""; string str_paramGroupID = System.Web.HttpContext.Current.Request.Params["groupid"] ?? ""; bool isASimpleSearch = (System.Web.HttpContext.Current.Request.QueryString.Count <=3 && !String.IsNullOrEmpty(str_keywordsParam) && !String.IsNullOrEmpty(str_k1)) || (System.Web.HttpContext.Current.Request.QueryString.Count <=2 && !String.IsNullOrEmpty(str_keywordsParam)); str_sortBy = str_sortBy.Replace("%2C",","); string str_FormatsParam = System.Web.HttpContext.Current.Request.Params["Format"] ?? ""; string str_CloneParam = System.Web.HttpContext.Current.Request.Params["Clone"] ?? ""; @functions{ 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 = "jpg", int num_compression = 75, 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/Lorenz/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 != "jpg" ? "&amp;Format=" + str_format : ""; string str_getImageCompression = num_compression != 75 ? "&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; } } } @if(loopProduct.Any() && isAValidSearch) { string groupLink = GetString("Ecom:Group:Field.LandingPageLink.Value.Clean"); string searchPageID = item["SearchResults"].ToString(); string detailPageID = item["ProductDetail"].ToString(); string detailPunchoutPageID = item["Punchout_ProductDetail"] != null ? item["Punchout_ProductDetail"].ToString() : ""; string liveSearchPage = item["LiveSearchPage"] != null ? item["LiveSearchPage"].ToString() : ""; string liveSearchPagePunchout = item["Punchout_LiveSearchPage"] != null ? item["Punchout_LiveSearchPage"].ToString() : ""; string addToCart = item["AddToCart"] != null ? item["AddToCart"].ToString() : ""; bool cartDisabled = Convert.ToBoolean(item["DisableAddToCart"].ToString()); string orderContext = item["OrderContext"] != null ? item["OrderContext"].ToString() : ""; bool isConnectionAvailable = GetBoolean("Item.Area.DisableCheckout.Value") || !TemplatesHelper.IsWebServiceConnectionAvailable() ? false : true; string inactiveButtonClass = isConnectionAvailable ? "addToCart" : "addToCart inactive"; string str_liveSearchFormat = System.Web.HttpContext.Current.Request.Params["Format"] ?? ""; string str_liveSearchReactivity = System.Web.HttpContext.Current.Request.Params["Reactivity"] ?? ""; string str_liveSearchCellType = System.Web.HttpContext.Current.Request.Params["CellType"] ?? ""; string str_liveSearchRegulatoryStatus = System.Web.HttpContext.Current.Request.Params["RegulatoryStatus"] ?? ""; string str_liveSearchProductType = System.Web.HttpContext.Current.Request.Params["ProductType"] ?? ""; string str_liveSearchApplications = System.Web.HttpContext.Current.Request.Params["Applications"] ?? ""; string str_liveSearchCompanyOld = System.Web.HttpContext.Current.Request.Params["CompanyOld"] ?? ""; string sortByNameSelected = str_sortBy == sortByName ? "sortActive" : ""; string sortByCloneSelected = (str_sortBy == sortByClone || str_sortBy == "" ) ? "sortActive" : ""; string sortByApplicationsSelected = str_sortBy == sortByApplication ? "sortActive" : ""; string sortByRegulatoryStatusSelected = str_sortBy == sortByRegulatoryStatus ? "sortActive" : ""; string colGroup = (!cartDisabled ? "col-xs-offset-7" : "col-xs-offset-7"); var prodLoop = loopProduct.Where(x => !string.IsNullOrWhiteSpace(x.GetString("Ecom:Product.Number"))).GroupBy(x => x.GetString("Ecom:Product.ID")).ToList(); var prodLoopCount = prodLoop.Count; // -------------------- string str_imagesFolder = "/Files/Files/BioLegend/Products/"; string navEnvironment = item["NavEnvironment"] != null ? item["NavEnvironment"].ToString() : ""; string str_pagingHref = ""; bool bol_userLogged = Pageview.User.LoggedIn; string siteCurrency = Dynamicweb.Frontend.PageView.Current().Area.get_Value("AreaEcomCurrencyID").ToString(); string userCurrency = bol_userLogged ? Dynamicweb.Modules.UserManagement.User.GetCurrentUser().Currency : siteCurrency; Dictionary<string, string> productTypes = new Dictionary<string, string>(); productTypes.Add("AncillaryProducts", "Ancillary"); productTypes.Add("BuffersSolutionsChemicals", "Ancillary"); productTypes.Add("CellBiologyAntibodies", "PrimaryAntibodies"); productTypes.Add("CellSeparation", "MojoSort"); productTypes.Add("CytokineChemokineAntibodies", "PrimaryAntibodies"); productTypes.Add("ELISAMAXLEGENDMAX", "ELISA"); productTypes.Add("EpitopeTagProducts", "PrimaryAntibodies"); productTypes.Add("HumanImmunologyAntibodies", "PrimaryAntibodies"); productTypes.Add("IsotypeControls", "IsotypeControls"); productTypes.Add("LEGENDplex", "LEGENDplex"); productTypes.Add("LEGENDScreen", "LEGENDScreen"); productTypes.Add("MarmosetImmunologyAntibodies", "PrimaryAntibodies"); productTypes.Add("MouseImmunologyAntibodies", "PrimaryAntibodies"); productTypes.Add("NeuroscienceProducts", "PrimaryAntibodies"); productTypes.Add("RatImmunologyAntibodies", "PrimaryAntibodies"); productTypes.Add("RecombinantProteins", "Recombinant"); productTypes.Add("SecondaryReagents", "SecondaryReagents"); productTypes.Add("VirusImmunologyAntibodies", "PrimaryAntibodies"); productTypes.Add("EnzymeAssays", "EnzymeAssays"); productTypes.Add("FlexT", "FlexT"); productTypes.Add("NonAntibodyChemicalProbes", "NonAntibodyChemicalProbes"); int pageCal = 0; string previousElement = ""; string longLang = (string)GetGlobalValue("Global:Area.LongLang"); var loop_productList3 = GetLoop("Ecom:ProductList.Pages3"); int itemsCount = 0; // Helpers to verify variants at the same product in a different page @helper ShowTextAboutMoreOptionsInPreviousOrNextPages(List<LoopItem> loopProduct, bool isToPageBefore = false) { if(loopProduct.Any()) { string countVariantsWithSameProdId = string.Empty; string countTotalOfVariantsForProd = string.Empty; string translateText = string.Empty; string positionClass = "moreVariantsBefore"; if(isToPageBefore) { countVariantsWithSameProdId = loopProduct.Where(p => p.GetString("Ecom:Product.ID") == loopProduct.First().GetString("Ecom:Product.ID")).Count().ToString(); countTotalOfVariantsForProd = loopProduct.Select(p => p.GetString("Ecom:Product.ActiveVariantCount")).First().ToString(); translateText = Translate("SeeMoreSizeOptionsForThisProductOnThePreviousPage","See more size options for this product on the previous page."); } else { countVariantsWithSameProdId = loopProduct.Where(p => p.GetString("Ecom:Product.ID") == loopProduct.Last().GetString("Ecom:Product.ID")).Count().ToString(); countTotalOfVariantsForProd = loopProduct.Select(p => p.GetString("Ecom:Product.ActiveVariantCount")).Last().ToString(); translateText = Translate("SeeMoreSizeOptionsForThisProductOnTheNextPage","See more size options for this product on the next page."); positionClass = "moreVariantsNext"; } if(countVariantsWithSameProdId != countTotalOfVariantsForProd) { <div class="@positionClass col-xs-12">@translateText</div> } } } if(!String.IsNullOrWhiteSpace(groupLink)) { BioLegend.Shared.WebUtility.Redirect(groupLink); } else if(prodLoopCount == 1 && GetInteger("Ecom:ProductList.CurrentPage") == 1 && !string.IsNullOrWhiteSpace(str_keywordsParam) && isASimpleSearch) { string frienldyHref = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(String.Format("Default.aspx?ID={0}&ProductID={1}",detailPageID,prodLoop[0].Key.ToString())); BioLegend.Shared.WebUtility.Redirect(frienldyHref); } else { <div class='col-xs-12 noPadding'> <div class="pull-left noPadding" id="moreInfo"> <button class='btn-primary viewOption default @(string.IsNullOrWhiteSpace(listView) ? "active" : "")'>@Translate("listView","List View")</button> <button class='btn-primary viewOption @(!string.IsNullOrWhiteSpace(listView) ? "active" : "")'>@Translate("detailView","Detail View")</button> @if(!string.IsNullOrWhiteSpace(str_keywordsParam)){ <button class='btn-primary' id="searchForContent" onClick="searchForContent();" data-searchpageID="@contentSearchPage">@Translate("contentPagesBTNText","Find Content Pages")</button> } </div> <div class="noPadding"><hr id="searchButtonDivider" /></div> </div> bool bol_noResults = false; var requestParams = System.Web.HttpContext.Current.Request.Params; string str_groupID = !string.IsNullOrEmpty(requestParams["GroupID"]) ? requestParams["GroupID"].ToString() : ""; string str_price = !string.IsNullOrEmpty(requestParams["Price"]) ? requestParams["Price"] : "" ; string str_clone = !string.IsNullOrEmpty(requestParams["Clone"]) ? requestParams["Clone"] : "" ; string str_keywords = !string.IsNullOrEmpty(requestParams["Keywords"]) ? requestParams["Keywords"] : "" ; string DateReleasedMin = !string.IsNullOrEmpty(requestParams["DateReleasedMin"]) ? requestParams["DateReleasedMin"] : "" ; string DateReleasedMax = !string.IsNullOrEmpty(requestParams["DateReleasedMax"]) ? requestParams["DateReleasedMax"] : "" ; string view = !string.IsNullOrEmpty(requestParams["view"]) ? requestParams["view"] : "" ; var lst_parameters = GetLoop("Query.Parameters"); var loopFacetGroups = GetLoop("FacetGroups"); /* Workaround due a DW bug */ Dictionary<string, string> applicationsData = GetFilterData("BLFD_1"); Dictionary<string, string> formatsData = GetFilterData("BLFDF_1"); /* END Workaround */ if(loopFacetGroups.Any()) { <div class="col-xs-2 noPadding"> <div class="headerBox filtersHead col-xs-12 noPadding"> <span class='title'>@Translate("filterYourResults", "Filter your results")</span> </div> <form id="filtersForm" action="/Default.aspx" class="col-xs-12 noPaddingLeft productSearchFilters"> <input type="hidden" name="ID" value="@Pageview.Page.ID" /> <input type="hidden" name="SortBy" value="@str_sortBy" /> <input type="hidden" name="PageSize" value="@str_pageSize" /> @hiddenField("Keywords", str_keywords) @hiddenField("Clone", str_clone) @if(string.IsNullOrEmpty(requestParams["p1"])){ for(var k = 1; k < 12; k++){ @hiddenField("k" + k, !string.IsNullOrEmpty(requestParams["k" + k]) ? requestParams["k" + k] : "") } } else { for(var p = 1; p < 12; p++){ @hiddenField("p" + p, !string.IsNullOrEmpty(requestParams["p" + p]) ? requestParams["p" + p] : "") } } @hiddenField("sortOrder", str_sortOrder) @hiddenField("GroupID", str_paramGroupID) @hiddenField("GeneID", str_GeneIDParam) @hiddenField("Specificity", str_SpecificityParam) @hiddenField("DateReleasedMin", DateReleasedMin) @hiddenField("DateReleasedMax", DateReleasedMax) <input type="hidden" name="view" value="@view" /> @if(item["ExploreNewProducts"].ToString() == Pageview.Page.ID.ToString()){ string currentMonth = DateTime.Today.ToString("MM"); string monthParameter = requestParams["month"] != null ? requestParams["month"].ToString() : ""; <fieldset> <label>@Translate("Month", "Month")</label> <div class="filtersContainer"> <label class="radioBoxContainer" for="@currentMonth"><input class="month" data-min='@String.Format("{0}-{1}-01", DateTime.Today.Year, DateTime.Today.Month)' data-max='@String.Format("{0}-{1}-{2}", DateTime.Today.Year, DateTime.Today.Month, DateTime.DaysInMonth(DateTime.Today.Year, DateTime.Today.Month))' @( monthParameter == currentMonth ? "checked='checked'" : "") type="radio" value="@currentMonth" id="@currentMonth" name="month"> <span>@DateTime.Today.ToString("MMMM")</span></label> </div> @for(var i=1; i < 6; i++ ){ string month = DateTime.Today.AddMonths(-i).ToString("MMMM"); string monthNumeric = DateTime.Today.AddMonths(-i).ToString("MM"); <div class="filtersContainer"> <label class="radioBoxContainer" for="@month"> <input class="month" data-min='@String.Format("{0}-{1}-01", DateTime.Today.AddMonths(-i).Year, DateTime.Today.AddMonths(-i).Month)' data-max='@String.Format("{0}-{1}-{2}", DateTime.Today.AddMonths(-i).Year, DateTime.Today.AddMonths(-i).Month, DateTime.DaysInMonth(DateTime.Today.AddMonths(-i).Year, DateTime.Today.AddMonths(-i).Month))' @( monthParameter == monthNumeric ? "checked='checked'" : "") type="radio" value="@monthNumeric" id="@month" name="month"> <span>@month</span> </label> </div> } </fieldset> } @foreach (LoopItem g in loopFacetGroups) { foreach (LoopItem i in g.GetLoop("Facets")) { string str_parameterType = lst_parameters.Where(x => x.GetString("Parameter.Name") == i.GetString("Facet.QueryParameter")).FirstOrDefault().GetString("Parameter.Type"); string str_templateOutput = "string"; if(str_parameterType.Contains("[]")){ switch (i.GetString("Facet.Name")) { case "fieldName": str_templateOutput = "multiselect"; break; default: str_templateOutput = "checkboxes"; 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(!String.IsNullOrWhiteSpace(i.GetString("Facet.OptionCount"))) { switch (i.GetString("Facet.Name")) { case "fieldName": str_templateOutput = "select"; break; case "fieldName2": str_templateOutput = "radios"; break; case "fieldName3": str_templateOutput = "multiselect"; break; case "fieldName4": str_templateOutput = "text"; break; default: str_templateOutput = "checkboxes"; break; } } else { switch (i.GetString("Facet.Name")) { case "fieldName": str_templateOutput = "autocomplete"; break; default: str_templateOutput = "text"; break; } } @field(i, str_parameterType, str_templateOutput, bol_noResults, applicationsData, formatsData) } } </form> </div> @helper hiddenField(string name, string value){ if(value != "") { <input type="hidden" name="@name" value="@value" /> } } @helper field(LoopItem i , string str_parameterType, string str_templateOutput, bool bol_noResults, Dictionary<string, string> applicationsData, Dictionary<string, string> formatsData ) { string str_parameter = i.GetString("Facet.QueryParameter"); string str_name = i.GetString("Facet.Name"); var facetOptions = i.GetLoop("FacetOptions"); if(bol_noResults){ facetOptions = facetOptions.OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label")).ToList(); } else{ facetOptions = facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).OrderBy(o => o.GetString("FacetOption.Label")).ToList(); } switch (str_templateOutput) { case "multiselect": if(facetOptions.Any()) { <fieldset> <legend>@str_name</legend> <select data-selected-text-format="count" data-live-search="true" data-size="8" name="@str_parameter" multiple> @foreach(LoopItem option in facetOptions.OrderByDescending(o => o.GetInteger("FacetOption.Label"))) { bool bol_checked = option.GetBoolean("FacetOption.Selected"); string str_value = option.GetString("FacetOption.Value"); <option selected="@bol_checked" value="@str_value">@option.GetString("FacetOption.Label")</option> } </select> </fieldset> } break; case "checkboxes": string extraClass = ( i.GetString("Facet.QueryParameter").Equals("ExcitationLaser") || i.GetString("Facet.QueryParameter").Equals("Isotype") ) ? "noCapitalize" : ""; string inputID = i.GetString("Facet.QueryParameter") + "Search"; string inputDivID = i.GetString("Facet.QueryParameter") + "Div"; if(facetOptions.Any()) { int count = 0; <fieldset data-type="@str_parameterType"> @if(facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).Count() > 0) { <legend class="filterTitle seeMoreProducts" data-parameter='@i.GetString("Facet.QueryParameter")'>@str_name</legend> } else{ <legend class="filterTitle">@str_name</legend> } <div class="filtersContainer @extraClass hide" id="@inputDivID"> @if(facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).Count() > 9) { <div class="searchFilterContainer"> <span class="fa fa-search"></span> <input class="searchFilterSearchBar" id="@inputID" onkeyup="filterSearchFilterOptions('@inputID','@inputDivID');" > </div> } @foreach(LoopItem option in facetOptions) { bool bol_checked = option.GetBoolean("FacetOption.Selected"); string str_value = option.GetString("FacetOption.Value"); if(bol_checked){ Dictionary<string, string> breadcrumbSourceTemp = new Dictionary<string, string>(); string thisFilter = @i.GetString("Facet.QueryParameter") + str_value; breadcrumbSourceTemp.Add("val",str_value); breadcrumbSourceTemp.Add("label",@option.GetString("FacetOption.Label")); breadcrumbSourceTemp.Add("filter",@i.GetString("Facet.QueryParameter")); breadcrumbSource.Add(thisFilter,breadcrumbSourceTemp); } count++; //string str_class = count > 5 ? "hide" : ""; <label class="checkBoxContainer"><input checked="@bol_checked" type="checkbox" value="@str_value" name="@str_parameter"> <span> @if(str_name == "Applications" && applicationsData.ContainsKey(str_value) ){ @applicationsData[str_value] } else if (str_name == "Format" && formatsData.ContainsKey(str_value) ){ @formatsData[str_value] } else { @option.GetString("FacetOption.Label") } @if(option.GetInteger("FacetOption.Count") > 0) { @String.Format("({0})", option.GetString("FacetOption.Count")); } </span> </label> } </div> </fieldset> } break; case "select": 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" : ""; if(str_value == "True") { <legend class="filterTitle">@str_name</legend> <div class="filtersContainer"> <label class="checkBoxContainer"><input checked="@bol_checked" type="checkbox" value="@str_value" name="@str_parameter"> <span>@str_name (@option.GetString("FacetOption.Count"))</span></label> </div> } } </fieldset> } break; case "radio": break; case "radios": break; case "autocomplete": break; default: <fieldset data-type="@str_parameterType"> <legend class="filterTitle">@str_name</legend> <div class="filtersContainer"> <input type="text" name="@str_parameter" value="" /> </div> </fieldset> break; } } } @functions{ public Dictionary<string, Dictionary<string, string>> breadcrumbSource = new Dictionary<string, Dictionary<string, string>>(); public string GetApplicationsLabel(string applicationValues, Dictionary<string, string> applicationsData){ applicationValues = applicationValues.Replace("\"","").Replace(",",", "); /* string[] applicationsList = applicationValues.Split(','); applicationValues = ""; foreach(var app in applicationsList){ if(applicationsData.ContainsKey(app)) { applicationValues += !String.IsNullOrEmpty(applicationValues) ? ", " : ""; applicationValues += applicationsData[app]; } } */ return applicationValues; } public Dictionary<string, string> GetFilterData(string fieldID) { //HttpContext.Current.Cache.Remove("applicationsDataCache_" + fieldID); var applicationCache = HttpContext.Current.Cache["applicationsDataCache_" + fieldID]; Dictionary<string, string> applicationsData = applicationCache as Dictionary<string, string> ?? new Dictionary<string, string>(); if(applicationCache == null) { using(var connection = Dynamicweb.Database.CreateConnection()) { using(var command = connection.CreateCommand()) { command.CommandText = "SELECT FieldOptionValue,FieldOptionName FROM EcomFieldOption WHERE FieldOptionFieldID=''+@fieldID+'' ORDER BY FieldOptionValue"; command.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "fieldID", SqlDbType = System.Data.SqlDbType.NVarChar, Value = fieldID }); using(var reader = command.ExecuteReader()) { if(reader != null) { while (reader.Read()) { applicationsData.Add(reader["FieldOptionValue"].ToString(), reader["FieldOptionName"].ToString()); } } } } } HttpContext.Current.Cache.Insert("applicationsDataCache_" + fieldID, applicationsData, null, DateTime.Now.AddMinutes(5), System.Web.Caching.Cache.NoSlidingExpiration); } return applicationsData; } } <div class='col-xs-10 productArea noPaddingRight @(listView == "detailedView" ? "detailedView" : "" )'> @{ string groupDescription = GetString("Ecom:Group.Description"); int loopProductCount = loopProduct.Count; int totalProductCount = GetInteger("Ecom:ProductList.PageProdCnt"); int startLoopProductCount = (loopProductCount * (GetInteger("Ecom:ProductList.CurrentPage") - 1)) + 1; int endLoopProductCount = loopProductCount * GetInteger("Ecom:ProductList.CurrentPage"); if(loopProductCount < GetInteger("Ecom:ProductList.PageSize")){ startLoopProductCount = (GetInteger("Ecom:ProductList.PageSize") * (GetInteger("Ecom:ProductList.CurrentPage") - 1)) + 1; endLoopProductCount = totalProductCount; } } @if(!String.IsNullOrWhiteSpace(groupDescription)) { <div id="groupDescription" class="col-xs-12 noPadding"> @groupDescription </div> } <span class="productListResume col-xs-3 noPadding"> @Translate("productListCount","{{numberProducts}} of {{countAllProducts}} items").Replace("{{numberProducts}}", String.Format("{0}-{1}", startLoopProductCount, endLoopProductCount)).Replace("{{countAllProducts}}", totalProductCount.ToString()) </span> <form id="orderProdList" class="col-xs-3 noPadding" action="/Default.aspx" name="ExtUserForm_Main" method="GET"> <input type="hidden" name="ID" value='@Pageview.Page.ID'> @if(!string.IsNullOrWhiteSpace(str_paramGroupID)) { <input type="hidden" name="GroupID" value='@str_paramGroupID'> } @if(!string.IsNullOrWhiteSpace(str_keywordsParam)) { <input type="hidden" name="Keywords" value='@str_keywordsParam'> } @if(!string.IsNullOrWhiteSpace(str_GeneIDParam)) { <input type="hidden" name="GeneID" value='@str_GeneIDParam'> } @if(!string.IsNullOrWhiteSpace(str_SpecificityParam)) { <input type="hidden" name="Specificity" value='@str_SpecificityParam'> } <fieldset class="col-xs-12 noPadding" data-groupdID="@str_paramGroupID"> <label>@Translate("Sort by"):</label> <select id="sortSelect" name="SortBy"> <option selected='@(str_sortBy == "")' value="@sortByMatch">@Translate("Match","Best Match")</option> <option selected='@(str_sortBy == sortByName)' value="@sortByName">@Translate("Name")</option> <option selected='@(str_sortBy == sortByClone)' value="@sortByClone">@Translate("Clone","Clone")</option> <option selected='@(str_sortBy == sortByApplication )' value="@sortByApplication">@Translate("Applications","Applications")</option> <option selected='@(str_sortBy == sortByRegulatoryStatus)' value="@sortByRegulatoryStatus">@Translate("RegulatoryStatus","Regulatory Status")</option> </select> </fieldset> </form> @{ string str_nextPage = GetString("Ecom:ProductList.NextPage"); int num_totalPages = GetInteger("Ecom:ProductList.TotalPages"); int num_curPage = System.Web.HttpContext.Current.Request.Params["PageNum"] != null ? Convert.ToInt32(System.Web.HttpContext.Current.Request.Params["PageNum"].ToString()) : 1; string prevPageClean = GetString("Ecom:ProductList.PrevPage.Clean"); string nextPageClean = GetString("Ecom:ProductList.NextPage.Clean"); } @if(num_totalPages > 1) { string getGlobalRequest = GetGlobalValue("Global:Request.Url"); <ul class="pagination col-xs-5 pull-right"> @if(!string.IsNullOrWhiteSpace(prevPageClean)) { <li class="previous"><a href='@prevPageClean'><i class="fa fa-angle-left"></i> @Translate("Previous")</a></li> } @if(num_curPage > 2 && num_totalPages > 3){ for(int i=1;i <= 1;i++){ string str_active = num_curPage == i ? "class=\"active\"" : ""; str_pagingHref = getGlobalRequest.Contains("PageNum") ? getGlobalRequest.Replace("PageNum="+num_curPage, "PageNum=" + i ) : getGlobalRequest + "&PageNum=" + i; <li @str_active><a href="@str_pagingHref">@i</a></li> } if(num_totalPages > 4 && num_curPage != 3 ) { <li class="etc"><span>...</span></li> } } @foreach (LoopItem i in loop_productList3) { if(i.GetBoolean("Ecom:ProductList.Pages3.Page.IsCurrent")) { <li class="active"><a href="@i.GetString("Ecom:ProductList.Pages3.Page.UrlHtmlEncoded")">@i.GetString("Ecom:ProductList.Pages3.Page.Number")</a></li> } else { <li><a href="@i.GetString("Ecom:ProductList.Pages3.Page.UrlHtmlEncoded")">@i.GetString("Ecom:ProductList.Pages3.Page.Number")</a></li> } } @if(num_curPage < num_totalPages-1 && num_totalPages > 3){ if(num_totalPages > 4) { <li class="etc"><span>...</span></li> } for(int i=num_totalPages;i <= num_totalPages;i++){ string str_active = num_curPage == i ? "class=\"active\"" : ""; str_pagingHref = getGlobalRequest.Contains("PageNum") ? getGlobalRequest.Replace("PageNum="+num_curPage, "PageNum="+i) : getGlobalRequest + "&PageNum=" + i; <li @str_active><a href="@str_pagingHref">@i</a></li> } } @if(!string.IsNullOrWhiteSpace(nextPageClean)) { <li class="next"><a href='@nextPageClean'>@Translate("Next") <i class="fa fa-angle-right"></i></a></li> } </ul> } @helper Truncate(string str_input,int num_length) { if(str_input.Length <= num_length){ @str_input }else{ @str_input.Substring(0,num_length)<text>...</text> } } <div class="col-xs-12"> @{ string keywordlessURL = String.Format("/Default.aspx?ID={0}", searchPageID); string breadcrumbEntry = ""; foreach(KeyValuePair<string, Dictionary<string, string>> entryOuter in breadcrumbSource) { Dictionary<string, string> thisItem = new Dictionary<string, string>(); foreach(KeyValuePair<string, string> entryMiddle in entryOuter.Value) { thisItem.Add(entryMiddle.Key, entryMiddle.Value); } string filterURL = String.Format("/Default.aspx?ID={0}&{1}={2}", searchPageID,thisItem["filter"],thisItem["val"]); string thisBreadcrumbEntry = String.Format("<a href=\"{0}\">{1}</a> <a href=\"javascript:uncheckFilter('{2}','{3}')\"><i class=\"fa fa-times-circle\"></i></a> <text>/</text>", filterURL,thisItem["label"],thisItem["val"],thisItem["filter"]); breadcrumbEntry += thisBreadcrumbEntry; keywordlessURL += String.Format("&{0}={1}", thisItem["filter"],thisItem["val"]); } if(!String.IsNullOrEmpty(str_keywordsParam)) { @str_keywordsParam <a href="@keywordlessURL"><i class="fa fa-times-circle"></i></a> <text>/</text> } if(!String.IsNullOrEmpty(str_CloneParam)) { @str_CloneParam <a href="@keywordlessURL"><i class="fa fa-times-circle"></i></a> <text>/</text> } if(!String.IsNullOrEmpty(str_SpecificityParam)) { @str_SpecificityParam <a href="@keywordlessURL"><i class="fa fa-times-circle"></i></a> <text>/</text> } @breadcrumbEntry } </div> <ul id="productsHolder" class="productList col-xs-12 noPadding"> <li class="col-xs-12 noPadding"> <div class="col-xs-3 @sortByNameSelected"> @Translate("Product","Product") </div> <div class='@(!cartDisabled ? "col-xs-2" : "col-xs-2") noPadding @sortByCloneSelected'> @Translate("Clone","Clone") </div> <div class="col-xs-1 noPadding @sortByApplicationsSelected"> @Translate("Appl","Appl.") </div> <div class="col-xs-1 @sortByRegulatoryStatusSelected"> @Translate("Reg","Reg") </div> <div class='@(!cartDisabled ? "col-xs-5" : "col-xs-5") noPadding'> <div class='@(!cartDisabled ? "col-xs-3" : "col-xs-4") noPadding'> @Translate("categoryNumberShort","Cat#") </div> <div class='@(!cartDisabled ? "col-xs-3" : "col-xs-4") noPadding'> @Translate("size","Size") </div> @if(!cartDisabled) { <div class="col-xs-2 noPadding"> @Translate("price","Price") </div> <div class="col-xs-1 noPadding"> @Translate("quantityHeader","Quantity") </div> } </div> </li> @foreach (var group in prodLoop){ itemsCount++; <li class="col-xs-12" > @if(itemsCount == 1) { @ShowTextAboutMoreOptionsInPreviousOrNextPages(loopProduct, true) } <ul> @foreach (var product in group) { string str_productName = product.GetString("Ecom:Product.Name"); string str_productID = product.GetString("Ecom:Product.ID"); string str_link = product.GetString("Ecom:Product.Link.Clean"); bool excludeAB = product.GetBoolean("Ecom:Product:Field.ExcludeAB.Value"); string productType = product.GetString("Ecom:Product:Field.CMProductType.Value"); string regulatoryStatus = product.GetString("Ecom:Product:Field.RegulatoryStatus.Value"); string productClone = Regex.Replace(product.GetString("Ecom:Product:Field.Clone.Value"), "<!.*?>", String.Empty , RegexOptions.Singleline).Trim(); string productReactivity = product.GetString("Ecom:Product:Field.Reactivity.Value"); string str_starClass = ""; string str_halfStar = ""; string str_productImage = product.GetString("Ecom:Product.ImageSmall.Clean"); string str_productImageMedium = product.GetString("Ecom:Product.ImageMedium.Clean"); string str_productImageLarge = product.GetString("Ecom:Product.ImageLarge.Clean"); string str_productImage4 = product.GetString("Ecom:Product:Field.Image4Path.Value.Clean"); string str_productGetImage = GetImage(str_productImage, 140, 0, 0, 0, 0, 0,"jpg",90); string str_productGetImageMedium = GetImage(str_productImageMedium, 140, 0, 0, 0, 0, 0,"jpg",90); string str_productGetImageLarge = GetImage(str_productImageLarge, 140, 0, 0, 0, 0, 0,"jpg",90); string str_productGetImage4 = GetImage(str_productImage4, 140, 0, 0, 0, 0, 0,"jpg",90); string str_image1Description = product.GetString("Ecom:Product:Field.Image1Description.Value"); string str_image2Description = product.GetString("Ecom:Product:Field.Image2Description.Value"); string str_image3Description = product.GetString("Ecom:Product:Field.Image3Description.Value"); string str_image4Description = product.GetString("Ecom:Product:Field.Image4Description.Value"); string str_image1Title = product.GetString("Ecom:Product:Field.Image1Title.Value"); string str_image2Title = product.GetString("Ecom:Product:Field.Image2Title.Value"); string str_image3Title = product.GetString("Ecom:Product:Field.Image3Title.Value"); string str_image4Title = product.GetString("Ecom:Product:Field.Image4Title.Value"); string str_productImage5 = product.GetString("Ecom:Product:Field.Image5Path.Value.Clean"); string str_productGetImage5 = GetImage(str_productImage5, 140, 0, 0, 0, 0, 0,"jpg",90); string str_image5Description = product.GetString("Ecom:Product:Field.Image5Description.Value"); string str_image5Title = product.GetString("Ecom:Product:Field.Image5Title.Value"); string str_productImage6 = product.GetString("Ecom:Product:Field.Image6Path.Value.Clean"); string str_productGetImage6 = GetImage(str_productImage6, 140, 0, 0, 0, 0, 0,"jpg",90); string str_image6Description = product.GetString("Ecom:Product:Field.Image6Description.Value"); string str_image6Title = product.GetString("Ecom:Product:Field.Image6Title.Value"); string str_productFormat = product.GetString("Ecom:Product:Field.Format.Value"); string stockUS = !string.IsNullOrWhiteSpace(product.GetString("Ecom:Product:Field.StockUS.Value.Clean")) ? product.GetString("Ecom:Product:Field.StockUS.Value.Clean") : "0"; string stockUK = !string.IsNullOrWhiteSpace(product.GetString("Ecom:Product:Field.StockUK.Value.Clean")) ? product.GetString("Ecom:Product:Field.StockUK.Value.Clean") : "0"; string stockControl = product.GetString("Ecom:Product:Field.StockControl.Value.Clean"); bool isComingSoon = product.GetBoolean("Ecom:Product:Field.ComingSoon.Value"); string DCSoon = product.GetString("Ecom:Product:Field.DCSoon.Value"); bool blockAddToCart = product.GetBoolean("Ecom:Product:Field.BlockAddToCart.Value"); string blockAddToCartText = product.GetString("Ecom:Product:Field.BlockAddToCartText.Value"); blockAddToCartText = blockAddToCartText.Replace("'", "&apos;"); blockAddToCartText = blockAddToCartText.Replace("\r\n", ""); blockAddToCartText = blockAddToCartText.Replace("\r", ""); blockAddToCartText = blockAddToCartText.Replace("\n", ""); List<Tuple<string,string,string>> lst_images = new List<Tuple<string,string,string>>(); if(!String.IsNullOrEmpty(str_productImage)) { lst_images.Add(new Tuple<string, string, string>(str_productImage,str_image1Title,str_image1Description)); } if(!String.IsNullOrEmpty(str_productImageMedium)) { lst_images.Add(new Tuple<string, string, string>(str_productImageMedium,str_image2Title,str_image2Description)); } if(!String.IsNullOrEmpty(str_productImageLarge)) { lst_images.Add(new Tuple<string, string, string>(str_productImageLarge,str_image3Title,str_image3Description)); } if(!String.IsNullOrEmpty(str_productImage4)) { lst_images.Add(new Tuple<string, string ,string>(str_productImage4,str_image4Title,str_image4Description)); } if(!String.IsNullOrEmpty(str_productImage5)) { lst_images.Add(new Tuple<string, string ,string>(str_productImage5,str_image5Title,str_image5Description)); } if(!String.IsNullOrEmpty(str_productImage6)) { lst_images.Add(new Tuple<string, string ,string>(str_productImage6,str_image6Title,str_image6Description)); } string str_productVariantID = product.GetString("Ecom:Product.VariantID"); string urlAction = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + addToCart); string productFieldType = ""; if (productTypes.ContainsKey(productType)) { productFieldType = productTypes[productType]; } int productStatus = product.GetInteger("Ecom:Product:Field.ProductStatus.Value.Clean"); string productSource = product.GetString("Ecom:Product:Field.ProductSource.Value.Clean"); int productVariantStatus = product.GetInteger("Ecom:Product:Field.ProductStatus.Value.Clean"); @functions { public string CalculateProductName(string prodName, string prodType, string prodFormat, bool excludeAntibody) { string cleanName = prodName; if(prodType.Equals("PrimaryAntibodies") && !prodName.Contains(" Antibody") && !prodName.Contains("Buffer") && !prodName.Contains("Annexin") && !prodName.Contains("Solution") && !prodName.Contains("Diluent") && !prodName.Contains("Substrate Reagent") && !prodName.Contains("ecombinant") && !prodName.Contains("Panel") && !prodName.Contains("Elisa Max") && !prodName.Contains("Cocktail") && !prodName.Contains("Isotype Control") && !prodName.Contains("Avidin") && !prodName.Contains("Normal Serum Block") && !prodName.Contains("Detection Kit") && !prodName.Contains("Affinity") && !prodName.Contains("ELISA Kit") && !prodName.Contains("Phase-Flow") && !prodName.Contains("Treg Flow") && !prodFormat.Equals("Peptide") && (!excludeAntibody)){ cleanName += " Antibody"; } if(prodType.Equals("SecondaryReagents") && !prodName.Contains(" Antibody") && !prodName.Contains("Streptavidin") && !prodName.Contains("Avidin") && (!excludeAntibody)){ cleanName += " Antibody"; } if(prodType.Equals("IsotypeControls") && !prodName.Contains(" Antibody") && !prodName.Contains("Lineage Cocktail") && (!excludeAntibody)){ cleanName += " Antibody"; } return cleanName; } } str_productName = CalculateProductName(str_productName,productFieldType,str_productFormat,excludeAB); <li class="row list" data-variantID="@str_productVariantID"> @if(previousElement != str_productID) { <h2 class="col-xs-3"> <a itemprop="name" href="@str_link"> @str_productName </a> </h2> <div class='@(!cartDisabled ? "col-xs-2" : "col-xs-2") noPaddingLeft'> @if(!String.IsNullOrEmpty(productClone)){ <a href="/Default.aspx?ID=@searchPageID&amp;Clone=@(System.Web.HttpUtility.HtmlDecode(productClone))"><i class="bl bl-cloneIcon" data-toggle="tooltip" title="@productReactivity"></i>@productClone</a> }else if(!String.IsNullOrWhiteSpace(productReactivity)) { <a href="javascript:void(0);"><i class="bl bl-cloneIcon" data-toggle="tooltip" title="@productReactivity"></i></a> } </div> <div class="col-xs-1 noPadding wordWrap"> <a href="@LocalizeLinksHTML("dwcountry/abbreviations")" target="_blank" title='@Translate("ViewAbbreviationDescriptions","View abbreviation descriptions")'> @GetApplicationsLabel(product.GetString("Ecom:Product:Field.AppAbrv.Value"), applicationsData) </a> </div> <div class="col-xs-1"> @if(!String.IsNullOrWhiteSpace(regulatoryStatus)){ @regulatoryStatus }else{ <text>--</text> } </div> } <div class='@(!cartDisabled ? "col-xs-5" : "col-xs-5") noPadding @(previousElement == str_productID ? colGroup : "")'> <form name="addToCart" class="add-to-cart col-xs-12 noPadding" action="@urlAction" method="POST"> @if(bol_userLogged) { <input type="hidden" name="redirect" value="false"/> } <input type="hidden" name="cartcmd" value="add"/> <input type="hidden" name="productid" value="@str_productID"/> <input type="hidden" name="variantID" value="@str_productVariantID" /> @if(!string.IsNullOrWhiteSpace(orderContext)) { <input type="hidden" name="OrderContext" value="@orderContext" /> } @if((longLang.Equals("ja-JP") && regulatoryStatus.Equals("IVD")) || (longLang.Equals("ja-JP") && str_productID.Equals("11573")) ){ <div class='@(!cartDisabled ? "col-xs-2" : "col-xs-4") noPadding'> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div> } else{ <div class='@(!cartDisabled ? "col-xs-3" : "col-xs-4") noPadding'> @if (!isComingSoon) { @product.GetString("Ecom:Product.Number") } else { @Translate("comingSoon", "Coming Soon") } </div> } <div class='@(!cartDisabled ? "col-xs-3" : "col-xs-4") noPadding'> @product.GetString("Ecom:Product.VariantText") </div> <div class='@(!cartDisabled ? "col-xs-2" : "col-xs-4") noPadding'> @if(longLang.Equals("ja-JP") && str_productFormat.Contains("GOINVIVO") && !str_productVariantID.Equals("5mg")) { @Translate("PleaseContactUs","Please Contact Us") } else if(str_productID.Equals("10801") && !longLang.Equals("en-US")) { @Translate("addToCartForPrice","Add to cart for price.") } else if(str_productName.Contains("Flex-T") && str_productName.Contains("Custom")){ } else if((longLang.Equals("ja-JP") && regulatoryStatus.Equals("IVD")) || (longLang.Equals("ja-JP") && str_productID.Equals("11573")) ){ } else{ var unitPrice = Math.Round((product.GetDouble("Ecom:Product.Price.PricePIP") * 0.01), 2); <span class="withBreak" itemprop="price">@RoundPrice(unitPrice, false)</span> } </div> @if(!cartDisabled && !(str_productName.Contains("Flex-T") && str_productName.Contains("Custom"))) { <div class="col-xs-1 noPadding"> @if (!productVariantStatus.Equals(3) && !isComingSoon && !blockAddToCart) { <input data-reservedStock='@product.GetString("Ecom:Product.AvailableAmount")' data-productStatus="@productStatus" data-stockControl='@stockControl.ToLower()' data-stocktranslate='@Translate("currentStock","The current stock is")' data-stock='@( navEnvironment.Equals("US") ? stockUS : stockUK)' type="text" name="quantity" value="1" size="3" class="productQTYRequestBox" /> } </div> <div class="col-xs-1"> @if(blockAddToCart) { <button onClick="alert('@blockAddToCartText'); return false;" title="@blockAddToCartText"><i class="fa fa-times-circle"></i></button> } else { if(str_productName.Contains("Capture Bead") || (str_productName.Contains("LEGENDplex") && (str_productName.Contains("Standard") || str_productName.Contains("Detection Antibodies") || str_productName.Contains("Buffer Set")))) { <button onClick="mixMatchProductRedirect(); return false;" title="@Translate("mixAndMatch","Mix & Match")"><i class="fa fa-shopping-cart"></i></button> } else if(str_productName.Contains("Flex-T") && str_productName.Contains("Custom")){ } else if((longLang.Equals("ja-JP") && regulatoryStatus.Equals("IVD")) || (longLang.Equals("ja-JP") && str_productID.Equals("11573"))){ } else{ if (isComingSoon) { @:&nbsp; } else if(userCurrency != siteCurrency){ <span class="inputSubmit" data-toggle="tooltip" title="@(Translate("CurrencyMissmatch","Your currency does not match the websites currency. Please navigate to the proper page."))"> <button type="submit" disabled><i class="fa fa-shopping-cart"></i></button> </span> } else if(string.IsNullOrWhiteSpace(productSource)){ <span class="inputSubmit" data-toggle="tooltip" title="@(Translate("ProductNotAvailable","This product is not currently available."))"> <button type="submit" disabled><i class="fa fa-shopping-cart"></i></button> </span> } else{ <button type="submit"><i class="fa fa-shopping-cart"></i></button> } } } </div> } </form> </div> </li> previousElement = group.Key; } </ul> @if(itemsCount == prodLoop.Count()) { @ShowTextAboutMoreOptionsInPreviousOrNextPages(loopProduct) } </li> } </ul> @{ int totalproductCount = GetInteger("Ecom:ProductList.PageProdCnt"); string tooManyResults = Translate("tooManyResults","Your search returned too many results. Please refine your search"); } <div class="pageBottom col-xs-3 noPadding"> <form id="bottom_pageSizeProdList" class="" action="/Default.aspx" name="ExtUserForm_Main" method="GET"> @if(!string.IsNullOrEmpty(requestParams["adv1"])){ <div class="advFields"> @for(var adv = 1; adv < 12; adv++){ @hiddenField("adv" + adv, !string.IsNullOrEmpty(requestParams["adv" + adv]) ? requestParams["adv" + adv] : "") } </div> } <fieldset> <label>@Translate("Results Per Page"):</label> <select name="PageSize"> <option selected="@(str_pageSize == "25" || str_pageSize == "")" value="25">25</option> <option selected="@(str_pageSize == "50")" value="50">50</option> <option selected="@(str_pageSize == "100")" value="100">100</option> <option selected="@(str_pageSize == "200" || str_pageSize == "1")" value="200">200</option> </select> </fieldset> </form> </div> @if(num_totalPages > 1) { string getGlobalRequest = GetGlobalValue("Global:Request.Url"); <ul class="pagination pageBottom pull-right col-xs-5"> @if(!string.IsNullOrWhiteSpace(prevPageClean)) { <li class="previous"><a href='@prevPageClean'><i class="fa fa-angle-left"></i> @Translate("Previous")</a></li> } @if(num_curPage > 2 && num_totalPages > 3){ for(int i=1;i <= 1;i++){ string str_active = num_curPage == i ? "class=\"active\"" : ""; str_pagingHref = getGlobalRequest.Contains("PageNum") ? getGlobalRequest.Replace("PageNum="+num_curPage, "PageNum=" + i ) : getGlobalRequest + "&PageNum=" + i; <li @str_active><a href="@str_pagingHref">@i</a></li> } if(num_totalPages > 4 && num_curPage != 3 ) { <li class="etc"><span>...</span></li> } } @foreach (LoopItem i in loop_productList3) { if(i.GetBoolean("Ecom:ProductList.Pages3.Page.IsCurrent")) { <li class="active"><a href="@i.GetString("Ecom:ProductList.Pages3.Page.UrlHtmlEncoded")">@i.GetString("Ecom:ProductList.Pages3.Page.Number")</a></li> } else { <li><a href="@i.GetString("Ecom:ProductList.Pages3.Page.UrlHtmlEncoded")">@i.GetString("Ecom:ProductList.Pages3.Page.Number")</a></li> } } @if(num_curPage < num_totalPages-1 && num_totalPages > 3){ if(num_totalPages > 4) { <li class="etc"><span>...</span></li> } for(int i=num_totalPages;i <= num_totalPages;i++){ string str_active = num_curPage == i ? "class=\"active\"" : ""; str_pagingHref = getGlobalRequest.Contains("PageNum") ? getGlobalRequest.Replace("PageNum="+num_curPage, "PageNum="+i) : getGlobalRequest + "&PageNum=" + i; <li @str_active><a href="@str_pagingHref">@i</a></li> } } @if(!string.IsNullOrWhiteSpace(nextPageClean)) { <li class="next"><a href='@nextPageClean'>@Translate("Next") <i class="fa fa-angle-right"></i></a></li> } </ul> } </div> @functions { public static string StripHtml(string source) { return Regex.Replace(source, "<.*?>", string.Empty); } } @SnippetStart("jsOnLoad") @: onLoadProductList(); @SnippetEnd("jsOnLoad") } } else{ var countProductDiscountinued = 0; var productDetailPage = item["ProductDetail"].ToString(); string liveSearchPage = item["LiveSearchPage"].ToString(); string advancedSearchLink = LocalizeLinks("/dwcountry/advanced-search"); // If product is discountinued send to PDP if(!string.IsNullOrWhiteSpace(str_keywordsParam)) { string productDiscountinued = GetDiscountinuedProductId(str_keywordsParam); if(!string.IsNullOrEmpty(productDiscountinued)) { string urlRedirect = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("/Default.aspx?ID="+@productDetailPage+"&ProductID="+productDiscountinued); BioLegend.Shared.WebUtility.Redirect(urlRedirect); } } <div id="listContainer"> @if(HttpContext.Current.Request.Params["p1"] != null || String.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["Keywords"])){ <h2>@Translate("noProductsFoundProductSearch","There are no products that match your term.")</h2> <div>@Translate("modifyYourSearch") <a href="@advancedSearchLink">@Translate("Advanced Search")</a> @Translate("modifyYourSearchB")</div> <div>@LocalizeLinks(Translate("contactCustomSolutionsTeamSearch"))<br /><hr /></div> <div id="contentResults"></div> @SnippetStart("jsOnLoad") @: onLoadContentSearchItems('@System.Web.HttpContext.Current.Request.Params["Keywords"]'); @SnippetEnd("jsOnLoad") } else { @SnippetStart("jsOnLoad") @: onLoadPartialSearch("@SearchForPartialTerms(Pageview.Page.ID)", '@Translate("performePartialSearch","Performing partial match search..")'); @SnippetEnd("jsOnLoad") } </div> @functions { public static string SearchForPartialTerms(int pageID) { string allQuery = HttpContext.Current.Request.QueryString.ToString(); for(var i = 1; i <= 12; i++){ if(!allQuery.Contains("k"+i+"=")){ break; } allQuery = allQuery.Replace(("k"+i+"="), ("p"+i+"=")); } allQuery = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?" + allQuery); return allQuery; } public static string GetDiscountinuedProductId(string str_keywordsParam) { string productId = string.Empty; using (var connection = Dynamicweb.Database.CreateConnection()) { using (var command = connection.CreateCommand()) { command.CommandText = "SELECT ProductID FROM EcomProducts WHERE ProductNumber = ''+@str_keywordsParam+'' and ProductStatus = '1'"; command.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "str_keywordsParam", SqlDbType = System.Data.SqlDbType.NVarChar, Value = str_keywordsParam }); using (var reader = command.ExecuteReader()) { if (reader != null) { while (reader.Read()) { productId = reader["ProductID"].ToString(); } } } } } return productId; } } }
Login/Register
Forgot your password? Reset Password
Request an Account