Error executing template "Designs/PLC/eCom/Productlist/PLCProductList.cshtml"
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at CompiledRazorTemplates.Dynamic.RazorEngine_a91ab22156f94afba308b2467160fcfa.<>c__DisplayClass2_2.b__0(TextWriter __razor_helper_writer) in E:\website\PLCMalaysia\Solution\Files\Templates\Designs\PLC\eCom\Productlist\PLCProductList.cshtml:line 436
at CompiledRazorTemplates.Dynamic.RazorEngine_a91ab22156f94afba308b2467160fcfa.Execute() in E:\website\PLCMalaysia\Solution\Files\Templates\Designs\PLC\eCom\Productlist\PLCProductList.cshtml:line 2094
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.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @using Newtonsoft.Json.Linq;
2 @using System.Web
3
4 @using System.Text.RegularExpressions
5 @using System.Web
6
7
8 @functions{
9 public class WrapMethods
10 {
11
12
13 //Gets the contrasting color
14 public static string getContrastYIQ(string hexcolor)
15 {
16 if (hexcolor != "")
17 {
18 hexcolor = Regex.Replace(hexcolor, "[^0-9a-zA-Z]+", "");
19
20 int r = Convert.ToByte(hexcolor.Substring(0, 2), 16);
21 int g = Convert.ToByte(hexcolor.Substring(2, 2), 16);
22 int b = Convert.ToByte(hexcolor.Substring(4, 2), 16);
23 int yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
24
25 if (yiq >= 128)
26 {
27 return "black";
28 }
29 else
30 {
31 return "white";
32 }
33 }
34 else
35 {
36 return "black";
37 }
38 }
39
40
41 //Truncate text
42 public static string Truncate (string value, int count, bool strip=true)
43 {
44 if (strip == true){
45 value = StripHtmlTagByCharArray(value);
46 }
47
48 if (value.Length > count)
49 {
50 value = value.Substring(0, count - 1) + "...";
51 }
52
53 return value;
54 }
55
56
57 //Strip text from HTML
58 public static string StripHtmlTagByCharArray(string htmlString)
59 {
60 char[] array = new char[htmlString.Length];
61 int arrayIndex = 0;
62 bool inside = false;
63
64 for (int i = 0; i < htmlString.Length; i++)
65 {
66 char let = htmlString[i];
67 if (let == '<')
68 {
69 inside = true;
70 continue;
71 }
72 if (let == '>')
73 {
74 inside = false;
75 continue;
76 }
77 if (!inside)
78 {
79 array[arrayIndex] = let;
80 arrayIndex++;
81 }
82 }
83 return new string(array, 0, arrayIndex);
84 }
85
86 //Make the correct count of columns
87 public static string ColumnMaker(int Col, string ScreenSize)
88 {
89 string Columns = "";
90
91 switch (Col)
92 {
93 case 1:
94 Columns = "col-"+ScreenSize+"-12";
95 break;
96
97 case 2:
98 Columns = "col-"+ScreenSize+"-6";
99 break;
100
101 case 3:
102 Columns = "col-"+ScreenSize+"-4";
103 break;
104
105 case 4:
106 Columns = "col-"+ScreenSize+"-3";
107 break;
108
109 default:
110 Columns = "col-"+ScreenSize+"-3";
111 break;
112 }
113
114 return Columns;
115 }
116
117
118 private string Custom(string firstoption, string secondoption)
119 {
120 if (firstoption == "custom")
121 {
122 return secondoption;
123 }
124 else
125 {
126 return firstoption;
127 }
128 }
129 }
130 }
131 @using DWAPAC.PLC.Services
132 @using Dynamicweb.Security.UserManagement.Common.CustomFields
133
134
135 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
136 <script type="text/javascript" src="/Files/Templates/Designs/PLC/eCom/ProductList/Compare.js"></script>
137 <style>
138 .ui-dialog-titlebar, .ui-dialog-buttonset button{
139 background:#662010;
140 color: #FFF;
141 }
142
143 .clearfix{
144 margin-bottom: -10px !important;
145 }
146
147 #myBtn {
148 display: none;
149 position: fixed;
150 bottom: 55px;
151 right: 9%;
152 z-index: 99;
153 font-size: 18px;
154 border: none;
155 outline: none;
156 color: white;
157 cursor: pointer;
158 padding: 15px;
159 border-radius: 4px;
160 background-image: url(/Files/Templates/Designs/PLC/assets/images/up_arrow_icon.png);
161 background-size: 35px;
162 width: 35px;
163 height: 35px;
164 }
165
166 .product-box .prod-img img {
167 display: block;
168 margin: 0px auto;
169 }
170 .prod-pbox{
171 height:115px;
172 }
173 /*::before {
174 padding-top:0.5em;
175 }commented out By AKS due to menu collapsing problem */
176 input[type=number]::-webkit-inner-spin-button,
177 input[type=number]::-webkit-outer-spin-button {
178 -webkit-appearance: none;
179 -moz-appearance: none;
180 appearance: none;
181 margin: 0;
182 }
183 @if(GetInteger("Ecom:ProductList.PageProdCnt") > 0)
184 {
185 <text>
186 .btn-addto-cart {
187 margin-bottom:5px;
188 background-color: #ad2d14;
189 height:38px;
190 border-radius: 3px;
191 }
192 .btn-addto-cart:hover {
193 //background-color: #500d00;
194 }
195 .glyphicon-minus, .glyphicon-plus {
196 cursor: pointer;
197 color: #ffffff;
198 }
199 </text>
200 if(System.Web.HttpContext.Current.Request.Browser.Type.ToUpper().Contains("SAFARI"))
201 {
202 <text>
203 .btn-addto-cart div a, .btn-addto-cart a {
204 line-height: 36px;
205 }
206 #addtocartLink {
207 margin-top: 30px !important;
208 }
209 @@media screen (max-width: 340px){
210 .btn-addto-cart div a, .btn-addto-cart a {
211 padding-top: 0px;
212 }
213 }
214 .fixsize {
215 margin-top: 120px;
216 }
217 </text>
218 }
219 else
220 {
221
222 }
223 }
224 else
225 {
226 if(System.Web.HttpContext.Current.Request.Browser.Type.ToUpper().Contains("SAFARI"))
227 {
228 <text>
229 .btn-addto-cart div a, .btn-addto-cart a {
230 line-height: 36px;
231 }
232 #addtocartLink {
233 margin-top: 30px !important;
234 }
235 @@media screen (max-width: 340px){
236 .btn-addto-cart div a, .btn-addto-cart a {
237 padding-top: 0px;
238 }
239 }
240 </text>
241 }
242 else
243 {
244
245 }
246 }
247 @@media screen and (max-width: 700px) and (min-width: 350px) and (max-height: 700px) {
248 .mblAddTo {
249 padding-left:30px !important;
250 }
251 }
252 @@media screen and (max-width: 700px) and (min-width: 375px) and (max-height: 700px) {
253 .mblpromologo {
254 padding-bottom:2px;
255 }
256 }
257 @@media screen and (max-width: 700px) and (min-width: 350px) and (max-height: 700px) {
258 .mblpromologo1 {
259 padding-bottom:-5px;
260 }
261 }
262 @@media screen and (max-width: 800px) and (min-width: 768px) and (max-height: 1024px) {
263 .mblPromologoipad {
264 padding-bottom:5px;
265 }
266 }
267 @@media screen and (max-width: 1024px) and (min-width: 768px) and (max-height: 800px) {
268 .mblPromologoipad1 {
269 padding-bottom:5px;
270 }
271 }
272 @@media screen and (max-width: 800px) and (min-width: 760px) and (max-height: 1200px) {
273 .mblPromologolap {
274 padding-bottom:2px;
275 }
276 }
277
278
279 @@media screen and (max-width: 800px) and (min-width: 700px) and (max-height: 1030px) {
280 .mblAddTo {
281 padding-left:70px !important;
282 }
283 }
284
285 @@media screen and (max-width: 700px) and (min-width: 350px) and (max-height: 700px) {
286 .btn-sale{
287 position: absolute;
288 z-index: 10;
289 right: 10px;
290 width: 80px;
291 padding-top: 8px !important;
292 }
293 }
294 </style>
295 <script>
296 var items = [];
297 </script>
298
299 @functions
300 {
301 public class SortInPage
302 {
303 public string StockStatus { get; set; }
304 public int StockStatusSortValue { get; set; }
305 public string ProductId { get; set; }
306 public string BrandName { get; set; }
307 public int BestSelling { get; set; }
308 public double TotalAmountSold { get; set; }
309 public double Price { get; set; }
310 public bool NewArrival { get; set; }
311 }
312 }
313
314 @helper GetProductList(dynamic ProductLoop,bool birthday,string becomeAMemberPrice, int ColMD=3, int ColSM=3, int ColXS=1)
315 {
316 var Loop = GetLoop("Products").ToList();
317 List<SortInPage> SortInPageList = new List<SortInPage>();
318 string SortByValue = "TotalAmtSold".ToUpper();
319 if (!string.IsNullOrEmpty(HttpContext.Current.Request["SortOrder"]))
320 {
321 SortByValue = Convert.ToString(HttpContext.Current.Request["SortBy"]).ToUpper();
322 if (SortByValue.Contains("NewArrivals".ToUpper()))
323 {
324 SortByValue = "NewArrivals".ToUpper();
325 }
326 }
327 string SortOrderValue = "Asc".ToUpper();
328 if (!string.IsNullOrEmpty(HttpContext.Current.Request["SortOrder"]))
329 {
330 SortOrderValue = Convert.ToString(HttpContext.Current.Request["SortOrder"]).ToUpper();
331 if (SortOrderValue.Contains("Desc".ToUpper()))
332 {
333 SortOrderValue = "Desc".ToUpper();
334 }
335 }
336
337 var birthday0 = false;
338 bool showBirthdayPrice = false;
339 bool userHasVIPCard = false;
340 bool userHasValidVipCard = false;
341 DateTime expDate = new DateTime();
342 DateTime today = DateTime.Now;
343
344 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")))
345 {
346 int i = Convert.ToInt32(GetGlobalValue("Global:Extranet.UserID"));
347 Dynamicweb.Security.UserManagement.User u = Dynamicweb.Security.UserManagement.User.GetUserByID(i);
348
349 foreach (CustomFieldValue val in u.CustomFieldValues)
350 {
351 CustomField field = val.CustomField;
352 string fieldName = field.Name;
353
354 if(fieldName == "DOB")
355 {
356 DateTime bDay = new DateTime();
357 if(val.Value != null)
358 {
359 bDay = (DateTime)val.Value;
360 if(bDay.Month == today.Month)
361 {
362 birthday0 = true;
363 }
364 }
365 }
366 if(fieldName=="ExpryDate")
367 {
368 expDate=(DateTime)val.Value;
369 }
370
371 switch (fieldName.ToUpper())
372 {
373 case "VIP CARD NO":
374 userHasVIPCard = !string.IsNullOrEmpty((val.Value).ToString());
375 break;
376 case "EXPRYDATE":
377 userHasValidVipCard = expDate.Date <= today.Date;
378 break;
379 default:
380 break;
381 }
382 }
383 }
384 showBirthdayPrice = birthday0 && userHasVIPCard && userHasValidVipCard;
385
386 string pathproduct="/Files/Images/plc";
387 string imgpath="/Files/Images/Ecom/Products/";
388 string imgpathpng="";
389 string pidString = "";
390 var loopCounter = 0;
391 List<string>statusList = new List<string>();
392
393 foreach(LoopItem product1 in Loop)
394 {
395 string pid1 = product1.GetString("Ecom:Product.ID");
396 pidString += "[" + pid1 + "],";
397 }
398 pidString = pidString.Remove(pidString.Length - 1);
399 pidString = "{" + pidString;
400 pidString = pidString + "}";
401
402 var response = WebServices.getProductMultiStatusAdvServiceResponse(pidString);
403
404 var responseSplit = response.Split(';');
405 if (responseSplit[0].Contains("500"))
406 {
407 <style>
408 @@media screen and (max-width: 700px) and (min-width: 350px) and (max-height: 700px) {
409 .mainImg{
410 padding-left: 85px;
411 }
412 }
413
414 @@media screen and (max-width: 700px) and (min-width: 600px) and (max-height: 400px) {
415 .mainImg{
416 padding-left: 222px;
417 }
418 }
419 </style>
420 if(Pageview.Device.ToString().ToUpper() == "MOBILE")
421 {
422 <div style="padding-left: 60px;" name="under_maintenance">
423 <img src="/Files/Templates/Designs/PLC/assets/images/under_maintenance_icon.png" class="mainImg" alt="Under Maintenance"><br><br>
424 <span style="font-size: 20px;font-weight: 700;">Sorry, we are facing a temporary server error. Please try again later.</span>
425 </div>
426 }else if(Pageview.Device.ToString().ToUpper() == "TABLET")
427 {
428 <div name="under_maintenance"><img src="/Files/Templates/Designs/PLC/assets/images/under_maintenance_icon.png" alt="Under Maintenance"><span style="padding-left: 15px; font-size: 20px; font-weight: 700;">Sorry, we are facing a temporary server error. Please try again later.</span></div>
429 }else{
430 <div style="padding-left: 60px;" name="under_maintenance"><img src="/Files/Templates/Designs/PLC/assets/images/under_maintenance_icon.png" alt="Under Maintenance"><span style="padding-left: 15px; font-size: 20px; font-weight: 700;">Sorry, we are facing a temporary server error. Please try again later.</span></div>
431 }
432 return;
433 }
434
435
436 string productResponse = responseSplit[2].Split('{')[1].Replace("}", "");
437
438 var singleProduct = productResponse.Split(',');
439 for (var i = 0; i < singleProduct.Length; i++)
440 {
441 string string1 = singleProduct[i].Remove(singleProduct[i].Length - 1).Remove(0, 1);
442 statusList.Add(string1.Split(':')[1]);
443
444 SortInPage sortInPage = new SortInPage();
445 sortInPage.StockStatus = Convert.ToString(string1.Split(':').LastOrDefault());
446 switch (sortInPage.StockStatus.ToUpper())
447 {
448 case "AVAILABLE":
449 sortInPage.StockStatusSortValue = 1;
450 break;
451 case "IN STOCK":
452 sortInPage.StockStatusSortValue = 1;
453 if (SortByValue.ToUpper() == "INTERNETPRICE")
454 {
455 sortInPage.StockStatusSortValue = 2;
456 }
457 break;
458 case "SPECIAL ORDER":
459 sortInPage.StockStatusSortValue = 3;
460 break;
461 default:
462 sortInPage.StockStatusSortValue = 0;
463 break;
464 }
465
466 sortInPage.ProductId = Convert.ToString(string1.Split(':').FirstOrDefault());
467
468 var sortInPageProduct = Loop.FirstOrDefault(x => x.GetString("Ecom:Product.ID") == sortInPage.ProductId);
469
470 sortInPage.BrandName = sortInPageProduct.GetString("Ecom:Product:Field.ProductBrand");
471 sortInPage.BestSelling = sortInPageProduct.GetInteger("Ecom:Product:Field.BestSelling.Value.Clean");
472 sortInPage.Price = Math.Floor((sortInPageProduct.GetDouble("Ecom:Product:Field.ProductSInternetPrice")) * 1000 / 5) / 200;
473 //sortInPage.TotalAmountSold = Dynamicweb.Core.Converter.ToDouble(Dynamicweb.Ecommerce.Products.Product.GetProductById(sortInPage.ProductId).ProductFieldValues.GetProductFieldValue("BestSellingAmount").Value);
474 sortInPage.NewArrival = sortInPageProduct.GetBoolean("Ecom:Product:Field.NewArrivals.Value.Clean");
475 SortInPageList.Add(sortInPage);
476 }
477
478 if (SortOrderValue == "DESC")
479 {
480 switch (SortByValue.ToUpper())
481 {
482 case "TOTALAMTSOLD":
483 SortInPageList = SortInPageList.OrderBy(x => x.StockStatusSortValue).ToList();
484 break;
485 case "BRAND":
486 SortInPageList = SortInPageList.OrderByDescending(x => x.BrandName).ThenBy(x => x.StockStatusSortValue).ToList();
487 break;
488 case "INTERNETPRICE":
489 SortInPageList = SortInPageList.OrderByDescending(x => x.Price).ThenBy(x => x.StockStatusSortValue).ToList();
490 break;
491 case "AUTOID":
492 //SortInPageList = SortInPageList.OrderByDescending(x => x.NewArrival).ThenBy(x => x.StockStatusSortValue).ToList();
493 ///Shawn Requested on 06-January-2023
494 SortInPageList = SortInPageList.OrderBy(x => x.StockStatusSortValue).ToList();
495 break;
496 }
497 }
498 else
499 {
500 switch (SortByValue.ToUpper())
501 {
502 case "TOTALAMTSOLD":
503 SortInPageList = SortInPageList.OrderByDescending(x => x.BestSelling).ThenBy(x => x.StockStatusSortValue).ToList();
504 break;
505 case "BRAND":
506 SortInPageList = SortInPageList.OrderBy(x => x.BrandName).ThenBy(x => x.StockStatusSortValue).ToList();
507 break;
508 case "INTERNETPRICE":
509 SortInPageList = SortInPageList.OrderBy(x => x.Price).ThenBy(x => x.StockStatusSortValue).ToList();
510 break;
511 case "AUTOID":
512 //SortInPageList = SortInPageList.OrderByDescending(x => x.NewArrival).ThenBy(x => x.StockStatusSortValue).ToList();
513 ///Shawn Requested on 06-January-2023
514 SortInPageList = SortInPageList.OrderBy(x => x.StockStatusSortValue).ToList();
515 break;
516 }
517 }
518
519 if (responseSplit[0].Contains("200"))
520 {
521 foreach (LoopItem product1 in Loop)
522 {
523 var sellingPrice1 = Math.Floor((product1.GetDouble("Ecom:Product:Field.ProductSPrice")) * 1000 / 5) / 200;
524 var internetPrice1 = Math.Floor((product1.GetDouble("Ecom:Product:Field.ProductSInternetPrice")) * 1000 / 5) / 200;
525 <script>
526 items.push({
527 'item_id': "@product1.GetString("Ecom:Product.ID")",
528 'item_name': "@product1.GetString("Ecom:Product.Name")",
529 'currency': "@product1.GetString("Ecom:Product.Price.Currency.Code")",
530 'discount': @string.Format("{0:0.00}", sellingPrice1-internetPrice1),
531 'index': 0,
532 'item_brand': "@product1.GetString("Ecom:Product:Field.ProductBrand")",
533 'item_category': "@product1.GetString("Ecom:Product:Field.FirstCategory")",
534 'item_category2': "@product1.GetString("Ecom:Product:Field.SecondCategory")",
535 'item_category3': "@product1.GetString("Ecom:Product:Field.ThirdCategory")",
536 'item_variant1': "@product1.GetString("Ecom:Product:Field.Flavour.Value")",
537 'item_variant2': "@product1.GetString("Ecom:Product:Field.Color.Value")",
538 'item_variant3': "@product1.GetString("Ecom:Product:Field.Size.Value")",
539 'price': @sellingPrice1,
540 'quantity': 1
541 })
542 </script>
543 }
544 foreach (SortInPage sortInPage in SortInPageList)
545 {
546 var product = Loop.FirstOrDefault(x => x.GetString("Ecom:Product.ID") == sortInPage.ProductId);
547
548 string prodGroupsforFBpixel = "";
549 prodGroupsforFBpixel = string.IsNullOrEmpty(product.GetString("Department")) ? product.GetString("Ecom:Product:Field.FirstCategory") : product.GetString("Department");
550 prodGroupsforFBpixel += "," + (string.IsNullOrEmpty(product.GetString("Category")) ? product.GetString("Ecom:Product:Field.SecondCategory") : product.GetString("Category"));
551 prodGroupsforFBpixel += "," + (string.IsNullOrEmpty(product.GetString("CategoryDetails")) ? product.GetString("Ecom:Product:Field.ThirdCategory") : product.GetString("CategoryDetails"));
552 string pid = product.GetString("Ecom:Product.ID");
553
554 //Promotion
555
556 string promoName = "";
557 string promoD = "";
558 List<string> productPromoNames=new List<string>();
559 var promosqlString = "SELECT ED.DISCOUNTNAME,ED.DISCOUNTDESCRIPTION FROM EcomDiscountExtensions EDEs INNER JOIN EcomDiscount ED ON EDEs.DISCOUNTID = ED.DISCOUNTID WHERE EDEs.DISCOUNTDISPLAYATPDP = 'True' and ED.DiscountActive = 'True' and (GetDate() BETWEEN ED.DiscountValidFrom AND ED.DiscountValidTo) and ED.DISCOUNTPRODUCTSANDGROUPS LIKE '%p:" + pid + ",%'";
560 using(System.Data.IDataReader promoNameReder = Dynamicweb.Data.Database.CreateDataReader(promosqlString))
561 {
562 while (promoNameReder.Read())
563 {
564 promoName += promoNameReder["DISCOUNTNAME"].ToString();
565 promoD += promoNameReder["DISCOUNTDESCRIPTION"].ToString() + "<br>";
566 }
567 }
568 string Image = product.GetString("Ecom:Product.ImageSmall.Default.Clean");
569 string Link = product.GetString("Ecom:Product.Link.Clean");
570 string GroupLink = product.GetString("Ecom:Product.LinkGroup.Clean");
571 string Name = product.GetString("Ecom:Product.Name");
572 Name = Name.Replace("\"","❞");
573 GroupLink = "Default.aspx?ID=298&ProductID=" + pid;
574 string Number = product.GetString("Ecom:Product.Number");
575 string ProdBrand = product.GetString("Ecom:Product:Field.ProductBrand");
576 imgpath = "/Files/Images/Ecom/Products/" + pid + ".jpg";
577 imgpathpng="/Files/Images/Ecom/Products/" + pid + ".png";
578 var absolutePathjpg = System.Web.HttpContext.Current.Server.MapPath("~/"+ imgpath);
579 var absolutePathpng = System.Web.HttpContext.Current.Server.MapPath("~/"+ imgpathpng);
580 if(System.IO.File.Exists(absolutePathjpg))
581 {
582 Image=imgpath;
583 }
584 else if(System.IO.File.Exists(absolutePathpng))
585 {
586 Image=imgpathpng;
587 }
588
589 string Description = product.GetString("Ecom:Product.ShortDescription");
590 string Discount = product.GetString("Ecom:Product.Discount.Price");
591 string Price = product.GetString("Ecom:Product.Price");
592 string CurrencyCode = product.GetString("Ecom:Product.Price.Currency.Code");
593 //string Promotion=product.GetString("Ecom:Product.Price");
594 string Active=product.GetString("Ecom:Product.IsActive");
595 var Rating=product.GetDouble("Ecom:Product.Rating");
596
597 var sellingPrice = Math.Floor((product.GetDouble("Ecom:Product:Field.ProductSPrice"))*1000/5)/200;
598 var internetPrice = Math.Floor((product.GetDouble("Ecom:Product:Field.ProductSInternetPriceBefTAX.Value"))*1000/5)/200;
599 var price=9.95;
600
601 if(price==product.GetDouble("Ecom:Product:Field.ProductSInternetPrice"))
602 {
603 internetPrice= product.GetDouble("Ecom:Product:Field.ProductSInternetPrice");
604 }
605 Boolean inventoryDiscount = product.GetBoolean("Ecom:Product:Field.ProductInventoryDiscountFlag");
606 var discountPercentage = product.GetDouble("Ecom:Product:Field.ProductInventoryDiscount");
607 var birthdayPrice = Math.Floor((product.GetDouble("Ecom:Product:Field.ProductSBirthdayPrice"))*1000/5)/200;
608 var memberPrice = Math.Floor((product.GetDouble("Ecom:Product:Field.ProductSMemberPrice"))*1000/5)/200;
609 var disable=product.GetBoolean("Ecom:Product:Field.Disable");
610 var promotion=0.00;
611 var discountType="";
612 var promoNames = "";
613 var testingNames = "";
614
615 string firstcategory = product.GetString("Ecom:Product:Field.FirstCategory");
616 string secondcategory = product.GetString("Ecom:Product:Field.SecondCategory");
617 string thirdcategory = product.GetString("Ecom:Product:Field.ThirdCategory");
618 string productSize = product.GetString("Ecom:Product:Field.Size.Value");
619 string productFlavour = product.GetString("Ecom:Product:Field.Flavour.Value");
620 string productColor = product.GetString("Ecom:Product:Field.Color.Value");
621
622 foreach(var promoItem in product.GetLoop("AllDiscounts"))
623 {
624 promoNames += promoItem.GetString("Ecom:AllDiscounts.Discount.Name") +"<br>";
625 }
626 foreach (LoopItem item in product.GetLoop("ProductDiscounts"))
627 {
628
629 if(item.GetString("Ecom:Product.Discount.Type")=="PERCENT")
630 {
631 discountType="PERCENT";
632 promotion=item.GetDouble("Ecom:Product.Discount.PercentWithoutVATFormatted");
633 }
634 else
635 {
636 discountType="AMOUNT";
637 promotion=item.GetDouble("Ecom:Product.Discount.AmountWithoutVATFormatted");
638 }
639 }
640 if(pid != "PROD1" && pid !="PROD2")
641 {
642 <!--product start-->
643 if(!disable)
644 {
645 <div class="product-box col-1-3 tab-col-1-2 mobile-col-1-1" id="get_@pid">
646 <div class="prod-img">
647 @if(promotion != 0)
648 {
649 if(discountType == "PERCENT")
650 {
651 <div class="ribbon-P"><span>@promotion% Off</span></div>
652 }
653 else
654 {
655 <div class="ribbon-P"><span>@product.GetString("Ecom:Product.Currency.Symbol")@promotion Off</span></div>
656 }
657 }
658 else
659 {
660 //add ERP discount ribbon
661 if(inventoryDiscount)
662 {
663 if(discountPercentage != 0)
664 {
665 <div class="ribbon-D"><span>@discountPercentage% Off</span></div>
666 }
667 }
668 }
669 <a href="@GroupLink" title="@Name" onclick='selectItem("@pid", "@Name", "@CurrencyCode", @string.Format("{0:0.00}", sellingPrice-internetPrice), "@product.GetString("Ecom:Product:Field.ProductBrand")", "@firstcategory", "@secondcategory", "@thirdcategory", "@productFlavour", "@productColor", "@productSize", @sellingPrice)'>
670 <img src="/Admin/Public/Getimage.ashx?width=147&compression=60&Crop=5&image=@Image" class="img-responsive" id="img_@pid" alt="@Name @Number" title="@Name @Number">
671 </a>
672 </div>
673 <p class="prod-name"><span class="brand-name">@ProdBrand</span>
674 <br/> @product.GetString("Ecom:Product.Name")
675 </p>
676
677
678 @if(promoName != "")
679 {
680 <span class="top tipso_style" data-tipso='@promoName.Replace("\"", """).Replace("'","'").Replace("<","<").Replace(">",">")'>
681 @if(GetGlobalValue("Global:Extranet.UserName")!= ""){
682 <div style="background: linear-gradient(to right, #ec5a11 , #f4a413 ); text-align: center; font-size: medium; color: white; font-weight: 600; margin-bottom: inherit;">PROMOTION</div>
683
684
685 }
686 else{
687
688 <div class="mblpromologo mblpromologo1 mblPromologoipad mblPromologoipad1 mblPromologolap" style="background: linear-gradient(to right, #ec5a11 , #f4a413 ); text-align: center; font-size: medium; color: white; font-weight: 600; margin-bottom: inherit;"><img src="/Files/Templates/Designs/PLC/assets/images/login_promo.png" style="padding-bottom:2px;"> LOGIN PROMO</div>
689
690 }
691 </span>
692 }else{
693 <div style="background: white; text-align: center; font-size: medium; color: white; font-weight: 600; margin-bottom: inherit; padding-bottom: 3px;"></div>
694 }
695 <div class="prod-star" style="display:none;">
696 @if(@Rating == 0)
697 {
698 <label class = "starUnselected"></label>
699 <label class = "starUnselected"></label>
700 <label class = "starUnselected"></label>
701 <label class = "starUnselected"></label>
702 <label class = "starUnselected"></label>
703 }
704 @if(Rating % 1 != 0)
705 {
706 for(var i = 1; i < @Rating; i++)
707 {
708 <label class = "starSelected"></label>
709 }
710 <label class = "starSelected half"></label>
711 }
712 else
713 {
714 for(var i = 1; i < @Rating+1; i++)
715 {
716 <label class = "starSelected"></label>
717 }
718 }
719
720
721 </div>
722 <div class="prod-pbox">
723 @if(inventoryDiscount)
724 {
725 if(sellingPrice != internetPrice)
726 {
727 <div class="prod-price">
728 <p class="op">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice)</p>
729 <p class="np">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", internetPrice)</p>
730 <p class="save-price">Save @product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice-internetPrice)</p>
731 </div>
732 }
733 else if(sellingPrice == internetPrice)
734 {
735 <div class="prod-price">
736 <p class="np">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice)</p>
737 </div>
738 }
739 <div style="height:65px;">@* Add gap to fix aligment *@
740 <div class="member-price"></div>
741 </div>
742 }
743 @*inventoryDiscount false*@
744 else
745 {
746 if (!Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")))
747 {
748 @*<div class="prod-price">
749 <p class="np">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice)</p>
750 </div>*@
751
752 if(sellingPrice != internetPrice)
753 {
754 <div class="prod-price">
755 <p class="op">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice)</p>
756 <p class="np">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", internetPrice)</p>
757 <p class="save-price">Save @product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice-internetPrice)</p>
758 </div>
759 }
760 else if(sellingPrice == internetPrice)
761 {
762 <div class="prod-price">
763 <p class="np">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice)</p>
764 </div>
765 }
766
767 <div style="height:65px;">
768 <div class="member-price">
769 @if(memberPrice > 0)
770 {
771 <div id="proId" style="display:none"></div>
772 <div class="title" id="memberId">VIP Member
773 <span class="top tipso_style" data-tipso="Become a VIP member for only @product.GetString("Ecom:Product.Currency.Symbol")11.00 & log in to your web account to enjoy this price">
774 <img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon info" title=""></span>
775 <p class="price">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", memberPrice)</p>
776 </div>
777 <div class="title" id="birthdayId" >VIP Birthday
778 <span class="top tipso_style" data-tipso="Become a VIP member for only @product.GetString("Ecom:Product.Currency.Symbol")11.00 & log in to your web account to enjoy this price on your birthday month">
779 <img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon info"></span>
780 <p class="price">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", birthdayPrice)</p>
781 </div>
782
783 }
784 @if(birthdayPrice > 0 && showBirthdayPrice)
785 {
786 <div class="title">VIP Birthday
787 <span class="top tipso_style" data-tipso="Become a VIP member for only @product.GetString("Ecom:Product.Currency.Symbol")11.00 & enjoy this price on your birthday month ">
788 <img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon info"></span>
789 <p class="price">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", birthdayPrice)</p>
790 </div>
791 }
792 </div>
793 </div>
794 }
795 else if(Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")))
796 {
797 @*<div class="prod-price">
798 <p class="np">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", internetPrice)</p>
799 </div>*@
800
801 if(sellingPrice != internetPrice)
802 {
803 <div class="prod-price">
804 <p class="op">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice)</p>
805 <p class="np">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", internetPrice)</p>
806 <p class="save-price">Save @product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice-internetPrice)</p>
807 </div>
808 }
809 else if(sellingPrice == internetPrice)
810 {
811 <div class="prod-price">
812 <p class="np">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", sellingPrice)</p>
813 </div>
814 }
815
816 if(userHasVIPCard)
817 {
818 if(userHasValidVipCard)
819 {
820 <div id="proId" style="display:none"></div>
821 <div style="height:65px;">
822 <div class="member-price">
823 <div class="title" id="memberId" >VIP Member
824 <span class="top tipso_style" data-tipso="As a VIP member, you get to enjoy this price">
825 <img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon info" title=""></span>
826 <p class="price">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", memberPrice)</p>
827 </div>
828 <div class="title" id="birthdayId">VIP Birthday
829 <span class="top tipso_style" data-tipso="As a VIP member, you get to enjoy this price on your birthday month">
830 <img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon info"></span>
831 <p class="price">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", birthdayPrice)</p>
832 </div>
833 </div>
834 </div>
835 }
836
837 if(!birthday)
838 {
839 if(!userHasValidVipCard)
840 {
841 <div style="height:65px;">
842 <div class="member-price">
843 @if(memberPrice > 0)
844 {
845 <div class="title" id="memberId">VIP Member
846 <span class="top tipso_style" data-tipso="As a VIP member, you get to enjoy this price " >
847 <img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon info"></span>
848 <p class="price">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", memberPrice)</p>
849 </div>
850 }
851 </div>
852 </div>
853 }
854 }
855 else if (birthday)
856 {
857 if(!userHasValidVipCard)
858 {
859 <div style="height:65px;">
860 <div class="member-price">
861 <div class="title" id="birthdayId">VIP Birthday
862 <span class="top tipso_style" data-tipso="As a VIP member, you get to enjoy this price on your birthday month">
863 <img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon_info"></span>
864 <p class="price">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", birthdayPrice)</p>
865 </div>
866 </div>
867 </div>
868 }
869 }
870 }
871 else
872 {
873 <div id="proId" style="display:none"></div>
874 <div style="height:65px;">
875 <div class="member-price">
876 <div class="title" id="memberId" >VIP Member
877 <span class="top tipso_style" data-tipso="Become a VIP member for only @product.GetString("Ecom:Product.Currency.Symbol")11.00 & log in to your web account to enjoy this price ">
878 <img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon info" title=""></span>
879 <p class="price">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", memberPrice)</p>
880 </div>
881 <div class="title" id="birthdayId">VIP Birthday
882 <span class="top tipso_style" data-tipso="Become a VIP member for only @product.GetString("Ecom:Product.Currency.Symbol")11.00 & log in to your web account to enjoy this price on your birthday month">
883 <img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon info"></span>
884 <p class="price">@product.GetString("Ecom:Product.Currency.Symbol")@string.Format("{0:0.00}", birthdayPrice)</p>
885 </div>
886 </div>
887 </div>
888 }
889 }
890 }
891 </div>
892 <!-------------------------------------------------------End Pricing---------------------------------------------------------------------------------------------------->
893 <hr>
894 @{ string tipsoMessage = "no Message Available!"; }
895 @if(product.GetBoolean("Ecom:Product:Field.ProductClassic.Value"))
896 {
897 tipsoMessage = "In Store Only";
898 <ul class="info" style="line-height: 31px;">
899 <li>*AVAILABLE IN STORE ONLY</li>
900 </ul>
901 <ul class="info">
902 <li style="height:17px;"> </li>
903 </ul>
904 }
905 else
906 {
907 tipsoMessage = statusList[loopCounter];
908 switch (statusList[loopCounter].ToUpper())
909 {
910 case "AVAILABLE" :
911 tipsoMessage = "Stocks are available, with the earliest delivery within 3 working days from the date of order.";
912 break;
913 case "SPECIAL ORDER" :
914 tipsoMessage = "We will check physical stocks availability before confirming your order.";
915 break;
916 case "IN STOCK" :
917 tipsoMessage = "Stocks are available at our retail stores for delivery within 7 working days upon receipt of payment.";
918 break;
919 default :
920 tipsoMessage = "no Message Available!";
921 break;
922 }
923 tipsoMessage = tipsoMessage.Replace("\'", "'");
924 <ul class="info">
925 <li>*@statusList[loopCounter] <span class="top tipso_style" data-tipso='@tipsoMessage' style="vertical-align: text-bottom;">
926 <img src="@pathproduct/images/icon_question_mark.png" alt="icon info" title="" style="width:10px;">
927 </span></li>
928 </ul>
929 }
930 @if(!product.GetBoolean("Ecom:Product:Field.ProductClassic.Value"))
931 {
932 <div class="btn-addto-cart smalldev">
933 <div class="col-md-6 col-sm-6 col-xs-6" style="padding: 5px 0px; border-radius: 3px 0px 0px 3px; text-align: center;display: table-cell;vertical-align: middle;">
934 <span onclick='QtyControlBtn("quantityInput_@pid", "-");' type="button" data-value="-1" data-target="#spinner2" data-toggle="spinner">
935 <span class="glyphicon glyphicon-minus"></span>
936 </span>
937 <input type="number" onkeydown='QtyKeyControl("quantityInput_@pid", "keydown");' onkeyup='QtyKeyControl("quantityInput_@pid", "keyup");' onfocusout='return QtyKeyControl("quantityInput_@pid", "focusout");' class="selectbox-qty" style="width:50px;text-align:center;" id="quantityInput_@pid" value="1" min="1" max="9999">
938 <span onclick='QtyControlBtn("quantityInput_@pid", "+");' type="button" data-value="2" data-target="#spinner2" data-toggle="spinner">
939 <span class="glyphicon glyphicon-plus"></span>
940 </span>
941 </div>
942 <div class="col-md-6 col-sm-6 col-xs-6 mblAddTo" style="padding: 1px 5px;display: table-cell;">
943 <a onclick='ShowAddedItem_Then_AjaxAddToCart(" ", "@pid", "@ProdBrand.Replace(" & ", " myAND ")", "@product.GetString("Ecom:Product.Name").Replace(" & ", " myAND ").Replace("\"", "")", "@product.GetString("Ecom:Product.Price.PriceWithVAT")", "@product.GetString("Ecom:Product.Price.Currency.Symbol")", $("#quantityInput_" + "@pid").val(), true, "&cartcmd=add&productid=@pid&quantity=","@Number","@CurrencyCode","@prodGroupsforFBpixel","@productSize","@productFlavour","@productColor");' href='javascript:void(0)' style="border-radius: 0px 3px 3px 0px;">
944 <i class="fa fa-shopping-cart"></i>
945 Add to cart
946 </a>
947 </div>
948 </div>
949 }
950 else
951 {
952 <div class="btn-addto-cart" style="margin-bottom:5px; cursor:not-allowed; display:none;">
953 <a ><i class="fa fa-shopping-cart"></i> In Store Only </a>
954 </div>
955 }
956 <!--<div class="btn-addto-cart smalldev" style="margin-bottom:5px;">
957 <a href="@GroupLink"><i class="fa fa-search-plus"></i> View products details </a>
958 </div>-->
959 <div class="prod-compare" style="height : 35px;">
960 @{
961 string productname = product.GetString("Ecom:Product.Name");
962 productname = productname.Replace("\"","❞");
963 }
964 <form>
965 <label>Compare
966 <input type="checkbox" id='@product.GetString("Ecom:Product.CompareID")' name="compareproduct" onclick="compareProducts('@product.GetString("Ecom:Product.CompareID")', '@productname', '@product.GetString("Ecom:Product.LinkGroup.Clean")',$(this).prop('checked'));$('html, body').animate({scrollTop: $('.compare-box').offset().top}, 500);">
967 <span></span>
968 </label>
969 </form>
970 </div>
971 </div>
972 }
973 <!--product end-->
974 }
975 loopCounter++;
976 }
977 }
978 <div onclick="topFunction()" id="myBtn" title="Go to top"></div>
979 }
980 <script>
981 $(document).ready(function () {
982 if (items.length > 0) {
983 gtag("event", "view_item_list", {
984 items
985 });
986 }
987 });
988 function topFunction() {
989 //document.body.scrollTop = 0;
990 //document.documentElement.scrollTop = 0;
991 $('html, body').animate({ scrollTop: 0 }, 'fast')
992 }
993
994 window.onscroll = function() {scrollFunction()};
995
996 function scrollFunction() {
997 if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
998 document.getElementById("myBtn").style.display = "block";
999 } else {
1000 document.getElementById("myBtn").style.display = "none";
1001 }
1002 }
1003
1004 function selectItem(pId, pName, currencyCode, savePrice, pBrand, firstCategory, secondCategory, thirdCategory, productFlavour, productColor, productSize, sellingPrice) {
1005 gtag("event", "select_item", {
1006 items: [
1007 {
1008 item_id: pId,
1009 item_name: pName,
1010 currency: currencyCode,
1011 discount: savePrice,
1012 index: 0,
1013 item_brand: pBrand,
1014 item_category: firstCategory,
1015 item_category2: secondCategory,
1016 item_category3: thirdCategory,
1017 item_variant: productFlavour,
1018 item_variant2: productColor,
1019 item_variant3: productSize,
1020 price: sellingPrice,
1021 quantity: 1
1022 }
1023 ]
1024 });
1025 }
1026 </script>
1027 <script type="text/javascript" src="/Files/Templates/Designs/PLC/eCom/ProductList/Compare.js"></script>
1028
1029 <style>
1030 .smallText {
1031 font-size: 14px;
1032 font-weight: bold;
1033 }
1034
1035 .product-box .prod-compare label{
1036 display: inline;
1037 }
1038 .btn-addto-cart {
1039 height: 37px !important;
1040 }
1041 @@media (max-width: 768px) {
1042 .category-title {
1043 margin-top: 0px;
1044 }
1045 }
1046 .backBtn {
1047 margin-top: -10px;margin-bottom: 10px;
1048 }
1049 @@media (max-width: 738px) {
1050 .backBtn {
1051 margin-top: 10px;
1052 }
1053 }
1054
1055 .clearfix{
1056 margin-bottom: -10px;
1057 }
1058
1059 .current1{
1060 margin-left: 217px;
1061 }
1062
1063 .current2{
1064 margin-left: 158px;
1065 }
1066
1067 .current3{
1068 margin-left: 131px;
1069 }
1070
1071 .current4{
1072 margin-left: 103px;
1073 }
1074
1075 .current5{
1076 margin-left: 75px;
1077 }
1078
1079 .current6{
1080 margin-left: 51px;
1081 }
1082
1083 .destopcurrent2{
1084 margin-left: 350px;
1085 }
1086
1087 .destopcurrent3{
1088 margin-left: 300px;
1089 }
1090
1091 .destopcurrent4{
1092 margin-left: 250px;
1093 }
1094
1095 .destopcurrent5{
1096 margin-left: 200px;
1097 }
1098
1099 .destopcurrent6{
1100 margin-left: 150px;
1101 }
1102
1103 .commoncurrent{
1104 margin-left: 221px;
1105 }
1106
1107 .total1{
1108 margin-left: 163px;
1109 }
1110
1111 .total2{
1112 margin-left: 134px;
1113 }
1114
1115 .total3{
1116 margin-left: 106px;
1117 }
1118
1119 .total4{
1120 margin-left: 79px;
1121 }
1122
1123 .total5{
1124 margin-left: 79px;
1125 }
1126
1127 .commontotal{
1128 margin-left: 51px;
1129 }
1130
1131 .currenttotal1{
1132 margin-left: 400px;
1133 }
1134
1135 .currenttotal2{
1136 margin-left: 304px;
1137 }
1138
1139 .currenttotal3{
1140 margin-left: 292px;
1141 }
1142
1143 .currenttotal4{
1144 margin-left: 278px;
1145 }
1146
1147 .currenttotal5{
1148 margin-left: 256px;
1149 }
1150
1151 .currenttotal6{
1152 margin-left: 238px;
1153 }
1154
1155 @@media only screen and (max-width: 850px){
1156 .mblpagination{
1157 margin-left: unset !important;
1158 }
1159 }
1160
1161 @@media screen and (max-width: 1050px) and (min-width: 1000px) and (max-height: 800px) {
1162 .currenttotal1{
1163 margin-left: 310px !important;
1164 }
1165
1166 .currenttotal2{
1167 margin-left: 250px !important;
1168 }
1169
1170 .currenttotal3{
1171 margin-left: 220px !important;
1172 }
1173
1174 .currenttotal4{
1175 margin-left: 195px !important;
1176 }
1177
1178 .currenttotal5{
1179 margin-left: 170px !important;
1180 }
1181
1182 .currenttotal6{
1183 margin-left: 135px !important;
1184 }
1185
1186 .total6current2{
1187 margin-left: 185px;
1188 }
1189
1190 .total6current3{
1191 margin-left: 166px;
1192 }
1193
1194 .total6current4{
1195 margin-left: 130px;
1196 }
1197
1198 .total6current5{
1199 margin-left: 100px;
1200 }
1201
1202 .total6current6{
1203 margin-left: 100px;
1204 }
1205
1206 .current1{
1207 margin-left: 125px;
1208 }
1209
1210 .current2{
1211 margin-left: 70px;
1212 }
1213
1214 .current3{
1215 margin-left: 40px;
1216 }
1217
1218 .current4{
1219 margin-left: 12px;
1220 }
1221
1222 .current5{
1223 margin-left: -15px;
1224 }
1225
1226 .current6{
1227 margin-left: -40px;
1228 }
1229
1230 .commoncurrent{
1231 margin-left: 128px;
1232 }
1233
1234 .total1{
1235 margin-left: 70px;
1236 }
1237
1238 .total2{
1239 margin-left: 45px;
1240 }
1241
1242 .total3{
1243 margin-left: 16px;
1244 }
1245
1246 .total4{
1247 margin-left: -10px;
1248 }
1249
1250 .total5{
1251 margin-left: -15px;
1252 }
1253
1254 .commontotal{
1255 margin-left: -42px;
1256 }
1257 }
1258 </style>
1259
1260 @{
1261 string sqlString = "SELECT BecomeAMemberPrice FROM ItemType_PLC_WebSite_Settings";
1262 string becomeAMemberPrice = "";
1263 using (System.Data.IDataReader myImageReader = Dynamicweb.Data.Database.CreateDataReader(sqlString.ToString()))
1264 {
1265 while (myImageReader.Read())
1266 {
1267 becomeAMemberPrice = myImageReader["BecomeAMemberPrice"].ToString();
1268 }
1269 }
1270
1271 var birthday = false;
1272 bool showBirthdayPrice1 = false;
1273 bool userHasVIPCard1 = false;
1274 bool userHasValidVipCard1 = false;
1275 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName")))
1276 {
1277 int i = Convert.ToInt32(GetGlobalValue("Global:Extranet.UserID"));
1278
1279 Dynamicweb.Security.UserManagement.User u = Dynamicweb.Security.UserManagement.User.GetUserByID(i);
1280
1281 foreach (CustomFieldValue val in u.CustomFieldValues)
1282 {
1283 CustomField field = val.CustomField;
1284
1285 string fieldName = field.Name;
1286
1287 if(fieldName == "DOB")
1288 {
1289 DateTime today = DateTime.Now;
1290 DateTime bDay = new DateTime();
1291 if(val.Value != null)
1292 {
1293 bDay = (DateTime)val.Value;
1294 if(bDay.Month == today.Month)
1295 {
1296 birthday = true;
1297 }
1298 }
1299 }
1300 switch (fieldName.ToUpper())
1301 {
1302 case "VIP CARD NO":
1303 userHasVIPCard1 = !string.IsNullOrEmpty((val.Value).ToString());
1304 break;
1305 case "EXPRYDATE":
1306 userHasValidVipCard1 = DateTime.Now.Month <= ((DateTime)val.Value).Month;
1307 break;
1308 default:
1309 break;
1310 }
1311 }
1312 }
1313 showBirthdayPrice1 = birthday && userHasVIPCard1 && userHasValidVipCard1;
1314
1315 string grouplink = "";
1316
1317 if (!string.IsNullOrWhiteSpace(GetString("Ecom:ProductList:Page.GroupID")))
1318 {
1319 grouplink = "/Default.aspx?ID=" + GetValue("Ecom:ProductList:Page.ID") + "&GroupID=" + GetValue("Ecom:ProductList:Page.GroupID");
1320 }
1321 else
1322 {
1323 grouplink = "&eComQuery=" + GetValue("Ecom:ProductList:Search.Query");
1324 }
1325 var strUrl = System.Web.HttpContext.Current.Request.RawUrl.ToString() ;
1326 string[] words = strUrl.Split('/');
1327 var firstgroup =System.Web.HttpContext.Current.Request.Params["firstgroup"];
1328 var secondgroup = System.Web.HttpContext.Current.Request.Params["secondgroup"];
1329 var thirdgroup = System.Web.HttpContext.Current.Request.Params["thirdgroup"];
1330 @*var firstgroup =words[2];
1331 var secondgroup = words[3];
1332 var thirdgroup = words[4];*@
1333 var grouptext = "";
1334
1335 if (!string.IsNullOrWhiteSpace(firstgroup) && !string.IsNullOrWhiteSpace(secondgroup) && !string.IsNullOrWhiteSpace(thirdgroup))
1336 {
1337 grouptext = thirdgroup;
1338 }
1339 else if(!string.IsNullOrWhiteSpace(firstgroup) && !string.IsNullOrWhiteSpace(secondgroup)){
1340 grouptext = secondgroup;
1341 }
1342 else{
1343 grouptext = firstgroup;
1344 }
1345
1346 var totalPages = GetInteger("Ecom:ProductList.TotalPages");
1347 var currentPage = GetInteger("Ecom:ProductList.CurrentPage");
1348 var noOfPages = 3;
1349 var currentPageLink = "";
1350 var blankLink = "";
1351 var otherLink = "";
1352 if(totalPages != 0){
1353
1354
1355 foreach (LoopItem page in GetLoop("Ecom:ProductList.Pages"))
1356 {
1357 if (page.GetBoolean("Ecom:ProductList.Pages.Page.IsCurrent")){
1358
1359 currentPageLink = page.GetString("Ecom:ProductList.Pages.Page.Url");
1360 }
1361 }
1362 var firstSplit = currentPageLink.Split(new string[] { "PageNum=" }, StringSplitOptions.None);
1363 blankLink =firstSplit[0];
1364
1365 if(firstSplit[1].Contains("&")){
1366 string[] split = firstSplit[1].Split(new char[] { '&' }, 2);
1367 otherLink = "&"+split[1];
1368 }
1369 }
1370
1371 object objShowH1Title = false;
1372 bool showH1TitleFlag = false;
1373 Dynamicweb.Frontend.PageView.Current().Page.PropertyItem.TryGetValue("Show_H1_Title", ref objShowH1Title);
1374 showH1TitleFlag = objShowH1Title != null ? bool.Parse(objShowH1Title.ToString()) : false;
1375 }
1376
1377 <script>
1378 $( document ).ready(function() {
1379 document.cookie = "sortby=";
1380 Compare.writecompare();
1381 if(getQueryStringValue("SortBy")){
1382 var selectedVal = getQueryStringValue("SortBy") + "&SortOrder=" + getQueryStringValue("SortOrder")
1383 $('#sortSelect').val(selectedVal);
1384 }else{
1385 //$('#sortSelect').val('PleaseSelect');
1386 }
1387 });
1388 function getCookie(name){
1389 var pattern = RegExp(name + "=.[^;]*")
1390 matched = document.cookie.match(pattern)
1391
1392 if (matched) {
1393 var cookie = matched[0].split('=')
1394 return cookie[1]
1395 }
1396 return false
1397 }
1398
1399 </script>
1400 @{
1401 string pathproduct = "/Files/Images/plc/";
1402 }
1403
1404 <div class="col-3-12">
1405 <div class="backBtn">
1406 <span onclick="window.location.assign(document.referrer);" style="padding-left:30px; font-weight:bold;cursor:pointer;"><img src="/Files/Templates/Designs/PLC/assets/images/backarrow.png" style="width:20px;padding-bottom:3px;"> Back</span>
1407 </div>
1408 <div class="category-title col-1-1">
1409 <div class="smallText">Filter by:</div>
1410 </div>
1411 <div class="category-box col-1-1">
1412 <div class="smallText">Filter by:</div>
1413 <hr class="grey">
1414 @{
1415 string stringGroupID = "";
1416 if(GetString("Ecom:ProductList:Page.ID") != "298")
1417 {
1418 foreach(var productGroup in GetLoop("ProductGroups"))
1419 {
1420 stringGroupID += productGroup.GetString("Ecom:Group.ID") + ",";
1421 }
1422 }
1423 }
1424 <!------------------------- for Price Filter Begin ------------------------->
1425
1426 <!------------------------- for Price Filter End ------------------------->
1427 <div class="filter-vertical toogleContent FixedHeightContainer" >
1428 <form id="filtercontainer" name="EcomSearch" class="form-filters" method="get" >
1429 @*<input type="hidden" name="ID" value='@GetString("Ecom:ProductList:Page.ID")' />*@
1430 @if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request["q"]))
1431 { <input type='hidden' name='q' value='@System.Web.HttpContext.Current.Request["q"]' /> }
1432 @if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request["searchsuggest"]))
1433 { <input type='hidden' name='searchsuggest' value='@System.Web.HttpContext.Current.Request["searchsuggest"]' /> }
1434
1435 <input type="submit" style="display:none;">
1436
1437 @foreach (LoopItem facetGroup in GetLoop("FacetGroups"))
1438 {
1439 foreach (LoopItem facet in facetGroup.GetLoop("Facets"))
1440 {
1441 var facetOptions = facet.GetLoop("FacetOptions");
1442 string facetQueryParameter = facet.GetString("Facet.QueryParameter");
1443
1444 if (!facetOptions.Any())
1445 {
1446 continue;
1447 }
1448 if(
1449 (facet.GetString("Facet.Name")=="SecondGroup" )
1450 || (facet.GetString("Facet.Name")=="ThirdGroup" )
1451 || (facet.GetString("Facet.Name")=="FirstGroup")
1452 || (facet.GetString("Facet.Name")=="Color")
1453 //|| (facet.GetString("Facet.Name")=="Size")
1454 || (facet.GetString("Facet.Name")=="Weight")
1455 || (facet.GetString("Facet.Name")=="Health Consideration")
1456 || (facet.GetString("Facet.Name")=="Life Stage")
1457 || (facet.GetString("Facet.Name")=="Availability")
1458 || (facet.GetString("Facet.Name")=="productclassic")
1459 || (facet.GetString("Facet.Name")=="Nutritional Option")
1460 || (facet.GetString("Facet.Name")=="Brands")
1461 || (facet.GetString("Facet.Name")=="Treats Type")
1462 || (facet.GetString("Facet.Name")=="Kibble - Bite Size")
1463 || (facet.GetString("Facet.Name")=="Pet Type")
1464 || (facet.GetString("Facet.Name")=="Applications Type")
1465 || (facet.GetString("Facet.Name")=="Pet Weight Range")
1466 || (facet.GetString("Facet.Name")=="Litter Materials")
1467 || (facet.GetString("Facet.Name")=="Litter Features")
1468 || (facet.GetString("Facet.Field") == "CustomField_ProductSize")
1469 || (facet.GetString("Facet.Name") == "Weights")
1470 || (facet.GetString("Facet.Name") == "Volume")
1471 || (facet.GetString("Facet.Name") == "Pet Weight Ranges")
1472 || (facet.GetString("Facet.Name")=="Promotion Type")
1473 )
1474 {
1475 if((facet.GetString("Facet.Name")=="SecondGroup")||(facet.GetString("Facet.Name")=="ThirdGroup")||(facet.GetString("Facet.Name")=="FirstGroup")||(facet.GetString("Facet.Name")=="productclassic")){
1476
1477 <!--Category-->
1478 <div style="display:none" class="panel panel-flat">
1479 <div class="panel-heading">
1480 @{
1481 var str = Regex.Replace(facet.GetString("Facet.Name"), @"\s+", "");
1482 }
1483 <h4 class="panel-title tot-accordion">
1484 <a data-toggle="collapse" data-target='#collapse@(str)' class="accordion-section-title" style="color: #000 !important;">
1485 <span class="pull-right hasMinus"> <i class="i-minus"></i></span> @facet.GetString("Facet.Name")
1486 </a>
1487 </h4>
1488 </div>
1489 <div id='collapse@(str)' class="collapse in">
1490 <div class="panel-body smoothscroll" >
1491
1492 @if (facetOptions.Count() > 0)
1493 {
1494 <ul class="list-unstyled long-list">
1495
1496 @foreach (LoopItem option in facetOptions)
1497 {
1498 var value = option.GetValue("FacetOption.Value");
1499 var isSelected = option.GetBoolean("FacetOption.Selected");
1500 var label = option.GetString("FacetOption.Label");
1501 label = label.Replace("-a-","");
1502
1503 var count = option.GetInteger("FacetOption.Count");
1504 var facetName = (Regex.Replace(facet.GetString("Facet.Name"), @"\s+", "")).ToLower();
1505
1506 char[] array = label.ToCharArray();
1507 // Handle the first letter in the string.
1508 if (array.Length >= 1)
1509 {
1510 if (char.IsLower(array[0]))
1511 {
1512 array[0] = char.ToUpper(array[0]);
1513 }
1514 }
1515 // Scan through the letters, checking for spaces.
1516 // ... Uppercase the lowercase letters following spaces.
1517 for (int i = 1; i < array.Length; i++)
1518 {
1519 if (array[i - 1] == ' ')
1520 {
1521 if (char.IsLower(array[i]))
1522 {
1523 array[i] = char.ToUpper(array[i]);
1524 }
1525 }
1526 }
1527 string label2=new string(array);
1528 <li>
1529 <div class="block-element">
1530 <label onclick ="clickCheckbox(this);">
1531 @*<input type="checkbox" onclick="submitform()" data-hidden="true" class="filter-option-value" id="chk@(facetName)@(count)" name="@facetName" value="@value" @if (isSelected) { <text> checked="checked" </text> } />*@
1532 <input type="checkbox" onclick="submitform()" data-hidden="true" class="filter-option-value" id="chk@(facetName)@(count)" name="@facetQueryParameter" value="@value" @if (isSelected) { <text> checked="checked" </text> } />
1533 @label2
1534 </label>
1535 <span class="badge">(@count)</span>
1536 </div>
1537 </li> }
1538 </ul>
1539 }
1540 </div>
1541 </div>
1542 </div>
1543 <!--/Category menu end-->
1544
1545 }
1546 else{
1547
1548 <div id="accordion">
1549 <!--Category-->
1550 <div class="accordion-section" >
1551 @{
1552 var str = Regex.Replace(facet.GetString("Facet.Name"), @"\s+", "");
1553 bool showFacetName = false;
1554 }
1555 @if(facetOptions.Count() == 1)
1556 {
1557 foreach (LoopItem option in facetOptions)
1558 {
1559 if(option.GetInteger("FacetOption.Count") > 0 && option.GetString("FacetOption.Label").ToLower().Contains("nothing select"))
1560 {
1561 showFacetName = false;
1562 }
1563 else if(option.GetInteger("FacetOption.Count") > 0)
1564 {
1565 showFacetName = true;
1566 }
1567 }
1568 }
1569 else if (facetOptions.Count() > 1)
1570 {
1571 foreach (LoopItem option in facetOptions)
1572 {
1573 if(option.GetInteger("FacetOption.Count") > 0)
1574 {
1575 showFacetName = true;
1576 }
1577 }
1578 }
1579 @if(showFacetName)
1580 {
1581 <a class="accordion-section-title" data-toggle="collapse" onclick="return disableLink();" data-target='#collapse@(str)' href="#collapse@(str)" style="padding-top: 20px;">
1582 @facet.GetString("Facet.Name")
1583 </a>
1584 }
1585 </div>
1586 <div name="visibleFilter" id='collapse@(str)' class="accordion-section-content collapse scrollminicart">
1587 @if (facetOptions.Count() > 0)
1588 {
1589 foreach (LoopItem option in facetOptions)
1590 {
1591 var value = option.GetValue("FacetOption.Value");
1592 var isSelected = option.GetBoolean("FacetOption.Selected");
1593
1594 var count = option.GetInteger("FacetOption.Count");
1595 var label = option.GetString("FacetOption.Label");
1596 label = facet.GetString("Facet.Name") == "Brands" ? label.ToUpper() : System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(label.ToLower());
1597 var displayLabel = label + " (" + count + ")";
1598 var facetName = (Regex.Replace(facet.GetString("Facet.Name"), @"\s+", "")).ToLower();
1599 facetName = facetName == "kibble-bitesize" ? "bitesize" : facetName;
1600 if(count != 0 && !displayLabel.ToLower().Contains("nothing select"))
1601 {
1602 @*<input type="checkbox" onclick="submitform()" data-hidden="false" data-category="@str" class="filter-option-value" id="chk@(label)@(count)" name="@facetName" value="@value" @if (isSelected) { <text> checked="checked" </text> } />*@
1603 <input type="checkbox" onclick="submitform()" data-hidden="false" data-category="@str" class="filter-option-value" id="chk@(label)@(count)" name="@facetQueryParameter" value="@value" @if (isSelected) { <text> checked="checked" </text> } />
1604 @displayLabel
1605 <br>
1606 }
1607
1608 }
1609 }
1610 </div>
1611 <!--/Category menu end-->
1612 </div>}}
1613 }
1614
1615 }
1616 @{
1617 string currency = GetLoop("Products").Count() > 0 ? GetLoop("Products")[0].GetString("Ecom:Product.Discount.Price.Currency.Symbol") : string.Empty;
1618 }
1619 <div id="accordion">
1620 <div id="priceFilterTitle" class="accordion-section" style="display:none;">
1621 <a class="accordion-section-title" data-toggle="collapse" onclick="return disableLink(); return false;" data-target='#collapsePriceFilter' href="#collapsePriceFilter" style="padding-top: 20px;">
1622 Price Filter
1623 </a>
1624 </div>
1625 <div name="visibleFilter" id='collapsePriceFilter' class="accordion-section-content collapse scrollminicart" style="display:none;">
1626 <div>
1627 <label>Price range: @currency</label>
1628 <input class="price-filter-min" id="price-filter-min" name="minpricefilter" value="0" readonly />
1629 ~
1630 <input class="price-filter-max" id="price-filter-max" name="maxpricefilter" value="10000" readonly />
1631 <input type="hidden" id="minprice" name="minprice" value="0" />
1632 <input type="hidden" id="maxprice" name="maxprice" value="10000" />
1633 </div>
1634 <div class="slider-range">
1635 <div id="slider-range"></div>
1636 </div>
1637 </div>
1638 </div>
1639
1640 <div id="accordion">
1641 <div id="wordSearchTitle" class="accordion-section">
1642 <a class="accordion-section-title" data-toggle="collapse" onclick="return disableLink();" data-target='#collapseWordSearch' href="#collapseWordSearch" style="padding-top: 20px;">
1643 Search within this list
1644 </a>
1645 </div>
1646 <div name="visibleFilter" id='collapseWordSearch' class="accordion-section-content collapse scrollminicart">
1647 <div>
1648 <input type="text" id="wordSearch" name="wordSearch" placeholder="Word Search" value='@System.Web.HttpContext.Current.Request["wordSearch"]' />
1649 <input id="applyFilters" type="submit" class="btn btn-sm btn-two" value="Search" style="width:60px;" />
1650 </div>
1651 </div>
1652 </div>
1653
1654 <div style="clear:both;margin-bottom:40px;" >
1655 <input id="clearFilters" type="reset" onclick="resetForm()" class="btn btn-sm btn-two" value="Reset Filters" />
1656 </div>
1657 </form>
1658
1659
1660
1661
1662 <script>
1663 function resetForm(){
1664 var checkboxes = document.getElementById("filtercontainer").getElementsByTagName("input");
1665 for(var i=0;i<checkboxes.length;i++){
1666 if(checkboxes[i].checked == true && $(checkboxes[i]).data("hidden")==false){
1667 console.log(checkboxes[i].value);
1668 $(checkboxes[i]).attr("checked",false);
1669 }
1670 }
1671 $("#wordSearch").val("");
1672 var url = new URL(window.location);
1673 var query_string = url.search;
1674 var search_params = new URLSearchParams(query_string);
1675 search_params.set('minpricefilter', '0');
1676 search_params.set('maxpricefilter', max_price);
1677 search_params.set('wordSearch', '');
1678 url.search = search_params.toString();
1679 var new_url = url.toString();
1680 window.location.href = new_url;
1681 setTimeout(function(){document.getElementById("filtercontainer").submit();},300);
1682 }
1683 </script>
1684 @foreach (LoopItem k in GetLoop("Ecom:Search.Filters"))
1685 {
1686
1687 <!--@LoopStart("Ecom:Search.Filter.Options")-->
1688 <!--@Ecom:Search.Filter.Name-->
1689 <!--@Ecom:Search.Filter.Option.Label-->
1690 <!--@Ecom:Search.Filter.Option.Value-->
1691 <!--@LoopEnd("Ecom:Search.Filter.Options")-->
1692 }
1693
1694 </div>
1695 <script>
1696 function disableLink(){
1697 return false;
1698 }
1699 function submitform(){
1700 var x = document.getElementsByName('EcomSearch');
1701 x[0].submit();
1702 }
1703
1704 function clickCheckbox(check){
1705
1706 }
1707
1708 function expandFacets(){
1709
1710 var filterDiv = document.getElementsByName("visibleFilter");
1711
1712 for(var i=0;i<filterDiv.length;i++){
1713
1714 var checkboxes = filterDiv[i].getElementsByTagName("input");
1715
1716 for(var j=0;j<checkboxes.length;j++){
1717 if(checkboxes[j].checked == true){
1718 var targetFilter = document.getElementById("collapse"+$(checkboxes[j]).data("category"));
1719 console.log("collapse"+$(checkboxes[j]).data("category"));
1720 targetFilter.setAttribute("class", "collapse in");
1721 break;
1722 }
1723 }
1724 }
1725 }
1726
1727 $(document).ready(function() {
1728 //expandFacets();
1729 if('@GetGlobalValue("Global:Device.IsMobile")' != "True") {
1730 $('.accordion-section-title').click();
1731 }
1732 });
1733 </script>
1734 <style>
1735 .price-filter-min, .price-filter-max {
1736 width: 22%;
1737 border: none;
1738 background: none;
1739 }
1740 .price-filter-min {
1741 text-align: right;
1742 }
1743 .price-filter-max {
1744 text-align: left;
1745 }
1746 .slider-range {
1747 padding: 0 10px 0 10px;
1748 }
1749 #applyFilters {
1750 margin-top: -3px;
1751 }
1752
1753 .FixedHeightContainer
1754 {
1755 height: auto;
1756 }
1757 .scrollminicart
1758 {
1759 max-height:224px;
1760 height:auto;
1761 overflow:auto;
1762
1763 }
1764 </style>
1765 <!------------------------- Price Filter Begin ------------------------->
1766 @{
1767 int requested_Min_Price = 0;
1768 int requested_Max_Price = 0;
1769 int minPrice = 0;
1770 int maxPrice = 0;
1771 int pageNumber = 0;
1772 string getPriceUrl = string.Empty;
1773 try
1774 {
1775 requested_Min_Price = Convert.ToInt32(System.Web.HttpContext.Current.Request["minpricefilter"]);
1776 requested_Max_Price = Convert.ToInt32(System.Web.HttpContext.Current.Request["maxpricefilter"]);
1777 minPrice = Convert.ToInt32(System.Web.HttpContext.Current.Request["minprice"]);
1778 maxPrice = Convert.ToInt32(System.Web.HttpContext.Current.Request["maxprice"]);
1779 pageNumber = Convert.ToInt32(System.Web.HttpContext.Current.Request["PageNum"]);
1780 //getPriceUrl = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.Replace(GetString("Ecom:ProductList:Page.ID"), "3123").Replace("PageNum=" + pageNumber,"PageNum=");
1781 getPriceUrl = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Host + "/Default.aspx?ID=3123";
1782 }
1783 catch(Exception ex)
1784 {
1785 requested_Min_Price = 0;
1786 requested_Max_Price = 0;
1787 minPrice = 0;
1788 maxPrice = 0;
1789 //getPriceUrl = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.Replace(GetString("Ecom:ProductList:Page.ID"), "3123");
1790 getPriceUrl = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Host + "/Default.aspx?ID=3123";
1791 }
1792 }
1793
1794 <link rel="stylesheet" href="/Files/Templates/Designs/PLC/assets/jQuery_Ui_Slider/jquery-ui.css" type="text/css">
1795 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
1796 <script src="/Files/Templates/Designs/PLC/assets/jQuery_Ui_Slider/jquery.ui.touch-punch.min.js"></script>
1797
1798 <script>
1799 var priceFilterMouseDown = false;
1800 var min_price = 0;
1801 var max_price = 0;
1802 var requested_min_price = parseInt("@requested_Min_Price");
1803 var requested_max_price = parseInt("@requested_Max_Price");
1804 var url = "@getPriceUrl" + "&SortBy=InternetPrice&SortOrder=Desc" + "&GroupId=" + "@stringGroupID";
1805 $.ajax(
1806 {
1807 url: url,
1808 type: 'POST',
1809 success: function (data)
1810 {
1811 if(parseInt("@minPrice") == 0 && parseInt("@maxPrice") == 0) {
1812 min_price = parseInt(data["Min_Price"]);
1813 max_price = parseInt(data["Max_Price"]) + 1;
1814 } else {
1815 min_price = parseInt("@minPrice");
1816 max_price = parseInt("@maxPrice");
1817 }
1818
1819 $("#minprice").val(min_price);
1820 $("#maxprice").val(max_price);
1821
1822 if(requested_min_price == 0 && requested_max_price == 0)
1823 {
1824 requested_max_price = min_price;
1825 requested_max_price = max_price;
1826 }
1827 $( function() {
1828 $( "#slider-range" ).slider({
1829 range: true,
1830 min: min_price,
1831 max: max_price,
1832 values: [ requested_min_price, requested_max_price ],
1833 slide: function( event, ui ) {
1834 $( "#price-filter-min" ).val(ui.values[ 0 ]);
1835 $( "#price-filter-max" ).val(ui.values[ 1 ]);
1836 }
1837 });
1838 $( "#price-filter-min" ).val( $( "#slider-range" ).slider( "values", 0 ));
1839 $( "#price-filter-max" ).val( $( "#slider-range" ).slider( "values", 1 ) );
1840 });
1841 $( "#priceFilterTitle" ).show();
1842 $( "#collapsePriceFilter" ).show();
1843 $('.ui-slider-handle ui-corner-all ui-state-default').draggable();
1844 },
1845 error: function (jqXHR, textStatus, errorThrown)
1846 {
1847 //console.log("jqXHR: " + jqXHR);
1848 //console.log("textStatus: " + textStatus);
1849 //console.log("errorThrown: " + errorThrown);
1850 }
1851 });
1852
1853 $( "#slider-range" ).mousedown(function() {
1854 priceFilterMouseDown = true;
1855 });
1856 $(document).mouseup(function() {
1857 if(priceFilterMouseDown) {
1858 $("#applyFilters").click();
1859 }
1860 });
1861
1862
1863 <!------------------------- Price Filter End ------------------------->
1864
1865 <!------------------------- on Form Submit Begin ------------------------->
1866
1867 $(function()
1868 {
1869 $("form").submit(function()
1870 {
1871 $('#wordSearch').val($('#wordSearch').val().toLowerCase());
1872 <!-- Handling null value parameter -->
1873 $( 'input[value=""]' ).each(function(index) {
1874 if($( this ).val() == null || $( this ).val() == "") {
1875 $( this ).attr("disabled", "disabled");
1876 }
1877 });
1878 return true; // ensure form still submits
1879 });
1880 });
1881 <!------------------------- on Form Submit End ------------------------->
1882 </script>
1883 <style>
1884 .dw-categories > li > .M2{
1885 background:none;
1886 }
1887 .list-open-active {
1888 background:none;
1889 }
1890 ul.dw-categories > li > ul {
1891 background:none;
1892 }
1893 .list-active {
1894 background:none;
1895 }
1896 </style>
1897 </div>
1898 </div>
1899 @if(showH1TitleFlag)
1900 {
1901 <h1 style="text-align: center;">@GetString("Ecom:Group:Field.h1titletext")</h1>
1902 }
1903 <div class="prod-content-right col-9-12">
1904
1905 @if( !string.IsNullOrWhiteSpace(grouptext))
1906 {
1907 <h2 style="text-transform: capitalize;">@grouptext.Replace("-a-","&")</h2>
1908 }
1909 else{
1910 <h2 style="text-transform: capitalize;">@grouptext</h2>
1911 }
1912 <div class="col-1-1 nopadding">
1913 <div class="sort-box col-1-3 nopadding">
1914 <form class="sort-by">
1915 <label class="smallText bold">@Translate("Sort by:", "Sort by:") </label>
1916 <select id="sortSelect" onchange="SortProductsBy(this.value)" style="width:100px">
1917 @*<option value="PleaseSelect">@Translate("Please select", "Please select")</option>*@
1918 <option value="TotalAmtSold&SortOrder=Desc" > @Translate("Best Selling", "Best Selling")</option>
1919 <option value="Brand&SortOrder=Asc" >@Translate("Brand A-Z", "Brand A-Z") </option>
1920 <option value="Brand&SortOrder=Desc" > @Translate("Brand Z-A", "Brand Z-A") </option>
1921
1922 <option value="InternetPrice&SortOrder=Asc" >@Translate("Price low-high", "Price low-high")</option>
1923 <option value="InternetPrice&SortOrder=Desc" > @Translate("Price high-low", "Price high-low")</option>
1924
1925 <option value="NewArrivals,AutoId&SortOrder=Desc,Desc" > @Translate("New Arrivals", "New Arrivals")</option>
1926 </select>
1927 </form>
1928 </div>
1929
1930 <div class="page-no-top col-2-3">
1931 @if(currentPage == 1)
1932 {
1933 if(totalPages == 1)
1934 {
1935 <div id="items-pages" class="items-pages currenttotal1 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1936 }else if(totalPages == 2){
1937 <div id="items-pages" class="items-pages currenttotal2 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1938 }else if(totalPages == 3){
1939 <div id="items-pages" class="items-pages currenttotal3 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1940 }else if(totalPages == 4){
1941 <div id="items-pages" class="items-pages currenttotal4 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1942 }else if(totalPages == 5){
1943 <div id="items-pages" class="items-pages currenttotal5 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1944 }else if(totalPages == 6){
1945 <div id="items-pages" class="items-pages currenttotal6 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1946 }else{
1947 <div id="items-pages" class="items-pages current1 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1948 }
1949 }else if(currentPage == 2)
1950 {
1951 if(totalPages <= 6)
1952 {
1953 <div id="items-pages" class="items-pages total6current2 destopcurrent2 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1954 }else{
1955 <div id="items-pages" class="items-pages current2 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1956 }
1957 }else if(currentPage == 3)
1958 {
1959 if(totalPages <= 6)
1960 {
1961 <div id="items-pages" class="items-pages total6current3 destopcurrent3 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1962 }else{
1963 <div id="items-pages" class="items-pages current3 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1964 }
1965 }else if(currentPage == 4)
1966 {
1967 if(totalPages <= 6)
1968 {
1969 <div id="items-pages" class="items-pages total6current4 destopcurrent4 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1970 }else{
1971 <div id="items-pages" class="items-pages current4 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1972 }
1973 }else if(currentPage == 5)
1974 {
1975 if(totalPages <= 6)
1976 {
1977 <div id="items-pages" class="items-pages total6current5 destopcurrent5 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1978 }else{
1979 <div id="items-pages" class="items-pages current5 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1980 }
1981 }else if(currentPage == 6)
1982 {
1983 if(totalPages <= 6)
1984 {
1985 <div id="items-pages" class="items-pages total6current6 destopcurrent6 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1986 }else{
1987 <div id="items-pages" class="items-pages current6 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1988 }
1989 }else
1990 {
1991 if(currentPage == totalPages)
1992 {
1993 <div id="items-pages" class="items-pages commoncurrent mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1994 }else{
1995 if(currentPage == (totalPages - 1))
1996 {
1997 <div id="items-pages" class="items-pages total1 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
1998 }else if(currentPage == (totalPages - 2))
1999 {
2000 <div id="items-pages" class="items-pages total2 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
2001 }else if(currentPage == (totalPages - 3))
2002 {
2003 <div id="items-pages" class="items-pages total3 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
2004 }else if(currentPage == (totalPages - 4))
2005 {
2006 <div id="items-pages" class="items-pages total4 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
2007 }else if(currentPage == (totalPages - 5))
2008 {
2009 <div id="items-pages" class="items-pages total5 mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
2010 }else{
2011 <div id="items-pages" class="items-pages commontotal mblpagination">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
2012 }
2013 }
2014 }
2015 <ul class="page-prev-next top-paging-prev" style="float: left;">
2016 @if (!string.IsNullOrWhiteSpace(GetString("Ecom:ProductList.PrevPage.Clean")))
2017 {
2018 <li><a href="@GetString("Ecom:ProductList.PrevPage.Clean")" style="margin-top:3px;">‹</a></li>
2019 }
2020 </ul>
2021 <ul id="page-no" class="page-no">
2022
2023 @{
2024 if(currentPage!=1){
2025 <li style="padding: 0 2px 0 2px;"><a href='@(blankLink+"PageNum=1"+otherLink)'><strong>1</strong></a></li>
2026 }
2027 @*...*@
2028 if(currentPage - noOfPages > 2){
2029 <li><a>...</a></li>
2030 }
2031 @*previous 5 pages*@
2032 for(var i = currentPage-noOfPages; i < currentPage; i++){
2033 if(i>1){
2034 <li style="padding: 0 2px 0 2px;"><a href='@(blankLink+"PageNum="+i+otherLink)' ><strong>@i</strong></a></li>
2035 }
2036 }
2037 @*currentpage*@
2038 <li class="active" style="padding: 0 2px 0 2px; text-decoration: underline;"><a href="@currentPageLink"><strong>@currentPage</strong></a></li>
2039 @*forward 5 pages*@
2040 for(var i = currentPage+1; i < currentPage+noOfPages + 1; i++){
2041 if(i<totalPages){
2042 <li style="padding: 0 2px 0 2px;"><a href='@(blankLink+"PageNum="+i+otherLink)'><strong>@i</strong></a></li>
2043 }
2044 }
2045 @*...*@
2046 if(currentPage + noOfPages < totalPages-2){
2047 <li style="padding: 0 2px 0 2px;"><a>...</a></li>
2048 }
2049
2050 if(currentPage != totalPages && totalPages != 0){
2051 <li style="padding: 0 2px 0 2px;"><a href='@(blankLink+"PageNum="+totalPages+otherLink)'><strong>@totalPages</strong></a></li>
2052 }
2053 }
2054
2055 </ul>
2056 <ul class="page-prev-next" style="margin-left: 10px;">
2057
2058 @if (!string.IsNullOrWhiteSpace(GetString("Ecom:ProductList.NextPage.Clean")))
2059 {
2060 <li><a href="@GetString("Ecom:ProductList.NextPage.Clean")" style="margin-top: 3px;">›</a></li>
2061 }
2062
2063 </ul>
2064 </div>
2065
2066 <hr class="grey">
2067 </div>
2068 @if(birthday && showBirthdayPrice1)
2069 {
2070 <!--<div class="info-box col-1-1" style="padding-bottom: 20px;">-->
2071 <!--<img src="@pathproduct/images/icon_info.png" width="20" align="texttop" alt="icon_info" title="">-->
2072 <!--<span style="font-size:16px;"><strong>That's because it's your birthday this month!</span>-->
2073 <!--</div>-->
2074 }
2075 <div class="clearfix"></div>
2076 <div class="clearfix"></div>
2077
2078 <div class="compare-box" id="comparebox" style="display: none;">
2079 <div class="title">
2080 <h3>Compare products</h3>
2081 <p>(Add up to 3 products)</p>
2082 </div>
2083 <div class="btn-box">
2084 <div class="btn" style="background-color:#FDF2F0;"><a href="javascript:Compare.compare(2834);">@Translate("Compare","Compare")</a></div>
2085 <p align="center" class="smallText bold"><a href="javascript:Compare.removeall();">@Translate("Clear All","Clear All")</a></p>
2086 </div>
2087 <div id ="compare" class="add-img">
2088 <div class="btn-add-img"><a href="#">+</a></div>
2089 </div>
2090 </div>
2091
2092 <div id="addedItem"></div>
2093 <div class="col-1-1 nopadding">
2094 @GetProductList(GetLoop("Products"),birthday,becomeAMemberPrice, 3)
2095 </div>
2096
2097 <p> </p>
2098 <hr class="grey">
2099
2100 <div class="page-no-bottom col-1-1" style="margin-bottom:0px;">
2101 <div class="items-pages">@GetString("Ecom:ProductList.PageProdCnt") items in list</div>
2102 <ul class="page-prev-next">
2103
2104 @if (!string.IsNullOrWhiteSpace(GetString("Ecom:ProductList.PrevPage.Clean")))
2105 {
2106 <li style="padding: 0 2px 0 2px;"><a href="@GetString("Ecom:ProductList.PrevPage.Clean")">‹</a></li>
2107 }
2108
2109 </ul>
2110 <ul id="page-no" class="page-no">
2111
2112 @{
2113 if(currentPage!=1){
2114 <li style="padding: 0 2px 0 2px;"><a href='@(blankLink+"PageNum=1"+otherLink)'><strong>1</strong></a></li>
2115 }
2116 @*...*@
2117 if(currentPage - noOfPages > 2){
2118 <li><a>...</a></li>
2119 }
2120 @*previous 5 pages*@
2121 for(var i =currentPage-noOfPages;i<currentPage;i++){
2122 if(i>1){
2123 <li style="padding: 0 2px 0 2px;"><a href='@(blankLink+"PageNum="+i+otherLink)' ><strong>@i</strong></a></li>
2124 }
2125 }
2126 @*currentpage*@
2127 <li class="active" style="padding: 0 2px 0 2px; text-decoration: underline;"><a href="@currentPageLink"><strong>@currentPage</strong></a></li>
2128 @*forward 5 pages*@
2129 for(var i =currentPage+1;i<currentPage+noOfPages+1;i++){
2130 if(i<totalPages){
2131 <li style="padding: 0 2px 0 2px;"><a href='@(blankLink+"PageNum="+i+otherLink)'><strong>@i</strong></a></li>
2132 }
2133 }
2134 @*...*@
2135 if(currentPage + noOfPages < totalPages-2){
2136 <li><a>...</a></li>
2137 }
2138
2139 if(currentPage != totalPages && totalPages != 0){
2140 <li style="padding: 0 2px 0 2px;"><a href='@(blankLink+"PageNum="+totalPages+otherLink)'><strong>@totalPages</strong></a></li>
2141 }
2142 }
2143
2144 </ul>
2145 <ul class="page-prev-next" style="margin-left: 10px;">
2146
2147 @if (!string.IsNullOrWhiteSpace(GetString("Ecom:ProductList.NextPage.Clean")))
2148 {
2149 <li><a href="@GetString("Ecom:ProductList.NextPage.Clean")">›</a></li>
2150 }
2151
2152 </ul>
2153 </div>
2154 <!--<div class="clearfix"></div>
2155
2156
2157
2158 </div>-->
2159
2160 <div id="location" style="width:100%; max-width:400px;display: none;">
2161 <form>
2162 <h3 style="margin:0;">You have selected more than one location.</h3>
2163 <p style="margin:0 0 20px 0;">Which location would like to pick up this product from?</p>
2164 <input type="checkbox" /> Toa Payoh<br />
2165 <input type="checkbox" /> Valley Point
2166 <div class="btn-addto-cart" style="margin-top:20px; width:200px;">
2167 <a href="#"><i class="fa fa-shopping-cart"></i> Add to cart</a>
2168 </div>
2169 </form>
2170 </div>
2171 <script>
2172 function getQueryStringValue (key) {
2173 return unescape(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + escape(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
2174 }
2175
2176
2177 setSortDropDown();
2178 function setSortDropDown(){
2179 var pageLink = document.location.href;
2180 if(!pageLink.includes("SortBy")){
2181
2182 }
2183 else{
2184 var sortby1 = pageLink.split('SortBy=')[1];
2185 var sortby = sortby1.split('&SortOrder=')[0];
2186 var sortorder = sortby1.split('&SortOrder=')[1];
2187 var sortstring = sortby.toLowerCase()+sortorder.toLowerCase();
2188 document.getElementById("sortSelect").value = sortstring;
2189 }
2190 }
2191 function SortProductsBy(sortcode) {
2192 var Page = "@grouplink";
2193 var pageLink = document.location.href;
2194 var paraJoinSign = "";
2195 if(location.href.indexOf('?') >= 0) {
2196 paraJoinSign = "&";
2197 } else {
2198 paraJoinSign = "?";
2199 }
2200
2201 if(!pageLink.includes("SortBy")){
2202 document.location.href = location.href + paraJoinSign + "SortBy=" + sortcode;
2203 }
2204 else{
2205 var pageUrl = window.location.href;
2206 if(pageUrl.includes("Purge=True")){
2207 var withoutParam = pageUrl.split('&')[0];
2208 document.location.href = withoutParam + paraJoinSign + "SortBy=" + sortcode;
2209 }else{
2210 var withoutParameter = pageUrl.split('?')[0];
2211 document.location.href = withoutParameter + "?SortBy=" + sortcode;
2212 }
2213 }
2214 }
2215
2216 function compareProducts(compareId,productName,productLink,checked){
2217
2218 if(!checked){
2219 Compare.remove(compareId);
2220
2221 }
2222 else{
2223 Compare.add(compareId,productName,productLink);
2224 }
2225
2226 }
2227 </script>
2228 @* ----- qty controller Begin----- *@
2229 <script type="text/javascript" src="/Files/Templates/Designs/PLC/js/PLCAddToCartQtyController.js?v=1.1"></script>
2230 @* ----- qty controller End------- *@