Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductListFacets.cshtml"
Line 79: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 81: The type or namespace name 'AVN' does not exist in the namespace 'Custom' (are you missing an assembly reference?)
Line 83: The type or namespace name 'AVN' does not exist in the namespace 'Custom' (are you missing an assembly reference?)
  1     // <auto-generated/>
  2     #pragma warning disable 1591
  3     namespace CompiledRazorTemplates.Dynamic
  4     {
  5         #line hidden
  6         using System.Threading.Tasks;
  7         using System;
  8         using System.Collections.Generic;
  9         using System.Linq;
 10         using Dynamicweb.Ecommerce.ProductCatalog;
 11         using Dynamicweb.Frontend.Navigation;
 12         using Dynamicweb.Environment;
 13         using Dynamicweb.Core.Encoders;
 14         using System.Text.RegularExpressions;
 15         internal class RazorEngine_2401dac3c75e4a4692079966c8c07801 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
 16         {
 17             #pragma warning disable 1998
 18             public async override global::System.Threading.Tasks.Task ExecuteAsync()
 19             {
 20                 WriteLiteral("\r\n");
 21                   
 22     	ProductListViewModel productList = new ProductListViewModel();
 23     	if (Dynamicweb.Context.Current.Items.Contains("ProductList"))
 24     	{
 25     		productList = (ProductListViewModel)Dynamicweb.Context.Current.Items["ProductList"];
 26     	}
 27     
 28     	string url = Pageview.SearchFriendlyUrl;
 29     	url = url.LastIndexOf("?") != -1 ? url.Substring(0, url.LastIndexOf("?")) : url;
 30     
 31     	//Fix for non-friendly urls
 32     	if (Dynamicweb.Context.Current.Request.QueryString.Get("GroupID") != null)
 33     	{
 34     		string groupId = Dynamicweb.Context.Current.Request.QueryString.Get("GroupID");
 35     		url += "?GroupID=" + groupId;
 36     	}
 37     
 38     	if (!url.Contains("LayoutTemplate"))
 39     	{
 40     		url += url.Contains("?") ? "&LayoutTemplate=Designs/Swift-v2/Swift-v2_PageClean.cshtml" : "?LayoutTemplate=Designs/Swift-v2/Swift-v2_PageClean.cshtml";
 41     	}
 42     
 43     	bool facetsFound = false;
 44     	int selectedFacetsCount = 0;
 45     
 46     	if (productList.FacetGroups != null)
 47     	{
 48     		foreach (FacetGroupViewModel facetGroup in productList.FacetGroups)
 49     		{
 50     			foreach (FacetViewModel facet in facetGroup.Facets)
 51     			{
 52     				if (facet.Options.Count() > 0)
 53     				{
 54     					facetsFound = true;
 55     
 56     					foreach (FacetOptionViewModel option in facet.Options)
 57     					{
 58     						if (option.Selected)
 59     						{
 60     							selectedFacetsCount++;
 61     						}
 62     					}
 63     				}
 64     			}
 65     		}
 66     	}
 67     
 68     	bool enableSorting = Model.Item.GetBoolean("SortByNameAZ");
 69     	enableSorting = Model.Item.GetBoolean("SortByNameZA") || enableSorting == true ? true : false;
 70     	enableSorting = Model.Item.GetBoolean("SortByNewest") || enableSorting == true ? true : false;
 71     	enableSorting = Model.Item.GetBoolean("SortByLowestPrice") || enableSorting == true ? true : false;
 72     	enableSorting = Model.Item.GetBoolean("SortByHighestPrice") || enableSorting == true ? true : false;
 73     
 74     	string layout = Model.Item.GetRawValueString("Layout", "vertical");
 75     
 76     	var formFieldsParms = new Dictionary<string, object>();
 77     	formFieldsParms.Add("DeviceType", "desktop");
 78     
 79     	string? searchQuery = Dynamicweb.Context.Current?.Request["q"];
 80     	var currentGroupId = Dynamicweb.Context.Current.Request.QueryString.Get("GroupID");
 81     	var pageRenderLayout = Custom.AVN.Facets.Helpers.ProductGroupHelper.PageContainerRenderLayout(currentGroupId, Dynamicweb.Ecommerce.Common.Context.LanguageID, !string.IsNullOrEmpty(searchQuery));
 82                 WriteLiteral("\r\n");
 83                  if (productList.TotalProductsCount > 0 && (facetsFound || Model.Item.GetBoolean("EnableGroupNavigation") || enableSorting) && pageRenderLayout != Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts.NotSet)
 84     {
 85     	string iconPath = "/Files/Images/Icons/";
 86     	string selectedFacetsLabel = selectedFacetsCount > 0 ? "(" + selectedFacetsCount + ")" : string.Empty;
 87     	string formContainerCss = layout == "horizontal" ? $"d-lg-flex gap-3 flex-row flex-wrap" : $"d-lg-block h-100";
 88     
 89     	//Desktop
 90     	if (layout == "horizontal")
 91     	{
 92                 WriteLiteral("\t\t");
 93                 WriteLiteral("<div class=\"h-100\" data-dw-colorscheme=\"");
 94                                                              Write(Model.ColorScheme?.Id);
 95                 WriteLiteral("\">\r\n");
 96                 	}
 97     
 98                 WriteLiteral("\t<form method=\"post\"");
 99                 BeginWriteAttribute("action", " action=\"", 3187, "\"", 3200, 1);
100                 WriteAttributeValue("", 3196, url, 3196, 4, false);
101                 EndWriteAttribute();
102                 WriteLiteral(" data-response-target-element=\"content\"");
103                 BeginWriteAttribute("id", " id=\"", 3240, "\"", 3273, 2);
104                 WriteAttributeValue("", 3245, "FacetsForm_Desktop_", 3245, 19, true);
105                 WriteAttributeValue("", 3264, Model.ID, 3264, 9, false);
106                 EndWriteAttribute();
107                 BeginWriteAttribute("class", " class=\"", 3274, "\"", 3344, 4);
108                 WriteAttributeValue("", 3282, "d-none", 3282, 6, true);
109                 WriteAttributeValue(" ", 3288, formContainerCss, 3289, 17, false);
110                 WriteAttributeValue(" ", 3306, "item_", 3307, 6, true);
111                 WriteAttributeValue("", 3312, Model.Item.SystemName.ToLower(), 3312, 32, false);
112                 EndWriteAttribute();
113                 WriteLiteral(" data-dw-colorscheme=\"");
114                                                                                                                                                                                                                       Write(Model.ColorScheme?.Id);
115                 WriteLiteral("\">\r\n\t\t");
116                    Write(RenderPartial("Paragraph/ProductListFacets/FormFields.cshtml", Model, formFieldsParms));
117                 WriteLiteral("\r\n\r\n");
118                          if (layout == "horizontal" && selectedFacetsCount > 0)
119     		{
120                 WriteLiteral("\t\t\t<button type=\"button\" class=\"btn btn-sm me-sm-1 me-lg-2\" onclick=\"swift.ProductList.ResetFacets(event)\"><span class=\"icon-2\">");
121                                                                                                                                                     Write(ReadFile(iconPath + "rotate-ccw.svg"));
122                 WriteLiteral("</span> ");
123                                                                                                                                                                                                   Write(Translate("Clear filters"));
124                 WriteLiteral("</button>\r\n");
125                 		}
126                 WriteLiteral("\t</form>\r\n");
127                 
128     	if (layout == "horizontal")
129     	{
130                 WriteLiteral("\t\t");
131                 WriteLiteral("</div>\r\n");
132                 	}
133     
134     	//Mobile
135                 WriteLiteral("\t<div");
136                 BeginWriteAttribute("class", " class=\"", 3847, "\"", 3941, 7);
137                 WriteAttributeValue("", 3855, "d-block", 3855, 7, true);
138                 WriteAttributeValue(" ", 3862, "d-lg-none", 3863, 10, true);
139                 WriteAttributeValue(" ", 3872, "mt-lg-0", 3873, 8, true);
140                 WriteAttributeValue(" ", 3880, "FacetsForm_Mobile_", 3881, 19, true);
141                 WriteAttributeValue("", 3899, Model.Item.SystemName.ToLower(), 3899, 32, false);
142                 WriteAttributeValue("", 3931, "_", 3931, 1, true);
143                 WriteAttributeValue("", 3932, Model.ID, 3932, 9, false);
144                 EndWriteAttribute();
145                 WriteLiteral(" data-dw-colorscheme=\"");
146                                                                                                                                         Write(Model.ColorScheme?.Id);
147                 WriteLiteral("\">\r\n\t\t<button type=\"button\" class=\"btn btn-primary w-100\" data-dw-button=\"primary\" data-bs-toggle=\"modal\" data-bs-target=\"#FacetsModal\">\r\n\t\t\t<span class=\"d-flex align-items-center\">\r\n\t\t\t\t<span class=\"flex-grow-1 text-start\">\r\n\t\t\t\t\t");
148                                Write(Translate("Filter"));
149                 WriteLiteral(" ");
150                                                     Write(selectedFacetsLabel);
151                 WriteLiteral("\r\n\t\t\t\t</span>\r\n\t\t\t\t<span class=\"icon-2\">\r\n\t\t\t\t\t");
152                                Write(ReadFile(iconPath + "sliders.svg"));
153                 WriteLiteral("\r\n\t\t\t\t</span>\r\n\t\t\t</span>\r\n\t\t</button>\r\n\r\n\t\t<form method=\"post\"");
154                 BeginWriteAttribute("action", " action=\"", 4403, "\"", 4416, 1);
155                 WriteAttributeValue("", 4412, url, 4412, 4, false);
156                 EndWriteAttribute();
157                 WriteLiteral(" data-response-target-element=\"content\" class=\"modal\" id=\"FacetsModal\" tabindex=\"-1\" aria-hidden=\"false\">\r\n\t\t\t<div class=\"modal-dialog modal-fullscreen\">\r\n\t\t\t\t<div class=\"modal-content\">\r\n\t\t\t\t\t<div class=\"modal-header\">\r\n\t\t\t\t\t\t<h5 class=\"modal-title\">");
158                                                            Write(Translate("Filters and sorting"));
159                 WriteLiteral("</h5>\r\n\t\t\t\t\t\t<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" onclick=\"document.querySelector(\'body\').style = \'\'\"></button>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"modal-body\">\r\n");
160                                           
161     							formFieldsParms["DeviceType"] = "mobile";
162     						WriteLiteral("\t\t\t\t\t\t");
163                                    Write(RenderPartial("Paragraph/ProductListFacets/FormFields.cshtml", Model, formFieldsParms));
164                 WriteLiteral("\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"modal-footer d-flex\">\r\n");
165                                          if (selectedFacetsCount != 0)
166     						{
167                 WriteLiteral("\t\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-secondary flex-fill\" data-dw-button=\"secondary\" onclick=\"swift.ProductList.ResetFacets(event)\">");
168                                                                                                                                                                            Write(Translate("Clear"));
169                 WriteLiteral(" (");
170                                                                                                                                                                                                 Write(selectedFacetsCount);
171                 WriteLiteral(")</button>\r\n");
172                 						}
173                 WriteLiteral("\t\t\t\t\t\t<button type=\"button\" class=\"btn btn-primary flex-fill\" data-dw-button=\"primary\" onclick=\"location.reload();\">");
174                                                                                                                                                  Write(Translate("Update"));
175                 WriteLiteral("</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</form>\r\n\t</div>\r\n");
176                 }
177     else if (Pageview.IsVisualEditorMode)
178     {	
179                 WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\r\n\t\t<span>");
180                          Write(Translate("Facets: The facets selectors will be shown here, if any"));
181                 WriteLiteral("</span>\r\n\t</div>\r\n");
182                 }
183             }
184             #pragma warning restore 1998
185         }
186     }
187     #pragma warning restore 1591
188     
  1     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
  2     @using Dynamicweb.Ecommerce.ProductCatalog
  3     @using Dynamicweb.Frontend.Navigation
  4     @using Dynamicweb.Environment
  5     @using Dynamicweb.Core.Encoders
  6     @using System.Text.RegularExpressions
  7     
  8     @{
  9     	ProductListViewModel productList = new ProductListViewModel();
 10     	if (Dynamicweb.Context.Current.Items.Contains("ProductList"))
 11     	{
 12     		productList = (ProductListViewModel)Dynamicweb.Context.Current.Items["ProductList"];
 13     	}
 14     
 15     	string url = Pageview.SearchFriendlyUrl;
 16     	url = url.LastIndexOf("?") != -1 ? url.Substring(0, url.LastIndexOf("?")) : url;
 17     
 18     	//Fix for non-friendly urls
 19     	if (Dynamicweb.Context.Current.Request.QueryString.Get("GroupID") != null)
 20     	{
 21     		string groupId = Dynamicweb.Context.Current.Request.QueryString.Get("GroupID");
 22     		url += "?GroupID=" + groupId;
 23     	}
 24     
 25     	if (!url.Contains("LayoutTemplate"))
 26     	{
 27     		url += url.Contains("?") ? "&LayoutTemplate=Designs/Swift-v2/Swift-v2_PageClean.cshtml" : "?LayoutTemplate=Designs/Swift-v2/Swift-v2_PageClean.cshtml";
 28     	}
 29     
 30     	bool facetsFound = false;
 31     	int selectedFacetsCount = 0;
 32     
 33     	if (productList.FacetGroups != null)
 34     	{
 35     		foreach (FacetGroupViewModel facetGroup in productList.FacetGroups)
 36     		{
 37     			foreach (FacetViewModel facet in facetGroup.Facets)
 38     			{
 39     				if (facet.Options.Count() > 0)
 40     				{
 41     					facetsFound = true;
 42     
 43     					foreach (FacetOptionViewModel option in facet.Options)
 44     					{
 45     						if (option.Selected)
 46     						{
 47     							selectedFacetsCount++;
 48     						}
 49     					}
 50     				}
 51     			}
 52     		}
 53     	}
 54     
 55     	bool enableSorting = Model.Item.GetBoolean("SortByNameAZ");
 56     	enableSorting = Model.Item.GetBoolean("SortByNameZA") || enableSorting == true ? true : false;
 57     	enableSorting = Model.Item.GetBoolean("SortByNewest") || enableSorting == true ? true : false;
 58     	enableSorting = Model.Item.GetBoolean("SortByLowestPrice") || enableSorting == true ? true : false;
 59     	enableSorting = Model.Item.GetBoolean("SortByHighestPrice") || enableSorting == true ? true : false;
 60     
 61     	string layout = Model.Item.GetRawValueString("Layout", "vertical");
 62     
 63     	var formFieldsParms = new Dictionary<string, object>();
 64     	formFieldsParms.Add("DeviceType", "desktop");
 65     
 66     	string? searchQuery = Dynamicweb.Context.Current?.Request["q"];
 67     	var currentGroupId = Dynamicweb.Context.Current.Request.QueryString.Get("GroupID");
 68     	var pageRenderLayout = Custom.AVN.Facets.Helpers.ProductGroupHelper.PageContainerRenderLayout(currentGroupId, Dynamicweb.Ecommerce.Common.Context.LanguageID, !string.IsNullOrEmpty(searchQuery));
 69     }
 70     
 71     @if (productList.TotalProductsCount > 0 && (facetsFound || Model.Item.GetBoolean("EnableGroupNavigation") || enableSorting) && pageRenderLayout != Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts.NotSet)
 72     {
 73     	string iconPath = "/Files/Images/Icons/";
 74     	string selectedFacetsLabel = selectedFacetsCount > 0 ? "(" + selectedFacetsCount + ")" : string.Empty;
 75     	string formContainerCss = layout == "horizontal" ? $"d-lg-flex gap-3 flex-row flex-wrap" : $"d-lg-block h-100";
 76     
 77     	//Desktop
 78     	if (layout == "horizontal")
 79     	{
 80     		@:<div class="h-100" data-dw-colorscheme="@Model.ColorScheme?.Id">
 81     	}
 82     
 83     	<form method="post" action="@url" data-response-target-element="content" id="FacetsForm_Desktop_@Model.ID" class="d-none @formContainerCss item_@Model.Item.SystemName.ToLower()" data-dw-colorscheme="@Model.ColorScheme?.Id">
 84     		@RenderPartial("Paragraph/ProductListFacets/FormFields.cshtml", Model, formFieldsParms)
 85     
 86     		@if (layout == "horizontal" && selectedFacetsCount > 0)
 87     		{
 88     			<button type="button" class="btn btn-sm me-sm-1 me-lg-2" onclick="swift.ProductList.ResetFacets(event)"><span class="icon-2">@ReadFile(iconPath + "rotate-ccw.svg")</span> @Translate("Clear filters")</button>
 89     		}
 90     	</form>
 91     
 92     	if (layout == "horizontal")
 93     	{
 94     		@:</div>
 95     	}
 96     
 97     	//Mobile
 98     	<div class="d-block d-lg-none mt-lg-0 FacetsForm_Mobile_@Model.Item.SystemName.ToLower()_@Model.ID" data-dw-colorscheme="@Model.ColorScheme?.Id">
 99     		<button type="button" class="btn btn-primary w-100" data-dw-button="primary" data-bs-toggle="modal" data-bs-target="#FacetsModal">
100     			<span class="d-flex align-items-center">
101     				<span class="flex-grow-1 text-start">
102     					@Translate("Filter") @selectedFacetsLabel
103     				</span>
104     				<span class="icon-2">
105     					@ReadFile(iconPath + "sliders.svg")
106     				</span>
107     			</span>
108     		</button>
109     
110     		<form method="post" action="@url" data-response-target-element="content" class="modal" id="FacetsModal" tabindex="-1" aria-hidden="false">
111     			<div class="modal-dialog modal-fullscreen">
112     				<div class="modal-content">
113     					<div class="modal-header">
114     						<h5 class="modal-title">@Translate("Filters and sorting")</h5>
115     						<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" onclick="document.querySelector('body').style = ''"></button>
116     					</div>
117     					<div class="modal-body">
118     						@{
119     							formFieldsParms["DeviceType"] = "mobile";
120     						}
121     						@RenderPartial("Paragraph/ProductListFacets/FormFields.cshtml", Model, formFieldsParms)
122     					</div>
123     					<div class="modal-footer d-flex">
124     						@if (selectedFacetsCount != 0)
125     						{
126     							<button type="button" class="btn btn-secondary flex-fill" data-dw-button="secondary" onclick="swift.ProductList.ResetFacets(event)">@Translate("Clear") (@selectedFacetsCount)</button>
127     						}
128     						<button type="button" class="btn btn-primary flex-fill" data-dw-button="primary" onclick="location.reload();">@Translate("Update")</button>
129     					</div>
130     				</div>
131     			</div>
132     		</form>
133     	</div>
134     }
135     else if (Pageview.IsVisualEditorMode)
136     {	
137     	<div class="alert alert-dark m-0" role="alert">
138     		<span>@Translate("Facets: The facets selectors will be shown here, if any")</span>
139     	</div>
140     }
141     
			 
			
				Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductListItemRepeater.cshtml"
Line 24: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 27: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 32: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 62: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 64: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 67: The type or namespace name 'AVN' does not exist in the namespace 'Custom' (are you missing an assembly reference?)
Line 68: The type or namespace name 'AVN' does not exist in the namespace 'Custom' (are you missing an assembly reference?)
Line 70: The type or namespace name 'AVN' does not exist in the namespace 'Custom' (are you missing an assembly reference?)
Line 76: Argument 1: cannot convert from 'Dynamicweb.Ecommerce.ProductCatalog.GroupInfoViewModel' to 'Dynamicweb.Ecommerce.Products.Group'
Line 91: 'GroupInfoViewModel' does not contain a definition for 'LargeImage' and no accessible extension method 'LargeImage' accepting a first argument of type 'GroupInfoViewModel' could be found (are you missing a using directive or an assembly reference?)
Line 106: 'GroupInfoViewModel' does not contain a definition for 'Description' and no accessible extension method 'Description' accepting a first argument of type 'GroupInfoViewModel' could be found (are you missing a using directive or an assembly reference?)
Line 122: The type or namespace name 'AVN' does not exist in the namespace 'Custom' (are you missing an assembly reference?)
Line 133: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 140: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 249: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 251: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
Line 399: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source.
  1     // <auto-generated/>
  2     #pragma warning disable 1591
  3     namespace CompiledRazorTemplates.Dynamic
  4     {
  5         #line hidden
  6         using System.Threading.Tasks;
  7         using System;
  8         using System.Collections.Generic;
  9         using System.Linq;
 10         using Dynamicweb.Ecommerce.ProductCatalog;
 11         using Dynamicweb.Core;
 12         using Dynamicweb.Core.Encoders;
 13         using Dynamicweb.Frontend;
 14         internal class RazorEngine_d20e4503295f49b28646dd9bb8a9bb18 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
 15         {
 16             #pragma warning disable 1998
 17             public async override global::System.Threading.Tasks.Task ExecuteAsync()
 18             {
 19                 WriteLiteral("\r\n");
 20                   
 21     	int productsCount = 0;
 22     	int maxProductsCounter = 0;
 23     
 24     	ProductListViewModel? productList = null;
 25     	if (Dynamicweb.Context.Current is not null && Dynamicweb.Context.Current.Items.Contains("ProductList"))
 26     	{
 27     		productList = (ProductListViewModel?)Dynamicweb.Context.Current.Items["ProductList"];
 28     	}
 29     	else if (Pageview.Page?.Item?["DummyProductGroup"] != null && Pageview.IsVisualEditorMode)
 30     	{
 31     		var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page);
 32     		ProductListViewModel? groupList = pageViewModel.Item?.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel();
 33     
 34     		if (groupList?.Products is object)
 35     		{
 36     			productList = groupList;
 37     		}
 38     	}
 39                 WriteLiteral("\r\n");
 40                 WriteLiteral("\r\n");
 41                  if (productList is not null)
 42     {
 43                 WriteLiteral("\t<div class=\"h-100 product-list\" data-dw-colorscheme=\"");
 44                                                                     Write(Model.ColorScheme?.Id);
 45                 WriteLiteral("\">\r\n");
 46                           
 47     			bool isVisualEditor = !string.IsNullOrEmpty(Dynamicweb.Context.Current?.Request.QueryString.Get("VisualEdit")) ? Convert.ToBoolean(Dynamicweb.Context.Current.Request.QueryString.Get("VisualEdit")) : false;
 48     
 49     			string groupId = productList?.Group?.Id != null ? productList.Group.Id : "";
 50     
 51     			if (productList?.TotalProductsCount > 0)
 52     			{
 53     				int pageSizeSetting = Converter.ToInt32(Dynamicweb.Context.Current?.Request.QueryString.Get("OriginalPageSize")) > 0 ? Converter.ToInt32(Dynamicweb.Context.Current.Request.QueryString.Get("OriginalPageSize")) : productList.PageSize;
 54     				int pageNumber = Converter.ToInt32(Dynamicweb.Context.Current?.Request.QueryString.Get("PageNum")) > 0 ? Converter.ToInt32(Dynamicweb.Context.Current.Request.QueryString.Get("PageNum")) : productList.CurrentPage;
 55     				int pageSize = Converter.ToInt32(Dynamicweb.Context.Current?.Request.QueryString.Get("PageSize")) > 0 ? Converter.ToInt32(Dynamicweb.Context.Current.Request.QueryString.Get("PageSize")) : productList.PageSize;
 56     				pageNumber = pageSize != pageSizeSetting ? (pageSize / pageSizeSetting) : pageNumber;
 57     				int loadedProducts = productList.PageSize > productList.TotalProductsCount ? productList.TotalProductsCount : pageSizeSetting * pageNumber;
 58     				loadedProducts = loadedProducts > productList.TotalProductsCount ? productList.TotalProductsCount : loadedProducts;
 59     
 60     				pageNumber += 1;
 61     
 62     				string? searchQuery = Dynamicweb.Context.Current?.Request["q"];
 63     
 64     				string? searchLayout = Dynamicweb.Context.Current?.Request.QueryString.Get("SearchLayout");
 65     
 66     				                                                                       
 67     				var pageRenderLayout = Custom.AVN.Facets.Helpers.ProductGroupHelper.PageContainerRenderLayout(groupId, Dynamicweb.Ecommerce.Common.Context.LanguageID, !string.IsNullOrEmpty(searchQuery));
 68     				                 if (pageRenderLayout == Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts.GroupList)
 69     				{
 70     					var subGroups = Custom.AVN.Facets.Helpers.ProductGroupHelper.GetSubGroups(groupId, Dynamicweb.Ecommerce.Common.Context.LanguageID);
 71     					                     if (subGroups.Any())
 72     					{
 73                 WriteLiteral("\t\t\t\t\t\t<div class=\"group-list\">\r\n");
 74                                              foreach (var group in subGroups)
 75     							{
 76     								var link = GetLink(group);
 77     
 78     								var count = GetGroupProductsCount(group.Id, productList);
 79     
 80     								if (count > 0)
 81     								{
 82                 WriteLiteral("\t\t\t\t\t\t\t\t\t<div class=\"grid g-col-12 mb-3 gap-0\">\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"g-col-2 group-list__list-item__left-wrapper\">\r\n\t\t\t\t\t\t\t\t\t\t\t<a");
 83                 BeginWriteAttribute("href", " href=\"", 4392, "\"", 4404, 1);
 84                 WriteAttributeValue("", 4399, link, 4399, 5, false);
 85                 EndWriteAttribute();
 86                 BeginWriteAttribute("title", " title=\"", 4405, "\"", 4413, 0);
 87                 EndWriteAttribute();
 88                 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<img class=\"object-fit-contain w-100\"");
 89                 BeginWriteAttribute("src", " src=\"", 4466, "\"", 4600, 2);
 90                 WriteAttributeValue("", 4472, "/Admin/Public/GetImage.ashx?width=680&height=314&crop=5&DoNotUpscale=True&Compression=75&image=", 4472, 111, true);
 91                 WriteAttributeValue("", 4583, group.LargeImage, 4583, 17, false);
 92                 EndWriteAttribute();
 93                 BeginWriteAttribute("alt", " alt=\"", 4601, "\"", 4651, 1);
 94                 WriteAttributeValue("", 4607, HtmlEncoder.HtmlAttributeEncode(group.Name), 4607, 44, false);
 95                 EndWriteAttribute();
 96                 WriteLiteral(" />\r\n\t\t\t\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"g-col-7 group-list__list-item__middle-wrapper dw-mod\">\r\n\t\t\t\t\t\t\t\t\t\t\t<a class=\"text-decoration-none\"");
 97                 BeginWriteAttribute("href", " href=\"", 4812, "\"", 4824, 1);
 98                 WriteAttributeValue("", 4819, link, 4819, 5, false);
 99                 EndWriteAttribute();
100                 BeginWriteAttribute("title", " title=\"", 4825, "\"", 4877, 1);
101                 WriteAttributeValue("", 4833, HtmlEncoder.HtmlAttributeEncode(group.Name), 4833, 44, false);
102                 EndWriteAttribute();
103                 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<h5>");
104                                                                Write(group.Name);
105                 WriteLiteral("</h5>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<p>");
106                                                               Write(group.Description);
107                 WriteLiteral("</p>\r\n\t\t\t\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"g-col-3 group-list__list-item__right-wrapper dw-mod\">\r\n\t\t\t\t\t\t\t\t\t\t\t<a");
108                 BeginWriteAttribute("href", " href=\"", 5079, "\"", 5091, 1);
109                 WriteAttributeValue("", 5086, link, 5086, 5, false);
110                 EndWriteAttribute();
111                 WriteLiteral(" class=\"btn btn-primary\" data-swift-btn=\"primary\"");
112                 BeginWriteAttribute("title", " title=\"", 5141, "\"", 5149, 0);
113                 EndWriteAttribute();
114                 WriteLiteral(">");
115                                                                                                                                  Write(string.Format(Translate("Custom:ViewList.ListViewItem.GroupList.ShowProducts.", "Vis {0} produkter"), count));
116                 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n");
117                 								}
118     							}						
119                 WriteLiteral("\t\t\t\t\t\t</div>\r\n");
120                 					}                     
121     				}
122     				else if (pageRenderLayout == Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts.ProductList)
123     				{
124     					int itemSourcePageId = Convert.ToInt32(Model.Item?.GetRawValueString("ListComponentSource", "0"));
125     					itemSourcePageId = Dynamicweb.Content.Services.Pages.GetPageOrLanguage(itemSourcePageId, Pageview.AreaID)?.ID ?? itemSourcePageId;
126     
127     					var page = Dynamicweb.Content.Services.Pages.GetPage(itemSourcePageId);
128     
129     					if (page != null)
130     					{
131     						var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(page);
132     
133     						string? gridColumnSize = Model.Item?.GetRawValueString("GridLayoutDesktop", "3-columns");
134     						gridColumnSize = gridColumnSize == "2-columns" ? "g-col-lg-6" : gridColumnSize;
135     						gridColumnSize = gridColumnSize == "3-columns" ? "g-col-lg-4" : gridColumnSize;
136     						gridColumnSize = gridColumnSize == "4-columns" ? "g-col-lg-3" : gridColumnSize;
137     						gridColumnSize = gridColumnSize == "6-columns" ? "g-col-lg-2" : gridColumnSize;
138     						gridColumnSize = gridColumnSize == "list" ? "g-col-lg-12" : gridColumnSize;
139     
140     						string? gridColumnMobileSize = Model.Item?.GetRawValueString("GridLayoutMobile", "2-columns");
141     						gridColumnMobileSize = gridColumnMobileSize == "list" ? "g-col-12" : gridColumnMobileSize;
142     						gridColumnMobileSize = gridColumnMobileSize == "2-columns" ? "g-col-6" : gridColumnMobileSize;
143     
144                 WriteLiteral("\t\t\t\t\t\t<div class=\"grid pb-3\">\r\n\t\t\t\t\t\t\t<script>\r\n\t\t\t\t\t\t\t\tgtag(\"event\", \"view_item_list\", {\r\n\t\t\t\t\t\t\t\t\titem_list_id: \"product_list_item_repeater\",\r\n\t\t\t\t\t\t\t\t\titem_list_name: \"Product list (Item Repeater)\",\r\n\t\t\t\t\t\t\t\t\titems: [\r\n");
145                                                          foreach (ProductViewModel product in productList.Products)
146     										{
147     											WriteLiteral("{\r\n\t\t\t\t\t\t\t\t\t\t\t\titem_id: \"");
148                                                                      Write(product.Number);
149                 WriteLiteral("\",\r\n\t\t\t\t\t\t\t\t\t\t\t\titem_name: \"");
150                                                                        Write(Dynamicweb.Core.Encoders.HtmlEncoder.JavaScriptStringEncode(product.Name));
151                 WriteLiteral("\",\r\n\t\t\t\t\t\t\t\t\t\t\t\tcurrency: \"");
152                                                                       Write(product.Price.CurrencyCode);
153                 WriteLiteral("\",\r\n\t\t\t\t\t\t\t\t\t\t\t\tprice: ");
154                                                                   Write(product.Price.ToStringInvariant());
155                 WriteLiteral(",\r\n\t\t\t\t\t\t\t\t\t\t\t\tdiscount: ");
156                                                                      Write(product.Discount.ToStringInvariant());
157                 WriteLiteral("\r\n\t\t\t\t\t\t\t\t\t\t\t},");
158                                                                      
159     										}
160                 WriteLiteral("\t\t\t\t\t\t\t\t\t]\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t</script>\r\n\r\n");
161                                              foreach (ProductViewModel product in productList.Products)
162     							{
163     								if (maxProductsCounter == 0 || (productsCount < maxProductsCounter))
164     								{
165     									string link = product.GetProductLink(GetPageIdByNavigationTag("Shop"), false);
166     
167     									if (Dynamicweb.Context.Current?.Items.Contains("ProductDetails") != null)
168     									{
169     										Dynamicweb.Context.Current.Items["ProductDetails"] = product;
170     									}
171     									else
172     									{
173     										Dynamicweb.Context.Current?.Items.Add("ProductDetails", product);
174     									}
175     
176     									if (Model.Item?.GetString("ListComponentSource") != null)
177     									{
178                 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<article");
179                 BeginWriteAttribute("class", " class=\"", 8139, "\"", 8240, 7);
180                 WriteAttributeValue("", 8147, gridColumnMobileSize, 8147, 21, false);
181                 WriteAttributeValue(" ", 8168, gridColumnSize, 8169, 15, false);
182                 WriteAttributeValue(" ", 8184, "d-flex", 8185, 7, true);
183                 WriteAttributeValue(" ", 8191, "flex-column", 8192, 12, true);
184                 WriteAttributeValue(" ", 8203, "position-relative", 8204, 18, true);
185                 WriteAttributeValue(" ", 8221, "product", 8222, 8, true);
186                 WriteAttributeValue(" ", 8229, "js-product", 8230, 11, true);
187                 EndWriteAttribute();
188                 WriteLiteral(" data-product-id=\"");
189                                                                                                                                                                                    Write(product.Id);
190                 WriteLiteral("\" data-variant-id=\"");
191                                                                                                                                                                                                                  Write(product.VariantId);
192                 WriteLiteral("\" itemscope itemtype=\"https://schema.org/Product\">\r\n");
193                                                               
194     												string clickProductLink = "onclick=\"return clickProductLink('" + @product.Id + "', '" + @product.Name + "', '" + @product.VariantName + "', '" + @product.Price.CurrencyCode + "', '" + @product.Price.ToStringInvariant() + "', '" + @product.Discount.ToStringInvariant() + "')\"";
195     											WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<a");
196                 BeginWriteAttribute("href", " href=\"", 8693, "\"", 8705, 1);
197                 WriteAttributeValue("", 8700, link, 8700, 5, false);
198                 EndWriteAttribute();
199                 WriteLiteral(" class=\"stretched-link\" onmouseover=\"swift.Image.swapImage(event)\" onmouseout=\"swift.Image.swapImage(event)\" ");
200                                                                                                                                                                                    Write(clickProductLink);
201                 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"visually-hidden\">");
202                                                                                          Write(product.Name);
203                 WriteLiteral(@"</span>
204     											</a>
205     										
206     											<script>
207     												function clickProductLink(productId, productName, productVariant, productCurrency, productPrice, productDiscount) {
208     													if (typeof gtag !== ""undefined"") {
209     														gtag(""event"", ""select_item"", {
210     															item_list_id: ""product_list_item_repeater"",
211     															item_list_name: ""Product list (Item Repeater)"",
212     															items: [
213     																{
214     																	item_id: productId,
215     																	item_name: productName,
216     																	currency: productCurrency,
217     																	item_list_id: ""product_list_item_repeater"",
218     																	item_list_name: ""Product list (Item Repeater)"",
219     																	item_variant: productVariant,
220     																	price: productPrice,
221     																	discount: productDiscount
222     																}
223     															]
224     														});
225     													}
226     												}
227     											</script>
228     
229     											");
230                                                        Write(RenderGrid(itemSourcePageId));
231                 WriteLiteral("\r\n\t\t\t\t\t\t\t\t\t\t</article>\r\n");
232                 									}
233     
234     									productsCount++;
235     								}
236     							}
237                 WriteLiteral("\t\t\t\t\t\t</div>\r\n");
238                 WriteLiteral("\t\t\t\t\t\t<div class=\"my-3\" id=\"ProductListLoadMore\">\r\n\t\t\t\t\t\t\t<div class=\"text-center\">\r\n\t\t\t\t\t\t\t\t<div class=\"opacity-85 mb-3\">");
239                                                                         Write(loadedProducts);
240                 WriteLiteral(" ");
241                                                                                         Write(Translate("out of"));
242                 WriteLiteral(" ");
243                                                                                                              Write(productList.TotalProductsCount);
244                 WriteLiteral(" ");
245                                                                                                                                              Write(Translate("products"));
246                 WriteLiteral("</div>\r\n");
247                                                  if (productList.PageCount != 1 && maxProductsCounter == 0 && loadedProducts < productList.TotalProductsCount)
248     								{
249     									string? sortBySelection = Dynamicweb.Context.Current?.Request.Form["SortBy"] ?? "";
250     									sortBySelection = Dynamicweb.Context.Current?.Request.QueryString.Get("SortBy") ?? sortBySelection;
251     									string? mainProductId = Dynamicweb.Context.Current?.Request.QueryString.Get("MainProductID");
252     
253                 WriteLiteral("\t\t\t\t\t\t\t\t\t<form method=\"get\" data-response-target-element=\".product-list\" data-swap=\"afterend\" class=\"w-100\">\r\n");
254                                                          if (productList?.FacetGroups != null)
255     										{
256     											foreach (FacetGroupViewModel facetGroup in productList.FacetGroups)
257     											{
258     												foreach (FacetViewModel facetItem in facetGroup.Facets)
259     												{
260     													foreach (FacetOptionViewModel facetOption in facetItem.Options)
261     													{
262     														if (facetOption.Selected)
263     														{
264                 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\"");
265                 BeginWriteAttribute("name", " name=\"", 11178, "\"", 11210, 1);
266                 WriteAttributeValue("", 11185, facetItem.QueryParameter, 11185, 25, false);
267                 EndWriteAttribute();
268                 BeginWriteAttribute("value", " value=\"", 11211, "\"", 11239, 3);
269                 WriteAttributeValue("", 11219, "[", 11219, 1, true);
270                 WriteAttributeValue("", 11220, facetOption.Value, 11220, 18, false);
271                 WriteAttributeValue("", 11238, "]", 11238, 1, true);
272                 EndWriteAttribute();
273                 WriteLiteral(">\r\n");
274                 														}
275     													}
276     												}
277     											}
278     										}
279                 WriteLiteral("\r\n");
280                                                          if (!string.IsNullOrEmpty(searchQuery))
281     										{
282                 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"q\"");
283                 BeginWriteAttribute("value", " value=\"", 11425, "\"", 11445, 1);
284                 WriteAttributeValue("", 11433, searchQuery, 11433, 12, false);
285                 EndWriteAttribute();
286                 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"SearchLayout\"");
287                 BeginWriteAttribute("value", " value=\"", 11500, "\"", 11521, 1);
288                 WriteAttributeValue("", 11508, searchLayout, 11508, 13, false);
289                 EndWriteAttribute();
290                 WriteLiteral(">\r\n");
291                 										}
292                 WriteLiteral("\r\n");
293                                                          if (!string.IsNullOrEmpty(mainProductId))
294     										{
295                 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"MainProductID\"");
296                 BeginWriteAttribute("value", " value=\"", 11659, "\"", 11681, 1);
297                 WriteAttributeValue("", 11667, mainProductId, 11667, 14, false);
298                 EndWriteAttribute();
299                 WriteLiteral(">\r\n");
300                 										}
301                 WriteLiteral("\r\n");
302                                                          if (productList?.Group?.Id != null)
303     										{
304                 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"GroupId\"");
305                 BeginWriteAttribute("value", " value=\"", 11807, "\"", 11823, 1);
306                 WriteAttributeValue("", 11815, groupId, 11815, 8, false);
307                 EndWriteAttribute();
308                 WriteLiteral(">\r\n");
309                 										}
310                 WriteLiteral("\r\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"OriginalPageSize\"");
311                 BeginWriteAttribute("value", " value=\"", 11896, "\"", 11920, 1);
312                 WriteAttributeValue("", 11904, pageSizeSetting, 11904, 16, false);
313                 EndWriteAttribute();
314                 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"PageSize\"");
315                 BeginWriteAttribute("value", " value=\"", 11970, "\"", 12013, 1);
316                 WriteAttributeValue("", 11978, loadedProducts + pageSizeSetting, 11978, 35, false);
317                 EndWriteAttribute();
318                 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"PageNum\"");
319                 BeginWriteAttribute("value", " value=\"", 12062, "\"", 12081, 1);
320                 WriteAttributeValue("", 12070, pageNumber, 12070, 11, false);
321                 EndWriteAttribute();
322                 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"SortBy\"");
323                 BeginWriteAttribute("value", " value=\"", 12129, "\"", 12153, 1);
324                 WriteAttributeValue("", 12137, sortBySelection, 12137, 16, false);
325                 EndWriteAttribute();
326                 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"RequestType\" value=\"UpdateList\">\r\n\t\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"ParagraphID\"");
327                 BeginWriteAttribute("value", " value=\"", 12277, "\"", 12294, 1);
328                 WriteAttributeValue("", 12285, Model.ID, 12285, 9, false);
329                 EndWriteAttribute();
330                 WriteLiteral(">\r\n\r\n");
331                                                          if (productList?.FacetGroups is object)
332     										{
333     											string nextPageLink = $"/Default.aspx?ID={Model.PageID}&PageNum={pageNumber}&SortBy={sortBySelection}";
334     
335     											foreach (FacetGroupViewModel facetGroup in productList.FacetGroups)
336     											{
337     												foreach (FacetViewModel facetItem in facetGroup.Facets)
338     												{
339     													foreach (FacetOptionViewModel facetOption in facetItem.Options)
340     													{
341     														if (facetOption.Selected)
342     														{
343     															nextPageLink += "&" + facetItem.QueryParameter + "=[" + facetOption.Value + "]";
344     														}
345     													}
346     												}
347     											}
348     
349     											nextPageLink += !string.IsNullOrEmpty(searchQuery) ? "&q=" + searchQuery : "";
350     
351                 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<a");
352                 BeginWriteAttribute("href", " href=\"", 13080, "\"", 13100, 1);
353                 WriteAttributeValue("", 13087, nextPageLink, 13087, 13, false);
354                 EndWriteAttribute();
355                 WriteLiteral(" class=\"btn btn-primary swift_load_more_button\" data-dw-button=\"primary\" onclick=\"swift.ProductList.Update(event)\"");
356                 BeginWriteAttribute("id", " id=\"", 13215, "\"", 13244, 2);
357                 WriteAttributeValue("", 13220, "LoadMoreButton_", 13220, 15, true);
358                 WriteAttributeValue("", 13235, Model.ID, 13235, 9, false);
359                 EndWriteAttribute();
360                 WriteLiteral(">");
361                                                                                                                                                                                                                                Write(Translate("Load more products"));
362                 WriteLiteral("</a>\r\n");
363                 										}
364                 WriteLiteral("\t\t\t\t\t\t\t\t\t</form>\r\n");
365                 								}
366                 WriteLiteral("\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n");
367                 WriteLiteral(@"						<script>
368     							function switchVariantProduct(id, price, imagesrc) {
369     								var productImageElement = document.querySelector(""#ProductImage_"" + id);
370     								var productPriceElement = document.querySelector(""#ProductPrice_"" + id + "" .text-price"");
371     
372     								if (productPriceElement) {
373     									productPriceElement.innerText = price;
374     								}
375     
376     								if (productImageElement) {
377     									productImageElement.src = imagesrc;
378     
379     									var imageSrcset = productImageElement.srcset;
380     									imageSrcset = imageSrcset.replace(/image=.*?&/g, 'image=' + imagesrc + ""&"");
381     
382     									productImageElement.srcset = imageSrcset;
383     								}
384     							}
385     						</script>
386     ");
387                 					}
388     					else if (Pageview.IsVisualEditorMode)
389     					{
390                 WriteLiteral("\t\t\t\t\t\t<div class=\"alert alert-dark m-0\" role=\"alert\">\r\n\t\t\t\t\t\t\t<span>");
391                                              Write(Translate("The selected component does not exist anymore"));
392                 WriteLiteral("</span>\r\n\t\t\t\t\t\t</div>\r\n");
393                 					}
394     					
395     				}                 
396     			}
397     			else
398     			{
399     				string? noProductsFoundMessage = Model.Item?.GetString("NoProductsFoundMessage") ?? Translate("We did not find anything matching your search result");
400     				bool hasSubgroups = false;
401     
402     				if (productList?.SubGroups != null)
403     				{
404     					hasSubgroups = productList.SubGroups.Any();
405     				}
406     
407     				if (Model.Item is not null && !Model.Item.GetBoolean("HideNoProductsFoundMessage"))
408     				{
409     					if (!isVisualEditor)
410     					{
411                 WriteLiteral("\t\t\t\t\t\t<div class=\"alert alert-dark m-0\" role=\"alert\">\r\n\t\t\t\t\t\t\t");
412                                        Write(noProductsFoundMessage);
413                 WriteLiteral("\r\n\t\t\t\t\t\t</div>\r\n");
414                 					}
415     					else
416     					{
417                 WriteLiteral("\t\t\t\t\t\t<div class=\"alert alert-dark m-0\" role=\"alert\">\r\n\t\t\t\t\t\t\t");
418                                        Write(Translate("Product list: The list will be shown here, if any"));
419                 WriteLiteral("\r\n\t\t\t\t\t\t</div>\r\n");
420                 					}
421     				}
422     				else if (!hasSubgroups)
423     				{
424                 WriteLiteral("\t\t\t\t\t<div class=\"alert alert-dark m-0\" role=\"alert\">\r\n\t\t\t\t\t\t");
425                                    Write(noProductsFoundMessage);
426                 WriteLiteral("\r\n\t\t\t\t\t</div>\r\n");
427                 				}
428     			}
429     		WriteLiteral("\t</div>\r\n");
430                 }
431     else if (Pageview.IsVisualEditorMode)
432     {
433                 WriteLiteral("\t<div class=\"alert alert-dark m-0\" role=\"alert\">\r\n\t\t<span>");
434                          Write(Translate("Product list item repeater: The repeater paragraph will be shown here, if any products are available"));
435                 WriteLiteral("</span>\r\n\t</div>\r\n");
436                 }
437             }
438             #pragma warning restore 1998
439                         
440     	private LinkViewModel GetLink(Dynamicweb.Ecommerce.Products.Group group)
441     	{
442     		var link = new LinkViewModel()
443     			{
444     				Url = $"/Default.aspx?ID={GetPageIdByNavigationTag("Shop")}&GroupID={group.Id.Trim()}",
445     				IsExternal = false
446     			};
447     
448     		return link;
449     	}
450     
451     	private int GetGroupProductsCount(string groupId, ProductListViewModel productList)
452     	{
453     		int count = 0;
454     
455     		foreach (FacetGroupViewModel facetGroup in productList.FacetGroups)
456     		{
457     			foreach (FacetViewModel facet in facetGroup.Facets)
458     			{
459     				if (facet.Options.Count() > 0)
460     				{
461     
462     					foreach (FacetOptionViewModel option in facet.Options.Where(p => p.Value == groupId))
463     					{
464     						count += Converter.ToInt32(option.Count);
465     					}
466     				}
467     			}
468     		}
469     
470     		return count;
471     	}
472         }
473     }
474     #pragma warning restore 1591
475     
  1     @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
  2     @using Dynamicweb.Ecommerce.ProductCatalog
  3     @using Dynamicweb.Core
  4     @using Dynamicweb.Core.Encoders
  5     @using Dynamicweb.Frontend
  6     
  7     @{
  8     	int productsCount = 0;
  9     	int maxProductsCounter = 0;
 10     
 11     	ProductListViewModel? productList = null;
 12     	if (Dynamicweb.Context.Current is not null && Dynamicweb.Context.Current.Items.Contains("ProductList"))
 13     	{
 14     		productList = (ProductListViewModel?)Dynamicweb.Context.Current.Items["ProductList"];
 15     	}
 16     	else if (Pageview.Page?.Item?["DummyProductGroup"] != null && Pageview.IsVisualEditorMode)
 17     	{
 18     		var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page);
 19     		ProductListViewModel? groupList = pageViewModel.Item?.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel();
 20     
 21     		if (groupList?.Products is object)
 22     		{
 23     			productList = groupList;
 24     		}
 25     	}
 26     }
 27     
 28     @*Custom functions*@
 29     @functions {
 30     	private LinkViewModel GetLink(Dynamicweb.Ecommerce.Products.Group group)
 31     	{
 32     		var link = new LinkViewModel()
 33     			{
 34     				Url = $"/Default.aspx?ID={GetPageIdByNavigationTag("Shop")}&GroupID={group.Id.Trim()}",
 35     				IsExternal = false
 36     			};
 37     
 38     		return link;
 39     	}
 40     
 41     	private int GetGroupProductsCount(string groupId, ProductListViewModel productList)
 42     	{
 43     		int count = 0;
 44     
 45     		foreach (FacetGroupViewModel facetGroup in productList.FacetGroups)
 46     		{
 47     			foreach (FacetViewModel facet in facetGroup.Facets)
 48     			{
 49     				if (facet.Options.Count() > 0)
 50     				{
 51     
 52     					foreach (FacetOptionViewModel option in facet.Options.Where(p => p.Value == groupId))
 53     					{
 54     						count += Converter.ToInt32(option.Count);
 55     					}
 56     				}
 57     			}
 58     		}
 59     
 60     		return count;
 61     	}
 62     }
 63     
 64     @if (productList is not null)
 65     {
 66     	<div class="h-100 product-list" data-dw-colorscheme="@Model.ColorScheme?.Id">
 67     		@{
 68     			bool isVisualEditor = !string.IsNullOrEmpty(Dynamicweb.Context.Current?.Request.QueryString.Get("VisualEdit")) ? Convert.ToBoolean(Dynamicweb.Context.Current.Request.QueryString.Get("VisualEdit")) : false;
 69     
 70     			string groupId = productList?.Group?.Id != null ? productList.Group.Id : "";
 71     
 72     			if (productList?.TotalProductsCount > 0)
 73     			{
 74     				int pageSizeSetting = Converter.ToInt32(Dynamicweb.Context.Current?.Request.QueryString.Get("OriginalPageSize")) > 0 ? Converter.ToInt32(Dynamicweb.Context.Current.Request.QueryString.Get("OriginalPageSize")) : productList.PageSize;
 75     				int pageNumber = Converter.ToInt32(Dynamicweb.Context.Current?.Request.QueryString.Get("PageNum")) > 0 ? Converter.ToInt32(Dynamicweb.Context.Current.Request.QueryString.Get("PageNum")) : productList.CurrentPage;
 76     				int pageSize = Converter.ToInt32(Dynamicweb.Context.Current?.Request.QueryString.Get("PageSize")) > 0 ? Converter.ToInt32(Dynamicweb.Context.Current.Request.QueryString.Get("PageSize")) : productList.PageSize;
 77     				pageNumber = pageSize != pageSizeSetting ? (pageSize / pageSizeSetting) : pageNumber;
 78     				int loadedProducts = productList.PageSize > productList.TotalProductsCount ? productList.TotalProductsCount : pageSizeSetting * pageNumber;
 79     				loadedProducts = loadedProducts > productList.TotalProductsCount ? productList.TotalProductsCount : loadedProducts;
 80     
 81     				pageNumber += 1;
 82     
 83     				string? searchQuery = Dynamicweb.Context.Current?.Request["q"];
 84     
 85     				string? searchLayout = Dynamicweb.Context.Current?.Request.QueryString.Get("SearchLayout");
 86     
 87     				@*Custom render group list if rendertype is GroupList*@
 88     				var pageRenderLayout = Custom.AVN.Facets.Helpers.ProductGroupHelper.PageContainerRenderLayout(groupId, Dynamicweb.Ecommerce.Common.Context.LanguageID, !string.IsNullOrEmpty(searchQuery));
 89     				@if (pageRenderLayout == Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts.GroupList)
 90     				{
 91     					var subGroups = Custom.AVN.Facets.Helpers.ProductGroupHelper.GetSubGroups(groupId, Dynamicweb.Ecommerce.Common.Context.LanguageID);
 92     					@if (subGroups.Any())
 93     					{
 94     						<div class="group-list">
 95     							@foreach (var group in subGroups)
 96     							{
 97     								var link = GetLink(group);
 98     
 99     								var count = GetGroupProductsCount(group.Id, productList);
100     
101     								if (count > 0)
102     								{
103     									<div class="grid g-col-12 mb-3 gap-0">
104     										<div class="g-col-2 group-list__list-item__left-wrapper">
105     											<a href="@link" title="">
106     												<img class="object-fit-contain w-100" src="/Admin/Public/GetImage.ashx?width=680&height=314&crop=5&DoNotUpscale=True&Compression=75&image=@group.LargeImage" alt="@HtmlEncoder.HtmlAttributeEncode(group.Name)" />
107     											</a>
108     										</div>
109     										<div class="g-col-7 group-list__list-item__middle-wrapper dw-mod">
110     											<a class="text-decoration-none" href="@link" title="@HtmlEncoder.HtmlAttributeEncode(group.Name)">
111     												<h5>@group.Name</h5>
112     												<p>@group.Description</p>
113     											</a>
114     										</div>
115     										<div class="g-col-3 group-list__list-item__right-wrapper dw-mod">
116     											<a href="@link" class="btn btn-primary" data-swift-btn="primary" title="">@string.Format(Translate("Custom:ViewList.ListViewItem.GroupList.ShowProducts.", "Vis {0} produkter"), count)</a>
117     										</div>
118     									</div>
119     								}
120     							}						
121     						</div>
122     					}
123     				}
124     				else if (pageRenderLayout == Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts.ProductList)
125     				{
126     					int itemSourcePageId = Convert.ToInt32(Model.Item?.GetRawValueString("ListComponentSource", "0"));
127     					itemSourcePageId = Dynamicweb.Content.Services.Pages.GetPageOrLanguage(itemSourcePageId, Pageview.AreaID)?.ID ?? itemSourcePageId;
128     
129     					var page = Dynamicweb.Content.Services.Pages.GetPage(itemSourcePageId);
130     
131     					if (page != null)
132     					{
133     						var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(page);
134     
135     						string? gridColumnSize = Model.Item?.GetRawValueString("GridLayoutDesktop", "3-columns");
136     						gridColumnSize = gridColumnSize == "2-columns" ? "g-col-lg-6" : gridColumnSize;
137     						gridColumnSize = gridColumnSize == "3-columns" ? "g-col-lg-4" : gridColumnSize;
138     						gridColumnSize = gridColumnSize == "4-columns" ? "g-col-lg-3" : gridColumnSize;
139     						gridColumnSize = gridColumnSize == "6-columns" ? "g-col-lg-2" : gridColumnSize;
140     						gridColumnSize = gridColumnSize == "list" ? "g-col-lg-12" : gridColumnSize;
141     
142     						string? gridColumnMobileSize = Model.Item?.GetRawValueString("GridLayoutMobile", "2-columns");
143     						gridColumnMobileSize = gridColumnMobileSize == "list" ? "g-col-12" : gridColumnMobileSize;
144     						gridColumnMobileSize = gridColumnMobileSize == "2-columns" ? "g-col-6" : gridColumnMobileSize;
145     
146     						<div class="grid pb-3">
147     							<script>
148     								gtag("event", "view_item_list", {
149     									item_list_id: "product_list_item_repeater",
150     									item_list_name: "Product list (Item Repeater)",
151     									items: [
152     										@foreach (ProductViewModel product in productList.Products)
153     										{
154     											<text>{
155     												item_id: "@product.Number",
156     												item_name: "@Dynamicweb.Core.Encoders.HtmlEncoder.JavaScriptStringEncode(product.Name)",
157     												currency: "@product.Price.CurrencyCode",
158     												price: @product.Price.ToStringInvariant(),
159     												discount: @product.Discount.ToStringInvariant()
160     											},</text>
161     										}
162     									]
163     								});
164     							</script>
165     
166     							@foreach (ProductViewModel product in productList.Products)
167     							{
168     								if (maxProductsCounter == 0 || (productsCount < maxProductsCounter))
169     								{
170     									string link = product.GetProductLink(GetPageIdByNavigationTag("Shop"), false);
171     
172     									if (Dynamicweb.Context.Current?.Items.Contains("ProductDetails") != null)
173     									{
174     										Dynamicweb.Context.Current.Items["ProductDetails"] = product;
175     									}
176     									else
177     									{
178     										Dynamicweb.Context.Current?.Items.Add("ProductDetails", product);
179     									}
180     
181     									if (Model.Item?.GetString("ListComponentSource") != null)
182     									{
183     										<article class="@gridColumnMobileSize @gridColumnSize d-flex flex-column position-relative product js-product" data-product-id="@product.Id" data-variant-id="@product.VariantId" itemscope itemtype="https://schema.org/Product">
184     											@{
185     												string clickProductLink = "onclick=\"return clickProductLink('" + @product.Id + "', '" + @product.Name + "', '" + @product.VariantName + "', '" + @product.Price.CurrencyCode + "', '" + @product.Price.ToStringInvariant() + "', '" + @product.Discount.ToStringInvariant() + "')\"";
186     											}
187     											<a href="@link" class="stretched-link" onmouseover="swift.Image.swapImage(event)" onmouseout="swift.Image.swapImage(event)" @clickProductLink>
188     												<span class="visually-hidden">@product.Name</span>
189     											</a>
190     										
191     											<script>
192     												function clickProductLink(productId, productName, productVariant, productCurrency, productPrice, productDiscount) {
193     													if (typeof gtag !== "undefined") {
194     														gtag("event", "select_item", {
195     															item_list_id: "product_list_item_repeater",
196     															item_list_name: "Product list (Item Repeater)",
197     															items: [
198     																{
199     																	item_id: productId,
200     																	item_name: productName,
201     																	currency: productCurrency,
202     																	item_list_id: "product_list_item_repeater",
203     																	item_list_name: "Product list (Item Repeater)",
204     																	item_variant: productVariant,
205     																	price: productPrice,
206     																	discount: productDiscount
207     																}
208     															]
209     														});
210     													}
211     												}
212     											</script>
213     
214     											@RenderGrid(itemSourcePageId)
215     										</article>
216     									}
217     
218     									productsCount++;
219     								}
220     							}
221     						</div>
222     
223     						<div class="my-3" id="ProductListLoadMore">
224     							<div class="text-center">
225     								<div class="opacity-85 mb-3">@loadedProducts @Translate("out of") @productList.TotalProductsCount @Translate("products")</div>
226     								@if (productList.PageCount != 1 && maxProductsCounter == 0 && loadedProducts < productList.TotalProductsCount)
227     								{
228     									string? sortBySelection = Dynamicweb.Context.Current?.Request.Form["SortBy"] ?? "";
229     									sortBySelection = Dynamicweb.Context.Current?.Request.QueryString.Get("SortBy") ?? sortBySelection;
230     									string? mainProductId = Dynamicweb.Context.Current?.Request.QueryString.Get("MainProductID");
231     
232     									<form method="get" data-response-target-element=".product-list" data-swap="afterend" class="w-100">
233     										@if (productList?.FacetGroups != null)
234     										{
235     											foreach (FacetGroupViewModel facetGroup in productList.FacetGroups)
236     											{
237     												foreach (FacetViewModel facetItem in facetGroup.Facets)
238     												{
239     													foreach (FacetOptionViewModel facetOption in facetItem.Options)
240     													{
241     														if (facetOption.Selected)
242     														{
243     															<input type="hidden" name="@facetItem.QueryParameter" value="[@facetOption.Value]">
244     														}
245     													}
246     												}
247     											}
248     										}
249     
250     										@if (!string.IsNullOrEmpty(searchQuery))
251     										{
252     											<input type="hidden" name="q" value="@searchQuery">
253     											<input type="hidden" name="SearchLayout" value="@searchLayout">
254     										}
255     
256     										@if (!string.IsNullOrEmpty(mainProductId))
257     										{
258     											<input type="hidden" name="MainProductID" value="@mainProductId">
259     										}
260     
261     										@if (productList?.Group?.Id != null)
262     										{
263     											<input type="hidden" name="GroupId" value="@groupId">
264     										}
265     
266     										<input type="hidden" name="OriginalPageSize" value="@pageSizeSetting">
267     										<input type="hidden" name="PageSize" value="@(loadedProducts + pageSizeSetting)">
268     										<input type="hidden" name="PageNum" value="@pageNumber">
269     										<input type="hidden" name="SortBy" value="@sortBySelection">
270     										<input type="hidden" name="RequestType" value="UpdateList">
271     										<input type="hidden" name="ParagraphID" value="@Model.ID">
272     
273     										@if (productList?.FacetGroups is object)
274     										{
275     											string nextPageLink = $"/Default.aspx?ID={Model.PageID}&PageNum={pageNumber}&SortBy={sortBySelection}";
276     
277     											foreach (FacetGroupViewModel facetGroup in productList.FacetGroups)
278     											{
279     												foreach (FacetViewModel facetItem in facetGroup.Facets)
280     												{
281     													foreach (FacetOptionViewModel facetOption in facetItem.Options)
282     													{
283     														if (facetOption.Selected)
284     														{
285     															nextPageLink += "&" + facetItem.QueryParameter + "=[" + facetOption.Value + "]";
286     														}
287     													}
288     												}
289     											}
290     
291     											nextPageLink += !string.IsNullOrEmpty(searchQuery) ? "&q=" + searchQuery : "";
292     
293     											<a href="@nextPageLink" class="btn btn-primary swift_load_more_button" data-dw-button="primary" onclick="swift.ProductList.Update(event)" id="LoadMoreButton_@Model.ID">@Translate("Load more products")</a>
294     										}
295     									</form>
296     								}
297     							</div>
298     						</div>
299     
300     						<script>
301     							function switchVariantProduct(id, price, imagesrc) {
302     								var productImageElement = document.querySelector("#ProductImage_" + id);
303     								var productPriceElement = document.querySelector("#ProductPrice_" + id + " .text-price");
304     
305     								if (productPriceElement) {
306     									productPriceElement.innerText = price;
307     								}
308     
309     								if (productImageElement) {
310     									productImageElement.src = imagesrc;
311     
312     									var imageSrcset = productImageElement.srcset;
313     									imageSrcset = imageSrcset.replace(/image=.*?&/g, 'image=' + imagesrc + "&");
314     
315     									productImageElement.srcset = imageSrcset;
316     								}
317     							}
318     						</script>
319     					}
320     					else if (Pageview.IsVisualEditorMode)
321     					{
322     						<div class="alert alert-dark m-0" role="alert">
323     							<span>@Translate("The selected component does not exist anymore")</span>
324     						</div>
325     					}
326     					
327     				}
328     			}
329     			else
330     			{
331     				string? noProductsFoundMessage = Model.Item?.GetString("NoProductsFoundMessage") ?? Translate("We did not find anything matching your search result");
332     				bool hasSubgroups = false;
333     
334     				if (productList?.SubGroups != null)
335     				{
336     					hasSubgroups = productList.SubGroups.Any();
337     				}
338     
339     				if (Model.Item is not null && !Model.Item.GetBoolean("HideNoProductsFoundMessage"))
340     				{
341     					if (!isVisualEditor)
342     					{
343     						<div class="alert alert-dark m-0" role="alert">
344     							@noProductsFoundMessage
345     						</div>
346     					}
347     					else
348     					{
349     						<div class="alert alert-dark m-0" role="alert">
350     							@Translate("Product list: The list will be shown here, if any")
351     						</div>
352     					}
353     				}
354     				else if (!hasSubgroups)
355     				{
356     					<div class="alert alert-dark m-0" role="alert">
357     						@noProductsFoundMessage
358     					</div>
359     				}
360     			}
361     		}
362     	</div>
363     }
364     else if (Pageview.IsVisualEditorMode)
365     {
366     	<div class="alert alert-dark m-0" role="alert">
367     		<span>@Translate("Product list item repeater: The repeater paragraph will be shown here, if any products are available")</span>
368     	</div>
369     }
370