Close
product image
Invalid email address
Close

Confirmation

Your notification request has been noted.
You will receive an email when the item becomes available in the online boutique.

Thank You

This website uses cookies to track your behavior and to improve your experience on the site. For more information, click here.

FIND THE PERFECT TEA FOR YOU

TWG TEA OFFERS THE LARGEST TEA LIST IN THE WORLD.
EXPLORE OUR COLLECTION AND DISCOVER NEW TASTE SENSATIONS BY ANSWERING
THESE QUESTIONS TO FIND THE TEA THAT WAS HARVESTED JUST FOR YOU.

Error executing template "Designs/TWG/eCom/Productlist/ProductList_auto_page_loading.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_5bac46f049504bf3bdeaa55816a5097f.b__0_0(TextWriter __razor_helper_writer) in W:\Websites-9.6\Solutions\files\Templates\Designs\TWG\eCom\Productlist\ProductList_auto_page_loading.cshtml:line 104
   at CompiledRazorTemplates.Dynamic.RazorEngine_5bac46f049504bf3bdeaa55816a5097f.Execute() in W:\Websites-9.6\Solutions\files\Templates\Designs\TWG\eCom\Productlist\ProductList_auto_page_loading.cshtml:line 93
   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 System.IO; 2 @using System.Web; 3 @using System.Text; 4 @using System.Collections.Generic; 5 @using System.Linq 6 @using System.Text.RegularExpressions; 7 8 @using Newtonsoft.Json.Linq; 9 @using Newtonsoft.Json; 10 @using System.Web.Script.Serialization; 11 @using System.Web.Helpers; 12 13 14 <div class='d-none'> 15 @foreach (LoopItem l in GetLoop("Query.Parameters")) 16 { 17 if (!string.IsNullOrWhiteSpace(@l.GetString("Parameter.Value"))) 18 { 19 <text> @l.GetString("Parameter.Name")++@l.GetString("Parameter.Value") </text> 20 } 21 } 22 23 24 </div> 25 <script> 26 $(document).ready(function(){ 27 $("#toptitle").show(); 28 }); 29 30 </script> 31 32 @{ 33 string languageIDSQL="SELECT AREAECOMLANGUAGEID,AREAITEMID FROM Area where AreaID="+GetGlobalValue("Global:Area.ID"); 34 string ecomLanguageID="LANG2"; 35 string areaItemID="1"; 36 using (System.Data.IDataReader SqlReader = Dynamicweb.Data.Database.CreateDataReader(languageIDSQL)) 37 { 38 while (SqlReader.Read()) 39 { 40 ecomLanguageID = SqlReader["AREAECOMLANGUAGEID"].ToString(); 41 if(!string.IsNullOrEmpty(SqlReader["AREAITEMID"].ToString())){ 42 areaItemID=SqlReader["AREAITEMID"].ToString(); 43 } 44 } 45 } 46 47 var TotalLooseTeaWeight = 0.00; 48 var maxWeight=0.00; 49 string sql = "SELECT LooseTeaMaximumWeight FROM ItemType_TWGWebsiteSetting WHERE ID="+areaItemID; 50 using (System.Data.IDataReader myImageReader = Dynamicweb.Data.Database.CreateDataReader(sql.ToString())) 51 { 52 while (myImageReader.Read()) 53 { 54 maxWeight = Convert.ToInt32(myImageReader["LooseTeaMaximumWeight"].ToString()); 55 } 56 } 57 58 maxWeight = maxWeight * 1000; 59 var cart = Dynamicweb.Ecommerce.Common.Context.Cart; 60 if(cart != null) 61 { 62 foreach (var item in cart.OrderLines) 63 { 64 var currentWeight = 0; 65 var quantity = 0.0; 66 if (!string.IsNullOrEmpty(item.ProductVariantText)) 67 { 68 quantity = item.Quantity; 69 if (item.ProductVariantText.Contains("kg")) 70 { 71 currentWeight = Convert.ToInt32(item.ProductVariantText.ToString().Replace("kg","") ); 72 } 73 else if( item.ProductVariantText.Contains("g")) 74 { 75 currentWeight = Convert.ToInt32(item.ProductVariantText.ToString().Replace("g", "")); 76 } 77 78 if (currentWeight == 1) 79 { 80 currentWeight = 1000; 81 } 82 } 83 84 TotalLooseTeaWeight += quantity * currentWeight; 85 } 86 } 87 88 } 89 90 91 @if (string.IsNullOrWhiteSpace(System.Web.HttpContext.Current.Request["PageNum"])) 92 { 93 @RenderFirstPage() 94 } 95 else 96 { 97 @RenderByPage() 98 } 99 100 @helper RenderFirstPage() 101 { 102 object objHideRefineResult = false; 103 bool hideRefineResultFlag = false; 104 Dynamicweb.Frontend.PageView.Current().Page.PropertyItem.TryGetValue("Hide_Refine_Result", ref objHideRefineResult); 105 hideRefineResultFlag = objHideRefineResult != null ? bool.Parse(objHideRefineResult.ToString()) : false; 106 107 var SortByValue = !string.IsNullOrWhiteSpace(System.Web.HttpContext.Current.Request["SortBy"])? System.Web.HttpContext.Current.Request["SortBy"]+"&" : "default"; 108 var SortByOrder = !string.IsNullOrWhiteSpace(System.Web.HttpContext.Current.Request["SortOrder"])? "SortOrder="+System.Web.HttpContext.Current.Request["SortOrder"] : ""; 109 110 string currentUrl = System.Web.HttpContext.Current.Request.Url.AbsoluteUri; 111 int productDetailPage=GetPageIdByNavigationTag("ProductDetailPage"); 112 113 string softByMarginValue = "-66px"; 114 softByMarginValue = currentUrl.ToUpper().Contains("SORTBY=NEWARRIVAL") ? "-20px" : softByMarginValue; 115 softByMarginValue = currentUrl.ToUpper().Contains("SORTBY=NAME") ? "-103px" : softByMarginValue; 116 softByMarginValue = currentUrl.ToUpper().Contains("SORTBY=BESTSELLER") ? "-17px" : softByMarginValue; 117 softByMarginValue = currentUrl.ToUpper().Contains("SORTBY=PRICE") ? "18px" : softByMarginValue; 118 119 string softByMarginValuemobile = "-35px"; 120 softByMarginValuemobile = currentUrl.ToUpper().Contains("SORTBY=NEWARRIVAL") ? "-18px" : softByMarginValuemobile; 121 softByMarginValuemobile = currentUrl.ToUpper().Contains("SORTBY=NAME") ? "-38px" : softByMarginValuemobile; 122 softByMarginValuemobile = currentUrl.ToUpper().Contains("SORTBY=BESTSELLER") ? "-15px" : softByMarginValuemobile; 123 softByMarginValuemobile = currentUrl.ToUpper().Contains("SORTBY=PRICE") ? "18px" : softByMarginValuemobile; 124 125 126 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> 127 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 128 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.2.2/jquery.form.js"></script> 129 130 <input type="hidden" id="sortByValue" value="@SortByValue@SortByOrder" /> 131 132 <style> 133 134 @@media (max-width: 767px){ 135 .custom-dropdown .dropdown-menu { 136 left: @softByMarginValuemobile !important; 137 } 138 } 139 @@media (min-width: 768px){ 140 .custom-dropdown .dropdown-menu { 141 left: @softByMarginValue !important; 142 } 143 144 .container{ 145 padding-left: 10px !important; 146 padding-right: 10px !important; 147 } 148 } 149 150 @@media (max-width: 768px) and (min-width: 414px){ 151 .product-refine{ 152 padding-top: 0px; 153 } 154 155 .container.sm-teac-p{ 156 padding-left: 15px !important; 157 padding-right: 15px !important; 158 } 159 } 160 </style> 161 162 163 164 <div class="container"> 165 <div class="product-list-wrapper"> 166 <div class="product-sorting mb-3" style="/*Hss*/ margin-bottom: 10px !important;"> 167 <div class="row"> 168 <div class="col-12 text-right"> 169 <div class="dropdown custom-dropdown sort"> 170 <button class="btn dropdown-toggle" type="button" id="dropdownMenuButton" targetDiv="sortingdropdown">@Translate("Sort By","Sort By")</button> 171 <div id="sortingdropdown" class="dropdown-menu"> 172 <a class="dropdown-item" href="javascript:void(0)" value="NewArrival&amp;SortOrder=Desc">@Translate("New arrivals","New arrivals")</a> 173 <a class="dropdown-item" href="javascript:void(0)" value="BestSeller&amp;SortOrder=Desc">@Translate("Most popular","Most popular")</a> 174 <a class="dropdown-item" href="javascript:void(0)" value="Name&amp;SortOrder=Asc">A-Z</a> 175 <a class="dropdown-item" href="javascript:void(0)" value="Price&amp;SortOrder=Asc">@Translate("Price low to high","Price low to high")</a> 176 <a class="dropdown-item" href="javascript:void(0)" value="Price&amp;SortOrder=Desc">@Translate("Price high to low","Price high to low")</a> 177 </div> 178 </div> 179 </div> 180 </div> 181 </div> 182 183 184 @if(!hideRefineResultFlag){ 185 foreach(LoopItem q in GetLoop("Query.Parameters")) 186 { 187 if(q.GetString("Parameter.Name")=="classification") 188 { 189 if(q.GetString("Parameter.Value")=="tea accessories") 190 { 191 <!--<input name="category" value="Loose Tea" autocomplete="off" type="hidden">--> 192 193 var pageId = GetGlobalValue("Global:Pageview.Url.Raw"); 194 string pageName = GetGlobalValue("Global:Page.Name").ToString(); 195 196 197 198 199 200 <div class="product-refine"> 201 <div class="refine-link"> 202 <div class="row"> 203 <div class="col-12 text-center"> 204 <a id="refineSlideButton" href="javascript:void(0)">@Translate("Refine Results", "Refine Results") <span></span></a> 205 </div> 206 </div> 207 </div> 208 <div class="refine-slide"> 209 <form method="get" action="/Default.aspx" id="facets"> 210 <div class="refine-content"> 211 <div class="row"> 212 213 @{ 214 var id = Dynamicweb.Context.Current.Request.QueryString["ID"]; 215 var groupid = Dynamicweb.Context.Current.Request.QueryString["GroupID"]; 216 var search = Dynamicweb.Context.Current.Request.QueryString["Search"]; 217 } 218 <input type="hidden" name="ID" value="@id" > 219 220 @{ 221 var idIndex = 1; 222 foreach (LoopItem facetGroup in GetLoop("FacetGroups")) 223 { 224 foreach (LoopItem facetItem in facetGroup.GetLoop("Facets")) 225 { 226 int OptionWithResultCount = facetItem.GetInteger("Facet.OptionWithResultCount"); 227 var FacetName = facetItem.GetString("Facet.Name"); 228 int FacetOptionWithResultCount = facetItem.GetInteger("Facet.OptionWithResultCount"); 229 var FacetOptionCount = facetItem.GetInteger("Facet.OptionCount"); 230 var FacetOptionResultTotalCount = facetItem.GetInteger("Facet.OptionResultTotalCount"); 231 var FacetQueryParameter = facetItem.GetString("Facet.QueryParameter"); 232 233 if (OptionWithResultCount > 0 ) 234 { 235 <div class="col-12 col-sm-12 col-lg-3 col-md-6 variants" style="height:fit-content;"> 236 <h4>@Translate(FacetName,FacetName)</h4> 237 <ul class="list-unstyled"> 238 @foreach (LoopItem FacetOption in facetItem.GetLoop("FacetOptions")) 239 { 240 var FacetOptionValue = FacetOption.GetString("FacetOption.Value"); 241 var FacetOptionName = FacetOption.GetString("FacetOption.Name"); 242 var FacetOptionLabel = FacetOption.GetString("FacetOption.Label"); 243 var variantColorcode = FacetOption.GetString("Ecom:VariantOption.ColorCode"); 244 bool FacetOptionSelected = FacetOption.GetBoolean("FacetOption.Selected"); 245 int OptionCount = FacetOption.GetInteger("FacetOption.Count"); 246 var selected = ""; 247 var chk = ""; 248 string notActive = ""; 249 250 if (FacetOptionSelected) 251 { 252 selected = " selected=\"selected\""; 253 chk = " checked=\"checked\""; 254 } 255 if(pageName.ToLower() != "tea accessories" && FacetName.ToLower() == "type of accessory") 256 { 257 notActive = "not_active"; 258 } 259 <li> 260 <div class="custom-checkbox @notActive"> 261 <input id="facet_@idIndex" name="@FacetQueryParameter" type="checkbox" value="@FacetOptionValue" @chk /> 262 <label for="facet_@idIndex"> @FacetOptionLabel</label> 263 </div> 264 </li> 265 idIndex++; 266 } 267 </ul> 268 </div> 269 } 270 } 271 } 272 } 273 </div> 274 </div> 275 <div class="refine-buttons"> 276 <div class="row justify-content-between"> 277 <div class="col-5 col-sm-6"> 278 <button id="btnReset" class="btn-yellow-outline" type="reset">@Translate("Reset","Reset")</button> 279 </div> 280 <div class="col-5 col-sm-6 text-right"> 281 <button id="btnApply" class="btn-yellow" type="submit">@Translate("Apply","Apply")</button> 282 </div> 283 </div> 284 </div> 285 </form> 286 </div> 287 </div> 288 289 <script type="text/javascript"> 290 291 292 $(document).ready(function() { 293 var currentUrl = window.location.href; 294 var result=currentUrl.split("/"); 295 296 checktoDisable(); 297 $('.refine-content input:checked').each(function() 298 { 299 300 if( currentUrl.includes('lvl3=true') || currentUrl.includes('ID=')) 301 { 302 303 $(this).parents('li').siblings().each(function(){ 304 $(this).find('input[type=checkbox]').addClass('selected'); 305 $(this).find('label').css("color","gray"); 306 }); 307 } 308 else if(result.length ==6) 309 { 310 $(this).parents('li').siblings().each(function(){ 311 $(this).find('input[type=checkbox]').addClass('selected'); 312 if($(this).find('input[type=checkbox]').attr("checked") !="checked") 313 { 314 $(this).find('label').css("color","gray"); 315 } 316 }); 317 } 318 319 }); 320 321 $('#btnReset').click(function() { 322 323 $('.refine-slide').find('input[type=checkbox]').each(function() { 324 $(this).prop('checked', false); 325 $(this).removeAttr('disabled'); 326 if ($(this).hasClass('selected')) { 327 $(this).removeClass('selected'); 328 } 329 }); 330 331 332 var actionUrl=currentUrl+"&lvl3=true"; 333 $('#facets').attr('action', actionUrl); 334 $("#facets").submit(); 335 336 337 }); 338 339 340 $("#btnApply").click(function(){ 341 342 if(currentUrl.includes('lvl3=true') || currentUrl.includes('ID=')){ 343 var actionUrl=currentUrl+"&lvl3=true"; 344 $('#facets').attr('action', actionUrl); 345 $("#facets").submit(); 346 } 347 else 348 { 349 $("#facets").submit(); 350 } 351 }); 352 353 $('.refine-content input[id*=facet_]').change(function() { 354 checktoDisable(); 355 }); 356 357 358 359 function checktoDisable() { 360 var queryparameters = ""; 361 362 if ($('.refine-content input:checked').length > 0) { 363 364 $('.refine-content input').each(function() { 365 $(this).attr("disabled", true); 366 }); 367 ////////////////////////////////////////////////////// 368 $('.refine-content input:checked').each(function() { 369 $(this).removeAttr("disabled"); 370 var query = $(this).attr('name'); 371 var val = $(this).val(); 372 373 if (queryparameters.includes(query)) { 374 var position = queryparameters.indexOf(query); 375 queryparameters = queryparameters.substring(0, position + query.length + 1) + val + "," + queryparameters.substring(position + query.length + 1); 376 } else { 377 queryparameters += "&" + query + "=" + val; 378 } 379 }); 380 ///////////////////////////////////////////////////////// 381 var availables = []; 382 383 console.log(queryparameters); 384 385 $.post("/Default.aspx?ID=@GetPageIdByNavigationTag("AccessoryFilterPage")" + queryparameters, function(data) { 386 var gg = []; 387 gg = data; 388 for (i = 0; i < gg.length; i++) { 389 for (j = 0; j < gg[i].values.length; j++) { 390 391 if (parseInt(gg[i].values[j].count) > 0) { 392 393 availables.push(gg[i].values[j].value); 394 } 395 } 396 } 397 398 $('.refine-content input').each(function() { 399 400 for (z = 0; z < availables.length; z++) { 401 if ((availables[z]).toLowerCase() == ($(this).val()).toLowerCase()) { 402 $(this).removeAttr("disabled"); 403 } 404 } 405 406 }); 407 }); 408 $('input[name=ID]').removeAttr('disabled'); 409 //////////////////////////////////////////////////////// 410 } else { 411 //alert("0 checked"); 412 $('.refine-content input').each(function() { 413 if( !$(this).hasClass('selected') ){ 414 $(this).removeAttr("disabled"); 415 } 416 }); 417 } 418 } 419 420 }); // $ ready function end 421 function refreshform() { 422 document.getElementById("facets").submit(); 423 } 424 425 </script> 426 } 427 else if(q.GetString("Parameter.Value")=="loose tea") 428 { 429 <!--<input name="category" value="Loose Tea" autocomplete="off" type="hidden">--> 430 431 var pageId = GetGlobalValue("Global:Pageview.Url.Raw"); 432 string pageName = GetGlobalValue("Global:Page.Name").ToString(); 433 // string looseTeaPage=GetPageIdByNavigationTag("LooseTeaPage").ToString(); 434 435 436 437 438 <div class="product-refine"> 439 <div class="refine-link"> 440 <div class="row"> 441 <div class="col-12 text-center"> 442 <a id="refineSlideButton" href="javascript:void(0)">@Translate("Refine Results", "Refine Results") <span></span></a> 443 </div> 444 </div> 445 </div> 446 <div class="refine-slide"> 447 <form method="get" action="/Default.aspx?ID=@pageId" id="facets"> 448 <div class="refine-content"> 449 <div class="row"> 450 451 @{ 452 var id = Dynamicweb.Context.Current.Request.QueryString["ID"]; 453 var groupid = Dynamicweb.Context.Current.Request.QueryString["GroupID"]; 454 var search = Dynamicweb.Context.Current.Request.QueryString["Search"]; 455 } 456 @{ 457 var properties = Dynamicweb.Frontend.PageView.Current().CurrentParagraph.ModuleProperties; 458 var queryConditions = properties["QueryConditions"]; 459 queryConditions = queryConditions.Replace("&quot;", "'"); 460 string queryParameter=""; 461 var jarray = JsonConvert.DeserializeObject<List<object>>(queryConditions); 462 foreach(var ja in jarray) 463 { 464 if(ja.ToString().IndexOf("classification") > 0) 465 { 466 queryParameter=ja.ToString(); 467 } 468 469 } 470 queryParameter=queryParameter.Replace("\"","").Replace("System.String[]","").Replace("Name: classification","").Replace(",","").Replace("{","").Replace("}","").Replace("Type:","").Replace("DefaultValue:","").Trim(); 471 } 472 <input type="hidden" name="ID" value="@id" > 473 474 @{ 475 var idIndex = 1; 476 foreach (LoopItem facetGroup in GetLoop("FacetGroups")) 477 { 478 foreach (LoopItem facetItem in facetGroup.GetLoop("Facets")) 479 { 480 int OptionWithResultCount = facetItem.GetInteger("Facet.OptionWithResultCount"); 481 var FacetName = facetItem.GetString("Facet.Name"); 482 int FacetOptionWithResultCount = facetItem.GetInteger("Facet.OptionWithResultCount"); 483 var FacetOptionCount = facetItem.GetInteger("Facet.OptionCount"); 484 var FacetOptionResultTotalCount = facetItem.GetInteger("Facet.OptionResultTotalCount"); 485 var FacetQueryParameter = facetItem.GetString("Facet.QueryParameter"); 486 487 if (OptionWithResultCount > 0 ) 488 { 489 <div class="col-12 col-sm-12 col-lg-3 col-md-6 variants"> 490 <h4>@Translate(FacetName,FacetName)</h4> 491 <ul class="list-unstyled"> 492 @foreach (LoopItem FacetOption in facetItem.GetLoop("FacetOptions")) 493 { 494 var FacetOptionValue = FacetOption.GetString("FacetOption.Value"); 495 var FacetOptionName = FacetOption.GetString("FacetOption.Name"); 496 var FacetOptionLabel = FacetOption.GetString("FacetOption.Label"); 497 var variantColorcode = FacetOption.GetString("Ecom:VariantOption.ColorCode"); 498 bool FacetOptionSelected = FacetOption.GetBoolean("FacetOption.Selected"); 499 int OptionCount = FacetOption.GetInteger("FacetOption.Count"); 500 var selected = ""; 501 var chk = ""; 502 string notActive = ""; 503 504 if (FacetOptionSelected) 505 { 506 selected = " selected=\"selected\""; 507 chk = " checked=\"checked\""; 508 } 509 if(FacetName.ToLower() == "country of origin" && FacetOptionSelected) 510 { 511 notActive = "not_active"; 512 } 513 else if (FacetName.ToLower() == "varieties of tea" && FacetOptionSelected) 514 { 515 notActive = "not_active"; 516 } 517 else if (FacetName.ToLower() == "predominant flavours" && FacetOptionSelected) 518 { 519 notActive = "not_active"; 520 } 521 <li> 522 <div class="custom-checkbox @notActive"> 523 <input id="facet_@idIndex" name="@FacetQueryParameter" type="checkbox" value="@FacetOptionValue" @chk /> 524 <label for="facet_@idIndex">@FacetOptionLabel</label> 525 </div> 526 </li> 527 idIndex++; 528 } 529 </ul> 530 </div> 531 } 532 } 533 } 534 } 535 </div> 536 </div> 537 <div class="refine-buttons"> 538 <div class="row justify-content-between"> 539 <div class="col-5 col-sm-6"> 540 <button id="btnReset" class="btn-yellow-outline" type="reset">@Translate("Reset","Reset")</button> 541 </div> 542 <div class="col-5 col-sm-6 text-right"> 543 <button id="btnApply" class="btn-yellow" type="button">@Translate("Apply","Apply")</button> 544 </div> 545 </div> 546 </div> 547 </form> 548 </div> 549 </div> 550 551 <script type="text/javascript"> 552 553 554 $(document).ready(function() { 555 var currentUrl = window.location.href; 556 var result=currentUrl.split("/"); 557 checktoDisable(); 558 559 $('.refine-content input:checked').each(function() 560 { 561 if( currentUrl.includes('lvl3=true') || currentUrl.includes('ID=')) 562 { 563 564 $(this).parents('li').siblings().each(function(){ 565 566 $(this).find('input[type=checkbox]').addClass('selected'); 567 $(this).find('label').css("color","gray"); 568 569 }); 570 } 571 else if(result.length ==6) 572 { 573 $(this).parents('li').siblings().each(function(){ 574 $(this).find('input[type=checkbox]').addClass('selected'); 575 if($(this).find('input[type=checkbox]').attr("checked") !="checked") 576 { 577 $(this).find('label').css("color","gray"); 578 } 579 580 581 }); 582 } 583 584 585 }); 586 587 588 $('#btnReset').click(function() { 589 590 $('.refine-slide').find('input[type=checkbox]').each(function() { 591 $(this).prop('checked', false); 592 $(this).removeAttr('disabled'); 593 if ($(this).hasClass('selected')) { 594 $(this).removeClass('selected'); 595 } 596 }); 597 598 599 var actionUrl=currentUrl+"&lvl3=true"; 600 $('#facets').attr('action', actionUrl); 601 $("#facets").submit(); 602 603 604 }); 605 606 607 $("#btnApply").click(function(){ 608 609 if(currentUrl.includes('lvl3=true') || currentUrl.includes('ID=')){ 610 var actionUrl=currentUrl+"&lvl3=true"; 611 $('#facets').attr('action', actionUrl); 612 $("#facets").submit(); 613 } 614 else 615 { 616 $("#facets").submit(); 617 } 618 }); 619 620 $('.refine-content input[id*=facet_]').change(function() { 621 checktoDisable(); 622 }); 623 624 625 626 function checktoDisable() { 627 var queryparameters = ""; 628 629 if ($('.refine-content input:checked').length > 0) { 630 631 $('.refine-content input').each(function() { 632 $(this).attr("disabled", true); 633 }); 634 ////////////////////////////////////////////////////// 635 $('.refine-content input:checked').each(function() { 636 $(this).removeAttr("disabled"); 637 var query = $(this).attr('name'); 638 var val = $(this).val(); 639 if (queryparameters.includes(query)) { 640 var position = queryparameters.indexOf(query); 641 queryparameters = queryparameters.substring(0, position + query.length + 1) + val + "," + queryparameters.substring(position + query.length + 1); 642 } else { 643 queryparameters += "&" + query + "=" + val; 644 } 645 }); 646 ///////////////////////////////////////////////////////// 647 console.log(queryparameters); 648 var availables = []; 649 650 $.post("/Default.aspx?ID=@GetPageIdByNavigationTag("FilterPage")" + queryparameters , function(data) { 651 console.log("data :"+data); 652 var gg = []; 653 gg = data; 654 for (i = 0; i < gg.length; i++) { 655 for (j = 0; j < gg[i].values.length; j++) { 656 657 if (parseInt(gg[i].values[j].count) > 0) { 658 659 availables.push(gg[i].values[j].value); 660 } 661 } 662 } 663 664 $('.refine-content input').each(function() { 665 666 for (z = 0; z < availables.length; z++) { 667 if ((availables[z]).toLowerCase() == ($(this).val()).toLowerCase()) { 668 $(this).removeAttr("disabled"); 669 } 670 } 671 672 }); 673 }); 674 $('input[name=ID]').removeAttr('disabled'); 675 //////////////////////////////////////////////////////// 676 } else { 677 678 $('.refine-content input').each(function() { 679 if( !$(this).hasClass('selected') ){ 680 $(this).removeAttr("disabled"); 681 } 682 }); 683 } 684 } 685 686 }); // $ ready function end 687 function refreshform() { 688 document.getElementById("facets").submit(); 689 } 690 691 </script> 692 } 693 else 694 { 695 <!--<input name="category" value="Loose Tea" autocomplete="off" type="hidden">--> 696 697 var pageId = GetGlobalValue("Global:Pageview.Url.Raw"); 698 string pageName = GetGlobalValue("Global:Page.Name").ToString(); 699 // string looseTeaPage=GetPageIdByNavigationTag("LooseTeaPage").ToString(); 700 701 702 703 704 <div class="product-refine"> 705 <div class="refine-link"> 706 <div class="row"> 707 <div class="col-12 text-center"> 708 <a id="refineSlideButton" href="javascript:void(0)">@Translate("Refine Results", "Refine Results") <span></span></a> 709 </div> 710 </div> 711 </div> 712 <div class="refine-slide"> 713 <form method="get" action="/Default.aspx?ID=@pageId" id="facets"> 714 <div class="refine-content"> 715 <div class="row"> 716 717 @{ 718 var id = Dynamicweb.Context.Current.Request.QueryString["ID"]; 719 var groupid = Dynamicweb.Context.Current.Request.QueryString["GroupID"]; 720 var search = Dynamicweb.Context.Current.Request.QueryString["Search"]; 721 } 722 @{ 723 var properties = Dynamicweb.Frontend.PageView.Current().CurrentParagraph.ModuleProperties; 724 var queryConditions = properties["QueryConditions"]; 725 queryConditions = queryConditions.Replace("&quot;", "'"); 726 string queryParameter=""; 727 var jarray = JsonConvert.DeserializeObject<List<object>>(queryConditions); 728 foreach(var ja in jarray) 729 { 730 if(ja.ToString().IndexOf("classification") > 0) 731 { 732 queryParameter=ja.ToString(); 733 } 734 735 } 736 queryParameter=queryParameter.Replace("\"","").Replace("System.String[]","").Replace("Name: classification","").Replace(",","").Replace("{","").Replace("}","").Replace("Type:","").Replace("DefaultValue:","").Trim(); 737 } 738 <input type="hidden" name="ID" value="@id" > 739 740 @{ 741 var idIndex = 1; 742 foreach (LoopItem facetGroup in GetLoop("FacetGroups")) 743 { 744 foreach (LoopItem facetItem in facetGroup.GetLoop("Facets")) 745 { 746 int OptionWithResultCount = facetItem.GetInteger("Facet.OptionWithResultCount"); 747 var FacetName = facetItem.GetString("Facet.Name"); 748 int FacetOptionWithResultCount = facetItem.GetInteger("Facet.OptionWithResultCount"); 749 var FacetOptionCount = facetItem.GetInteger("Facet.OptionCount"); 750 var FacetOptionResultTotalCount = facetItem.GetInteger("Facet.OptionResultTotalCount"); 751 var FacetQueryParameter = facetItem.GetString("Facet.QueryParameter"); 752 753 if (OptionWithResultCount > 0 ) 754 { 755 <div class="col-12 col-sm-12 col-lg-3 col-md-6 variants"> 756 <h4>@Translate(FacetName,FacetName)</h4> 757 <ul class="list-unstyled"> 758 @foreach (LoopItem FacetOption in facetItem.GetLoop("FacetOptions")) 759 { 760 var FacetOptionValue = FacetOption.GetString("FacetOption.Value"); 761 var FacetOptionName = FacetOption.GetString("FacetOption.Name"); 762 var FacetOptionLabel = FacetOption.GetString("FacetOption.Label"); 763 var variantColorcode = FacetOption.GetString("Ecom:VariantOption.ColorCode"); 764 bool FacetOptionSelected = FacetOption.GetBoolean("FacetOption.Selected"); 765 int OptionCount = FacetOption.GetInteger("FacetOption.Count"); 766 var selected = ""; 767 var chk = ""; 768 string notActive = ""; 769 770 if (FacetOptionSelected) 771 { 772 selected = " selected=\"selected\""; 773 chk = " checked=\"checked\""; 774 } 775 if(FacetName.ToLower() == "country of origin" && FacetOptionSelected) 776 { 777 notActive = "not_active"; 778 } 779 else if (FacetName.ToLower() == "varieties of tea" && FacetOptionSelected) 780 { 781 notActive = "not_active"; 782 } 783 else if (FacetName.ToLower() == "predominant flavours" && FacetOptionSelected) 784 { 785 notActive = "not_active"; 786 } 787 <li> 788 <div class="custom-checkbox @notActive"> 789 <input id="facet_@idIndex" name="@FacetQueryParameter" type="checkbox" value="@FacetOptionValue" @chk /> 790 <label for="facet_@idIndex">@FacetOptionLabel</label> 791 </div> 792 </li> 793 idIndex++; 794 } 795 </ul> 796 </div> 797 } 798 } 799 } 800 } 801 </div> 802 </div> 803 <div class="refine-buttons"> 804 <div class="row justify-content-between"> 805 <div class="col-5 col-sm-6"> 806 <button id="btnReset" class="btn-yellow-outline" type="reset">@Translate("Reset","Reset")</button> 807 </div> 808 <div class="col-5 col-sm-6 text-right"> 809 <button id="btnApply" class="btn-yellow" type="button">@Translate("Apply","Apply")</button> 810 </div> 811 </div> 812 </div> 813 </form> 814 </div> 815 </div> 816 817 <script type="text/javascript"> 818 819 820 $(document).ready(function() { 821 var currentUrl = window.location.href; 822 var result=currentUrl.split("/"); 823 checktoDisable(); 824 825 $('.refine-content input:checked').each(function() 826 { 827 if( currentUrl.includes('lvl3=true') || currentUrl.includes('ID=')) 828 { 829 830 $(this).parents('li').siblings().each(function(){ 831 832 $(this).find('input[type=checkbox]').addClass('selected'); 833 $(this).find('label').css("color","gray"); 834 835 }); 836 } 837 else if(result.length ==6) 838 { 839 $(this).parents('li').siblings().each(function(){ 840 $(this).find('input[type=checkbox]').addClass('selected'); 841 if($(this).find('input[type=checkbox]').attr("checked") !="checked") 842 { 843 $(this).find('label').css("color","gray"); 844 } 845 846 847 }); 848 } 849 850 851 }); 852 853 854 $('#btnReset').click(function() { 855 856 $('.refine-slide').find('input[type=checkbox]').each(function() { 857 $(this).prop('checked', false); 858 $(this).removeAttr('disabled'); 859 if ($(this).hasClass('selected')) { 860 $(this).removeClass('selected'); 861 } 862 }); 863 864 865 var actionUrl=currentUrl+"&lvl3=true"; 866 $('#facets').attr('action', actionUrl); 867 $("#facets").submit(); 868 869 870 }); 871 872 873 $("#btnApply").click(function(){ 874 875 if(currentUrl.includes('lvl3=true') || currentUrl.includes('ID=')){ 876 var actionUrl=currentUrl+"&lvl3=true"; 877 $('#facets').attr('action', actionUrl); 878 $("#facets").submit(); 879 } 880 else 881 { 882 $("#facets").submit(); 883 } 884 }); 885 886 $('.refine-content input[id*=facet_]').change(function() { 887 checktoDisable(); 888 }); 889 890 891 892 function checktoDisable() { 893 var queryparameters = ""; 894 895 if ($('.refine-content input:checked').length > 0) { 896 897 $('.refine-content input').each(function() { 898 $(this).attr("disabled", true); 899 }); 900 ////////////////////////////////////////////////////// 901 $('.refine-content input:checked').each(function() { 902 $(this).removeAttr("disabled"); 903 var query = $(this).attr('name'); 904 var val = $(this).val(); 905 if (queryparameters.includes(query)) { 906 var position = queryparameters.indexOf(query); 907 queryparameters = queryparameters.substring(0, position + query.length + 1) + val + "," + queryparameters.substring(position + query.length + 1); 908 } else { 909 queryparameters += "&" + query + "=" + val; 910 } 911 }); 912 ///////////////////////////////////////////////////////// 913 console.log(queryparameters); 914 var availables = []; 915 916 $.post("/Default.aspx?ID=@GetPageIdByNavigationTag("FilterPage")" + queryparameters , function(data) { 917 console.log("data :"+data); 918 var gg = []; 919 gg = data; 920 for (i = 0; i < gg.length; i++) { 921 for (j = 0; j < gg[i].values.length; j++) { 922 923 if (parseInt(gg[i].values[j].count) > 0) { 924 925 availables.push(gg[i].values[j].value); 926 } 927 } 928 } 929 930 $('.refine-content input').each(function() { 931 932 for (z = 0; z < availables.length; z++) { 933 if ((availables[z]).toLowerCase() == ($(this).val()).toLowerCase()) { 934 $(this).removeAttr("disabled"); 935 } 936 } 937 938 }); 939 }); 940 $('input[name=ID]').removeAttr('disabled'); 941 //////////////////////////////////////////////////////// 942 } else { 943 944 $('.refine-content input').each(function() { 945 if( !$(this).hasClass('selected') ){ 946 $(this).removeAttr("disabled"); 947 } 948 }); 949 } 950 } 951 952 }); // $ ready function end 953 function refreshform() { 954 document.getElementById("facets").submit(); 955 } 956 957 </script> 958 } 959 960 } 961 } 962 } 963 964 <div id="productlist" class="product-content"> 965 966 @{ 967 var loopCounter = 0; 968 var prodCounter = 0; 969 string linkTo = ""; 970 int pagesize = 12; 971 972 foreach (LoopItem Product in GetLoop("Products")) 973 { 974 975 var isMixMatch = Product.GetBoolean("productIsMixMatch"); 976 977 string productName = Product.GetString("Ecom:Product.Name"); 978 //if(productName.Length>25){productName=productName.Substring(0,19)+"...";} 979 string Image = Product.GetString("Ecom:Product.ImageSmall.Default.Clean"); 980 var productDetailURL=productName.Replace(' ','-').Trim('(').Trim(')'); 981 982 var regexItem = new Regex(@"[^0-9a-zA-Z]+"); 983 if (regexItem.IsMatch(Product.GetString("Ecom:Product.Number"))) 984 { 985 string myImageSmall = Product.GetString("Ecom:Product.ImageSmall").Replace(Product.GetString("Ecom:Product.Number"), Regex.Replace(Product.GetString("Ecom:Product.Number"), @"[^0-9a-zA-Z]+", "")); 986 myImageSmall = myImageSmall.Replace("height=\"0\"", "height=\"100%\""); 987 myImageSmall = Regex.Match(myImageSmall, "<img.+?src=[\"'](.+?)[\"'].+?>", RegexOptions.IgnoreCase).Groups[1].Value; 988 Image = myImageSmall; 989 } 990 991 ////////////////////////////// 992 993 string catName = ""; 994 995 foreach (LoopItem cat in Product.GetLoop("ProductCategories")) 996 { 997 catName = cat.GetString("Ecom:Product.Category.Name"); 998 } 999 linkTo = "default.aspx?id=" + GetString("Ecom:ProductList:Page.ID") + "&productid=" + Product.GetString("Ecom:Product.ID") + "&cartcmd=add&quantity=1"; 1000 1001 if (loopCounter == 0) 1002 { 1003 @: <div class="row"> 1004 } 1005 1006 loopCounter++; 1007 prodCounter++; 1008 1009 <div class='col-12 col-sm-6 col-lg-3 col-md-6 product-box' style="padding-left: 10px;padding-right: 10px;"> 1010 <div class="product-img"> 1011 <div class="product-img-overlay"> 1012 <ul class="list-unstyled"> 1013 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1014 { 1015 <li> 1016 1017 @if (isMixMatch != true) 1018 { 1019 <a onclick='addtofav(this,"/Default.aspx?ID=@GetPageIdByNavigationTag("MyFavPage")&productid=@Product.GetString("Ecom:Product.ID")&CCAddToMyLists=@Product.GetValue("Ecom:Product.ID")&CCAddToListVariantID=&CCAddToListLanguageID=LANG2")' href="javascript:void(0)" data-product-code='@Product.GetValue("Ecom:Product.ID")'> 1020 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/favourites-off.svg" alt="add as favourite" /> 1021 <span id='fvtext-@Product.GetString("Ecom:Product.ID")'>@Translate("Add as","Add as")<br /> @Translate("Favourite","Favourite")</span> 1022 1023 <script type="text/javascript"> 1024 var fvtext = 'fvtext-'+'@Product.GetString("Ecom:Product.ID")'; 1025 if(itemsInWant.indexOf('@Product.GetString("Ecom:Product.ID")') != -1){ 1026 $('#' + fvtext).html('@Translate("ADDED!","ADDED!")');$('#' + fvtext).closest('li').addClass('not_active'); 1027 1028 } 1029 </script> 1030 </a> 1031 } 1032 else 1033 { 1034 <a href="javascript:void(0)">&nbsp;</a> 1035 } 1036 1037 </li> 1038 <li> 1039 @if(Product.GetString("Ecom:Product:Field.SEOURL") != ""){ 1040 <a href="@Product.GetString("Ecom:Product:Field.SEOURL")"> 1041 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/info.svg" alt="" /> 1042 <span>@Translate("View","View")<br /> @Translate("PD_Details","Details")</span> 1043 </a> 1044 } 1045 else{ 1046 <a href="@Product.GetString("Ecom:Product.Link.Clean")"> 1047 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/info.svg" alt="" /> 1048 <span>@Translate("View","View")<br /> @Translate("PD_Details","Details")</span> 1049 </a> 1050 } 1051 </li> 1052 1053 <li> 1054 @if (Product.GetDouble("Ecom:Product.Stock") > 0) 1055 { 1056 if (Product.GetString("Ecom:Product:Field.item_classification.Value") == "loose tea") 1057 { 1058 <form name="multiForm" id='productID_@Product.GetValue("Ecom:Product.ID")' method="post" style="display:none"> 1059 <input type="hidden" name="CartCmd" value="addMulti" /> 1060 <input type="hidden" name="ProductID1" value='@Product.GetValue("Ecom:Product.ID")' /> 1061 <input type="hidden" name="ProductLoopCounter1" value="1" /> 1062 <input type="hidden" name="EcomOrderLineFieldInput_LooseTeaParentNo1" value="quick" /> 1063 <input type="hidden" name="Quantity1" class="Quantity1" value="1" /> 1064 <input type="hidden" name="VariantID1" class="VariantID1" value='@Product.GetString("Ecom:Product.DefaultVariantComboID")' /> 1065 <input type="hidden" name="ProductID2" value='PROD380' /> 1066 <input type="hidden" name="ProductLoopCounter2" value="2" /> 1067 <input type="hidden" name="Quantity2" class="Quantity2" value="1" /> 1068 <input type="hidden" class="orderlinefield" name="EcomOrderLineFieldInput_ParentProductId2" value='@Product.GetValue("Ecom:Product.ID")@Product.GetString("Ecom:Product.DefaultVariantComboID")_quick' /> 1069 </form> 1070 <a href="javascript:void(0)" onclick='amountCheck("@Product.GetValue("Ecom:Product.ID")","@Product.GetString("Ecom:Product.DefaultVariantComboName")");return false;'> 1071 <img class="img-fluid" src="Files/Templates/Designs/TWG/images/icons/add-to-cart.svg" alt="add to cart" /> 1072 <span>@Translate("Add to","Add to")<br /> @Translate("Bag","Bag")</span> 1073 </a> 1074 } 1075 else 1076 { 1077 //not loose tea 1078 <a class="" @if(catName != "Set"){ <text> href='javascript:void(0)' onclick='return ajaxsubmitcart2("@linkTo");' </text>} @if(catName == "Set") { <text> href='@Product.GetValue("Ecom:Product.Link.Clean")' </text> }> 1079 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/add-to-cart.svg" alt="add to cart" /> 1080 <span>@Translate("Add to","Add to")<br /> @Translate("Bag","Bag") </span> 1081 </a> 1082 } 1083 } 1084 </li> 1085 }else 1086 { 1087 <li> 1088 @if (isMixMatch == false) 1089 { 1090 <a href="javascript:void(0)" onclick="linktologinfav('@Product.GetString("Ecom:Product.ID")');"> 1091 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/favourites-off.svg" alt="add as favourite" /> 1092 <span>@Translate("Add as","Add as")<br /> @Translate("Favourite","Favourite")</span> 1093 </a> 1094 <script> 1095 function linktologinfav(pid){ 1096 1097 //document.cookie = "comefromfavourite=true;expires=Sat, 31 Dec 2050 12:00:00 UTC; path=/;"; 1098 // document.cookie = "refreshcounterforfav=1;expires=Sat, 31 Dec 2050 12:00:00 UTC; path=/;"; 1099 //document.cookie = "favouriteproductcookie="+pid+";expires=Sat, 31 Dec 2050 12:00:00 UTC; path=/;"; 1100 window.location.href="/Default.aspx?ID=@GetPageIdByNavigationTag("LoginPage")"; 1101 } 1102 </script> 1103 } 1104 else 1105 { 1106 <a href="javascript:void(0)"></a> 1107 } 1108 </li> 1109 1110 <li> 1111 1112 @if(Product.GetString("Ecom:Product:Field.SEOURL") != ""){ 1113 <a href="@Product.GetString("Ecom:Product:Field.SEOURL")"> 1114 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/info.svg" alt="" /> 1115 <span>@Translate("View","View")<br /> @Translate("PD_Details","Details")</span> 1116 </a> 1117 } 1118 else{ 1119 <a href="@Product.GetString("Ecom:Product.Link.Clean")"> 1120 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/info.svg" alt="" /> 1121 <span>@Translate("View","View")<br /> @Translate("PD_Details","Details")</span> 1122 </a> 1123 } 1124 1125 </li> 1126 1127 <li> 1128 @if (Product.GetDouble("Ecom:Product.Stock") > 0) 1129 { 1130 if (Product.GetString("Ecom:Product:Field.item_classification.Value") == "loose tea") 1131 { 1132 <form name="multiForm" id='productID_@Product.GetValue("Ecom:Product.ID")' method="post" style="display:none"> 1133 <input type="hidden" name="CartCmd" value="addMulti" /> 1134 <input type="hidden" name="ProductID1" value='@Product.GetValue("Ecom:Product.ID")' /> 1135 <input type="hidden" name="ProductLoopCounter1" value="1" /> 1136 <input type="hidden" name="EcomOrderLineFieldInput_LooseTeaParentNo1" value="quick" /> 1137 <input type="hidden" name="Quantity1" class="Quantity1" value="1" /> 1138 <input type="hidden" name="VariantID1" class="VariantID1" value='@Product.GetString("Ecom:Product.DefaultVariantComboID")' /> 1139 <input type="hidden" name="ProductID2" value='PROD380' /> 1140 <input type="hidden" name="ProductLoopCounter2" value="2" /> 1141 <input type="hidden" name="Quantity2" class="Quantity2" value="1" /> 1142 <input type="hidden" class="orderlinefield" name="EcomOrderLineFieldInput_ParentProductId2" value='@Product.GetValue("Ecom:Product.ID")@Product.GetString("Ecom:Product.DefaultVariantComboID")_quick' /> 1143 </form> 1144 <a href="javascript:void(0)" onclick='amountCheck("@Product.GetValue("Ecom:Product.ID")","@Product.GetString("Ecom:Product.DefaultVariantComboName")");return false;'> 1145 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/add-to-cart.svg" alt="add to cart" /> 1146 <span>@Translate("Add to","Add to")<br /> @Translate("Bag","Bag")</span> 1147 </a> 1148 } 1149 else 1150 { 1151 <a class="test" @if(catName != "Set"){ <text> href='javascript:void(0)' onclick='return ajaxsubmitcart2("@linkTo");' </text>} @if(catName == "Set") { <text> href='@Product.GetValue("Ecom:Product.Link.Clean")' </text> }> 1152 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/add-to-cart.svg" alt="add to cart" /> 1153 <span>@Translate("Add to","Add to")<br /> @Translate("Bag","Bag") </span> 1154 </a> 1155 } 1156 1157 } 1158 </li> 1159 } 1160 </ul> 1161 </div> 1162 <img src='@Image' class="img-fluid w-100" onError="this.onerror = null; this.src = '/Files/Images/TWG Design/GetImage.png';" alt="@productName" /> 1163 </div> 1164 @if(Product.GetString("Ecom:Product:Field.SEOURL") != ""){ 1165 <a href='@Product.GetString("Ecom:Product:Field.SEOURL")'> <h3>@productName</h3></a> 1166 } 1167 else{ 1168 1169 <a href='@Product.GetValue("Ecom:Product.Link.Clean")'> <h3>@productName</h3></a> 1170 } 1171 1172 @if(Product.GetString("Ecom:Product.Price") != Product.GetString("Ecom:Product.Currency.Symbol")+"0.00"){ 1173 <p>@Product.GetString("Ecom:Product.Price")</p> 1174 } 1175 1176 1177 1178 </div> 1179 if (loopCounter == 4 && prodCounter != pagesize) 1180 { 1181 @: </div><div class=""> 1182 loopCounter = 0; 1183 } 1184 if (prodCounter == pagesize) 1185 { 1186 @: </div> 1187 } 1188 } 1189 } 1190 </div> 1191 </div> 1192 <div class="text-center productsAppendHere"> 1193 <button class="btn-link preloader"><img class="fa-spin" src="/Files/Images/TWG-Tea/ring.png" alt="ring"></button> 1194 </div> 1195 <div id="emdOfworld" style="background:rgb(31, 22, 19); height:10px;color:white"></div> 1196 </div> 1197 1198 1199 1200 <script> 1201 ///////////////////////////////cookie functions//////////////////////////////////// 1202 function setCookie(cname, cvalue, exdays) { 1203 var d = new Date(); 1204 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 1205 var expires = "expires="+ d.toUTCString(); 1206 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 1207 } 1208 function getCookie(cname) { 1209 var name = cname + "="; 1210 var ca = document.cookie.split(';'); 1211 for(var i = 0; i <ca.length; i++) { 1212 var c = ca[i]; 1213 while (c.charAt(0)==' ') { 1214 c = c.substring(1); 1215 } 1216 if (c.indexOf(name) == 0) { 1217 return c.substring(name.length,c.length); 1218 } 1219 } 1220 return ""; 1221 } 1222 ///////////////get query function////////////////////////// 1223 var totalpage=@GetInteger("Ecom:ProductList.TotalPages"); 1224 var currentPage=1; 1225 var nextPage=2; 1226 $(".preloader").hide(); 1227 1228 function loadmore(loadmore){ 1229 ////console.log("Current: " + currentPage + " | Next: " + nextPage + " | Total: " + totalpage); 1230 if((currentPage<totalpage) && (nextPage==currentPage+1)){ 1231 1232 $(".preloader").show(); 1233 var n = loadmore.indexOf("PageNum"); 1234 var firstUrl = loadmore.substring(0,n); 1235 var secondUrl = loadmore.substring(n); 1236 var j = secondUrl.indexOf("&"); 1237 secondUrl = j==-1 ? "" : secondUrl.substring(j); 1238 var loadmorelink = firstUrl + "PageNum=" + nextPage + secondUrl; 1239 //console.log("Current: " + currentPage + " | Next: " + nextPage + " | Total: " + totalpage + " | Load: " + loadmorelink); 1240 var formerclass = $( ".listitem" ).attr( "class" ); 1241 $.ajax({ 1242 url: loadmorelink, 1243 dataType: 'html', 1244 success: function(data){ 1245 1246 var result = $($.parseHTML(data)).find("#divProducts"); 1247 result.children().insertBefore($('#productlist .text-center')); 1248 $(".listitem").attr('class', formerclass); 1249 //console.log("Products loaded for page: " + loadmorelink); 1250 currentPage++; 1251 $(".preloader").hide(); 1252 } 1253 }); 1254 nextPage++; 1255 } 1256 } 1257 1258 function getQueryStringValue (key) { 1259 return unescape(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + escape(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1")); 1260 } 1261 1262 function updateQueryString(uri, key, value) { 1263 var re = new RegExp("([?|&])" + key + "=.*?(&|#|$)", "i"); 1264 if (uri.match(re)) { 1265 return uri.replace(re, '$1' + key + "=" + value + '$2'); 1266 } else { 1267 var hash = ''; 1268 1269 if( uri.indexOf('#') !== -1 ){ 1270 hash = uri.replace(/.*#/, '#'); 1271 uri = uri.replace(/#.*/, ''); 1272 } 1273 var separator = uri.indexOf('?') !== -1 ? "&" : "?"; 1274 return uri + separator + key + "=" + value + hash; 1275 } 1276 } 1277 1278 function setPagesize(value){ 1279 ////console.log("hi there setPagesize work"); 1280 var str=window.location.toString(); 1281 str=updateQueryString(str,"pagesize",value); 1282 window.location=updateQueryString(str,"PageNum",1); 1283 1284 } 1285 1286 if(getQueryStringValue ("SortBy")){$('#sortingdropdown').val(getQueryStringValue ("SortBy")+"&SortOrder="+getQueryStringValue ("SortOrder"));} 1287 1288 function SortProductsBy(sortcode) { 1289 1290 var Page=document.location.href; 1291 if(getQueryStringValue("SortBy")) 1292 { 1293 if(Page.indexOf("&SortBy")>0 || Page.indexOf("?SortBy")>0) 1294 { if(Page.indexOf("&SortBy")>0){Page=Page.substring(0,Page.indexOf("&SortBy"));} 1295 else if(Page.indexOf("?SortBy")>0){Page=Page.substring(0,Page.indexOf("SortBy"));} 1296 } 1297 } 1298 1299 else if(Page.indexOf("?")<0){ 1300 Page+="?"; 1301 } 1302 1303 var uri= ((Page + "&SortBy=" + sortcode).replace("?&","?")).replace("&&","&"); 1304 document.location.href =uri; 1305 } 1306 1307 if(getQueryStringValue("SortBy")){ 1308 $('#selectedSort').html(getCookie("SortBycookie")); 1309 } 1310 1311 $('#sortingdropdown > a').click(function(){ 1312 var SortBycooki=$(this).html(); 1313 setCookie("SortBycookie", SortBycooki, 1); 1314 var sortcode= $(this).attr('value'); 1315 var Page=document.location.href; 1316 if(getQueryStringValue("SortBy")) 1317 { 1318 if(Page.indexOf("&SortBy")>0 || Page.indexOf("?SortBy")>0) 1319 { if(Page.indexOf("&SortBy")>0){Page=Page.substring(0,Page.indexOf("&SortBy"));} 1320 else if(Page.indexOf("?SortBy")>0){Page=Page.substring(0,Page.indexOf("SortBy"));} 1321 } 1322 } 1323 else if(Page.indexOf("?")<0){ 1324 Page+="?"; 1325 } 1326 1327 var uri= ((Page + "&SortBy=" + sortcode).replace("?&","?")).replace("&&","&"); 1328 document.location.href =uri; 1329 }); 1330 1331 var pagecount = 1; 1332 var linkUrl = '@GetString("Ecom:ProductList.NextPage.Clean")'; 1333 //console.log(linkUrl); 1334 $(document).ready(function(){ 1335 1336 var win = $(window); 1337 win.scroll(function() { 1338 if($('#emdOfworld').offset().top < window.pageYOffset + win.height()){ 1339 loadmore(linkUrl); 1340 } 1341 }); 1342 1343 1344 1345 ///////////////////////////////////////////////// 1346 @foreach(LoopItem l in GetLoop("Query.Parameters")){ 1347 if(!string.IsNullOrWhiteSpace(@l.GetString("Parameter.Value"))){ 1348 1349 <text> 1350 try { 1351 1352 $('#@l.GetString("Parameter.Name") .checkbox').addClass('not_active'); 1353 $('#@l.GetString("Parameter.Name") .checkbox').addClass('grey-out'); 1354 ////console.log('@l.GetString("Parameter.Name")'); 1355 $('#@l.GetString("Parameter.Value").Replace(" ","")').closest("div").removeClass('grey-out'); 1356 if(!$('#@l.GetString("Parameter.Value").Replace(" ","")').is(':checked')) 1357 {$('#@l.GetString("Parameter.Value").Replace(" ","")').closest("div").find('.custom-label').trigger( "click" );} 1358 1359 } 1360 catch(err) { 1361 document.getElementById("demo").innerHTML = err.message; 1362 } 1363 </text> 1364 } 1365 } 1366 /////////////////////////////////////////////////// 1367 }); 1368 </script> 1369 } 1370 1371 @helper RenderByPage() 1372 { 1373 <div id="divProducts"> 1374 @{ 1375 var loopCounter = 0; 1376 var prodCounter = 0; 1377 string linkTo = ""; 1378 int pagesize = 12; 1379 } 1380 @foreach (LoopItem Product in GetLoop("Products")) 1381 { 1382 var productIsMixMatch = Product.GetBoolean("productIsMixMatch"); 1383 1384 string Image = Product.GetString("Ecom:Product.ImageSmall.Default.Clean"); 1385 1386 string productName = Product.GetString("Ecom:Product.Name"); 1387 //if(productName.Length>25){productName=productName.Substring(0,19)+"...";} 1388 1389 var regexItem = new Regex(@"[^0-9a-zA-Z]+"); 1390 if (regexItem.IsMatch(Product.GetString("Ecom:Product.Number"))) 1391 { 1392 string myImageSmall = Product.GetString("Ecom:Product.ImageSmall").Replace(Product.GetString("Ecom:Product.Number"), Regex.Replace(Product.GetString("Ecom:Product.Number"), @"[^0-9a-zA-Z]+", "")); 1393 myImageSmall = myImageSmall.Replace("height=\"0\"", "height=\"100%\""); 1394 myImageSmall = Regex.Match(myImageSmall, "<img.+?src=[\"'](.+?)[\"'].+?>", RegexOptions.IgnoreCase).Groups[1].Value; 1395 Image = myImageSmall; 1396 } 1397 1398 linkTo = "default.aspx?id=" + GetString("Ecom:ProductList:Page.ID") + "&productid=" + Product.GetString("Ecom:Product.ID") + "&cartcmd=add&quantity=1"; 1399 if (loopCounter == 0) 1400 { 1401 @: <div class="row"> 1402 } 1403 string catName = ""; 1404 1405 foreach (LoopItem cat in Product.GetLoop("ProductCategories")) 1406 { 1407 catName = cat.GetString("Ecom:Product.Category.Name"); 1408 } 1409 1410 loopCounter++; 1411 prodCounter++; 1412 1413 <div class='col-12 col-sm-6 col-lg-3 col-md-6 product-box' style="padding-right: 10px;padding-left: 10px;"> 1414 <div class="product-img"> 1415 <div class="product-img-overlay"> 1416 <ul class="list-unstyled"> 1417 @if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1418 { 1419 <li> 1420 @if (productIsMixMatch != true) 1421 { 1422 <a onclick='addtofav(this,"/Default.aspx?ID=@GetPageIdByNavigationTag("MyFavPage")&productid=@Product.GetString("Ecom:Product.ID")&CCAddToMyLists=@Product.GetValue("Ecom:Product.ID")&CCAddToListVariantID=&CCAddToListLanguageID=LANG2")' href="javascript:void(0)" data-product-code='@Product.GetValue("Ecom:Product.ID")'> 1423 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/favourites-off.svg" alt="add as favourite" /> 1424 <span id="fvtext-@Product.GetString("Ecom:Product.ID")">@Translate("Add as","Add as")<br /> @Translate("Favourite","Favourite")</span> 1425 </a> 1426 <script type="text/javascript"> 1427 var fvtext = 'fvtext-'+'@Product.GetString("Ecom:Product.ID")'; 1428 if(itemsInWant.indexOf('@Product.GetString("Ecom:Product.ID")') != -1) 1429 { 1430 $('#' + fvtext).html('@Translate("ADDED!","ADDED!")');$('#' + fvtext).closest('li').addClass('not_active'); 1431 } 1432 </script> 1433 }else 1434 { 1435 <a href="javascript:void(0)">&nbsp;</a> 1436 } 1437 </li> 1438 } 1439 else 1440 { 1441 <li> 1442 1443 @if (productIsMixMatch != true) 1444 { 1445 <a href="javascript:void(0)" onclick="linktologinfav('@Product.GetString("Ecom:Product.ID")');"> 1446 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/favourites-off.svg" alt="add as favourite" /> 1447 <span>@Translate("Add as","Add as")<br /> @Translate("Favourite","Favourite")</span> 1448 </a> 1449 <script> 1450 function linktologin(pid){ 1451 //document.cookie = "comefromfavourite=true;expires=Sat, 31 Dec 2050 12:00:00 UTC; path=/;"; 1452 //document.cookie = "refreshcounterforfav=1;expires=Sat, 31 Dec 2050 12:00:00 UTC; path=/;"; 1453 //document.cookie = "favouriteproductcookie="+pid+";expires=Sat, 31 Dec 2050 12:00:00 UTC; path=/;"; 1454 window.location.href="/Default.aspx?ID=@GetPageIdByNavigationTag("LoginPage")"; 1455 } 1456 </script> 1457 } 1458 else 1459 { 1460 <a href="javascript:void(0)"></a> 1461 } 1462 </li> 1463 } 1464 <li> 1465 @if(Product.GetString("Ecom:Product:Field.SEOURL") != ""){ 1466 <a href="@Product.GetString("Ecom:Product:Field.SEOURL")"> 1467 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/info.svg" alt="" /> 1468 <span>@Translate("View","View")<br /> @Translate("PD_Details","Details")</span> 1469 </a> 1470 } 1471 else{ 1472 <a href="@Product.GetString("Ecom:Product.Link.Clean")"> 1473 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/info.svg" alt="" /> 1474 <span>@Translate("View","View")<br /> @Translate("PD_Details","Details")</span> 1475 </a> 1476 } 1477 1478 </li> 1479 <li> 1480 @if (Product.GetDouble("Ecom:Product.Stock") > 0) 1481 { 1482 if (Product.GetString("Ecom:Product:Field.item_classification.Value") == "loose tea") 1483 { 1484 <form name="multiForm" id='productID_@Product.GetValue("Ecom:Product.ID")' method="post" style="display:none"> 1485 <input type="hidden" name="CartCmd" value="addMulti" /> 1486 <input type="hidden" name="ProductID1" value='@Product.GetValue("Ecom:Product.ID")' /> 1487 <input type="hidden" name="ProductLoopCounter1" value="1" /> 1488 <input type="hidden" name="EcomOrderLineFieldInput_LooseTeaParentNo1" value="quick" /> 1489 <input type="hidden" name="Quantity1" class="Quantity1" value="1" /> 1490 <input type="hidden" name="VariantID1" class="VariantID1" value='@Product.GetString("Ecom:Product.DefaultVariantComboID")' /> 1491 <input type="hidden" name="ProductID2" value='PROD380' /> 1492 <input type="hidden" name="ProductLoopCounter2" value="2" /> 1493 <input type="hidden" name="Quantity2" class="Quantity2" value="1" /> 1494 <input type="hidden" class="orderlinefield" name="EcomOrderLineFieldInput_ParentProductId2" value='@Product.GetValue("Ecom:Product.ID")@Product.GetString("Ecom:Product.DefaultVariantComboID")_quick' /> 1495 </form> 1496 <a href="javascript:void(0)" onclick='amountCheck("@Product.GetValue("Ecom:Product.ID")","@Product.GetString("Ecom:Product.DefaultVariantComboName")");return false;'> 1497 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/add-to-cart.svg" alt="add to cart" /> 1498 <span>@Translate("Add to","Add to")<br /> @Translate("Bag","Bag")</span> 1499 </a> 1500 } 1501 else 1502 { 1503 <a class="test" @if(catName != "Set"){ <text> href='javascript:void(0)' onclick='return ajaxsubmitcart2("@linkTo");' </text>} @if(catName == "Set") { <text> href='@Product.GetValue("Ecom:Product.Link.Clean")' </text> }> 1504 <img class="img-fluid" src="/Files/Templates/Designs/TWG/images/icons/add-to-cart.svg" alt="add to cart" /> 1505 <span>@Translate("Add to","Add to")<br /> @Translate("Bag","Bag") </span> 1506 </a> 1507 } 1508 } 1509 </li> 1510 </ul> 1511 </div> 1512 <img alt="@productName" src='@Image' class="img-fluid w-100" onError="this.onerror = null; this.src = '/Files/Images/TWG Design/GetImage.png';"/> 1513 </div> 1514 @if(Product.GetString("Ecom:Product:Field.SEOURL") != ""){ 1515 <a href='@Product.GetString("Ecom:Product:Field.SEOURL")'> <h3>@productName</h3></a> 1516 } 1517 else{ 1518 <a href='@Product.GetString("Ecom:Product.Link.Clean")'> <h3>@productName</h3></a> 1519 } 1520 @if(Product.GetString("Ecom:Product.Price") != Product.GetString("Ecom:Product.Currency.Symbol")+"0.00"){ 1521 <p>@Product.GetString("Ecom:Product.Price")</p> 1522 } 1523 1524 1525 </div> 1526 if (loopCounter == 4 && prodCounter != pagesize) 1527 { 1528 @: </div><div class=""> 1529 loopCounter = 0; 1530 } 1531 if (prodCounter == pagesize) 1532 { 1533 @: </div> 1534 } 1535 } 1536 </div> 1537 } 1538 1539 1540 1541 1542 1543 <script> 1544 $(document).ready(function(){ 1545 makeRefineDesignLookGood(); 1546 }); 1547 1548 function makeRefineDesignLookGood(){ 1549 $('.variants').css({position:'absolute', visibility: 'hidden', display: 'block'}); 1550 $('.refine-slide').css({visibility: 'hidden', display: 'block'}); 1551 $('.refine-buttons').css('display','none'); 1552 var h1 = 0; 1553 var h2 = 0; 1554 1555 var refines = $('.variants'); 1556 refines.each(function(){ 1557 h1 = $(this).innerHeight(); 1558 if( h2 > h1 ){ 1559 h1 = h2; 1560 }else{ 1561 h2 = h1; 1562 } 1563 }); 1564 1565 for(var i = 1; i < refines.length ; i++){ 1566 var ih = $(refines[i]).innerHeight(); 1567 var ih2 = $(refines[i+1]).innerHeight(); 1568 var h4, ul; 1569 if( (ih+ih2) <= (h1+50) ){ 1570 h4 = $(refines[i+1]).find('h4'); 1571 ul = $(refines[i+1]).find('ul'); 1572 1573 $(refines[i]).append(h4); 1574 $(refines[i]).append(ul); 1575 1576 $(refines[i+1]).remove(); 1577 1578 //i++; 1579 refines = $('.variants'); 1580 } 1581 } 1582 1583 $('.variants').css({position:'', visibility: '', display: ''}); 1584 $('.refine-slide').css({visibility: '', display: ''}); 1585 $('.refine-buttons').css('display',''); 1586 } 1587 1588 function ajaxsubmitcart2(input){ 1589 1590 1591 1592 $.ajax({ 1593 url: input, 1594 type: "POST", 1595 success: function (data) { 1596 1597 //fbq('track', 'AddToCart'); 1598 1599 $('.cart-indicator .count').html(parseInt($('.cart-indicator .count').html())+1); 1600 showTooltip( 'cart' , '@Translate("Added to bag","Added to bag")'); 1601 }, 1602 error: function(xhr, ajaxOptions, thrownError){ 1603 1604 } 1605 }); 1606 } 1607 function ajaxsubmitcart(input){ 1608 //var form=$(a).closest('form'); 1609 var form=input; 1610 //console.log(form); 1611 var options = { 1612 success: function() { 1613 1614 //fbq('track', 'AddToCart'); 1615 1616 $('.cart-indicator .count').html(parseInt($('.cart-indicator .count').html())+1); 1617 showTooltip( 'cart' , '@Translate("Added to bag","Added to bag")' ); 1618 } 1619 }; 1620 1621 $(form).find('input:disabled').each(function(e) { 1622 $(this).removeAttr('disabled'); 1623 }); 1624 1625 $(form).ajaxSubmit(options); 1626 1627 return false; 1628 } 1629 1630 var maxWeight = '@maxWeight'; 1631 var totalLooseTeaWeight = '@TotalLooseTeaWeight'; 1632 1633 var isAvailableToAdd = true; 1634 1635 function amountCheck(id,default_variant){ 1636 1637 var totalamount=0; 1638 var curamount=parseInt((default_variant.replace('k','')).replace('g')); 1639 for(var j=0;j<itemsInCart.length;j++){ 1640 1641 if(itemsInCart[j]==id){ 1642 if(parseInt(((cartVarQty[j].split(',')[1]).replace('k','')).replace('g'))>39) 1643 {totalamount+= parseInt(cartVarQty[j].split(',')[0])*parseInt(((cartVarQty[j].split(',')[1]).replace('k','')).replace('g'));} 1644 else 1645 {totalamount+= parseInt(cartVarQty[j].split(',')[0])*parseInt(((cartVarQty[j].split(',')[1]).replace('k','')).replace('g'))*1000;} 1646 } 1647 } 1648 1649 if( parseInt(totalLooseTeaWeight)+curamount > parseInt(maxWeight) ){ 1650 isAvailableToAdd = false; 1651 }else{ 1652 isAvailableToAdd = true; 1653 } 1654 1655 1656 if(totalamount+curamount > parseInt(maxWeight) || isAvailableToAdd == false ){ 1657 $('#global_popup').show(); 1658 $('#c_location').show(); 1659 $('#GPbody').html('@Translate("Loose Tea exceed 5Kg error message","You cannot buy more than 5 kg per loosetea.")'); 1660 //alert('You have '+totalamount/1000+ 'Kg of this product in your cart. You cannot buy more than 5 kg per loosetea.'); 1661 } 1662 else{ 1663 // $("#productID_"+id).submit(); 1664 ajaxsubmitcart($("#productID_"+id)); 1665 totalLooseTeaWeight = parseInt(totalLooseTeaWeight) + curamount; 1666 } 1667 } 1668 1669 ////add to fav ajax////////////////////// 1670 function addtofav(item, favUrl) 1671 { 1672 1673 1674 $.ajax({ 1675 type: "POST", 1676 url: favUrl, 1677 contentType: "application/json", 1678 success: function(result){ 1679 var favCount = $(".favIcon").html(); 1680 var totalCount = parseInt(favCount) + 1; 1681 $(".favIcon").html(totalCount); 1682 $(item).find('span').html('@Translate("ADDED!","ADDED!")'); 1683 $(item).closest('li').addClass("not_active"); 1684 1685 showTooltip( 'fav' , '@Translate("Added to favorites")'); 1686 }, 1687 error: function(error){ 1688 //console.log("Error in Ajax."); 1689 } 1690 }); 1691 } 1692 1693 1694 </script> 1695 @{ 1696 string GoogleTagManagerIDSQL = "SELECT GoogleTagManagerID FROM ItemType_TWGWebsiteSetting Where ID="+Dynamicweb.Content.AreaService.Repository.GetArea(1).ItemId; 1697 string GoogleTagManagerID=string.Empty; 1698 using (System.Data.IDataReader GTMReader = Dynamicweb.Data.Database.CreateDataReader(GoogleTagManagerIDSQL)) 1699 { 1700 while (GTMReader.Read()) 1701 { 1702 1703 GoogleTagManagerID=GTMReader["GoogleTagManagerID"].ToString(); 1704 1705 } 1706 } 1707 1708 if(!string.IsNullOrEmpty(GoogleTagManagerID)){ 1709 <!--GTM for Product--> 1710 <script> 1711 <!-- start Adding a Product to a Shopping Cart GTM--> 1712 // Measure adding a product to a shopping cart by using an 'add' actionFieldObject 1713 // and a list of productFieldObjects. 1714 1715 dataLayer.push({ 1716 "event":"addToCart", 1717 "ecommerce": { 1718 "currencyCode":'@GetString("Ecom:Product.Currency.Symbol")', 1719 "add": { 1720 "products": [ 1721 @foreach (LoopItem Product in GetLoop("Products")) 1722 { 1723 var groupObject = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(Product.GetString("Ecom:Product.PrimaryOrFirstGroupID")); 1724 <text> 1725 { 1726 "name": "@Product.GetString("Ecom:Product.Name")", 1727 "id": "@Product.GetString("Ecom:Product.ID")", 1728 "price": "@Product.GetString("Ecom:Product.Price.Price")", 1729 "brand": "TWG Tea", 1730 "category": "@(groupObject != null ? groupObject.Name : "")", 1731 "variant": "@Product.GetString("Ecom:Product.ProductVariantID")", 1732 "quantity": 1 1733 }, 1734 </text> 1735 } 1736 ] 1737 } 1738 } 1739 }); 1740 <!--End Adding a Product to a Shopping Cart GTM--> 1741 1742 1743 </script> 1744 <!--GTM for Product--> 1745 } 1746 } 1747 1748 <script> 1749 var product_name=""; 1750 var product_category=""; 1751 var product_id=""; 1752 var product_value=""; 1753 var country=""; 1754 var city=""; 1755 @{ 1756 foreach (LoopItem Product in GetLoop("Products")) 1757 { 1758 1759 var prod = Dynamicweb.Ecommerce.Products.Product.GetProductById(Product.GetString("Ecom:Product.ID")); 1760 string prodID = Product.GetString("Ecom:Product.ID"); 1761 string itemClassification = prod.GetProductFieldValue("ItemClassification").ToString(); 1762 string name = Product.GetString("Ecom:Product.Name"); 1763 string UnitPrice= Product.GetString("Ecom:Product.Price"); 1764 1765 <text> 1766 product_name += "@name ,"; 1767 product_category += "[" + "@itemClassification" + "]," ; 1768 product_id += '@prodID,'; 1769 product_value += '@UnitPrice,'; 1770 </text> 1771 } 1772 string userCountry=""; 1773 string userCity=""; 1774 if (Dynamicweb.Core.Converter.ToBoolean(GetGlobalValue("Global:Extranet.UserName"))) 1775 { 1776 var curuser = Dynamicweb.Security.UserManagement.User.GetCurrentUser(); 1777 userCountry = curuser.Country; 1778 userCity = curuser.City; 1779 <text> 1780 country='@userCountry'; 1781 city='@userCity'; 1782 </text> 1783 } 1784 } 1785 gaProductListData(product_name,product_category,product_id,product_value,country,city); 1786 </script>