Pneumatic cylinder 10A-6L series that securely locks the piston rod in an emergency with a safety lock mechanism. The tie rod construction guarantees long cylinder life with excellent design and quality without trouble.
Error compiling template "Designs/Swift-v2/Paragraph/Swift-v2_ProductGroupGrid.cshtml" Line 238: 'GroupService.GetGroup(string)' is obsolete: 'Use GetGroup(string groupId, string languageId) instead' Line 268: 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 269: The type or namespace name 'AVN' does not exist in the namespace 'Custom' (are you missing an assembly reference?) Line 269: The type or namespace name 'AVN' does not exist in the namespace 'Custom' (are you missing an assembly reference?) Line 270: The type or namespace name 'AVN' does not exist in the namespace 'Custom' (are you missing an assembly reference?) Line 303: 'GroupService.GetGroup(string)' is obsolete: 'Use GetGroup(string groupId, string languageId) instead'
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; 11 using Dynamicweb.Ecommerce.ProductCatalog; 12 using Dynamicweb.Frontend; 13 internal class RazorEngine_7e9fd51c6aa942ec8eead54dff455a06 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 14 { 15 #pragma warning disable 1998 16 public async override global::System.Threading.Tasks.Task ExecuteAsync() 17 { 18 WriteLiteral("\r\n"); 19 WriteLiteral("\r\n"); 20 21 string groupType = Model.Item.GetRawValueString("GroupType", "subgroups"); 22 var groups = GetGroups(groupType); 23 24 bool hideHeaders = (Model.Item?.GetBoolean("HideHeaders") ?? false); 25 string title = Model.Item?.GetString("Title", string.Empty); 26 string subtitle = Model.Item?.GetString("Subtitle", string.Empty); 27 bool groupsExist = groups is object && groups.Count != 0; 28 29 // Grid layout 30 string gridSize = Model.Item.GetRawValueString("GridSize", "3"); 31 string gridSizeMobile = Model.Item.GetRawValueString("GridSizeMobile", "1"); 32 gridSize = $"grid-{gridSizeMobile} grid-sm-3 grid-lg-{gridSize}"; 33 34 string itemsGap = $"gap-{Model.Item.GetRawValueString("GridItemsGap", "3")}"; 35 string layout = Model.Item.GetRawValueString("Layout", "overlay"); 36 37 // Styling 38 string ratio = Model.Item.GetRawValueString("ImageAspectRatio", string.Empty); 39 ratio = ratio != "0" ? ratio : string.Empty; 40 string ratioCssClass = ratio != string.Empty ? "ratio" : string.Empty; 41 string ratioVariable = ratio != string.Empty ? "--bs-aspect-ratio: " + ratio : string.Empty; 42 43 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h3"); 44 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 45 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty); 46 maxWidth = maxWidth == "max-width-on" ? "mw-75ch" : string.Empty; 47 48 string buttonAlignment = GetButtonAlignment(); 49 50 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", "primary"); 51 52 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 53 buttonSize = buttonSize == "small" ? "btn btn-sm" : buttonSize; 54 buttonSize = buttonSize == "regular" ? "btn" : buttonSize; 55 buttonSize = buttonSize == "large" ? "btn btn-lg" : buttonSize; 56 57 string stretchedLink = "stretched-link"; 58 59 string imageShape = GetImageShape(); 60 string missingImageMarkup = $"<div class=\"bg-opacity-10 {imageShape}\" style=\"background-color:rgba(var(--swift-foreground-color-rgb),var(--bs-bg-opacity));\"></div>"; 61 WriteLiteral("\r\n"); 62 if (groupsExist) 63 { 64 WriteLiteral("\t<div"); 65 BeginWriteAttribute("class", " class=\"", 6692, "\"", 6750, 4); 66 WriteAttributeValue("", 6700, "grid", 6700, 4, true); 67 WriteAttributeValue(" ", 6704, "gap-0", 6705, 6, true); 68 WriteAttributeValue(" ", 6710, "item_", 6711, 6, true); 69 WriteAttributeValue("", 6716, Model.Item.SystemName.ToLower(), 6716, 34, false); 70 EndWriteAttribute(); 71 WriteLiteral(">\r\n\t\t\r\n"); 72 if (!hideHeaders) 73 { 74 WriteLiteral("\t\t\t<div class=\"g-col-12 pb-2 pb-lg-4\">\r\n\t\t\t\t<div class=\"mb-0-last-child\">\r\n"); 75 if (!string.IsNullOrEmpty(title)) 76 { 77 WriteLiteral("\t\t\t\t\t\t<h2"); 78 BeginWriteAttribute("class", " class=\"", 6918, "\"", 6955, 3); 79 WriteAttributeValue("", 6926, "mt-0", 6926, 4, true); 80 WriteAttributeValue(" ", 6930, titleFontSize, 6931, 14, false); 81 WriteAttributeValue(" ", 6945, maxWidth, 6946, 9, false); 82 EndWriteAttribute(); 83 WriteLiteral(">"); 84 Write(title); 85 WriteLiteral("</h2>\r\n"); 86 } 87 WriteLiteral("\r\n"); 88 if (!string.IsNullOrEmpty(subtitle)) 89 { 90 WriteLiteral("\t\t\t\t\t\t<p"); 91 BeginWriteAttribute("class", " class=\"", 7040, "\"", 7075, 2); 92 WriteAttributeValue("", 7048, subtitleFontSize, 7048, 17, false); 93 WriteAttributeValue(" ", 7065, maxWidth, 7066, 9, false); 94 EndWriteAttribute(); 95 WriteLiteral(">"); 96 Write(subtitle); 97 WriteLiteral("</p>\r\n"); 98 } 99 WriteLiteral("\t\t\t\t</div>\r\n\t\t\t</div>\r\n"); 100 } 101 WriteLiteral("\r\n\t\t<div"); 102 BeginWriteAttribute("class", " class=\"", 7136, "\"", 7177, 4); 103 WriteAttributeValue("", 7144, "g-col-12", 7144, 8, true); 104 WriteAttributeValue(" ", 7152, "grid", 7153, 5, true); 105 WriteAttributeValue(" ", 7157, gridSize, 7158, 9, false); 106 WriteAttributeValue(" ", 7167, itemsGap, 7168, 9, false); 107 EndWriteAttribute(); 108 WriteLiteral(">\r\n"); 109 foreach (var group in groups) 110 { 111 string groupImageMarkup = GetGroupImageMarkup(group, imageShape) ?? missingImageMarkup; 112 bool groupImage = !string.IsNullOrEmpty(groupImageMarkup); 113 114 WriteLiteral("\t\t\t\t<div class=\"d-flex flex-column h-100\">\r\n"); 115 116 switch (layout) 117 { 118 case "overlay": 119 WriteLiteral("\t\t\t\t\t\t\t\t<div"); 120 BeginWriteAttribute("class", " class=\"", 7502, "\"", 7550, 4); 121 WriteAttributeValue("", 7510, "card", 7510, 4, true); 122 WriteAttributeValue(" ", 7514, "rounded-0", 7515, 10, true); 123 WriteAttributeValue(" ", 7524, "border-0", 7525, 9, true); 124 WriteAttributeValue(" ", 7533, ratioCssClass, 7534, 16, false); 125 EndWriteAttribute(); 126 BeginWriteAttribute("style", " style=\"", 7551, "\"", 7573, 1); 127 WriteAttributeValue("", 7559, ratioVariable, 7559, 14, false); 128 EndWriteAttribute(); 129 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t"); 130 Write(groupImage ? groupImageMarkup : missingImageMarkup); 131 WriteLiteral("\r\n\r\n\t\t\t\t\t\t\t\t\t<div"); 132 BeginWriteAttribute("class", " class=\"", 7667, "\"", 7702, 3); 133 WriteAttributeValue("", 7675, "d-grid", 7675, 6, true); 134 WriteAttributeValue(" ", 7681, "p-3", 7682, 4, true); 135 WriteAttributeValue(" ", 7685, buttonAlignment, 7686, 16, false); 136 EndWriteAttribute(); 137 WriteLiteral(">\r\n"); 138 if (GetLink(group) is object) 139 { 140 bool openLinksInNewTab = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && GetLink(group).IsExternal; 141 string target = openLinksInNewTab ? "target=\"_blank\"" : string.Empty; 142 string rel = openLinksInNewTab ? "rel=\"noopener\"" : string.Empty; 143 144 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<a"); 145 BeginWriteAttribute("href", " href=\"", 8061, "\"", 8083, 1); 146 WriteAttributeValue("", 8068, GetLink(group), 8068, 15, false); 147 EndWriteAttribute(); 148 BeginWriteAttribute("class", " class=\"", 8084, "\"", 8139, 4); 149 WriteAttributeValue("", 8092, buttonSize, 8092, 13, false); 150 WriteAttributeValue(" ", 8105, "btn-", 8106, 5, true); 151 WriteAttributeValue("", 8110, buttonStyle, 8110, 12, false); 152 WriteAttributeValue(" ", 8122, stretchedLink, 8123, 16, false); 153 EndWriteAttribute(); 154 WriteLiteral(" data-dw-button=\""); 155 Write(buttonStyle); 156 WriteLiteral("\" "); 157 Write(target); 158 WriteLiteral(" "); 159 Write(rel); 160 WriteLiteral(">"); 161 Write(group.Name); 162 WriteLiteral("</a>\r\n"); 163 } 164 WriteLiteral("\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t</div>\r\n"); 165 break; 166 case "below": 167 WriteLiteral("\t\t\t\t\t\t\t\t<div class=\"card rounded-0 border-0 gap-3\">\r\n\r\n\t\t\t\t\t\t\t\t\t<div"); 168 BeginWriteAttribute("class", " class=\"", 8353, "\"", 8377, 1); 169 WriteAttributeValue("", 8361, ratioCssClass, 8361, 16, false); 170 EndWriteAttribute(); 171 BeginWriteAttribute("style", " style=\"", 8378, "\"", 8400, 1); 172 WriteAttributeValue("", 8386, ratioVariable, 8386, 14, false); 173 EndWriteAttribute(); 174 WriteLiteral(">\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t"); 175 Write(groupImage ? groupImageMarkup : missingImageMarkup); 176 WriteLiteral("\r\n\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t<div"); 177 BeginWriteAttribute("class", " class=\"", 8515, "\"", 8585, 3); 178 WriteAttributeValue("", 8523, groupImage ? "h-100" : string.Empty, 8523, 38, false); 179 WriteAttributeValue(" ", 8561, "d-grid", 8562, 7, true); 180 WriteAttributeValue(" ", 8568, buttonAlignment, 8569, 16, false); 181 EndWriteAttribute(); 182 WriteLiteral(">\r\n\r\n"); 183 if (GetLink(group) is object) 184 { 185 bool openLinksInNewTab = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && GetLink(group).IsExternal; 186 string target = openLinksInNewTab ? "target=\"_blank\"" : string.Empty; 187 string rel = openLinksInNewTab ? "rel=\"noopener\"" : string.Empty; 188 189 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<a"); 190 BeginWriteAttribute("href", " href=\"", 8946, "\"", 8968, 1); 191 WriteAttributeValue("", 8953, GetLink(group), 8953, 15, false); 192 EndWriteAttribute(); 193 BeginWriteAttribute("class", " class=\"", 8969, "\"", 9024, 4); 194 WriteAttributeValue("", 8977, buttonSize, 8977, 13, false); 195 WriteAttributeValue(" ", 8990, "btn-", 8991, 5, true); 196 WriteAttributeValue("", 8995, buttonStyle, 8995, 12, false); 197 WriteAttributeValue(" ", 9007, stretchedLink, 9008, 16, false); 198 EndWriteAttribute(); 199 WriteLiteral(" data-dw-button=\""); 200 Write(buttonStyle); 201 WriteLiteral("\" "); 202 Write(target); 203 WriteLiteral(" "); 204 Write(rel); 205 WriteLiteral(">"); 206 Write(group.Name); 207 WriteLiteral("</a>\r\n"); 208 } 209 WriteLiteral("\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t</div>\r\n"); 210 break; 211 } 212 WriteLiteral("\t\t\t\t</div>\r\n"); 213 } 214 WriteLiteral("\t\t</div>\r\n\t</div>\r\n"); 215 } 216 else if (Pageview.IsVisualEditorMode) 217 { 218 WriteLiteral("\t<div class=\"alert alert-dark\" role=\"alert\">\r\n\t\t<span>"); 219 Write(Translate("Group grid")); 220 WriteLiteral(": "); 221 Write(Translate("Edit this column to configure")); 222 WriteLiteral("</span>\r\n\t</div>\r\n"); 223 } 224 } 225 #pragma warning restore 1998 226 227 private IList<ProductGroupViewModel> GetGroups(string type) 228 { 229 IList<ProductGroupViewModel> groupList = new List<ProductGroupViewModel> { }; 230 231 if (type == "subgroups") 232 { 233 IList<ProductGroupViewModel> groups = Model.Item.GetValue<IList<ProductGroupViewModel>>("Subgroups"); 234 if (groups != null) 235 { 236 foreach (var group in groups) 237 { 238 var subGroups = Services.ProductGroups.GetSubgroups(Services.ProductGroups.GetGroup(group.Id)); 239 240 foreach (var subGroup in subGroups) 241 { 242 var subGroupViewModel = ViewModelFactory.CreateView(new ProductGroupViewModelSettings(), subGroup); 243 groupList.Add(subGroupViewModel); 244 } 245 } 246 } 247 } 248 249 if (type == "selected-groups") 250 { 251 IList<ProductGroupViewModel> groups = Model.Item.GetValue<IList<ProductGroupViewModel>>("SelectedGroups"); 252 if (groups != null) 253 { 254 foreach (var group in groups) 255 { 256 groupList.Add(group); 257 } 258 } 259 } 260 261 if (type == "subgroups-current") 262 { 263 var currentGroupId = Dynamicweb.Context.Current.Request.QueryString.Get("GroupID"); 264 265 //Custom: Only render groupgrid if productlist is not rendered as groups 266 if (!string.IsNullOrEmpty(currentGroupId)) 267 { 268 string? searchQuery = Dynamicweb.Context.Current?.Request["q"]; 269 Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts pageRenderLayout = Custom.AVN.Facets.Helpers.ProductGroupHelper.PageContainerRenderLayout(currentGroupId, Dynamicweb.Ecommerce.Common.Context.LanguageID, !string.IsNullOrEmpty(searchQuery)); 270 if (pageRenderLayout != Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts.GroupList) 271 { 272 var currentGroup = Services.ProductGroups.GetGroup(currentGroupId, Dynamicweb.Ecommerce.Common.Context.LanguageID); 273 var groups = currentGroup != null ? Services.ProductGroups.GetSubgroups(currentGroup) : null; 274 if (groups != null) 275 { 276 foreach (var group in groups) 277 { 278 var groupViewModel = ViewModelFactory.CreateView(new ProductGroupViewModelSettings(), group); 279 groupList.Add(groupViewModel); 280 } 281 } 282 } 283 } 284 285 } 286 287 return groupList; 288 } 289 290 private LinkViewModel GetLink(ProductGroupViewModel group) 291 { 292 var link = new LinkViewModel() 293 { 294 Url = $"/Default.aspx?ID={GetPageIdByNavigationTag("Shop")}&GroupID={group.Id.Trim()}", 295 IsExternal = false 296 }; 297 298 return link; 299 } 300 301 private string GetGroupImageMarkup(ProductGroupViewModel group, string imageShape) 302 { 303 string groupImage = Services.ProductGroups.GetGroup(group.Id)?.LargeImage; 304 if (groupImage != null && groupImage.StartsWith("/") && !groupImage.StartsWith("/Files", StringComparison.OrdinalIgnoreCase)) 305 { 306 groupImage = $"/Files{groupImage}"; 307 } 308 309 string groupImageEncoded = Dynamicweb.Context.Current.Server.UrlEncode(groupImage); 310 string groupImagePath = $"/Admin/Public/GetImage.ashx?width=640&crop=0&image={groupImageEncoded}&format=webp"; 311 //Custom image fill 312 string imageFill = Model.Item.GetRawValueString("CustomImageFill", "contain"); 313 string groupImageMarkup = $"<img class=\"{imageShape}\" src=\"{groupImagePath}\" alt=\"{group.Name}\" style=\"object-fit:{imageFill}\">"; 314 315 return !string.IsNullOrEmpty(groupImage) ? groupImageMarkup : string.Empty; 316 } 317 318 private string GetImageShape() 319 { 320 string imageShape = Model.Item.GetRawValueString("ImageShape", "boxed"); 321 switch (imageShape) 322 { 323 case "boxed": 324 imageShape = "rounded-0"; 325 break; 326 case "rounded": 327 imageShape = "rounded-3"; 328 break; 329 case "circle": 330 imageShape = "rounded-pill"; 331 break; 332 } 333 return imageShape; 334 } 335 336 private string GetButtonAlignment() 337 { 338 string buttonAlignment = Model.Item.GetRawValueString("ButtonAlignment", "align-center-center"); 339 340 switch (buttonAlignment) 341 { 342 case "align-center-center": 343 return "text-center justify-content-center align-items-center"; 344 case "align-bottom-start": 345 return "text-start justify-content-start align-items-end"; 346 case "align-bottom-center": 347 return "text-center justify-content-center align-items-end"; 348 case "align-bottom-center-text-center": 349 return "text-center justify-content-center align-items-end"; 350 case "align-bottom-end": 351 return "text-end justify-content-end align-items-end"; 352 default: 353 return "align-center-center"; 354 } 355 } 356 } 357 } 358 #pragma warning restore 1591 359
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce 3 @using Dynamicweb.Ecommerce.ProductCatalog 4 @using Dynamicweb.Frontend 5 6 @functions 7 { 8 private IList<ProductGroupViewModel> GetGroups(string type) 9 { 10 IList<ProductGroupViewModel> groupList = new List<ProductGroupViewModel> { }; 11 12 if (type == "subgroups") 13 { 14 IList<ProductGroupViewModel> groups = Model.Item.GetValue<IList<ProductGroupViewModel>>("Subgroups"); 15 if (groups != null) 16 { 17 foreach (var group in groups) 18 { 19 var subGroups = Services.ProductGroups.GetSubgroups(Services.ProductGroups.GetGroup(group.Id)); 20 21 foreach (var subGroup in subGroups) 22 { 23 var subGroupViewModel = ViewModelFactory.CreateView(new ProductGroupViewModelSettings(), subGroup); 24 groupList.Add(subGroupViewModel); 25 } 26 } 27 } 28 } 29 30 if (type == "selected-groups") 31 { 32 IList<ProductGroupViewModel> groups = Model.Item.GetValue<IList<ProductGroupViewModel>>("SelectedGroups"); 33 if (groups != null) 34 { 35 foreach (var group in groups) 36 { 37 groupList.Add(group); 38 } 39 } 40 } 41 42 if (type == "subgroups-current") 43 { 44 var currentGroupId = Dynamicweb.Context.Current.Request.QueryString.Get("GroupID"); 45 46 //Custom: Only render groupgrid if productlist is not rendered as groups 47 @if (!string.IsNullOrEmpty(currentGroupId)) 48 { 49 string? searchQuery = Dynamicweb.Context.Current?.Request["q"]; 50 Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts pageRenderLayout = Custom.AVN.Facets.Helpers.ProductGroupHelper.PageContainerRenderLayout(currentGroupId, Dynamicweb.Ecommerce.Common.Context.LanguageID, !string.IsNullOrEmpty(searchQuery)); 51 @if (pageRenderLayout != Custom.AVN.Facets.Helpers.ProductGroupHelper.RenderLayouts.GroupList) 52 { 53 var currentGroup = Services.ProductGroups.GetGroup(currentGroupId, Dynamicweb.Ecommerce.Common.Context.LanguageID); 54 var groups = currentGroup != null ? Services.ProductGroups.GetSubgroups(currentGroup) : null; 55 if (groups != null) 56 { 57 foreach (var group in groups) 58 { 59 var groupViewModel = ViewModelFactory.CreateView(new ProductGroupViewModelSettings(), group); 60 groupList.Add(groupViewModel); 61 } 62 } 63 } 64 } 65 66 } 67 68 return groupList; 69 } 70 71 private LinkViewModel GetLink(ProductGroupViewModel group) 72 { 73 var link = new LinkViewModel() 74 { 75 Url = $"/Default.aspx?ID={GetPageIdByNavigationTag("Shop")}&GroupID={group.Id.Trim()}", 76 IsExternal = false 77 }; 78 79 return link; 80 } 81 82 private string GetGroupImageMarkup(ProductGroupViewModel group, string imageShape) 83 { 84 string groupImage = Services.ProductGroups.GetGroup(group.Id)?.LargeImage; 85 if (groupImage != null && groupImage.StartsWith("/") && !groupImage.StartsWith("/Files", StringComparison.OrdinalIgnoreCase)) 86 { 87 groupImage = $"/Files{groupImage}"; 88 } 89 90 string groupImageEncoded = Dynamicweb.Context.Current.Server.UrlEncode(groupImage); 91 string groupImagePath = $"/Admin/Public/GetImage.ashx?width=640&crop=0&image={groupImageEncoded}&format=webp"; 92 //Custom image fill 93 string imageFill = Model.Item.GetRawValueString("CustomImageFill", "contain"); 94 string groupImageMarkup = $"<img class=\"{imageShape}\" src=\"{groupImagePath}\" alt=\"{group.Name}\" style=\"object-fit:{imageFill}\">"; 95 96 return !string.IsNullOrEmpty(groupImage) ? groupImageMarkup : string.Empty; 97 } 98 99 private string GetImageShape() 100 { 101 string imageShape = Model.Item.GetRawValueString("ImageShape", "boxed"); 102 switch (imageShape) 103 { 104 case "boxed": 105 imageShape = "rounded-0"; 106 break; 107 case "rounded": 108 imageShape = "rounded-3"; 109 break; 110 case "circle": 111 imageShape = "rounded-pill"; 112 break; 113 } 114 return imageShape; 115 } 116 117 private string GetButtonAlignment() 118 { 119 string buttonAlignment = Model.Item.GetRawValueString("ButtonAlignment", "align-center-center"); 120 121 switch (buttonAlignment) 122 { 123 case "align-center-center": 124 return "text-center justify-content-center align-items-center"; 125 case "align-bottom-start": 126 return "text-start justify-content-start align-items-end"; 127 case "align-bottom-center": 128 return "text-center justify-content-center align-items-end"; 129 case "align-bottom-center-text-center": 130 return "text-center justify-content-center align-items-end"; 131 case "align-bottom-end": 132 return "text-end justify-content-end align-items-end"; 133 default: 134 return "align-center-center"; 135 } 136 } 137 } 138 139 @{ 140 string groupType = Model.Item.GetRawValueString("GroupType", "subgroups"); 141 var groups = GetGroups(groupType); 142 143 bool hideHeaders = (Model.Item?.GetBoolean("HideHeaders") ?? false); 144 string title = Model.Item?.GetString("Title", string.Empty); 145 string subtitle = Model.Item?.GetString("Subtitle", string.Empty); 146 bool groupsExist = groups is object && groups.Count != 0; 147 148 // Grid layout 149 string gridSize = Model.Item.GetRawValueString("GridSize", "3"); 150 string gridSizeMobile = Model.Item.GetRawValueString("GridSizeMobile", "1"); 151 gridSize = $"grid-{gridSizeMobile} grid-sm-3 grid-lg-{gridSize}"; 152 153 string itemsGap = $"gap-{Model.Item.GetRawValueString("GridItemsGap", "3")}"; 154 string layout = Model.Item.GetRawValueString("Layout", "overlay"); 155 156 // Styling 157 string ratio = Model.Item.GetRawValueString("ImageAspectRatio", string.Empty); 158 ratio = ratio != "0" ? ratio : string.Empty; 159 string ratioCssClass = ratio != string.Empty ? "ratio" : string.Empty; 160 string ratioVariable = ratio != string.Empty ? "--bs-aspect-ratio: " + ratio : string.Empty; 161 162 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h3"); 163 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 164 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty); 165 maxWidth = maxWidth == "max-width-on" ? "mw-75ch" : string.Empty; 166 167 string buttonAlignment = GetButtonAlignment(); 168 169 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", "primary"); 170 171 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 172 buttonSize = buttonSize == "small" ? "btn btn-sm" : buttonSize; 173 buttonSize = buttonSize == "regular" ? "btn" : buttonSize; 174 buttonSize = buttonSize == "large" ? "btn btn-lg" : buttonSize; 175 176 string stretchedLink = "stretched-link"; 177 178 string imageShape = GetImageShape(); 179 string missingImageMarkup = $"<div class=\"bg-opacity-10 {imageShape}\" style=\"background-color:rgba(var(--swift-foreground-color-rgb),var(--bs-bg-opacity));\"></div>"; 180 } 181 182 @if (groupsExist) 183 { 184 <div class="grid gap-0 item_@(Model.Item.SystemName.ToLower())"> 185 186 @if (!hideHeaders) 187 { 188 <div class="g-col-12 pb-2 pb-lg-4"> 189 <div class="mb-0-last-child"> 190 @if (!string.IsNullOrEmpty(title)) 191 { 192 <h2 class="mt-0 @titleFontSize @maxWidth">@title</h2> 193 } 194 195 @if (!string.IsNullOrEmpty(subtitle)) 196 { 197 <p class="@subtitleFontSize @maxWidth">@subtitle</p> 198 } 199 </div> 200 </div> 201 } 202 203 <div class="g-col-12 grid @gridSize @itemsGap"> 204 @foreach (var group in groups) 205 { 206 string groupImageMarkup = GetGroupImageMarkup(group, imageShape) ?? missingImageMarkup; 207 bool groupImage = !string.IsNullOrEmpty(groupImageMarkup); 208 209 <div class="d-flex flex-column h-100"> 210 @{ 211 switch (layout) 212 { 213 case "overlay": 214 <div class="card rounded-0 border-0 @(ratioCssClass)" style="@ratioVariable"> 215 216 @(groupImage ? groupImageMarkup : missingImageMarkup) 217 218 <div class="d-grid p-3 @buttonAlignment"> 219 @if (GetLink(group) is object) 220 { 221 bool openLinksInNewTab = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && GetLink(group).IsExternal; 222 string target = openLinksInNewTab ? "target=\"_blank\"" : string.Empty; 223 string rel = openLinksInNewTab ? "rel=\"noopener\"" : string.Empty; 224 225 <a href="@GetLink(group)" class="@(buttonSize) btn-@buttonStyle @(stretchedLink)" data-dw-button="@buttonStyle" @target @rel>@group.Name</a> 226 } 227 </div> 228 </div> 229 break; 230 case "below": 231 <div class="card rounded-0 border-0 gap-3"> 232 233 <div class="@(ratioCssClass)" style="@ratioVariable"> 234 235 @(groupImage ? groupImageMarkup : missingImageMarkup) 236 237 </div> 238 239 <div class="@(groupImage ? "h-100" : string.Empty) d-grid @buttonAlignment"> 240 241 @if (GetLink(group) is object) 242 { 243 bool openLinksInNewTab = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && GetLink(group).IsExternal; 244 string target = openLinksInNewTab ? "target=\"_blank\"" : string.Empty; 245 string rel = openLinksInNewTab ? "rel=\"noopener\"" : string.Empty; 246 247 <a href="@GetLink(group)" class="@(buttonSize) btn-@buttonStyle @(stretchedLink)" data-dw-button="@buttonStyle" @target @rel>@group.Name</a> 248 } 249 </div> 250 </div> 251 break; 252 } 253 } 254 </div> 255 } 256 </div> 257 </div> 258 } 259 else if (Pageview.IsVisualEditorMode) 260 { 261 <div class="alert alert-dark" role="alert"> 262 <span>@Translate("Group grid"): @Translate("Edit this column to configure")</span> 263 </div> 264 } 265
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_5da283838c47422a936b200ac562558d : 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_247426826bea482cb19d2f578e232666 : 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