Error executing template "Designs/BioLegend/eCom/Productlist/productList.cshtml"
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at CompiledRazorTemplates.Dynamic.RazorEngine_fef5611effcb458e974ef67c57956b25.GetFilterData(String fieldID) in f:\Domains\Sites\www.biolegend.com\Files\Templates\Designs\BioLegend\eCom\Productlist\productList.cshtml:line 969
at CompiledRazorTemplates.Dynamic.RazorEngine_fef5611effcb458e974ef67c57956b25.Execute() in f:\Domains\Sites\www.biolegend.com\Files\Templates\Designs\BioLegend\eCom\Productlist\productList.cshtml:line 660
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits RazorTemplateBase<RazorTemplateModel<Template>>
2 @using Dynamicweb;
3 @using Dynamicweb.Frontend;
4 @using Dynamicweb.Rendering;
5 @using System;
6 @using System.IO;
7 @using System.Web;
8 @using System.Data;
9 @using System.Text;
10 @using System.Text.RegularExpressions;
11 @using BioLegend.Ecommerce.LiveIntegration;
12 @using System.Collections.Generic;
13 @using System.Linq;
14 @using System.Collections;
15 @using System.Runtime.Caching;
16
17 @using System.Collections.Specialized;
18 @using System.Linq
19 @functions {
20
21 public string LocalizeLinksHTML (string HtmlContent){
22 int areaID = Pageview.Area.ID;
23 var area = Dynamicweb.Services.Areas.GetArea(areaID);
24 string areaCulture = area.Culture.ToLower();
25 if(!string.IsNullOrEmpty(HtmlContent)){
26 if(HtmlContent.IndexOf("dwcountry") > -1){
27 return HtmlContent.Replace("dwcountry",areaCulture);
28 } else{
29 return HtmlContent;
30 }
31
32 } else {
33 return HtmlContent;
34 }
35
36 }
37
38 public string LocalizeLinks (string HtmlContent){
39 int areaID = Pageview.Area.ID;
40 var area = Dynamicweb.Services.Areas.GetArea(areaID);
41 string areaCulture = area.Culture.ToLower();
42 if(!string.IsNullOrEmpty(HtmlContent)){
43 if(HtmlContent.IndexOf("dwcountry") > -1){
44 return HtmlContent.Replace("dwcountry",areaCulture);
45 } else if (HtmlContent.IndexOf("?ID=") > -1) {
46 //do something
47 string baseHref = String.Format("https://{0}",GetGlobalValue("Global:Request.Host"));
48 HtmlContent = HtmlContent.Contains("http") ? HtmlContent : baseHref + "/" + HtmlContent;
49 var uri = new Uri(HtmlContent,UriKind.RelativeOrAbsolute);
50 var parsedQuery = HttpUtility.ParseQueryString(uri.Query);
51 var pageID = parsedQuery.Get("ID");
52
53 string pageVersionID = pageID;
54 string localizedLink = HtmlContent;
55 if (!string.IsNullOrEmpty(pageID)){
56 var pageService = new Dynamicweb.Content.PageService();
57 var linkPage = pageService.GetPagesByAreaID(areaID).FirstOrDefault(x => x.MasterPageId == int.Parse(pageID));
58 pageVersionID = linkPage != null ? linkPage.ID.ToString() : pageID ;
59
60 localizedLink = ModifyQueryStringValue(HtmlContent,"ID",pageVersionID);
61 }
62 //return string.Join(",", parsedQuery.AllKeys);
63 //return string.Join(HtmlContent,"-",pageVersionID);
64 return localizedLink;
65 } else {
66 return HtmlContent;
67 }
68 }else {
69 return HtmlContent;
70 }
71
72 }
73
74 private string ModifyQueryStringValue(string p_query, string p_Name, string p_NewValue)
75 {
76 Uri uri = new Uri(p_query,UriKind.RelativeOrAbsolute);
77 //if(p_query.Contains("http"))
78 //{
79 //uri = new Uri(p_query);
80 //} else {
81 //uri = new Uri(p_query, UriKind.Relative);
82 //}
83 //uri = new Uri(p_query);
84
85
86
87 var nameValues = HttpUtility.ParseQueryString(uri.Query);
88 nameValues.Set(p_Name, p_NewValue);
89 string url = uri.AbsolutePath + "?" + nameValues.ToString();
90 return url;
91 }
92 }
93 @{
94 bool isAValidSearch = true;
95 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)
96 {
97 isAValidSearch = ProcessRequest();
98 }
99 }
100 @functions {
101 public const int numberOfAdvFields = 7; // Number of free text fields (adv) in the advanced search
102
103 /* This method get all the ADV parameters values and concatenate that values into a string */
104 public static string GetAllTheAdvValuesFromQuery()
105 {
106 var allAdvValues = string.Empty;
107
108 for (int adv = 1; adv <= numberOfAdvFields; adv++)
109 {
110 var currentAdv = System.Web.HttpContext.Current.Request.Params["adv" + adv];
111
112 if (!string.IsNullOrEmpty(currentAdv))
113 {
114 allAdvValues += " " + currentAdv;
115 }
116 }
117
118 return allAdvValues;
119 }
120
121 /* This method gets the number of kewords per input */
122 public static List<int> GetNumberOfKeywordsPerInput()
123 {
124 var kewordsCount = new List<int>();
125
126 for (int adv = 1; adv <= numberOfAdvFields; adv++)
127 {
128 var currentAdv = System.Web.HttpContext.Current.Request.Params["adv" + adv];
129
130 if (string.IsNullOrEmpty(currentAdv)) continue;
131 string[] splitParams = currentAdv.Split(' ');
132 kewordsCount.Add(splitParams.Length);
133 }
134
135 return kewordsCount;
136 }
137
138 /* This method returns the parameters from the "thesaurus" named item list */
139 public static string GetParamsFromThesaurus( bool isLiveSearch, List<string> keywords, int advNumber = 1)
140 {
141 var prefixParameter = isLiveSearch ? string.Format("adv{0}-k", advNumber) : "k";
142 var parameter = string.Empty;
143
144 for (var i = 0; i < keywords.Count; i++)
145 {
146 parameter += "&" + prefixParameter + (i + 1) + "=" + keywords[i];
147
148 using (var connection = Dynamicweb.Data.Database.CreateConnection())
149 {
150 using (var commandSearchTerms = connection.CreateCommand())
151 {
152 commandSearchTerms.CommandText = string.Format("SELECT RelatedTerm FROM {0} WHERE SearchTerm = ''+@keywordSearch+''", "itemtype_thesaurus");
153
154 commandSearchTerms.Parameters.Add(new System.Data.SqlClient.SqlParameter()
155 {
156 ParameterName = "keywordSearch",
157 SqlDbType = System.Data.SqlDbType.NVarChar,
158 Value = keywords[i]
159 });
160
161 var readerSearch = commandSearchTerms.ExecuteScalar();
162
163 if(readerSearch != null && !string.IsNullOrWhiteSpace(readerSearch.ToString()))
164 {
165 parameter += ","+readerSearch;
166 }
167 }
168 }
169 }
170 return parameter;
171 }
172
173 public bool ProcessRequest()
174 {
175 string id = Pageview.Page.ID.ToString();
176 string postKeywords = System.Web.HttpContext.Current.Request.QueryString["Keywords"] ?? "";
177 postKeywords = !string.IsNullOrEmpty(postKeywords) ? postKeywords : GetAllTheAdvValuesFromQuery();
178 string criteria = "";
179 bool isLiveSearch = !string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["isLiveSearch"]) ? Convert.ToBoolean(System.Web.HttpContext.Current.Request.Params["isLiveSearch"]) : false;
180
181 if (!string.IsNullOrWhiteSpace(postKeywords))
182 {
183 criteria = System.Web.HttpUtility.HtmlEncode(postKeywords.Trim());
184 criteria = criteria.Replace("\"", "");
185 criteria = criteria.Replace("“", "");
186 criteria = criteria.Replace("”", "");
187 criteria = criteria.Replace("“", "");
188 criteria = criteria.Replace("â€;", "");
189 criteria = criteria.Replace("“", "");
190 criteria = criteria.Replace("”", "");
191 criteria = criteria.Replace(""", "");
192 }
193
194 criteria = Regex.Replace(criteria, "cyclin a", "cyclin.a", RegexOptions.IgnoreCase);
195 criteria = Regex.Replace(criteria, "protein a", "protein.a", RegexOptions.IgnoreCase);
196 criteria = Regex.Replace(criteria, "granzyme a", "granzyme.a", RegexOptions.IgnoreCase);
197 criteria = Regex.Replace(criteria, "buffer set a", "buffer set.a", RegexOptions.IgnoreCase);
198 criteria = Regex.Replace(criteria, "glycophorin a", "glycophorin.a", RegexOptions.IgnoreCase);
199 criteria = Regex.Replace(criteria, "do-7", "DO7", RegexOptions.IgnoreCase);
200 criteria = Regex.Replace(criteria, "and-1", "AND1", RegexOptions.IgnoreCase);
201 criteria = Regex.Replace(criteria, "total%20seq", "totalseq", RegexOptions.IgnoreCase);
202 criteria = Regex.Replace(criteria, "totalseq-a", "totalseqa", RegexOptions.IgnoreCase);
203 criteria = Regex.Replace(criteria, "totalseq-b", "totalseqb", RegexOptions.IgnoreCase);
204 criteria = Regex.Replace(criteria, "totalseq-c", "totalseqc", RegexOptions.IgnoreCase);
205 criteria = Regex.Replace(criteria, "totalseq-d", "totalseqd", RegexOptions.IgnoreCase);
206
207
208 string tableName = "UrlPath";
209 string urlToRedirect = "";
210 using (var connection = Dynamicweb.Data.Database.CreateConnection())
211 {
212 using (var command = connection.CreateCommand())
213 {
214 command.CommandText = string.Format("SELECT * FROM {0} WHERE UrlPathPath = ''+@keyword+''", tableName);
215 command.Parameters.Add(new System.Data.SqlClient.SqlParameter()
216 {
217 ParameterName = "keyword",
218 SqlDbType = System.Data.SqlDbType.NVarChar,
219 Value = criteria.ToUpper()
220 });
221
222 using (var reader = command.ExecuteReader())
223 {
224 if (reader != null)
225 {
226 while (reader.Read())
227 {
228 urlToRedirect = reader["UrlPathRedirect"].ToString();
229 break;
230 }
231 }
232 }
233 }
234 }
235
236 if (!string.IsNullOrWhiteSpace(urlToRedirect))
237 {
238 urlToRedirect = urlToRedirect.Replace("http://www.biolegend.com", "").Replace("PageSize=1", "PageSize=99999");
239 urlToRedirect = LocalizeLinks(urlToRedirect);
240 var friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(urlToRedirect);
241 urlToRedirect = !string.IsNullOrEmpty(friendlyUrl) ? friendlyUrl : urlToRedirect;
242 BioLegend.Shared.WebUtility.Redirect(urlToRedirect);
243 }
244 else
245 {
246 string kParameter = "";
247 string tmpVal = criteria.Replace("chr(169)", "").Replace("chr(194).chr(174)", " ").Replace("chr(206).chr(177)", "")
248 .Replace("chr(206).chr(178)", "α").Replace("chr(206).chr(179)", "β").Replace("chr(206).chr(180)", "γ")
249 .Replace("chr(206).chr(181)", "δ").Replace("chr(206).chr(186)", "ε").Replace("chr(226).chr(132).chr(162)", "κ")
250 .Replace("anti-biotin", "biotinAb").Replace("anti-PE", "PEab").Replace("anti-APC", "APCab").Replace("anti-streptavidin", "streptavidinab")
251 .Replace("anti-Biotin", "biotinAb").Replace("anti-pe", "PEab").Replace("anti-apc", "APCab").Replace("anti-Streptavidin", "streptavidinab")
252 .Replace("anti-FITC", "FITCab").Replace("anti-fitc", "FITCab").Replace("anti-SAV", "SAVab").Replace("anti-sav", "SAVab").Replace("anti-Sav", "SAVab")
253 .Replace("anti-", " ").Replace("antibody", "").Replace("Antibody", ""); //.Replace("anti", "");
254
255 tmpVal = tmpVal == "anti" ? "" : tmpVal;
256 tmpVal = tmpVal.StartsWith("anti") ? tmpVal.Replace("anti", "") : tmpVal;
257 tmpVal = tmpVal.EndsWith("anti") ? tmpVal.Replace("anti", "") : tmpVal;
258
259 string[] tmpValWords = criteria.Split(' ');
260
261 if (tmpValWords.Length > 1)
262 {
263 List<string> tmpWords = new List<string>();
264 foreach (var w in tmpValWords)
265 {
266 string word = w.ToLower();
267
268 if (word.StartsWith("anti") || word.EndsWith("anti"))
269 {
270 word = word.Replace("anti", "");
271 }
272 tmpWords.Add(word);
273 }
274 tmpVal = string.Join(" ", tmpWords.ToArray());
275 }
276
277 tmpVal = tmpVal.Replace("%20", " ").Replace("+", " ").Replace(" ", ",").Replace("-", "-").Replace(" / ", ",");
278
279 // Named Item List
280 var keywords = new List<string>();
281 char[] splitter = {','};
282 keywords.AddRange(tmpVal.Split(splitter, System.StringSplitOptions.RemoveEmptyEntries));
283
284 if (isLiveSearch)
285 {
286 var tmpKeywords = new List<string>();
287 tmpKeywords.AddRange(tmpVal.Split(splitter, System.StringSplitOptions.RemoveEmptyEntries));
288 int advIndex = 1;
289 foreach (var kewordsNumber in GetNumberOfKeywordsPerInput())
290 {
291 var kewordsPerField = new List<string>();
292 int tempKeywordsIndex = 1;
293
294 foreach (var keyword in tmpKeywords)
295 {
296 if( tempKeywordsIndex > kewordsNumber)
297 break;
298
299 kewordsPerField.Add(keyword);
300 tempKeywordsIndex++;
301 }
302
303 tmpKeywords.RemoveRange(0, kewordsPerField.Count);
304
305 kParameter += GetParamsFromThesaurus(true, kewordsPerField, advIndex);
306 advIndex++;
307 }
308 }
309 else
310 {
311 kParameter += GetParamsFromThesaurus(false, keywords);
312 }
313
314 if (!string.IsNullOrEmpty(criteria))
315 {
316 string applications,
317 productType,
318 reactivy,
319 format,
320 cellType,
321 regulatoryStatus,
322 companyOld,
323 sortBy,
324 pageSize,
325 paragraphID,
326 redirectToThisUrl = string.Format("{0}?Keywords={1}{2}", Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + id), string.Join(" ", keywords.ToArray()), kParameter);
327
328 if (isLiveSearch)
329 {
330 applications = System.Web.HttpContext.Current.Request.QueryString["Applications"] ?? "";
331 productType = System.Web.HttpContext.Current.Request.QueryString["ProductType"] ?? "";
332 reactivy = System.Web.HttpContext.Current.Request.QueryString["Reactivity"] ?? "";
333 format = System.Web.HttpContext.Current.Request.QueryString["Format"] ?? "";
334 cellType = System.Web.HttpContext.Current.Request.QueryString["CellType"] ?? "";
335 regulatoryStatus = System.Web.HttpContext.Current.Request.QueryString["RegulatoryStatus"] ?? "";
336 companyOld = System.Web.HttpContext.Current.Request.QueryString["CompanyOld"] ?? "";
337 sortBy = System.Web.HttpContext.Current.Request.QueryString["SortBy"] ?? "";
338 pageSize = System.Web.HttpContext.Current.Request.QueryString["PageSize"] ?? "";
339 paragraphID = System.Web.HttpContext.Current.Request.QueryString["PID"] ?? "";
340
341 redirectToThisUrl += !string.IsNullOrWhiteSpace(applications) ? "&Applications=" + applications : "";
342 redirectToThisUrl += !string.IsNullOrWhiteSpace(productType) ? "&ProductType=" + productType : "";
343 redirectToThisUrl += !string.IsNullOrWhiteSpace(reactivy) ? "&Reactivity=" + reactivy : "";
344 redirectToThisUrl += !string.IsNullOrWhiteSpace(format) ? "&Format=" + format : "";
345 redirectToThisUrl += !string.IsNullOrWhiteSpace(cellType) ? "&CellType=" + cellType : "";
346 redirectToThisUrl += !string.IsNullOrWhiteSpace(regulatoryStatus) ? "&RegulatoryStatus=" + regulatoryStatus : "";
347 redirectToThisUrl += !string.IsNullOrWhiteSpace(companyOld) ? "&CompanyOld=" + companyOld : "";
348 redirectToThisUrl += !string.IsNullOrWhiteSpace(sortBy) ? "&SortBy=" + sortBy : "";
349 redirectToThisUrl += !string.IsNullOrWhiteSpace(pageSize) ? "&PageSize=" + (pageSize == "1" ? "99999" : pageSize) : "";
350 redirectToThisUrl += !string.IsNullOrWhiteSpace(paragraphID) ? "&PID=" + paragraphID : "";
351 }
352
353 BioLegend.Shared.WebUtility.Redirect(redirectToThisUrl);
354 }
355 }
356 return false;
357 }
358
359 }
360 @using System
361 @functions {
362
363 public double ConvertPrice(double price, Dynamicweb.Ecommerce.International.Currency fromCurrency, Dynamicweb.Ecommerce.International.Currency toCurrency, bool roundPrice = false)
364 {
365 if (price.Equals(0.0d))
366 {
367 return price;
368 }
369 if (fromCurrency is null || toCurrency is null || (fromCurrency.Code ?? "") == (toCurrency.Code ?? ""))
370 {
371 return price;
372 }
373 else
374 {
375 var convertedPrice =fromCurrency.Rate / toCurrency.Rate * price;
376 return roundPrice ? Math.Ceiling(convertedPrice) : convertedPrice;
377 }
378 }
379
380 string RoundPrice(double price, bool isPriceInterestPointValue = true, bool roundPrice = true, bool showDecimals = false)
381 {
382 var priceDouble = price;
383 if(isPriceInterestPointValue) {
384 priceDouble = price * 0.01;
385 }
386 var isCurrencyJp = Dynamicweb.Ecommerce.Common.Context.Currency.CultureInfo == "ja-JP";
387 /*var roundPriceDouble = Math.Round(priceDouble, 0, MidpointRounding.AwayFromZero);*/
388 var roundPriceDouble = Math.Ceiling(priceDouble);
389 var roundedPrice = isCurrencyJp ? price.ToString("#,##") : (roundPrice ? roundPriceDouble.ToString() : priceDouble.ToString());
390 if(showDecimals){
391 roundedPrice = isCurrencyJp ? price.ToString("#,##") : (roundPrice ? roundPriceDouble.ToString("0.00") : priceDouble.ToString("0.00"));
392 }
393
394 var priceWithSymbol = string.Empty;
395 var currencySymbol = Dynamicweb.Ecommerce.Common.Context.Currency.Symbol;
396 var positivePattern = Dynamicweb.Ecommerce.Common.Context.Currency.PositivePattern;
397 var symbolPlace = Dynamicweb.Ecommerce.Common.Context.Currency.SymbolPlace;
398
399 if (positivePattern == 3)
400 {
401 priceWithSymbol = String.Format("{0} {1}", currencySymbol, roundedPrice);
402 }
403 else if (positivePattern == 1)
404 {
405 priceWithSymbol = String.Format("{0} {1}", roundedPrice, currencySymbol);
406 }
407 else if (symbolPlace == 0 || positivePattern == 2) {
408 priceWithSymbol = String.Format("{0}{1}", currencySymbol, roundedPrice);
409 }
410 else
411 {
412 priceWithSymbol = String.Format("{0}{1}", roundedPrice, currencySymbol);
413 }
414
415 return priceWithSymbol;
416 }
417
418 string RoundPriceToCurrentCurrency(double price, bool roundPrice = false)
419 {
420 var defaultCurrency = Dynamicweb.Ecommerce.Common.Application.DefaultCurrency;
421 var currentCurrency = Dynamicweb.Ecommerce.Common.Context.Currency;
422 var convertedPrice = ConvertPrice(price, defaultCurrency, currentCurrency, roundPrice);
423 return FormatPrice(convertedPrice);
424 }
425
426 string FormatPrice(double price)
427 {
428 var formattedPrice = (new Dynamicweb.Ecommerce.International.CurrencyService()).FormatCurrency(Dynamicweb.Ecommerce.Common.Context.Currency, price, true);
429 return formattedPrice;
430 }
431 }
432 @{
433 // List view by cookie ot parameter
434 string listView = System.Web.HttpContext.Current.Request.Cookies["dataList"] != null ? System.Web.HttpContext.Current.Request.Cookies["dataList"].Value : "";
435 listView = System.Web.HttpContext.Current.Request.Params["view"] != null ? (System.Web.HttpContext.Current.Request.Params["view"].ToString() == "detail" ? "detailedView" : "") : listView;
436 var item = Pageview.Area.Item;
437
438 //-- REDIRECT
439 // If is the ExploreNewProducts page, redirect and put some parameters to filter
440
441 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)){
442 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"));
443 if(System.Web.HttpContext.Current.Request.Params["view"] == null && !String.IsNullOrEmpty(listView)) {
444 redirect = redirect + "&view=detail";
445 }
446 BioLegend.Shared.WebUtility.Redirect(Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(redirect));
447 }
448 var loop_subgroups = GetLoop("Subgroups").OrderBy(o => o.GetString("Ecom:Group.Name")).ToList();
449 // If have subgroups, redirecto to the groups list page
450 if(loop_subgroups.Any()){
451 string redirect = "/"+item["GroupsPage"].ToString()+"&GroupID="+System.Web.HttpContext.Current.Request.QueryString["GroupID"].ToString();
452 BioLegend.Shared.WebUtility.Redirect(redirect);
453 }
454
455
456 var loopProduct = GetLoop("Products");
457 string currentPageId = Pageview.Page.ID.ToString();
458 bool isWebserviceAvailable = TemplatesHelper.IsWebServiceConnectionAvailable();
459 var contentSearchPage = item["ContentSearchPage"];
460 // SORT BY
461 string sortByName = "Name_sortable,Price";
462 string sortByClone = "CloneIndexed,Name_sortable,Price";
463 string sortByMatch = "-_score,CloneIndexed,Name_sortable,Price";
464 string sortByApplication = "AppAbrvString,Name_sortable,Price";
465 string sortByRegulatoryStatus = "CustomField_RegulatoryStatus,Name_sortable,Price";
466 string str_sortOrder = System.Web.HttpContext.Current.Request.Params["SortOrder"] ?? "";
467 string str_sortBy = System.Web.HttpContext.Current.Request.Params["SortBy"] ?? "";
468 string str_pageSize = System.Web.HttpContext.Current.Request.Params["PageSize"] ?? "25";
469 string str_keywordsParam = System.Web.HttpContext.Current.Request.Params["Keywords"] ?? "";
470 string str_k1 = System.Web.HttpContext.Current.Request.Params["k1"] ?? "";
471 string str_GeneIDParam = System.Web.HttpContext.Current.Request.Params["GeneID"] ?? "";
472 string str_SpecificityParam = System.Web.HttpContext.Current.Request.Params["Specificity"] ?? "";
473 string str_paramGroupID = System.Web.HttpContext.Current.Request.Params["groupid"] ?? "";
474 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));
475
476 str_sortBy = str_sortBy.Replace("%2C",",");
477 string str_FormatsParam = System.Web.HttpContext.Current.Request.Params["Format"] ?? "";
478 string str_CloneParam = System.Web.HttpContext.Current.Request.Params["Clone"] ?? "";
479
480
481
482 @functions{
483 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)
484 {
485 Dynamicweb.Frontend.PageView obj_currentPageview = Dynamicweb.Frontend.PageView.Current();
486 string str_currDevice = obj_currentPageview.Device.ToString();
487 string str_alternativeImage = obj_currentPageview.Area.Item["NoImage"] != null ? obj_currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/Lorenz/images/alternativeImage.jpg";
488
489 string str_width = "";
490 string str_height = "";
491 int num_getImageWidth = num_width != 0 ? num_width : 0;
492 int num_getImageHeight = num_height != 0 ? num_height : 0;
493 string str_getImageFormat = str_format != "jpg" ? "&Format=" + str_format : "";
494 string str_getImageCompression = num_compression != 75 ? "&Compression=" + num_compression : "";
495
496 var cdnImageHandleDomain = BioLegend.Web.Helpers.CdnFunctions.GetCdnByType("Image_Handler", "Image_Handler_Domain"); //CUSTOM CODE
497
498 if (str_currDevice == Dynamicweb.Frontend.Devices.DeviceType.Tablet.ToString())
499 {
500 num_getImageWidth = num_widthTablet != 0 ? num_widthTablet : num_getImageWidth;
501 num_getImageHeight = num_heightTablet != 0 ? num_heightTablet : num_getImageHeight;
502 }
503 else if (str_currDevice == Dynamicweb.Frontend.Devices.DeviceType.Mobile.ToString())
504 {
505 num_getImageWidth = num_widthMobile != 0 ? num_widthMobile : num_getImageWidth;
506 num_getImageHeight = num_heightMobile != 0 ? num_heightMobile : num_getImageHeight;
507 }
508
509 if (num_getImageWidth != 0)
510 {
511 str_width = "&Width=" + num_getImageWidth;
512 }
513 if (num_getImageHeight != 0)
514 {
515 str_height = "&Height=" + num_getImageHeight;
516 }
517
518 string str_output = cdnImageHandleDomain + "/Admin/Public/GetImage.ashx?Image=" + str_source + str_width + str_height + "&altFmImage_path=" + str_alternativeImage + str_getImageFormat + str_getImageCompression + "&Crop=" + num_crop;
519 return str_output;
520 }
521 }
522 }
523
524 @if(loopProduct.Any() && isAValidSearch)
525 {
526 string groupLink = GetString("Ecom:Group:Field.LandingPageLink.Value.Clean");
527 string searchPageID = item["SearchResults"].ToString();
528 string detailPageID = item["ProductDetail"].ToString();
529 string detailPunchoutPageID = item["Punchout_ProductDetail"] != null ? item["Punchout_ProductDetail"].ToString() : "";
530 string liveSearchPage = item["LiveSearchPage"] != null ? item["LiveSearchPage"].ToString() : "";
531 string liveSearchPagePunchout = item["Punchout_LiveSearchPage"] != null ? item["Punchout_LiveSearchPage"].ToString() : "";
532 string addToCart = item["AddToCart"] != null ? item["AddToCart"].ToString() : "";
533 bool cartDisabled = Convert.ToBoolean(item["DisableAddToCart"].ToString());
534 string orderContext = item["OrderContext"] != null ? item["OrderContext"].ToString() : "";
535 bool isConnectionAvailable = GetBoolean("Item.Area.DisableCheckout.Value") || !TemplatesHelper.IsWebServiceConnectionAvailable() ? false : true;
536 string inactiveButtonClass = isConnectionAvailable ? "addToCart" : "addToCart inactive";
537 string str_liveSearchFormat = System.Web.HttpContext.Current.Request.Params["Format"] ?? "";
538 string str_liveSearchReactivity = System.Web.HttpContext.Current.Request.Params["Reactivity"] ?? "";
539 string str_liveSearchCellType = System.Web.HttpContext.Current.Request.Params["CellType"] ?? "";
540 string str_liveSearchRegulatoryStatus = System.Web.HttpContext.Current.Request.Params["RegulatoryStatus"] ?? "";
541 string str_liveSearchProductType = System.Web.HttpContext.Current.Request.Params["ProductType"] ?? "";
542 string str_liveSearchApplications = System.Web.HttpContext.Current.Request.Params["Applications"] ?? "";
543 string str_liveSearchCompanyOld = System.Web.HttpContext.Current.Request.Params["CompanyOld"] ?? "";
544
545 string sortByNameSelected = str_sortBy == sortByName ? "sortActive" : "";
546 string sortByCloneSelected = (str_sortBy == sortByClone || str_sortBy == "" ) ? "sortActive" : "";
547 string sortByApplicationsSelected = str_sortBy == sortByApplication ? "sortActive" : "";
548 string sortByRegulatoryStatusSelected = str_sortBy == sortByRegulatoryStatus ? "sortActive" : "";
549
550 string colGroup = (!cartDisabled ? "col-xs-offset-7" : "col-xs-offset-7");
551
552 var prodLoop = loopProduct.Where(x => !string.IsNullOrWhiteSpace(x.GetString("Ecom:Product.Number"))).GroupBy(x => x.GetString("Ecom:Product.ID")).ToList();
553 var prodLoopCount = prodLoop.Count;
554
555
556 // --------------------
557
558 string str_imagesFolder = "/Files/Files/BioLegend/Products/";
559 string navEnvironment = item["NavEnvironment"] != null ? item["NavEnvironment"].ToString() : "";
560 string str_pagingHref = "";
561 bool bol_userLogged = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn();
562 string siteCurrency = Dynamicweb.Frontend.PageView.Current().Area.EcomCurrencyId;
563 string userCurrency = bol_userLogged ? Dynamicweb.Security.UserManagement.User.GetCurrentUser().Currency : siteCurrency;
564
565 Dictionary<string, string> productTypes = new Dictionary<string, string>();
566 productTypes.Add("AncillaryProducts", "Ancillary");
567 productTypes.Add("BuffersSolutionsChemicals", "Ancillary");
568 productTypes.Add("CellBiologyAntibodies", "PrimaryAntibodies");
569 productTypes.Add("CellSeparation", "MojoSort");
570 productTypes.Add("CytokineChemokineAntibodies", "PrimaryAntibodies");
571 productTypes.Add("ELISAMAXLEGENDMAX", "ELISA");
572 productTypes.Add("EpitopeTagProducts", "PrimaryAntibodies");
573 productTypes.Add("HumanImmunologyAntibodies", "PrimaryAntibodies");
574 productTypes.Add("IsotypeControls", "IsotypeControls");
575 productTypes.Add("LEGENDplex", "LEGENDplex");
576 productTypes.Add("LEGENDScreen", "LEGENDScreen");
577 productTypes.Add("MarmosetImmunologyAntibodies", "PrimaryAntibodies");
578 productTypes.Add("MouseImmunologyAntibodies", "PrimaryAntibodies");
579 productTypes.Add("NeuroscienceProducts", "PrimaryAntibodies");
580 productTypes.Add("RatImmunologyAntibodies", "PrimaryAntibodies");
581 productTypes.Add("RecombinantProteins", "Recombinant");
582 productTypes.Add("SecondaryReagents", "SecondaryReagents");
583 productTypes.Add("VirusImmunologyAntibodies", "PrimaryAntibodies");
584 productTypes.Add("EnzymeAssays", "EnzymeAssays");
585 productTypes.Add("FlexT", "FlexT");
586 productTypes.Add("NonAntibodyChemicalProbes", "NonAntibodyChemicalProbes");
587 int pageCal = 0;
588 string previousElement = "";
589 string longLang = (string)GetGlobalValue("Global:Area.LongLang");
590 var loop_productList3 = GetLoop("Ecom:ProductList.Pages3");
591 int itemsCount = 0;
592
593 // Helpers to verify variants at the same product in a different page
594 @helper ShowTextAboutMoreOptionsInPreviousOrNextPages(List<LoopItem> loopProduct, bool isToPageBefore = false)
595 {
596 if(loopProduct.Any()) {
597 string countVariantsWithSameProdId = string.Empty;
598 string countTotalOfVariantsForProd = string.Empty;
599 string translateText = string.Empty;
600 string positionClass = "moreVariantsBefore";
601 int totalPages = GetInteger("Ecom:ProductList.TotalPages");
602
603 if(isToPageBefore) {
604 countVariantsWithSameProdId = loopProduct.Where(p => p.GetString("Ecom:Product.ID") == loopProduct.First().GetString("Ecom:Product.ID")).Count().ToString();
605 countTotalOfVariantsForProd = loopProduct.Select(p => p.GetString("Ecom:Product.ActiveVariantCount")).First().ToString();
606 translateText = Translate("SeeMoreSizeOptionsForThisProductOnThePreviousPage","See more size options for this product on the previous page.");
607
608 }
609 else {
610 countVariantsWithSameProdId = loopProduct.Where(p => p.GetString("Ecom:Product.ID") == loopProduct.Last().GetString("Ecom:Product.ID")).Count().ToString();
611 countTotalOfVariantsForProd = loopProduct.Select(p => p.GetString("Ecom:Product.ActiveVariantCount")).Last().ToString();
612 translateText = Translate("SeeMoreSizeOptionsForThisProductOnTheNextPage","See more size options for this product on the next page.");
613 positionClass = "moreVariantsNext";
614 }
615
616 if(countVariantsWithSameProdId != countTotalOfVariantsForProd && totalPages > 1) {
617 <div class="@positionClass col-xs-12">@translateText</div>
618 }
619
620 }
621 }
622
623 if(!String.IsNullOrWhiteSpace(groupLink))
624 {
625 BioLegend.Shared.WebUtility.Redirect(groupLink);
626 }
627 else if(prodLoopCount == 1 && GetInteger("Ecom:ProductList.CurrentPage") == 1 && !string.IsNullOrWhiteSpace(str_keywordsParam) && isASimpleSearch)
628 {
629 string frienldyHref = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(String.Format("Default.aspx?ID={0}&ProductID={1}",detailPageID,prodLoop[0].Key.ToString()));
630 BioLegend.Shared.WebUtility.Redirect(frienldyHref);
631 }
632 else
633 {
634
635 <div class='col-xs-12 noPadding'>
636 <div class="pull-left noPadding" id="moreInfo">
637 <button class='btn-primary viewOption default @(string.IsNullOrWhiteSpace(listView) ? "active" : "")'>@Translate("listView","List View")</button>
638 <button class='btn-primary viewOption @(!string.IsNullOrWhiteSpace(listView) ? "active" : "")'>@Translate("detailView","Detail View")</button>
639 @if(!string.IsNullOrWhiteSpace(str_keywordsParam)){
640 <button class='btn-primary' id="searchForContent" onClick="searchForContent();" data-searchpageID="@contentSearchPage">@Translate("contentPagesBTNText","Find Content Pages")</button>
641 }
642 </div>
643 <div class="noPadding"><hr id="searchButtonDivider" /></div>
644 </div>
645
646 bool bol_noResults = false;
647 var requestParams = System.Web.HttpContext.Current.Request.Params;
648 string str_groupID = !string.IsNullOrEmpty(requestParams["GroupID"]) ? requestParams["GroupID"].ToString() : "";
649 string str_price = !string.IsNullOrEmpty(requestParams["Price"]) ? requestParams["Price"] : "" ;
650 string str_clone = !string.IsNullOrEmpty(requestParams["Clone"]) ? requestParams["Clone"] : "" ;
651 string str_keywords = !string.IsNullOrEmpty(requestParams["Keywords"]) ? requestParams["Keywords"] : "" ;
652 string DateReleasedMin = !string.IsNullOrEmpty(requestParams["DateReleasedMin"]) ? requestParams["DateReleasedMin"] : "" ;
653 string DateReleasedMax = !string.IsNullOrEmpty(requestParams["DateReleasedMax"]) ? requestParams["DateReleasedMax"] : "" ;
654 string view = !string.IsNullOrEmpty(requestParams["view"]) ? requestParams["view"] : "" ;
655 var lst_parameters = GetLoop("Query.Parameters");
656 var loopFacetGroups = GetLoop("FacetGroups");
657
658 /* Workaround due a DW bug */
659 Dictionary<string, string> applicationsData = GetFilterData("BLFD_1");
660 Dictionary<string, string> formatsData = GetFilterData("BLFDF_1");
661
662 /* END Workaround */
663
664 if(loopFacetGroups.Any())
665 {
666 <div class="col-xs-2 noPadding">
667
668 <div class="headerBox filtersHead col-xs-12 noPadding">
669 <span class='title'>@Translate("filterYourResults", "Filter your results")</span>
670 </div>
671
672 <form id="filtersForm" action="/Default.aspx" class="col-xs-12 noPaddingLeft productSearchFilters">
673 <input type="hidden" name="ID" value="@Pageview.Page.ID" />
674 <input type="hidden" name="SortBy" value="@str_sortBy" />
675 <input type="hidden" name="PageSize" value="@str_pageSize" />
676
677 @hiddenField("Keywords", str_keywords)
678 @hiddenField("Clone", str_clone)
679 @if(string.IsNullOrEmpty(requestParams["p1"])){
680 for(var k = 1; k < 12; k++){
681 @hiddenField("k" + k, !string.IsNullOrEmpty(requestParams["k" + k]) ? requestParams["k" + k] : "")
682 }
683 }
684 else {
685 for(var p = 1; p < 12; p++){
686 @hiddenField("p" + p, !string.IsNullOrEmpty(requestParams["p" + p]) ? requestParams["p" + p] : "")
687 }
688 }
689 @hiddenField("sortOrder", str_sortOrder)
690 @hiddenField("GroupID", str_paramGroupID)
691 @hiddenField("GeneID", str_GeneIDParam)
692 @hiddenField("Specificity", str_SpecificityParam)
693 @hiddenField("DateReleasedMin", DateReleasedMin)
694 @hiddenField("DateReleasedMax", DateReleasedMax)
695
696 <input type="hidden" name="view" value="@view" />
697
698 @if(item["ExploreNewProducts"].ToString() == Pageview.Page.ID.ToString()){
699 string currentMonth = DateTime.Today.ToString("MM");
700 string monthParameter = requestParams["month"] != null ? requestParams["month"].ToString() : "";
701
702 <fieldset>
703 <label>@Translate("Month", "Month")</label>
704 <div class="filtersContainer">
705 <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>
706 </div>
707 @for(var i=1; i < 6; i++ ){
708 string month = DateTime.Today.AddMonths(-i).ToString("MMMM");
709 string monthNumeric = DateTime.Today.AddMonths(-i).ToString("MM");
710 <div class="filtersContainer">
711 <label class="radioBoxContainer" for="@month">
712 <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">
713 <span>@month</span>
714 </label>
715 </div>
716 }
717 </fieldset>
718 }
719
720 @foreach (LoopItem g in loopFacetGroups) {
721 foreach (LoopItem i in g.GetLoop("Facets")) {
722 string str_parameterType = lst_parameters.Where(x => x.GetString("Parameter.Name") == i.GetString("Facet.QueryParameter")).FirstOrDefault().GetString("Parameter.Type");
723 string str_templateOutput = "string";
724
725 if(str_parameterType.Contains("[]")){
726 switch (i.GetString("Facet.Name"))
727 {
728 case "fieldName":
729 str_templateOutput = "multiselect";
730 break;
731 default:
732 str_templateOutput = "checkboxes";
733 break;
734 }
735 }
736 else if(str_parameterType.Contains("Boolean")){
737 switch (i.GetString("Facet.Name"))
738 {
739 case "fieldName":
740 str_templateOutput = "select";
741 break;
742 case "fieldName2":
743 str_templateOutput = "radio";
744 break;
745 default:
746 str_templateOutput = "checkbox";
747 break;
748 }
749 }
750 else if(!String.IsNullOrWhiteSpace(i.GetString("Facet.OptionCount"))) {
751 switch (i.GetString("Facet.Name"))
752 {
753 case "fieldName":
754 str_templateOutput = "select";
755 break;
756 case "fieldName2":
757 str_templateOutput = "radios";
758 break;
759 case "fieldName3":
760 str_templateOutput = "multiselect";
761 break;
762 case "fieldName4":
763 str_templateOutput = "text";
764 break;
765 default:
766 str_templateOutput = "checkboxes";
767 break;
768 }
769
770 }
771 else {
772 switch (i.GetString("Facet.Name"))
773 {
774 case "fieldName":
775 str_templateOutput = "autocomplete";
776 break;
777 default:
778 str_templateOutput = "text";
779 break;
780 }
781 }
782 @field(i, str_parameterType, str_templateOutput, bol_noResults, applicationsData, formatsData)
783 }
784 }
785 </form>
786 </div>
787
788 @helper hiddenField(string name, string value){
789 if(value != "") {
790 <input type="hidden" name="@name" value="@value" />
791 }
792 }
793
794 @helper field(LoopItem i , string str_parameterType, string str_templateOutput, bool bol_noResults, Dictionary<string, string> applicationsData, Dictionary<string, string> formatsData ) {
795 string str_parameter = i.GetString("Facet.QueryParameter");
796 string str_name = i.GetString("Facet.Name");
797 var facetOptions = i.GetLoop("FacetOptions");
798
799 if(bol_noResults){
800 facetOptions = facetOptions.OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label")).ToList();
801 }
802 else{
803 facetOptions = facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).OrderBy(o => o.GetString("FacetOption.Label")).ToList();
804 }
805
806 switch (str_templateOutput)
807 {
808 case "multiselect":
809 if(facetOptions.Any()) {
810 <fieldset>
811 <legend>@str_name</legend>
812 <select data-selected-text-format="count" data-live-search="true" data-size="8" name="@str_parameter" multiple>
813 @foreach(LoopItem option in facetOptions.OrderByDescending(o => o.GetInteger("FacetOption.Label")))
814 {
815 bool bol_checked = option.GetBoolean("FacetOption.Selected");
816 string str_value = option.GetString("FacetOption.Value");
817
818 <option selected="@bol_checked" value="@str_value">@option.GetString("FacetOption.Label")</option>
819 }
820 </select>
821 </fieldset>
822 }
823
824 break;
825 case "checkboxes":
826 string extraClass = ( i.GetString("Facet.QueryParameter").Equals("ExcitationLaser") || i.GetString("Facet.QueryParameter").Equals("Isotype") ) ? "noCapitalize" : "";
827 string inputID = i.GetString("Facet.QueryParameter") + "Search";
828 string inputDivID = i.GetString("Facet.QueryParameter") + "Div";
829 if(facetOptions.Any()) {
830 int count = 0;
831 <fieldset data-type="@str_parameterType">
832 @if(facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).Count() > 0) {
833 <legend class="filterTitle seeMoreProducts" data-parameter='@i.GetString("Facet.QueryParameter")'>@str_name</legend>
834 }
835 else{
836 <legend class="filterTitle">@str_name</legend>
837 }
838
839 <div class="filtersContainer @extraClass hide" id="@inputDivID">
840 @if(facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).Count() > 9) {
841 <div class="searchFilterContainer">
842 <span class="fa fa-search"></span>
843 <input class="searchFilterSearchBar" id="@inputID" onkeyup="filterSearchFilterOptions('@inputID','@inputDivID');" >
844 </div>
845 }
846 @foreach(LoopItem option in facetOptions)
847 {
848 bool bol_checked = option.GetBoolean("FacetOption.Selected");
849 string str_value = option.GetString("FacetOption.Value");
850 if(bol_checked){
851 Dictionary<string, string> breadcrumbSourceTemp = new Dictionary<string, string>();
852 string thisFilter = @i.GetString("Facet.QueryParameter") + str_value;
853 breadcrumbSourceTemp.Add("val",str_value);
854 breadcrumbSourceTemp.Add("label",@option.GetString("FacetOption.Label"));
855 breadcrumbSourceTemp.Add("filter",@i.GetString("Facet.QueryParameter"));
856 breadcrumbSource.Add(thisFilter,breadcrumbSourceTemp);
857 }
858 count++;
859 //string str_class = count > 5 ? "hide" : "";
860
861 <label class="checkBoxContainer"><input checked="@bol_checked" type="checkbox" value="@str_value" name="@str_parameter">
862 <span>
863 @if(str_name == "Applications" && applicationsData.ContainsKey(str_value) ){
864 @applicationsData[str_value]
865 }
866 else if (str_name == "Format" && formatsData.ContainsKey(str_value) ){
867 @formatsData[str_value]
868 }
869 else {
870 @option.GetString("FacetOption.Label")
871 }
872 @if(option.GetInteger("FacetOption.Count") > 0) {
873 @String.Format("({0})", option.GetString("FacetOption.Count"));
874 }
875 </span>
876 </label>
877 }
878 </div>
879 </fieldset>
880 }
881
882 break;
883 case "select":
884
885 break;
886 case "checkbox":
887
888 if(facetOptions.Any()) {
889 <fieldset data-type="@str_parameterType">
890 @foreach(LoopItem option in facetOptions.Where(f => f.GetInteger("FacetOption.Count") != 0).OrderByDescending(o => o.GetInteger("FacetOption.Count")).ThenBy(or => or.GetString("FacetOption.Label")))
891 {
892 bool bol_checked = option.GetBoolean("FacetOption.Selected");
893 string str_value = option.GetString("FacetOption.Value") == "True" ? "True" : "";
894
895 if(str_value == "True") {
896 <legend class="filterTitle">@str_name</legend>
897 <div class="filtersContainer">
898 <label class="checkBoxContainer"><input checked="@bol_checked" type="checkbox" value="@str_value" name="@str_parameter"> <span>@str_name (@option.GetString("FacetOption.Count"))</span></label>
899 </div>
900 }
901 }
902 </fieldset>
903 }
904
905 break;
906 case "radio":
907
908 break;
909 case "radios":
910
911 break;
912 case "autocomplete":
913
914 break;
915 default:
916 <fieldset data-type="@str_parameterType">
917 <legend class="filterTitle">@str_name</legend>
918 <div class="filtersContainer">
919 <input type="text" name="@str_parameter" value="" />
920 </div>
921 </fieldset>
922 break;
923 }
924 }
925
926 }
927
928 @functions{
929 public Dictionary<string, Dictionary<string, string>> breadcrumbSource = new Dictionary<string, Dictionary<string, string>>();
930 public string GetApplicationsLabel(string applicationValues, Dictionary<string, string> applicationsData){
931 applicationValues = applicationValues.Replace("\"","").Replace(",",", ");
932 /*
933 string[] applicationsList = applicationValues.Split(',');
934 applicationValues = "";
935 foreach(var app in applicationsList){
936 if(applicationsData.ContainsKey(app)) {
937 applicationValues += !String.IsNullOrEmpty(applicationValues) ? ", " : "";
938 applicationValues += applicationsData[app];
939 }
940 }
941 */
942 return applicationValues;
943 }
944
945 public Dictionary<string, string> GetFilterData(string fieldID)
946 {
947 //HttpContext.Current.Cache.Remove("applicationsDataCache_" + fieldID);
948 var applicationCache = HttpContext.Current.Cache["applicationsDataCache_" + fieldID];
949 Dictionary<string, string> applicationsData = applicationCache as Dictionary<string, string> ?? new Dictionary<string, string>();
950 if(applicationCache == null)
951 {
952 using(var connection = Dynamicweb.Data.Database.CreateConnection())
953 {
954 using(var command = connection.CreateCommand())
955 {
956 command.CommandText = "SELECT FieldOptionValue,FieldOptionName FROM EcomFieldOption WHERE FieldOptionFieldID=''+@fieldID+'' ORDER BY FieldOptionValue";
957 command.Parameters.Add(new System.Data.SqlClient.SqlParameter()
958 {
959 ParameterName = "fieldID",
960 SqlDbType = System.Data.SqlDbType.NVarChar,
961 Value = fieldID
962 });
963 using(var reader = command.ExecuteReader())
964 {
965 if(reader != null)
966 {
967 while (reader.Read())
968 {
969 applicationsData.Add(reader["FieldOptionValue"].ToString(), reader["FieldOptionName"].ToString());
970 }
971 }
972 }
973 }
974 }
975 HttpContext.Current.Cache.Insert("applicationsDataCache_" + fieldID, applicationsData, null, DateTime.Now.AddMinutes(5), System.Web.Caching.Cache.NoSlidingExpiration);
976 }
977 return applicationsData;
978 }
979 }
980
981 <div class='col-xs-10 productArea noPaddingRight @(listView == "detailedView" ? "detailedView" : "" )'>
982
983 @{
984 string groupDescription = GetString("Ecom:Group.Description");
985 int loopProductCount = loopProduct.Count;
986 int totalProductCount = GetInteger("Ecom:ProductList.PageProdCnt");
987 int startLoopProductCount = (loopProductCount * (GetInteger("Ecom:ProductList.CurrentPage") - 1)) + 1;
988 int endLoopProductCount = loopProductCount * GetInteger("Ecom:ProductList.CurrentPage");
989
990 if(loopProductCount < GetInteger("Ecom:ProductList.PageSize")){
991 startLoopProductCount = (GetInteger("Ecom:ProductList.PageSize") * (GetInteger("Ecom:ProductList.CurrentPage") - 1)) + 1;
992 endLoopProductCount = totalProductCount;
993 }
994 }
995
996 @if(!String.IsNullOrWhiteSpace(groupDescription)) {
997 <div id="groupDescription" class="col-xs-12 noPadding">
998 @groupDescription
999 </div>
1000 }
1001
1002 <span class="productListResume col-xs-3 noPadding">
1003 @Translate("productListCount","{{numberProducts}} of {{countAllProducts}} items").Replace("{{numberProducts}}", String.Format("{0}-{1}", startLoopProductCount, endLoopProductCount)).Replace("{{countAllProducts}}", totalProductCount.ToString())
1004 </span>
1005
1006 <form id="orderProdList" class="col-xs-3 noPadding" action="/Default.aspx" name="ExtUserForm_Main" method="GET">
1007 <input type="hidden" name="ID" value='@Pageview.Page.ID'>
1008 @if(!string.IsNullOrWhiteSpace(str_paramGroupID))
1009 {
1010 <input type="hidden" name="GroupID" value='@str_paramGroupID'>
1011 }
1012
1013 @if(!string.IsNullOrWhiteSpace(str_keywordsParam))
1014 {
1015 <input type="hidden" name="Keywords" value='@str_keywordsParam'>
1016 }
1017
1018 @if(!string.IsNullOrWhiteSpace(str_GeneIDParam))
1019 {
1020 <input type="hidden" name="GeneID" value='@str_GeneIDParam'>
1021 }
1022
1023 @if(!string.IsNullOrWhiteSpace(str_SpecificityParam))
1024 {
1025 <input type="hidden" name="Specificity" value='@str_SpecificityParam'>
1026 }
1027
1028 <fieldset class="col-xs-12 noPadding" data-groupdID="@str_paramGroupID">
1029 <label>@Translate("Sort by"):</label>
1030 <select id="sortSelect" name="SortBy">
1031 <option selected='@(str_sortBy == "")' value="@sortByMatch">@Translate("Match","Best Match")</option>
1032 <option selected='@(str_sortBy == sortByName)' value="@sortByName">@Translate("Name")</option>
1033 <option selected='@(str_sortBy == sortByClone)' value="@sortByClone">@Translate("Clone","Clone")</option>
1034 <option selected='@(str_sortBy == sortByApplication )' value="@sortByApplication">@Translate("Applications","Applications")</option>
1035 <option selected='@(str_sortBy == sortByRegulatoryStatus)' value="@sortByRegulatoryStatus">@Translate("RegulatoryStatus","Regulatory Status")</option>
1036 </select>
1037 </fieldset>
1038
1039 </form>
1040
1041 @{
1042 string str_nextPage = GetString("Ecom:ProductList.NextPage");
1043 int num_totalPages = GetInteger("Ecom:ProductList.TotalPages");
1044 int num_curPage = System.Web.HttpContext.Current.Request.Params["PageNum"] != null ? Convert.ToInt32(System.Web.HttpContext.Current.Request.Params["PageNum"].ToString()) : 1;
1045 string prevPageClean = GetString("Ecom:ProductList.PrevPage.Clean");
1046 string nextPageClean = GetString("Ecom:ProductList.NextPage.Clean");
1047 }
1048
1049 @if(num_totalPages > 1)
1050 {
1051 string getGlobalRequest = GetGlobalValue("Global:Request.Url");
1052
1053 <ul class="pagination col-xs-5 pull-right">
1054 @if(!string.IsNullOrWhiteSpace(prevPageClean))
1055 {
1056 <li class="previous"><a href='@prevPageClean'><i class="fa fa-angle-left"></i> @Translate("Previous")</a></li>
1057 }
1058
1059 @if(num_curPage > 2 && num_totalPages > 3){
1060 for(int i=1;i <= 1;i++){
1061 string str_active = num_curPage == i ? "class=\"active\"" : "";
1062 str_pagingHref = getGlobalRequest.Contains("PageNum") ? getGlobalRequest.Replace("PageNum="+num_curPage, "PageNum=" + i ) : getGlobalRequest + "&PageNum=" + i;
1063 <li @str_active><a href="@str_pagingHref">@i</a></li>
1064 }
1065 if(num_totalPages > 4 && num_curPage != 3 ) {
1066 <li class="etc"><span>...</span></li>
1067 }
1068 }
1069 @foreach (LoopItem i in loop_productList3)
1070 {
1071 if(i.GetBoolean("Ecom:ProductList.Pages3.Page.IsCurrent"))
1072 {
1073 <li class="active"><a href="@i.GetString("Ecom:ProductList.Pages3.Page.UrlHtmlEncoded")">@i.GetString("Ecom:ProductList.Pages3.Page.Number")</a></li>
1074 }
1075 else
1076 {
1077 <li><a href="@i.GetString("Ecom:ProductList.Pages3.Page.UrlHtmlEncoded")">@i.GetString("Ecom:ProductList.Pages3.Page.Number")</a></li>
1078 }
1079 }
1080 @if(num_curPage < num_totalPages-1 && num_totalPages > 3){
1081 if(num_totalPages > 4) {
1082 <li class="etc"><span>...</span></li>
1083 }
1084 for(int i=num_totalPages;i <= num_totalPages;i++){
1085 string str_active = num_curPage == i ? "class=\"active\"" : "";
1086 str_pagingHref = getGlobalRequest.Contains("PageNum") ? getGlobalRequest.Replace("PageNum="+num_curPage, "PageNum="+i) : getGlobalRequest + "&PageNum=" + i;
1087 <li @str_active><a href="@str_pagingHref">@i</a></li>
1088 }
1089 }
1090 @if(!string.IsNullOrWhiteSpace(nextPageClean))
1091 {
1092 <li class="next"><a href='@nextPageClean'>@Translate("Next") <i class="fa fa-angle-right"></i></a></li>
1093 }
1094 </ul>
1095 }
1096
1097 @helper Truncate(string str_input,int num_length)
1098 {
1099 if(str_input.Length <= num_length){
1100 @str_input
1101 }else{
1102 @str_input.Substring(0,num_length)<text>...</text>
1103 }
1104 }
1105
1106 <div class="col-xs-12">
1107 @{
1108 string keywordlessURL = String.Format("/Default.aspx?ID={0}", searchPageID);
1109 string breadcrumbEntry = "";
1110 foreach(KeyValuePair<string, Dictionary<string, string>> entryOuter in breadcrumbSource)
1111 {
1112 Dictionary<string, string> thisItem = new Dictionary<string, string>();
1113 foreach(KeyValuePair<string, string> entryMiddle in entryOuter.Value)
1114 {
1115 thisItem.Add(entryMiddle.Key, entryMiddle.Value);
1116 }
1117 string filterURL = String.Format("/Default.aspx?ID={0}&{1}={2}", searchPageID,thisItem["filter"],thisItem["val"]);
1118 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"]);
1119 breadcrumbEntry += thisBreadcrumbEntry;
1120 keywordlessURL += String.Format("&{0}={1}", thisItem["filter"],thisItem["val"]);
1121
1122 }
1123
1124 if(!String.IsNullOrEmpty(str_keywordsParam))
1125 {
1126 @str_keywordsParam <a href="@keywordlessURL"><i class="fa fa-times-circle"></i></a> <text>/</text>
1127 }
1128 if(!String.IsNullOrEmpty(str_CloneParam))
1129 {
1130 @str_CloneParam <a href="@keywordlessURL"><i class="fa fa-times-circle"></i></a> <text>/</text>
1131 }
1132 if(!String.IsNullOrEmpty(str_SpecificityParam))
1133 {
1134 @str_SpecificityParam <a href="@keywordlessURL"><i class="fa fa-times-circle"></i></a> <text>/</text>
1135 }
1136
1137 @breadcrumbEntry
1138 }
1139
1140
1141 </div>
1142
1143 <ul id="productsHolder" class="productList col-xs-12 noPadding">
1144
1145 <li class="col-xs-12 noPadding">
1146 <div class="col-xs-3 @sortByNameSelected">
1147 @Translate("Product","Product")
1148 </div>
1149
1150 <div class='@(!cartDisabled ? "col-xs-2" : "col-xs-2") noPadding @sortByCloneSelected'>
1151 @Translate("Clone","Clone")
1152 </div>
1153
1154 <div class="col-xs-1 noPadding @sortByApplicationsSelected">
1155 @Translate("Appl","Appl.")
1156 </div>
1157
1158 <div class="col-xs-1 @sortByRegulatoryStatusSelected">
1159 @Translate("Reg","Reg")
1160 </div>
1161
1162 <div class='@(!cartDisabled ? "col-xs-5" : "col-xs-5") noPadding'>
1163 <div class='@(!cartDisabled ? "col-xs-3" : "col-xs-4") noPadding'>
1164 @Translate("categoryNumberShort","Cat#")
1165 </div>
1166
1167 <div class='@(!cartDisabled ? "col-xs-3" : "col-xs-4") noPadding'>
1168 @Translate("size","Size")
1169 </div>
1170
1171 @if(!cartDisabled)
1172 {
1173 <div class="col-xs-2 noPadding">
1174 @Translate("price","Price")
1175 </div>
1176
1177 <div class="col-xs-1 noPadding">
1178 @Translate("quantityHeader","Quantity")
1179 </div>
1180 }
1181
1182 </div>
1183
1184 </li>
1185
1186 @foreach (var group in prodLoop){
1187 itemsCount++;
1188
1189 <li class="col-xs-12" >
1190 @if(itemsCount == 1) {
1191 @ShowTextAboutMoreOptionsInPreviousOrNextPages(loopProduct, true)
1192 }
1193 <ul>
1194 @foreach (var product in group)
1195 {
1196
1197 string str_productName = product.GetString("Ecom:Product.Name");
1198 string str_productID = product.GetString("Ecom:Product.ID");
1199 var str_link = "/Default.aspx?id=" + GetPageIdByNavigationTag("ProductDetail") + "&ProductId=" + str_productID;
1200 //string str_link = product.GetString("Ecom:Product.Link.Clean");
1201 bool excludeAB = product.GetBoolean("Ecom:Product:Field.ExcludeAB.Value");
1202 string productType = product.GetString("Ecom:Product:Field.CMProductType.Value");
1203 string productCategory = product.GetString("Ecom:Product:Field.ProductCategory.Value");
1204 string regulatoryStatus = product.GetString("Ecom:Product:Field.RegulatoryStatus.Value");
1205 string productClone = Regex.Replace(product.GetString("Ecom:Product:Field.Clone.Value"), "<!.*?>", String.Empty , RegexOptions.Singleline).Trim();
1206 string productReactivity = product.GetString("Ecom:Product:Field.Reactivity.Value");
1207
1208 string str_starClass = "";
1209 string str_halfStar = "";
1210
1211 string str_productImage = product.GetString("Ecom:Product.ImageSmall.Clean");
1212 string str_productImageMedium = product.GetString("Ecom:Product.ImageMedium.Clean");
1213 string str_productImageLarge = product.GetString("Ecom:Product.ImageLarge.Clean");
1214 string str_productImage4 = product.GetString("Ecom:Product:Field.Image4Path.Value.Clean");
1215
1216 string str_productGetImage = GetImage(str_productImage, 140, 0, 0, 0, 0, 0,"jpg",90);
1217 string str_productGetImageMedium = GetImage(str_productImageMedium, 140, 0, 0, 0, 0, 0,"jpg",90);
1218 string str_productGetImageLarge = GetImage(str_productImageLarge, 140, 0, 0, 0, 0, 0,"jpg",90);
1219 string str_productGetImage4 = GetImage(str_productImage4, 140, 0, 0, 0, 0, 0,"jpg",90);
1220
1221 string str_image1Description = product.GetString("Ecom:Product:Field.Image1Description.Value");
1222 string str_image2Description = product.GetString("Ecom:Product:Field.Image2Description.Value");
1223 string str_image3Description = product.GetString("Ecom:Product:Field.Image3Description.Value");
1224 string str_image4Description = product.GetString("Ecom:Product:Field.Image4Description.Value");
1225
1226 string str_image1Title = product.GetString("Ecom:Product:Field.Image1Title.Value");
1227 string str_image2Title = product.GetString("Ecom:Product:Field.Image2Title.Value");
1228 string str_image3Title = product.GetString("Ecom:Product:Field.Image3Title.Value");
1229 string str_image4Title = product.GetString("Ecom:Product:Field.Image4Title.Value");
1230
1231 string str_productImage5 = product.GetString("Ecom:Product:Field.Image5Path.Value.Clean");
1232 string str_productGetImage5 = GetImage(str_productImage5, 140, 0, 0, 0, 0, 0,"jpg",90);
1233 string str_image5Description = product.GetString("Ecom:Product:Field.Image5Description.Value");
1234 string str_image5Title = product.GetString("Ecom:Product:Field.Image5Title.Value");
1235
1236 string str_productImage6 = product.GetString("Ecom:Product:Field.Image6Path.Value.Clean");
1237 string str_productGetImage6 = GetImage(str_productImage6, 140, 0, 0, 0, 0, 0,"jpg",90);
1238 string str_image6Description = product.GetString("Ecom:Product:Field.Image6Description.Value");
1239 string str_image6Title = product.GetString("Ecom:Product:Field.Image6Title.Value");
1240
1241 string str_productFormat = product.GetString("Ecom:Product:Field.Format.Value");
1242
1243 string stockUS = !string.IsNullOrWhiteSpace(product.GetString("Ecom:Product:Field.StockUS.Value.Clean")) ? product.GetString("Ecom:Product:Field.StockUS.Value.Clean") : "0";
1244 string stockUK = !string.IsNullOrWhiteSpace(product.GetString("Ecom:Product:Field.StockUK.Value.Clean")) ? product.GetString("Ecom:Product:Field.StockUK.Value.Clean") : "0";
1245 string stockEU = !string.IsNullOrWhiteSpace(product.GetString("Ecom:Product:Field.StockEU.Value.Clean")) ? product.GetString("Ecom:Product:Field.StockEU.Value.Clean") : "0";
1246 string stockControl = product.GetString("Ecom:Product:Field.StockControl.Value.Clean");
1247
1248 bool isComingSoon = product.GetBoolean("Ecom:Product:Field.ComingSoon.Value");
1249 string DCSoon = product.GetString("Ecom:Product:Field.DCSoon.Value");
1250
1251 bool blockAddToCart = product.GetBoolean("Ecom:Product:Field.BlockAddToCart.Value");
1252 string blockAddToCartText = product.GetString("Ecom:Product:Field.BlockAddToCartText.Value");
1253 blockAddToCartText = blockAddToCartText.Replace("'", "'");
1254 blockAddToCartText = blockAddToCartText.Replace("\r\n", "");
1255 blockAddToCartText = blockAddToCartText.Replace("\r", "");
1256 blockAddToCartText = blockAddToCartText.Replace("\n", "");
1257
1258 bool requestQuote = product.GetBoolean("Ecom:Product:Field.RequestQuote.Value");
1259
1260 List<Tuple<string,string,string>> lst_images = new List<Tuple<string,string,string>>();
1261
1262 if(!String.IsNullOrEmpty(str_productImage)) { lst_images.Add(new Tuple<string, string, string>(str_productImage,str_image1Title,str_image1Description)); }
1263 if(!String.IsNullOrEmpty(str_productImageMedium)) { lst_images.Add(new Tuple<string, string, string>(str_productImageMedium,str_image2Title,str_image2Description)); }
1264 if(!String.IsNullOrEmpty(str_productImageLarge)) { lst_images.Add(new Tuple<string, string, string>(str_productImageLarge,str_image3Title,str_image3Description)); }
1265 if(!String.IsNullOrEmpty(str_productImage4)) { lst_images.Add(new Tuple<string, string ,string>(str_productImage4,str_image4Title,str_image4Description)); }
1266 if(!String.IsNullOrEmpty(str_productImage5)) { lst_images.Add(new Tuple<string, string ,string>(str_productImage5,str_image5Title,str_image5Description)); }
1267 if(!String.IsNullOrEmpty(str_productImage6)) { lst_images.Add(new Tuple<string, string ,string>(str_productImage6,str_image6Title,str_image6Description)); }
1268
1269 string str_productVariantID = product.GetString("Ecom:Product.VariantID");
1270 string urlAction = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + addToCart);
1271 string productFieldType = "";
1272 if (productTypes.ContainsKey(productType))
1273 {
1274 productFieldType = productTypes[productType];
1275 }
1276
1277 int productStatus = product.GetInteger("Ecom:Product:Field.ProductStatus.Value.Clean");
1278 string productSource = product.GetString("Ecom:Product:Field.ProductSource.Value.Clean");
1279 int productVariantStatus = product.GetInteger("Ecom:Product:Field.ProductStatus.Value.Clean");
1280
1281 @functions {
1282 public string CalculateProductName(string prodName, string prodType, string prodFormat, bool excludeAntibody)
1283 {
1284 string cleanName = prodName;
1285 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)){
1286 cleanName += " Antibody";
1287 }
1288
1289 if(prodType.Equals("SecondaryReagents") && !prodName.Contains(" Antibody") && !prodName.Contains("Streptavidin") && !prodName.Contains("Avidin") && (!excludeAntibody)){
1290 cleanName += " Antibody";
1291 }
1292
1293 if(prodType.Equals("IsotypeControls") && !prodName.Contains(" Antibody") && !prodName.Contains("Lineage Cocktail") && (!excludeAntibody)){
1294 cleanName += " Antibody";
1295 }
1296
1297 return cleanName;
1298 }
1299 }
1300 str_productName = CalculateProductName(str_productName,productFieldType,str_productFormat,excludeAB);
1301
1302 @helper renderCloneFieldForSearch(string clone, string spID, string pCat, string pReact, string searchType)
1303 {
1304 string cloneText = "";
1305 if(!String.IsNullOrEmpty(clone)){
1306
1307 string thisClone = "";
1308 if(clone.Contains(";")){
1309 string[] clones = (clone).Replace(" ", "").Split(';');
1310 foreach (var x in clones)
1311 {
1312 string cloneHTML = System.Web.HttpUtility.HtmlDecode(x);
1313 string cloneTag = "; ";
1314 thisClone += "<a href=\"/Default.aspx?ID=" + spID + "&Clone=" + cloneHTML + "\">" + x + "</a>" + cloneTag;
1315 }
1316 }
1317 else{
1318 string cloneHTML = System.Web.HttpUtility.HtmlDecode(clone);
1319 if(pCat.Equals("RECOM_PRO")){
1320 thisClone = "<a href=\"/Default.aspx?ID=" + spID + "&Clone=" + cloneHTML + "\">" + clone + "</a>";
1321
1322 }
1323 else{
1324 if(searchType == "Detail"){
1325 thisClone = "<a href=\"/Default.aspx?ID=" + spID + "&Clone=" + cloneHTML + "\">" + clone + "</a>";
1326 }
1327 else{
1328 thisClone = "<a href=\"/Default.aspx?ID=" + spID + "&Clone=" + cloneHTML + "\"><i class=\"bl bl-cloneIcon\" data-toggle=\"tooltip\" title=\"" + pReact + "\"></i> " + clone + "</a>";
1329 }
1330 }
1331
1332 }
1333
1334 cloneText += thisClone;
1335
1336
1337
1338 }
1339 else if(!String.IsNullOrWhiteSpace(pReact) && !pCat.Equals("RECOM_PRO") && !searchType.Equals("Detail"))
1340 {
1341 cloneText += "<a href=\"javascript:void(0);\"><i class=\"bl bl-cloneIcon\" data-toggle=\"tooltip\" title=\"" + pReact + "\"></i></a>";
1342 }
1343
1344 <text>@cloneText</text>
1345
1346 }
1347
1348 @helper renderCloneFieldForSearch_v2(string clone, string spID, string pCat, string pReact, string searchType)
1349 {
1350 string cloneText = "";
1351 if(!string.IsNullOrEmpty(clone)) {
1352 string thisClone = "";
1353 if(clone.Contains(";")){
1354 string[] clones = (clone).Replace(" ", "").Split(';');
1355 foreach (var x in clones)
1356 {
1357 string cloneTag = "; ";
1358 thisClone += $"<a href=\"javascript:updateClone('{x}');\">{x}</a>" + cloneTag;
1359 }
1360 }
1361 else {
1362 if(pCat.Equals("RECOM_PRO")
1363 || searchType == "Detail")
1364 {
1365 thisClone = $"<a href=\"javascript:updateClone('{clone}');\">{clone}</a>";
1366 }
1367 else {
1368 thisClone = "<a href=\"javascript:updateClone('" + clone + "');\"><i class=\"bl bl-cloneIcon\" data-toggle=\"tooltip\" title=\"" + pReact + "\"></i> " + clone + "</a>";
1369 }
1370 }
1371
1372 cloneText += thisClone;
1373 }
1374 else if(!string.IsNullOrWhiteSpace(pReact) && !pCat.Equals("RECOM_PRO") && !searchType.Equals("Detail"))
1375 {
1376 cloneText += "<a href=\"javascript:void(0);\"><i class=\"bl bl-cloneIcon\" data-toggle=\"tooltip\" title=\"" + pReact + "\"></i></a>";
1377 }
1378
1379 <text>@cloneText</text>
1380 }
1381
1382 <li class="row list" data-variantID="@str_productVariantID">
1383 @if(previousElement != str_productID)
1384 {
1385 <h2 class="col-xs-3">
1386 <a itemprop="name" href="@str_link">
1387 @str_productName
1388 </a>
1389 </h2>
1390
1391 <div class='@(!cartDisabled ? "col-xs-2" : "col-xs-2") noPaddingLeft'>
1392 @renderCloneFieldForSearch(productClone,searchPageID,productCategory,productReactivity,"List")
1393 </div>
1394
1395 <div class="col-xs-1 noPadding wordWrap">
1396 <a href="@LocalizeLinksHTML("dwcountry/abbreviations")" target="_blank" title='@Translate("ViewAbbreviationDescriptions","View abbreviation descriptions")'>
1397 @GetApplicationsLabel(product.GetString("Ecom:Product:Field.AppAbrv.Value"), applicationsData)
1398 </a>
1399 </div>
1400
1401 <div class="col-xs-1">
1402 @if(!String.IsNullOrWhiteSpace(regulatoryStatus)){
1403 @regulatoryStatus
1404 }else{
1405 <text>--</text>
1406 }
1407 </div>
1408 }
1409
1410 <div class='@(!cartDisabled ? "col-xs-5" : "col-xs-5") noPadding @(previousElement == str_productID ? colGroup : "")'>
1411
1412 <form name="addToCart" class="add-to-cart col-xs-12 noPadding" action="@urlAction" method="POST">
1413 @if(bol_userLogged)
1414 {
1415 <input type="hidden" name="redirect" value="false"/>
1416 }
1417 <input type="hidden" name="cartcmd" value="add"/>
1418 <input type="hidden" name="productid" value="@str_productID"/>
1419 <input type="hidden" name="variantID" value="@str_productVariantID" />
1420 @if(!string.IsNullOrWhiteSpace(orderContext))
1421 {
1422 <input type="hidden" name="OrderContext" value="@orderContext" />
1423 }
1424
1425 @if((longLang.Equals("ja-JP") && regulatoryStatus.Equals("IVD")) || (longLang.Equals("ja-JP") && str_productID.Equals("11573")) ){
1426 <div class='@(!cartDisabled ? "col-xs-2" : "col-xs-4") noPadding'>
1427
1428 </div>
1429 }
1430 else{
1431 <div class='@(!cartDisabled ? "col-xs-3" : "col-xs-4") noPadding'>
1432 @if (!isComingSoon)
1433 {
1434 @product.GetString("Ecom:Product.Number")
1435 }
1436 else
1437 {
1438 @Translate("comingSoon", "Coming Soon")
1439 }
1440 </div>
1441 }
1442
1443 <div class='@(!cartDisabled ? "col-xs-3" : "col-xs-4") noPadding'>
1444 @product.GetString("Ecom:Product.VariantText")
1445 </div>
1446
1447 <div class='@(!cartDisabled ? "col-xs-2" : "col-xs-4") noPadding'>
1448 @if(longLang.Equals("ja-JP") && str_productFormat.Contains("GOINVIVO") && !str_productVariantID.Equals("5mg"))
1449 {
1450 @Translate("PleaseContactUs","Please Contact Us")
1451 }
1452 else if(longLang.Equals("ja-JP") && blockAddToCart){
1453 <div><p class="coming-soon">@blockAddToCartText</p></div>
1454 }
1455 else if(longLang.Equals("ja-JP") && @product.GetString("Ecom:Product.Number").Equals("423555")){
1456 <span class="withBreak" itemprop="price">@RoundPrice(product.GetDouble("Ecom:Product.Price.PricePIP"))</span>
1457 }
1458 else if(requestQuote){
1459 <div><a href="@LocalizeLinksHTML("dwcountry/contact-local-rep")" target="_blank">Get a Quote</a></div>
1460 }
1461 else if(str_productID.Equals("10801") && !longLang.Equals("en-US"))
1462 {
1463 @Translate("addToCartForPrice","Add to cart for price.")
1464 }
1465 else if(str_productName.Contains("Flex-T") && str_productName.Contains("Custom")){
1466
1467 }
1468 else if((longLang.Equals("ja-JP") && regulatoryStatus.Equals("IVD")) || (longLang.Equals("ja-JP") && str_productID.Equals("11573")) ){
1469
1470 }
1471 else{
1472 <span class="withBreak" itemprop="price">@RoundPrice(product.GetDouble("Ecom:Product.Price.PricePIP"))</span>
1473 }
1474 </div>
1475
1476 @if(!cartDisabled && !(str_productName.Contains("Flex-T") && str_productName.Contains("Custom")))
1477 {
1478 <div class="col-xs-1 noPadding">
1479 @if (!productVariantStatus.Equals(3) && !isComingSoon && !blockAddToCart)
1480 {
1481 <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" />
1482 }
1483 </div>
1484
1485 <div class="col-xs-1">
1486 @if(blockAddToCart) {
1487 <button onClick="alert('@blockAddToCartText'); return false;" title="@blockAddToCartText"><i class="fa fa-times-circle"></i></button>
1488 } else {
1489 if(str_productName.Contains("Capture Bead") || (str_productName.Contains("LEGENDplex") && (str_productName.Contains("Standard") || str_productName.Contains("Detection Antibodies") || str_productName.Contains("Detection Abs") || str_productName.Contains("Buffer Set"))))
1490 {
1491 <button onClick="mixMatchProductRedirect('@longLang'); return false;" title="@Translate("mixAndMatch","Mix & Match")"><i class="fa fa-shopping-cart"></i></button>
1492 }
1493 else if(str_productName.Contains("Flex-T") && str_productName.Contains("Custom")){
1494 }
1495 else if((longLang.Equals("ja-JP") && regulatoryStatus.Equals("IVD")) || (longLang.Equals("ja-JP") && str_productID.Equals("11573"))){
1496 }
1497 else{
1498 if (isComingSoon)
1499 {
1500 @:
1501 }
1502 else if(userCurrency != siteCurrency){
1503 <span class="inputSubmit" data-toggle="tooltip" title="@(Translate("CurrencyMissmatch","Your currency does not match the websites currency. Please navigate to the proper page."))">
1504 <button type="submit" disabled><i class="fa fa-shopping-cart"></i></button>
1505 </span>
1506 }
1507 else if(string.IsNullOrWhiteSpace(productSource)){
1508 <span class="inputSubmit" data-toggle="tooltip" title="@(Translate("ProductNotAvailable","This product is not currently available."))">
1509 <button type="submit" disabled><i class="fa fa-shopping-cart"></i></button>
1510 </span>
1511 }
1512 else{
1513 <button type="submit"><i class="fa fa-shopping-cart"></i></button>
1514 }
1515 }
1516 }
1517 </div>
1518 }
1519 </form>
1520 </div>
1521 </li>
1522
1523 previousElement = group.Key;
1524 }
1525 </ul>
1526 @if(itemsCount == prodLoop.Count()) {
1527 @ShowTextAboutMoreOptionsInPreviousOrNextPages(loopProduct)
1528 }
1529 </li>
1530 }
1531 </ul>
1532
1533
1534
1535 @{
1536 int totalproductCount = GetInteger("Ecom:ProductList.PageProdCnt");
1537 string tooManyResults = Translate("tooManyResults","Your search returned too many results. Please refine your search");
1538 }
1539 <div class="pageBottom col-xs-3 noPadding">
1540 <form id="bottom_pageSizeProdList" class="" action="/Default.aspx" name="ExtUserForm_Main" method="GET">
1541 @if(!string.IsNullOrEmpty(requestParams["adv1"])){
1542 <div class="advFields">
1543 @for(var adv = 1; adv < 12; adv++){
1544 @hiddenField("adv" + adv, !string.IsNullOrEmpty(requestParams["adv" + adv]) ? requestParams["adv" + adv] : "")
1545 }
1546 </div>
1547 }
1548 <fieldset>
1549 <label>@Translate("Results Per Page"):</label>
1550 <select name="PageSize">
1551 <option selected="@(str_pageSize == "25" || str_pageSize == "")" value="25">25</option>
1552 <option selected="@(str_pageSize == "50")" value="50">50</option>
1553 <option selected="@(str_pageSize == "100")" value="100">100</option>
1554 <option selected="@(str_pageSize == "200" || str_pageSize == "1")" value="200">200</option>
1555 </select>
1556 </fieldset>
1557 </form>
1558 </div>
1559
1560 @if(num_totalPages > 1)
1561 {
1562 string getGlobalRequest = GetGlobalValue("Global:Request.Url");
1563
1564 <ul class="pagination pageBottom pull-right col-xs-5">
1565 @if(!string.IsNullOrWhiteSpace(prevPageClean))
1566 {
1567 <li class="previous"><a href='@prevPageClean'><i class="fa fa-angle-left"></i> @Translate("Previous")</a></li>
1568 }
1569
1570 @if(num_curPage > 2 && num_totalPages > 3){
1571 for(int i=1;i <= 1;i++){
1572 string str_active = num_curPage == i ? "class=\"active\"" : "";
1573 str_pagingHref = getGlobalRequest.Contains("PageNum") ? getGlobalRequest.Replace("PageNum="+num_curPage, "PageNum=" + i ) : getGlobalRequest + "&PageNum=" + i;
1574 <li @str_active><a href="@str_pagingHref">@i</a></li>
1575 }
1576 if(num_totalPages > 4 && num_curPage != 3 ) {
1577 <li class="etc"><span>...</span></li>
1578 }
1579 }
1580
1581 @foreach (LoopItem i in loop_productList3)
1582 {
1583 if(i.GetBoolean("Ecom:ProductList.Pages3.Page.IsCurrent"))
1584 {
1585 <li class="active"><a href="@i.GetString("Ecom:ProductList.Pages3.Page.UrlHtmlEncoded")">@i.GetString("Ecom:ProductList.Pages3.Page.Number")</a></li>
1586 }
1587 else
1588 {
1589 <li><a href="@i.GetString("Ecom:ProductList.Pages3.Page.UrlHtmlEncoded")">@i.GetString("Ecom:ProductList.Pages3.Page.Number")</a></li>
1590 }
1591 }
1592 @if(num_curPage < num_totalPages-1 && num_totalPages > 3){
1593 if(num_totalPages > 4) {
1594 <li class="etc"><span>...</span></li>
1595 }
1596 for(int i=num_totalPages;i <= num_totalPages;i++){
1597 string str_active = num_curPage == i ? "class=\"active\"" : "";
1598 str_pagingHref = getGlobalRequest.Contains("PageNum") ? getGlobalRequest.Replace("PageNum="+num_curPage, "PageNum="+i) : getGlobalRequest + "&PageNum=" + i;
1599 <li @str_active><a href="@str_pagingHref">@i</a></li>
1600 }
1601 }
1602 @if(!string.IsNullOrWhiteSpace(nextPageClean))
1603 {
1604 <li class="next"><a href='@nextPageClean'>@Translate("Next") <i class="fa fa-angle-right"></i></a></li>
1605 }
1606 </ul>
1607 }
1608
1609 </div>
1610
1611 @functions {
1612 public static string StripHtml(string source)
1613 {
1614 return Regex.Replace(source, "<.*?>", string.Empty);
1615 }
1616 }
1617
1618 @SnippetStart("jsOnLoad")
1619 @: onLoadProductList();
1620 @SnippetEnd("jsOnLoad")
1621
1622 }
1623 }
1624 else{
1625 var countProductDiscountinued = 0;
1626 var productDetailPage = item["ProductDetail"].ToString();
1627 string liveSearchPage = item["LiveSearchPage"].ToString();
1628 string advancedSearchLink = LocalizeLinks("/dwcountry/advanced-search");
1629
1630 // If product is discountinued send to PDP
1631 if(!string.IsNullOrWhiteSpace(str_keywordsParam))
1632 {
1633 string productDiscountinued = GetDiscountinuedProductId(str_keywordsParam);
1634 if(!string.IsNullOrEmpty(productDiscountinued))
1635 {
1636 string urlRedirect = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID="+@productDetailPage+"&ProductID="+productDiscountinued);
1637 BioLegend.Shared.WebUtility.Redirect(urlRedirect);
1638 }
1639
1640 }
1641
1642 <div id="listContainer">
1643 @if(HttpContext.Current.Request.Params["p1"] != null || String.IsNullOrEmpty(System.Web.HttpContext.Current.Request.Params["Keywords"])){
1644 <h2>@Translate("noProductsFoundProductSearch","There are no products that match your term.")</h2>
1645 <div>@Translate("modifyYourSearch") <a href="@advancedSearchLink">@Translate("Advanced Search")</a> @Translate("modifyYourSearchB")</div>
1646 <div>@LocalizeLinks(Translate("contactCustomSolutionsTeamSearch"))<br /><hr /></div>
1647
1648 <div id="contentResults"></div>
1649 @SnippetStart("jsOnLoad")
1650 @: onLoadContentSearchItems('@System.Web.HttpContext.Current.Request.Params["Keywords"]');
1651 @SnippetEnd("jsOnLoad")
1652
1653 }
1654 else {
1655 @SnippetStart("jsOnLoad")
1656 @: onLoadPartialSearch("@SearchForPartialTerms(Pageview.Page.ID)", '@Translate("performePartialSearch","Performing partial match search..")');
1657 @SnippetEnd("jsOnLoad")
1658
1659 }
1660 </div>
1661
1662 @functions {
1663 public static string SearchForPartialTerms(int pageID) {
1664 string allQuery = HttpContext.Current.Request.QueryString.ToString();
1665
1666 for(var i = 1; i <= 12; i++){
1667 if(!allQuery.Contains("k"+i+"=")){
1668 break;
1669 }
1670 allQuery = allQuery.Replace(("k"+i+"="), ("p"+i+"="));
1671 }
1672
1673 allQuery = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?" + allQuery);
1674
1675 return allQuery;
1676 }
1677
1678 public static string GetDiscountinuedProductId(string str_keywordsParam)
1679 {
1680 string productId = string.Empty;
1681
1682 using (var connection = Dynamicweb.Data.Database.CreateConnection())
1683 {
1684 using (var command = connection.CreateCommand())
1685 {
1686 command.CommandText = "SELECT ProductID FROM EcomProducts WHERE ProductNumber = ''+@str_keywordsParam+'' and ProductStatus = '1'";
1687 command.Parameters.Add(new System.Data.SqlClient.SqlParameter()
1688 {
1689 ParameterName = "str_keywordsParam",
1690 SqlDbType = System.Data.SqlDbType.NVarChar,
1691 Value = str_keywordsParam
1692 });
1693
1694 using (var reader = command.ExecuteReader())
1695 {
1696 if (reader != null)
1697 {
1698 while (reader.Read())
1699 {
1700 productId = reader["ProductID"].ToString();
1701 }
1702 }
1703 }
1704 }
1705 }
1706
1707 return productId;
1708 }
1709 }
1710 }
Follow Us