Error executing template "Designs/Rapido/eCom/Productlist/ProductsRender.cshtml"
System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Dynamicweb.Ecommerce.Products.GroupRelation.GetGroupRelationsByParentId(String theParentId)
   at Dynamicweb.Ecommerce.Products.GroupService.GetSubgroups(Group group, Boolean showUnTranslated)
   at Dynamicweb.Ecommerce.Products.GroupService.GetSubgroups(Group group)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(IEnumerable`1 groups, Page page, NavigationItem parentNode, Int32 thisLevel, Int32 maxLevel, Page productPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(IEnumerable`1 groups, Page page, NavigationItem parentNode, Int32 thisLevel, Int32 maxLevel, Page productPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(Page page, NavigationItem parentNode)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.Process(NavigationItem node)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.ProcessTree(RootNavigationItem rootNode, NavigationType navigationType)
   at Dynamicweb.Frontend.XmlNavigation.MakeXml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, Int32 selectedAreaId)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, String name, String xsltPath, Int32 selectedAreaId, Boolean sitemapMode, NameValueCollection settings, NameValueCollection attributes, IncludeMode mode)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(NameValueCollection settings, NameValueCollection attributes)
   at CompiledRazorTemplates.Dynamic.RazorEngine_354ee810c47d429389ed6daa65eccd18.<RenderProductListMenu>b__135_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 4875
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_354ee810c47d429389ed6daa65eccd18.<>c__DisplayClass5_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 220
   at CompiledRazorTemplates.Dynamic.RazorEngine_354ee810c47d429389ed6daa65eccd18.<>c__DisplayClass4_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 130
   at CompiledRazorTemplates.Dynamic.RazorEngine_354ee810c47d429389ed6daa65eccd18.<>c__DisplayClass5_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 258
   at CompiledRazorTemplates.Dynamic.RazorEngine_354ee810c47d429389ed6daa65eccd18.<>c__DisplayClass4_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 158
   at CompiledRazorTemplates.Dynamic.RazorEngine_354ee810c47d429389ed6daa65eccd18.<RenderPageContainer>b__155_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 5823
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_354ee810c47d429389ed6daa65eccd18.<>c__DisplayClass5_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 220
   at CompiledRazorTemplates.Dynamic.RazorEngine_354ee810c47d429389ed6daa65eccd18.<>c__DisplayClass4_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 130
   at CompiledRazorTemplates.Dynamic.RazorEngine_354ee810c47d429389ed6daa65eccd18.Execute() in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 5753
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb.Frontend.Devices 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Content 5 @using Dynamicweb.Core 6 @using System 7 @using System.IO 8 @using System.Web 9 @using System.Collections.Generic; 10 @using System.Linq 11 @using System.Text.RegularExpressions 12 @using Dynamicweb.Rapido.Blocks 13 @using Dynamicweb.Rapido.Blocks.Components.General 14 15 @functions { 16 BlocksPage productListPage = BlocksPage.GetBlockPage("ProductList"); 17 Dynamicweb.Frontend.ItemViewModel productListSettings = null; 18 19 string favoriteListId = HttpContext.Current.Request.QueryString.Get("ListID"); 20 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 21 } 22 23 @{ 24 productListSettings = Pageview.AreaSettings.GetItem("ProductList"); 25 26 27 Block pageContainer = new Block() 28 { 29 Id = "PageContainer", 30 Template = RenderPageContainer(), 31 SkipRenderBlocksList = true 32 33 }; 34 productListPage.Add(pageContainer); 35 36 Block productListNavigation = new Block() 37 { 38 Id = "Navigation", 39 SortId = 20, 40 Design = new Design 41 { 42 RenderType = RenderType.Column, 43 Size = "3" 44 } 45 }; 46 productListPage.Add("PageContainer", productListNavigation); 47 48 Block productListContainer = new Block() 49 { 50 Id = "ProductList", 51 SortId = 30, 52 Template = RenderProductList(), 53 SkipRenderBlocksList = true, 54 BlocksList = new List<Block> { 55 new Block 56 { 57 Id = "ProductListHeader", 58 SortId = 10, 59 Template = RenderProductListHeader(), 60 SkipRenderBlocksList = true, 61 BlocksList = new List<Block> { 62 new Block 63 { 64 Id = "ProductListTitle", 65 SortId = 10, 66 Design = new Design 67 { 68 CssClass = isFavoriteList ? "grid__col-xs-12 grid__col-md-4" : "grid__col-xs-12 grid__col-md-6" 69 }, 70 Template = RenderProductListTitle() 71 } 72 } 73 } 74 } 75 }; 76 productListPage.Add("PageContainer", productListContainer); 77 78 if (isFavoriteList) 79 { 80 productListPage.Add("ProductListHeader", new Block 81 { 82 Id = "FavoriteListSearch", 83 SortId = 20, 84 Template = RenderFavoriteListSearch(), 85 Design = new Design 86 { 87 CssClass = "grid__col-sm-4 u-margin-bottom u-margin-top grid--align-self-center" 88 } 89 }); 90 } 91 92 Block productListSnippets = new Block() 93 { 94 Id = "BottomSnippets", 95 SortId = 40 96 }; 97 productListPage.Add(productListSnippets); 98 } 99 100 @* This is required for the product list feed to work *@ 101 @GetValue("DoNotRenderProductListTemplate") 102 103 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 104 @using System.Text.RegularExpressions 105 @using System.Collections.Generic 106 @using System.Reflection 107 @using System.Web 108 @using System.Web.UI.HtmlControls 109 @using Dynamicweb.Rapido.Blocks.Components 110 @using Dynamicweb.Rapido.Blocks.Components.Articles 111 @using Dynamicweb.Rapido.Blocks.Components.Documentation 112 @using Dynamicweb.Rapido.Blocks 113 114 115 @*--- START: Base block renderers ---*@ 116 117 @helper RenderBlockList(List<Block> blocks) 118 { 119 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 120 blocks = blocks.OrderBy(item => item.SortId).ToList(); 121 122 foreach (Block item in blocks) 123 { 124 if (debug) { 125 <!-- Block START: @item.Id --> 126 } 127 128 if (item.Design == null) 129 { 130 @RenderBlock(item) 131 } 132 else if (item.Design.RenderType == RenderType.None) { 133 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 134 135 <div class="@cssClass dw-mod"> 136 @RenderBlock(item) 137 </div> 138 } 139 else if (item.Design.RenderType != RenderType.Hide) 140 { 141 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 142 143 if (!item.SkipRenderBlocksList) { 144 if (item.Design.RenderType == RenderType.Row) 145 { 146 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 147 @RenderBlock(item) 148 </div> 149 } 150 151 if (item.Design.RenderType == RenderType.Column) 152 { 153 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 154 string size = item.Design.Size ?? "12"; 155 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 156 157 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id"> 158 @RenderBlock(item) 159 </div> 160 } 161 162 if (item.Design.RenderType == RenderType.Table) 163 { 164 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 165 @RenderBlock(item) 166 </table> 167 } 168 169 if (item.Design.RenderType == RenderType.TableRow) 170 { 171 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 172 @RenderBlock(item) 173 </tr> 174 } 175 176 if (item.Design.RenderType == RenderType.TableColumn) 177 { 178 <td class="@cssClass dw-mod" id="Block__@item.Id"> 179 @RenderBlock(item) 180 </td> 181 } 182 183 if (item.Design.RenderType == RenderType.CardHeader) 184 { 185 <div class="card-header @cssClass dw-mod"> 186 @RenderBlock(item) 187 </div> 188 } 189 190 if (item.Design.RenderType == RenderType.CardBody) 191 { 192 <div class="card @cssClass dw-mod"> 193 @RenderBlock(item) 194 </div> 195 } 196 197 if (item.Design.RenderType == RenderType.CardFooter) 198 { 199 <div class="card-footer @cssClass dw-mod"> 200 @RenderBlock(item) 201 </div> 202 } 203 } 204 else 205 { 206 @RenderBlock(item) 207 } 208 } 209 210 if (debug) { 211 <!-- Block END: @item.Id --> 212 } 213 } 214 } 215 216 @helper RenderBlock(Block item) 217 { 218 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 219 220 if (item.Template != null) 221 { 222 @BlocksPage.RenderTemplate(item.Template) 223 } 224 225 if (item.Component != null) 226 { 227 string customSufix = "Custom"; 228 string methodName = item.Component.HelperName; 229 230 ComponentBase[] methodParameters = new ComponentBase[1]; 231 methodParameters[0] = item.Component; 232 Type methodType = this.GetType(); 233 234 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 235 236 try { 237 if (debug) { 238 <!-- Component: @methodName.Replace("Render", "") --> 239 } 240 if(customMethod != null) { 241 @customMethod.Invoke(this, methodParameters).ToString(); 242 } else { 243 MethodInfo generalMethod = methodType.GetMethod(methodName); 244 @generalMethod.Invoke(this, methodParameters).ToString(); 245 } 246 } catch { 247 try { 248 MethodInfo generalMethod = methodType.GetMethod(methodName); 249 @generalMethod.Invoke(this, methodParameters).ToString(); 250 } catch(Exception ex) { 251 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 252 } 253 } 254 } 255 256 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 257 { 258 @RenderBlockList(item.BlocksList) 259 } 260 } 261 262 @*--- END: Base block renderers ---*@ 263 264 @using Dynamicweb.Rapido.Blocks.Components 265 @using Dynamicweb.Rapido.Blocks.Components.General 266 @using Dynamicweb.Rapido.Blocks 267 @using System.IO 268 269 @* Required *@ 270 @using Dynamicweb.Rapido.Blocks.Components 271 @using Dynamicweb.Rapido.Blocks.Components.General 272 @using Dynamicweb.Rapido.Blocks 273 274 275 @helper Render(ComponentBase component) 276 { 277 if (component != null) 278 { 279 @component.Render(this) 280 } 281 } 282 283 @* Components *@ 284 @using System.Reflection 285 @using Dynamicweb.Rapido.Blocks.Components.General 286 287 288 @* Component *@ 289 290 @helper RenderIcon(Icon settings) 291 { 292 if (settings != null) 293 { 294 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 295 296 if (settings.Name != null) 297 { 298 if (string.IsNullOrEmpty(settings.Label)) 299 { 300 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 301 } 302 else 303 { 304 if (settings.LabelPosition == IconLabelPosition.Before) 305 { 306 <div class="u-flex u-flex--align-items-center @settings.CssClass">@settings.Label <i class="@settings.Prefix @settings.Name u-margin-left" @color></i></div> 307 } 308 else 309 { 310 <div class="u-flex u-flex--align-items-center @settings.CssClass"><i class="@settings.Prefix @settings.Name u-margin-right--lg u-w20px" @color></i>@settings.Label</div> 311 } 312 } 313 } 314 else if (!string.IsNullOrEmpty(settings.Label)) 315 { 316 @settings.Label 317 } 318 } 319 } 320 @using System.Reflection 321 @using Dynamicweb.Rapido.Blocks.Components.General 322 @using Dynamicweb.Rapido.Blocks.Components 323 @using Dynamicweb.Core 324 325 @* Component *@ 326 327 @helper RenderButton(Button settings) 328 { 329 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 330 { 331 Dictionary<string, string> attributes = new Dictionary<string, string>(); 332 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 333 if (settings.Disabled) { 334 attributes.Add("disabled", "true"); 335 classList.Add("disabled"); 336 } 337 338 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 339 { 340 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 341 @RenderConfirmDialog(settings); 342 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 343 } 344 345 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 346 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 347 if (!string.IsNullOrEmpty(settings.AltText)) 348 { 349 attributes.Add("title", settings.AltText); 350 } 351 else if (!string.IsNullOrEmpty(settings.Title)) 352 { 353 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty); 354 cleanTitle = cleanTitle.Replace("&nbsp;", " "); 355 attributes.Add("title", cleanTitle); 356 } 357 358 var onClickEvents = new List<string>(); 359 if (!string.IsNullOrEmpty(settings.OnClick)) 360 { 361 onClickEvents.Add(settings.OnClick); 362 } 363 if (!string.IsNullOrEmpty(settings.Href)) 364 { 365 onClickEvents.Add("location.href='" + settings.Href + "'"); 366 } 367 if (onClickEvents.Count > 0) 368 { 369 attributes.Add("onClick", string.Join(";", onClickEvents)); 370 } 371 372 if (settings.ButtonLayout != ButtonLayout.None) 373 { 374 classList.Add("btn"); 375 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 376 if (btnLayout == "linkclean") 377 { 378 btnLayout = "link-clean"; //fix 379 } 380 classList.Add("btn--" + btnLayout); 381 } 382 383 if (settings.Icon == null) 384 { 385 settings.Icon = new Icon(); 386 } 387 388 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : ""; 389 settings.Icon.Label = settings.Title; 390 391 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 392 393 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 394 } 395 } 396 397 @helper RenderConfirmDialog(Button settings) 398 { 399 Modal confirmDialog = new Modal { 400 Id = settings.Id, 401 Width = ModalWidth.Sm, 402 Heading = new Heading 403 { 404 Level = 2, 405 Title = settings.ConfirmTitle 406 }, 407 BodyText = settings.ConfirmText 408 }; 409 410 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 411 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 412 413 @Render(confirmDialog) 414 } 415 @using Dynamicweb.Rapido.Blocks.Components.General 416 @using Dynamicweb.Rapido.Blocks.Components 417 @using Dynamicweb.Core 418 419 @helper RenderDashboard(Dashboard settings) 420 { 421 var widgets = settings.GetWidgets(); 422 423 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 424 { 425 //set bg color for them 426 427 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 428 int r = Convert.ToInt16(color.R); 429 int g = Convert.ToInt16(color.G); 430 int b = Convert.ToInt16(color.B); 431 432 var count = widgets.Length; 433 var max = Math.Max(r, Math.Max(g, b)); 434 double step = 255.0 / (max * count); 435 var i = 0; 436 foreach (var widget in widgets) 437 { 438 i++; 439 440 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 441 widget.BackgroundColor = shade; 442 } 443 } 444 445 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 446 @foreach (var widget in widgets) 447 { 448 <div class="dashboard__widget"> 449 @Render(widget) 450 </div> 451 } 452 </div> 453 } 454 @using Dynamicweb.Rapido.Blocks.Components.General 455 @using Dynamicweb.Rapido.Blocks.Components 456 457 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 458 { 459 if (!string.IsNullOrEmpty(settings.Link)) 460 { 461 var backgroundStyles = ""; 462 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 463 { 464 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 465 } 466 467 <a href="@settings.Link" style="background-color:#c00" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 468 <div class="u-center-middle u-color-light"> 469 @if (settings.Icon != null) 470 { 471 settings.Icon.CssClass += "widget__icon"; 472 @Render(settings.Icon) 473 } 474 <div class="widget__title">@settings.Title</div> 475 </div> 476 </a> 477 } 478 } 479 @using Dynamicweb.Rapido.Blocks.Components.General 480 @using Dynamicweb.Rapido.Blocks.Components 481 482 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 483 { 484 var backgroundStyles = ""; 485 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 486 { 487 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 488 } 489 490 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 491 <div class="u-center-middle u-color-light"> 492 @if (settings.Icon != null) 493 { 494 settings.Icon.CssClass += "widget__icon"; 495 @Render(settings.Icon) 496 } 497 <div class="widget__counter">@settings.Count</div> 498 <div class="widget__title">@settings.Title</div> 499 </div> 500 </div> 501 } 502 @using System.Reflection 503 @using Dynamicweb.Rapido.Blocks.Components.General 504 @using Dynamicweb.Rapido.Blocks.Components 505 @using Dynamicweb.Core 506 507 @* Component *@ 508 509 @helper RenderLink(Link settings) 510 { 511 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 512 { 513 Dictionary<string, string> attributes = new Dictionary<string, string>(); 514 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 515 if (settings.Disabled) 516 { 517 attributes.Add("disabled", "true"); 518 classList.Add("disabled"); 519 } 520 521 if (!string.IsNullOrEmpty(settings.AltText)) 522 { 523 attributes.Add("title", settings.AltText); 524 } 525 else if (!string.IsNullOrEmpty(settings.Title)) 526 { 527 attributes.Add("title", settings.Title); 528 } 529 530 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 531 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 532 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 533 attributes.Add("href", settings.Href); 534 535 if (settings.ButtonLayout != ButtonLayout.None) 536 { 537 classList.Add("btn"); 538 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 539 if (btnLayout == "linkclean") 540 { 541 btnLayout = "link-clean"; //fix 542 } 543 classList.Add("btn--" + btnLayout); 544 } 545 546 if (settings.Icon == null) 547 { 548 settings.Icon = new Icon(); 549 } 550 settings.Icon.Label = settings.Title; 551 552 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 553 { 554 settings.Rel = LinkRelType.Noopener; 555 } 556 if (settings.Target != LinkTargetType.None) 557 { 558 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 559 } 560 if (settings.Download) 561 { 562 attributes.Add("download", "true"); 563 } 564 if (settings.Rel != LinkRelType.None) 565 { 566 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 567 } 568 569 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 570 } 571 } 572 @using System.Reflection 573 @using Dynamicweb.Rapido.Blocks.Components 574 @using Dynamicweb.Rapido.Blocks.Components.General 575 @using Dynamicweb.Rapido.Blocks 576 577 578 @* Component *@ 579 580 @helper RenderRating(Rating settings) 581 { 582 if (settings.Score > 0) 583 { 584 int rating = settings.Score; 585 string iconType = "fa-star"; 586 587 switch (settings.Type.ToString()) { 588 case "Stars": 589 iconType = "fa-star"; 590 break; 591 case "Hearts": 592 iconType = "fa-heart"; 593 break; 594 case "Lemons": 595 iconType = "fa-lemon"; 596 break; 597 case "Bombs": 598 iconType = "fa-bomb"; 599 break; 600 } 601 602 <div class="u-ta-right"> 603 @for (int i = 0; i < settings.OutOf; i++) 604 { 605 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 606 } 607 </div> 608 } 609 } 610 @using System.Reflection 611 @using Dynamicweb.Rapido.Blocks.Components.General 612 @using Dynamicweb.Rapido.Blocks.Components 613 614 615 @* Component *@ 616 617 @helper RenderSelectFieldOption(SelectFieldOption settings) 618 { 619 Dictionary<string, string> attributes = new Dictionary<string, string>(); 620 if (settings.Checked) { attributes.Add("selected", "true"); } 621 if (settings.Disabled) { attributes.Add("disabled", "true"); } 622 if (settings.Value != null) { attributes.Add("value", settings.Value); } 623 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 624 625 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 626 } 627 @using System.Reflection 628 @using Dynamicweb.Rapido.Blocks.Components.General 629 @using Dynamicweb.Rapido.Blocks.Components 630 631 632 @* Component *@ 633 634 @helper RenderNavigation(Navigation settings) { 635 @RenderNavigation(new 636 { 637 id = settings.Id, 638 cssclass = settings.CssClass, 639 startLevel = settings.StartLevel, 640 endlevel = settings.EndLevel, 641 expandmode = settings.Expandmode, 642 sitemapmode = settings.SitemapMode, 643 template = settings.Template 644 }) 645 } 646 @using Dynamicweb.Rapido.Blocks.Components.General 647 @using Dynamicweb.Rapido.Blocks.Components 648 649 650 @* Component *@ 651 652 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 653 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 654 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 655 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 656 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 657 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 658 settings.SitemapMode = false; 659 660 @RenderNavigation(settings) 661 } 662 @using Dynamicweb.Rapido.Blocks.Components.General 663 @using Dynamicweb.Rapido.Blocks.Components 664 665 666 @* Component *@ 667 668 @helper RenderLeftNavigation(LeftNavigation settings) { 669 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 670 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 671 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 672 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 673 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 674 675 <div class="grid__cell"> 676 @RenderNavigation(settings) 677 </div> 678 } 679 @using System.Reflection 680 @using Dynamicweb.Rapido.Blocks.Components.General 681 @using Dynamicweb.Core 682 683 @* Component *@ 684 685 @helper RenderHeading(Heading settings) 686 { 687 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 688 { 689 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 690 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 691 692 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 693 if (!string.IsNullOrEmpty(settings.Link)) 694 { 695 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 696 } 697 else 698 { 699 if (settings.Icon == null) 700 { 701 settings.Icon = new Icon(); 702 } 703 settings.Icon.Label = settings.Title; 704 @Render(settings.Icon) 705 } 706 @("</" + tagName + ">"); 707 } 708 } 709 @using Dynamicweb.Rapido.Blocks.Components 710 @using Dynamicweb.Rapido.Blocks.Components.General 711 @using Dynamicweb.Rapido.Blocks 712 713 714 @* Component *@ 715 716 @helper RenderImage(Image settings) 717 { 718 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 719 { 720 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 721 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 722 723 if (settings.Caption != null) 724 { 725 @:<div> 726 } 727 728 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 729 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 730 731 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 732 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 733 @if (settings.Link != null) 734 { 735 <a href="@settings.Link"> 736 @RenderTheImage(settings) 737 </a> 738 } 739 else 740 { 741 @RenderTheImage(settings) 742 } 743 </div> 744 </div> 745 746 if (settings.Caption != null) 747 { 748 <span class="image-caption dw-mod">@settings.Caption</span> 749 @:</div> 750 } 751 } 752 else 753 { 754 if (settings.Caption != null) 755 { 756 @:<div> 757 } 758 if (!string.IsNullOrEmpty(settings.Link)) 759 { 760 <a href="@settings.Link"> 761 @RenderTheImage(settings) 762 </a> 763 } 764 else 765 { 766 @RenderTheImage(settings) 767 } 768 769 if (settings.Caption != null) 770 { 771 <span class="image-caption dw-mod">@settings.Caption</span> 772 @:</div> 773 } 774 } 775 } 776 777 @helper RenderTheImage(Image settings) 778 { 779 if (settings != null) 780 { 781 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg"; 782 string placeholderImage = "/Files/Images/placeholder.gif"; 783 string imageEngine = "/Admin/Public/GetImage.ashx?"; 784 785 string imageStyle = ""; 786 787 switch (settings.Style) 788 { 789 case ImageStyle.Ball: 790 imageStyle = "grid__cell-img--ball"; 791 break; 792 793 case ImageStyle.Triangle: 794 imageStyle = "grid__cell-img--triangle"; 795 break; 796 } 797 798 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle) 799 { 800 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop; 801 802 if (settings.ImageDefault != null) 803 { 804 settings.ImageDefault.Height = settings.ImageDefault.Width; 805 } 806 if (settings.ImageMedium != null) 807 { 808 settings.ImageMedium.Height = settings.ImageMedium.Width; 809 } 810 if (settings.ImageSmall != null) 811 { 812 settings.ImageSmall.Height = settings.ImageSmall.Width; 813 } 814 } 815 816 string defaultImage = imageEngine; 817 string imageSmall = ""; 818 string imageMedium = ""; 819 820 if (settings.DisableImageEngine) 821 { 822 defaultImage = settings.Path; 823 } 824 else 825 { 826 if (settings.ImageDefault != null) 827 { 828 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 829 830 if (settings.Path.GetType() != typeof(string)) 831 { 832 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 833 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 834 } 835 else 836 { 837 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 838 } 839 840 defaultImage += "&AlternativeImage=" + alternativeImage; 841 } 842 843 if (settings.ImageSmall != null) 844 { 845 imageSmall = "data-src-small=\"" + imageEngine; 846 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 847 848 if (settings.Path.GetType() != typeof(string)) 849 { 850 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 851 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 852 } 853 else 854 { 855 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 856 } 857 858 imageSmall += "&alternativeImage=" + alternativeImage; 859 860 imageSmall += "\""; 861 } 862 863 if (settings.ImageMedium != null) 864 { 865 imageMedium = "data-src-medium=\"" + imageEngine; 866 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 867 868 if (settings.Path.GetType() != typeof(string)) 869 { 870 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 871 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 872 } 873 else 874 { 875 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 876 } 877 878 imageMedium += "&alternativeImage=" + alternativeImage; 879 880 imageMedium += "\""; 881 } 882 } 883 884 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 885 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 886 if (!string.IsNullOrEmpty(settings.Title)) 887 { 888 optionalAttributes.Add("alt", settings.Title); 889 optionalAttributes.Add("title", settings.Title); 890 } 891 892 if (settings.DisableLazyLoad) 893 { 894 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 895 } 896 else 897 { 898 <img id="@settings.Id" class="b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 899 } 900 } 901 } 902 @using System.Reflection 903 @using Dynamicweb.Rapido.Blocks.Components.General 904 @using Dynamicweb.Rapido.Blocks.Components 905 906 @* Component *@ 907 908 @helper RenderFileField(FileField settings) 909 { 910 var attributes = new Dictionary<string, string>(); 911 if (string.IsNullOrEmpty(settings.Id)) 912 { 913 settings.Id = Guid.NewGuid().ToString("N"); 914 } 915 916 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 917 if (settings.Disabled) { attributes.Add("disabled", "true"); } 918 if (settings.Required) { attributes.Add("required", "true"); } 919 if (settings.Multiple) { attributes.Add("multiple", "true"); } 920 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 921 if (string.IsNullOrEmpty(settings.ChooseFileText)) 922 { 923 settings.ChooseFileText = Translate("Choose file"); 924 } 925 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 926 { 927 settings.NoFilesChosenText = Translate("No files chosen..."); 928 } 929 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 930 931 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 932 933 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 934 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 935 936 attributes.Add("type", "file"); 937 if (settings.Value != null) { attributes.Add("value", settings.Value); } 938 settings.CssClass = "u-full-width " + settings.CssClass; 939 940 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 941 942 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 943 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 944 { 945 <div class="u-full-width"> 946 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 947 @if (settings.Link != null) { 948 <div class="u-pull--right"> 949 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 950 @Render(settings.Link) 951 </div> 952 } 953 </div> 954 955 } 956 957 @if (!string.IsNullOrEmpty(settings.HelpText)) 958 { 959 <small class="form__help-text">@settings.HelpText</small> 960 } 961 962 <div class="form__field-combi file-input u-no-margin dw-mod"> 963 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 964 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 965 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 966 @if (settings.UploadButton != null) 967 { 968 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 969 @Render(settings.UploadButton) 970 } 971 </div> 972 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 973 </div> 974 } 975 @using System.Reflection 976 @using Dynamicweb.Rapido.Blocks.Components.General 977 @using Dynamicweb.Rapido.Blocks.Components 978 @using Dynamicweb.Core 979 @using System.Linq 980 981 @* Component *@ 982 983 @helper RenderDateTimeField(DateTimeField settings) 984 { 985 if (string.IsNullOrEmpty(settings.Id)) 986 { 987 settings.Id = Guid.NewGuid().ToString("N"); 988 } 989 990 var textField = new TextField { 991 Name = settings.Name, 992 Id = settings.Id, 993 Label = settings.Label, 994 HelpText = settings.HelpText, 995 Value = settings.Value, 996 Disabled = settings.Disabled, 997 Required = settings.Required, 998 ErrorMessage = settings.ErrorMessage, 999 CssClass = settings.CssClass, 1000 WrapperCssClass = settings.WrapperCssClass, 1001 OnChange = settings.OnChange, 1002 OnClick = settings.OnClick, 1003 Link = settings.Link, 1004 ExtraAttributes = settings.ExtraAttributes, 1005 // 1006 Placeholder = settings.Placeholder 1007 }; 1008 1009 @Render(textField) 1010 1011 List<string> jsAttributes = new List<string>(); 1012 1013 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 1014 1015 if (!string.IsNullOrEmpty(settings.DateFormat)) 1016 { 1017 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 1018 } 1019 if (!string.IsNullOrEmpty(settings.MinDate)) 1020 { 1021 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 1022 } 1023 if (!string.IsNullOrEmpty(settings.MaxDate)) 1024 { 1025 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 1026 } 1027 if (settings.IsInline) 1028 { 1029 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 1030 } 1031 if (settings.EnableTime) 1032 { 1033 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 1034 } 1035 if (settings.EnableWeekNumbers) 1036 { 1037 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 1038 } 1039 1040 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 1041 1042 <script> 1043 document.addEventListener("DOMContentLoaded", function () { 1044 flatpickr("#@textField.Id", { 1045 @string.Join(",", jsAttributes) 1046 }); 1047 }); 1048 </script> 1049 } 1050 @using System.Reflection 1051 @using Dynamicweb.Rapido.Blocks.Components.General 1052 @using Dynamicweb.Rapido.Blocks.Components 1053 1054 @* Component *@ 1055 1056 @helper RenderTextField(TextField settings) 1057 { 1058 var attributes = new Dictionary<string, string>(); 1059 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1060 { 1061 settings.Id = Guid.NewGuid().ToString("N"); 1062 } 1063 1064 /*base settings*/ 1065 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1066 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1067 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1068 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1069 if (settings.Required) { attributes.Add("required", "true"); } 1070 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1071 /*end*/ 1072 1073 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1074 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1075 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1076 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1077 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1078 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1079 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1080 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1081 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1082 1083 settings.CssClass = "u-full-width " + settings.CssClass; 1084 1085 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1086 1087 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1088 1089 string noMargin = "u-no-margin"; 1090 if (!settings.ReadOnly) { 1091 noMargin = ""; 1092 } 1093 1094 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1095 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1096 { 1097 <div class="u-full-width"> 1098 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1099 @if (settings.Link != null) { 1100 settings.Link.ButtonLayout = ButtonLayout.LinkClean; 1101 1102 <div class="u-pull--right"> 1103 @Render(settings.Link) 1104 </div> 1105 } 1106 </div> 1107 1108 } 1109 1110 @if (!string.IsNullOrEmpty(settings.HelpText)) 1111 { 1112 <small class="form__help-text">@settings.HelpText</small> 1113 } 1114 1115 @if (settings.ActionButton != null) 1116 { 1117 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1118 <div class="form__field-combi u-no-margin dw-mod"> 1119 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1120 @Render(settings.ActionButton) 1121 </div> 1122 } 1123 else 1124 { 1125 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1126 } 1127 1128 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1129 </div> 1130 } 1131 @using System.Reflection 1132 @using Dynamicweb.Rapido.Blocks.Components.General 1133 @using Dynamicweb.Rapido.Blocks.Components 1134 1135 @* Component *@ 1136 1137 @helper RenderNumberField(NumberField settings) 1138 { 1139 var attributes = new Dictionary<string, string>(); 1140 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1141 { 1142 settings.Id = Guid.NewGuid().ToString("N"); 1143 } 1144 1145 /*base settings*/ 1146 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1147 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1148 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1149 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1150 if (settings.Required) { attributes.Add("required", "true"); } 1151 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1152 /*end*/ 1153 1154 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1155 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1156 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1157 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1158 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1159 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1160 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1161 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1162 attributes.Add("type", "number"); 1163 1164 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1165 1166 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1167 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1168 { 1169 <div class="u-full-width"> 1170 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1171 @if (settings.Link != null) { 1172 <div class="u-pull--right"> 1173 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1174 @Render(settings.Link) 1175 </div> 1176 } 1177 </div> 1178 1179 } 1180 1181 @if (!string.IsNullOrEmpty(settings.HelpText)) 1182 { 1183 <small class="form__help-text">@settings.HelpText</small> 1184 } 1185 1186 @if (settings.ActionButton != null) 1187 { 1188 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1189 <div class="form__field-combi u-no-margin dw-mod"> 1190 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1191 @Render(settings.ActionButton) 1192 </div> 1193 } 1194 else 1195 { 1196 <div class="form__field-combi u-no-margin dw-mod"> 1197 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1198 </div> 1199 } 1200 1201 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1202 </div> 1203 } 1204 @using System.Reflection 1205 @using Dynamicweb.Rapido.Blocks.Components.General 1206 @using Dynamicweb.Rapido.Blocks.Components 1207 1208 1209 @* Component *@ 1210 1211 @helper RenderTextareaField(TextareaField settings) 1212 { 1213 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1214 string id = settings.Id; 1215 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1216 { 1217 id = Guid.NewGuid().ToString("N"); 1218 } 1219 1220 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1221 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1222 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1223 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1224 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1225 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1226 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1227 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1228 if (settings.Required) { attributes.Add("required", "true"); } 1229 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1230 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1231 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1232 attributes.Add("name", settings.Name); 1233 1234 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1235 1236 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1237 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1238 { 1239 <div class="u-full-width"> 1240 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1241 @if (settings.Link != null) { 1242 <div class="u-pull--right"> 1243 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1244 @Render(settings.Link) 1245 </div> 1246 } 1247 </div> 1248 } 1249 1250 @if (!string.IsNullOrEmpty(settings.HelpText)) 1251 { 1252 <small class="form__help-text">@settings.HelpText</small> 1253 } 1254 1255 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 1256 1257 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1258 </div> 1259 } 1260 @using System.Reflection 1261 @using Dynamicweb.Rapido.Blocks.Components.General 1262 @using Dynamicweb.Rapido.Blocks.Components 1263 1264 1265 @* Component *@ 1266 1267 @helper RenderHiddenField(HiddenField settings) { 1268 var attributes = new Dictionary<string, string>(); 1269 attributes.Add("type", "hidden"); 1270 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1271 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1272 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1273 1274 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1275 } 1276 @using System.Reflection 1277 @using Dynamicweb.Rapido.Blocks.Components.General 1278 @using Dynamicweb.Rapido.Blocks.Components 1279 1280 @* Component *@ 1281 1282 @helper RenderCheckboxField(CheckboxField settings) 1283 { 1284 var attributes = new Dictionary<string, string>(); 1285 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1286 { 1287 settings.Id = Guid.NewGuid().ToString("N"); 1288 } 1289 1290 /*base settings*/ 1291 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1292 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1293 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1294 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1295 if (settings.Required) { attributes.Add("required", "true"); } 1296 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1297 /*end*/ 1298 1299 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1300 1301 attributes.Add("type", "checkbox"); 1302 if (settings.Checked) { attributes.Add("checked", "true"); } 1303 settings.CssClass = "form__control " + settings.CssClass; 1304 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1305 1306 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1307 1308 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1309 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1310 @if (!string.IsNullOrEmpty(settings.Label)) 1311 { 1312 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1313 } 1314 1315 @if (settings.Link != null) { 1316 <span> 1317 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1318 @Render(settings.Link) 1319 </span> 1320 } 1321 1322 @if (!string.IsNullOrEmpty(settings.HelpText)) 1323 { 1324 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small> 1325 } 1326 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1327 </div> 1328 } 1329 @using System.Reflection 1330 @using Dynamicweb.Rapido.Blocks.Components.General 1331 @using Dynamicweb.Rapido.Blocks.Components 1332 1333 1334 @* Component *@ 1335 1336 @helper RenderCheckboxListField(CheckboxListField settings) 1337 { 1338 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1339 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1340 { 1341 <div class="u-full-width"> 1342 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1343 @if (settings.Link != null) { 1344 <div class="u-pull--right"> 1345 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1346 @Render(settings.Link) 1347 </div> 1348 } 1349 </div> 1350 1351 } 1352 1353 <div class="u-pull--left"> 1354 @if (!string.IsNullOrEmpty(settings.HelpText)) 1355 { 1356 <small class="form__help-text">@settings.HelpText</small> 1357 } 1358 1359 @foreach (var item in settings.Options) 1360 { 1361 if (settings.Required) 1362 { 1363 item.Required = true; 1364 } 1365 if (settings.Disabled) 1366 { 1367 item.Disabled = true; 1368 } 1369 if (!string.IsNullOrEmpty(settings.Name)) 1370 { 1371 item.Name = settings.Name; 1372 } 1373 if (!string.IsNullOrEmpty(settings.CssClass)) 1374 { 1375 item.CssClass += settings.CssClass; 1376 } 1377 1378 /* value is not supported */ 1379 1380 if (!string.IsNullOrEmpty(settings.OnClick)) 1381 { 1382 item.OnClick += settings.OnClick; 1383 } 1384 if (!string.IsNullOrEmpty(settings.OnChange)) 1385 { 1386 item.OnChange += settings.OnChange; 1387 } 1388 @Render(item) 1389 } 1390 1391 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1392 </div> 1393 1394 </div> 1395 } 1396 @using Dynamicweb.Rapido.Blocks.Components.General 1397 1398 @* Component *@ 1399 1400 @helper RenderSearch(Search settings) 1401 { 1402 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? ""; 1403 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? ""; 1404 1405 if (string.IsNullOrEmpty(settings.Id)) 1406 { 1407 settings.Id = Guid.NewGuid().ToString("N"); 1408 } 1409 1410 var resultAttributes = new Dictionary<string, string>(); 1411 1412 if (settings.PageSize != 0) 1413 { 1414 resultAttributes.Add("data-page-size", settings.PageSize.ToString()); 1415 } 1416 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1417 { 1418 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl); 1419 if (!string.IsNullOrEmpty(groupValue)) 1420 { 1421 resultAttributes.Add("data-selected-group", groupValue); 1422 } 1423 if (!string.IsNullOrEmpty(settings.GroupsParameter)) 1424 { 1425 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter); 1426 } 1427 } 1428 resultAttributes.Add("data-force-init", "true"); 1429 if (settings.GoToFirstSearchResultOnEnter) 1430 { 1431 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower()); 1432 } 1433 if (!string.IsNullOrEmpty(settings.SearchParameter)) 1434 { 1435 resultAttributes.Add("data-search-parameter", settings.SearchParameter); 1436 } 1437 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl); 1438 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId); 1439 1440 if (settings.SecondSearchData != null) 1441 { 1442 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl); 1443 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId); 1444 } 1445 if (!string.IsNullOrEmpty(settings.ResultsPageUrl)) 1446 { 1447 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl); 1448 } 1449 1450 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1451 1452 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : ""; 1453 1454 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)> 1455 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1456 { 1457 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button> 1458 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul> 1459 } 1460 1461 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue"> 1462 1463 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")"> 1464 @if (settings.SecondSearchData != null) 1465 { 1466 <div class="search__column search__column--products dw-mod"> 1467 <div class="search__column-header dw-mod">@Translate("Products")</div> 1468 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1469 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1470 { 1471 @Render(new Link { 1472 Title = Translate("View all"), 1473 CssClass = "js-view-all-button u-margin", 1474 Href = settings.SearchData.ResultsPageUrl 1475 }); 1476 } 1477 </div> 1478 <div class="search__column search__column--pages dw-mod"> 1479 <div class="search__column-header">@Translate("Pages")</div> 1480 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul> 1481 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl)) 1482 { 1483 @Render(new Link 1484 { 1485 Title = Translate("View all"), 1486 CssClass = "js-view-all-button u-margin", 1487 Href = settings.SecondSearchData.ResultsPageUrl 1488 }); 1489 } 1490 </div> 1491 } 1492 else 1493 { 1494 <div class="search__column search__column--only dw-mod"> 1495 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1496 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1497 { 1498 @Render(new Link { 1499 Title = Translate("View all"), 1500 CssClass = "js-view-all-button u-margin", 1501 Href = settings.SearchData.ResultsPageUrl 1502 }); 1503 } 1504 </div> 1505 } 1506 </div> 1507 1508 @if (settings.SearchButton != null) 1509 { 1510 settings.SearchButton.CssClass += " search__btn js-search-btn"; 1511 if (settings.RenderDefaultSearchIcon) 1512 { 1513 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue }; 1514 } 1515 @Render(settings.SearchButton); 1516 } 1517 </div> 1518 } 1519 @using System.Reflection 1520 @using Dynamicweb.Rapido.Blocks.Components.General 1521 @using Dynamicweb.Rapido.Blocks.Components 1522 1523 1524 @* Component *@ 1525 1526 @helper RenderSelectField(SelectField settings) 1527 { 1528 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1529 { 1530 settings.Id = Guid.NewGuid().ToString("N"); 1531 } 1532 1533 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1534 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1535 { 1536 <div class="u-full-width"> 1537 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1538 @if (settings.Link != null) { 1539 <div class="u-pull--right"> 1540 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1541 @Render(settings.Link) 1542 </div> 1543 } 1544 </div> 1545 } 1546 1547 @if (!string.IsNullOrEmpty(settings.HelpText)) 1548 { 1549 <small class="form__help-text">@settings.HelpText</small> 1550 } 1551 1552 @if (settings.ActionButton != null) 1553 { 1554 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1555 <div class="form__field-combi u-no-margin dw-mod"> 1556 @RenderSelectBase(settings) 1557 @Render(settings.ActionButton) 1558 </div> 1559 } 1560 else 1561 { 1562 @RenderSelectBase(settings) 1563 } 1564 1565 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1566 </div> 1567 } 1568 1569 @helper RenderSelectBase(SelectField settings) 1570 { 1571 var attributes = new Dictionary<string, string>(); 1572 1573 /*base settings*/ 1574 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1575 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1576 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1577 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1578 if (settings.Required) { attributes.Add("required", "true"); } 1579 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1580 /*end*/ 1581 1582 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1583 1584 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1585 @if (settings.Default != null) 1586 { 1587 @Render(settings.Default) 1588 } 1589 1590 @foreach (var item in settings.Options) 1591 { 1592 if (settings.Value != null) { 1593 item.Checked = item.Value == settings.Value; 1594 } 1595 @Render(item) 1596 } 1597 </select> 1598 } 1599 @using System.Reflection 1600 @using Dynamicweb.Rapido.Blocks.Components.General 1601 @using Dynamicweb.Rapido.Blocks.Components 1602 1603 @* Component *@ 1604 1605 @helper RenderRadioButtonField(RadioButtonField settings) 1606 { 1607 var attributes = new Dictionary<string, string>(); 1608 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1609 { 1610 settings.Id = Guid.NewGuid().ToString("N"); 1611 } 1612 1613 /*base settings*/ 1614 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1615 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1616 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1617 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1618 if (settings.Required) { attributes.Add("required", "true"); } 1619 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1620 /*end*/ 1621 1622 attributes.Add("type", "radio"); 1623 if (settings.Checked) { attributes.Add("checked", "true"); } 1624 settings.CssClass = "form__control " + settings.CssClass; 1625 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1626 1627 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1628 1629 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1630 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1631 @if (!string.IsNullOrEmpty(settings.Label)) 1632 { 1633 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1634 } 1635 @if (!string.IsNullOrEmpty(settings.HelpText)) 1636 { 1637 <small class="form__help-text">@settings.HelpText</small> 1638 } 1639 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1640 </div> 1641 } 1642 @using System.Reflection 1643 @using Dynamicweb.Rapido.Blocks.Components.General 1644 @using Dynamicweb.Rapido.Blocks.Components 1645 1646 1647 @* Component *@ 1648 1649 @helper RenderRadioButtonListField(RadioButtonListField settings) 1650 { 1651 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1652 1653 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1654 @if (!string.IsNullOrEmpty(settings.Label)) 1655 { 1656 <label>@settings.Label</label> 1657 } 1658 @if (!string.IsNullOrEmpty(settings.HelpText)) 1659 { 1660 <small class="form__help-text">@settings.HelpText</small> 1661 } 1662 1663 @foreach (var item in settings.Options) 1664 { 1665 if (settings.Required) 1666 { 1667 item.Required = true; 1668 } 1669 if (settings.Disabled) 1670 { 1671 item.Disabled = true; 1672 } 1673 if (!string.IsNullOrEmpty(settings.Name)) 1674 { 1675 item.Name = settings.Name; 1676 } 1677 if (settings.Value != null && settings.Value == item.Value) 1678 { 1679 item.Checked = true; 1680 } 1681 if (!string.IsNullOrEmpty(settings.OnClick)) 1682 { 1683 item.OnClick += settings.OnClick; 1684 } 1685 if (!string.IsNullOrEmpty(settings.OnChange)) 1686 { 1687 item.OnChange += settings.OnChange; 1688 } 1689 if (!string.IsNullOrEmpty(settings.CssClass)) 1690 { 1691 item.CssClass += settings.CssClass; 1692 } 1693 @Render(item) 1694 } 1695 1696 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1697 </div> 1698 } 1699 @using System.Reflection 1700 @using Dynamicweb.Rapido.Blocks.Components.General 1701 @using Dynamicweb.Rapido.Blocks.Components 1702 1703 1704 @* Component *@ 1705 1706 @helper RenderNotificationMessage(NotificationMessage settings) 1707 { 1708 if (!string.IsNullOrEmpty(settings.Message)) 1709 { 1710 var attributes = new Dictionary<string, string>(); 1711 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1712 1713 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1714 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower(); 1715 string minHeightClass = settings.Icon != null ? "u-min-h70px" : ""; 1716 1717 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)> 1718 @if (settings.Icon != null) { 1719 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message; 1720 @Render(settings.Icon) 1721 } else { 1722 @settings.Message 1723 } 1724 </div> 1725 } 1726 } 1727 @using Dynamicweb.Rapido.Blocks.Components.General 1728 1729 1730 @* Component *@ 1731 1732 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1733 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1734 1735 <div class="@settings.CssClass dw-mod js-handlebars-root" id="@settings.Id" data-template="@settings.ScriptTemplate" data-json-feed="@settings.FeedUrl" data-init-onload="@settings.InitOnLoad.ToString()" data-preloader="@settings.Preloader" @preRender> 1736 @if (settings.SubBlocks != null) { 1737 @RenderBlockList(settings.SubBlocks) 1738 } 1739 </div> 1740 } 1741 @using System.Reflection 1742 @using Dynamicweb.Rapido.Blocks.Components.General 1743 @using Dynamicweb.Rapido.Blocks.Components 1744 @using System.Text.RegularExpressions 1745 1746 1747 @* Component *@ 1748 1749 @helper RenderSticker(Sticker settings) { 1750 if (!String.IsNullOrEmpty(settings.Title)) { 1751 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1752 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1753 1754 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1755 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1756 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1757 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1758 optionalAttributes.Add("style", styleTag); 1759 } 1760 1761 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1762 } 1763 } 1764 1765 @using System.Reflection 1766 @using Dynamicweb.Rapido.Blocks.Components.General 1767 @using Dynamicweb.Rapido.Blocks.Components 1768 1769 1770 @* Component *@ 1771 1772 @helper RenderStickersCollection(StickersCollection settings) 1773 { 1774 if (settings.Stickers.Count > 0) 1775 { 1776 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 1777 1778 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1779 @foreach (Sticker sticker in settings.Stickers) 1780 { 1781 @Render(sticker) 1782 } 1783 </div> 1784 } 1785 } 1786 1787 @using Dynamicweb.Rapido.Blocks.Components.General 1788 1789 1790 @* Component *@ 1791 1792 @helper RenderForm(Form settings) { 1793 if (settings != null) 1794 { 1795 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1796 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1797 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1798 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1799 var enctypes = new Dictionary<string, string> 1800 { 1801 { "multipart", "multipart/form-data" }, 1802 { "text", "text/plain" }, 1803 { "application", "application/x-www-form-urlencoded" } 1804 }; 1805 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1806 optionalAttributes.Add("method", settings.Method.ToString()); 1807 1808 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1809 { 1810 @settings.FormStartMarkup 1811 } 1812 else 1813 { 1814 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1815 } 1816 1817 foreach (var field in settings.GetFields()) 1818 { 1819 @Render(field) 1820 } 1821 1822 @:</form> 1823 } 1824 } 1825 @using System.Reflection 1826 @using Dynamicweb.Rapido.Blocks.Components.General 1827 @using Dynamicweb.Rapido.Blocks.Components 1828 1829 1830 @* Component *@ 1831 1832 @helper RenderText(Text settings) 1833 { 1834 @settings.Content 1835 } 1836 @using System.Reflection 1837 @using Dynamicweb.Rapido.Blocks.Components.General 1838 @using Dynamicweb.Rapido.Blocks.Components 1839 1840 1841 @* Component *@ 1842 1843 @helper RenderContentModule(ContentModule settings) { 1844 if (!string.IsNullOrEmpty(settings.Content)) 1845 { 1846 @settings.Content 1847 } 1848 } 1849 @using System.Reflection 1850 @using Dynamicweb.Rapido.Blocks.Components.General 1851 @using Dynamicweb.Rapido.Blocks.Components 1852 1853 1854 @* Component *@ 1855 1856 @helper RenderModal(Modal settings) { 1857 if (settings != null) 1858 { 1859 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 1860 1861 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 1862 1863 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 1864 1865 <div class="modal-container"> 1866 @if (!settings.DisableDarkOverlay) 1867 { 1868 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1869 } 1870 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 1871 @if (settings.Heading != null) 1872 { 1873 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1874 { 1875 <div class="modal__header"> 1876 @Render(settings.Heading) 1877 </div> 1878 } 1879 } 1880 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1881 @if (!string.IsNullOrEmpty(settings.BodyText)) 1882 { 1883 @settings.BodyText 1884 } 1885 @if (settings.BodyTemplate != null) 1886 { 1887 @settings.BodyTemplate 1888 } 1889 @{ 1890 var actions = settings.GetActions(); 1891 } 1892 </div> 1893 @if (actions.Length > 0) 1894 { 1895 <div class="modal__footer"> 1896 @foreach (var action in actions) 1897 { 1898 if (Pageview.Device.ToString() != "Mobile") { 1899 action.CssClass += " u-no-margin"; 1900 } else { 1901 action.CssClass += " u-full-width u-margin-bottom"; 1902 } 1903 1904 @Render(action) 1905 } 1906 </div> 1907 } 1908 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 1909 </div> 1910 </div> 1911 } 1912 } 1913 @using Dynamicweb.Rapido.Blocks.Components.General 1914 1915 @* Component *@ 1916 1917 @helper RenderMediaListItem(MediaListItem settings) 1918 { 1919 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1920 @if (!string.IsNullOrEmpty(settings.Label)) 1921 { 1922 if (!string.IsNullOrEmpty(settings.Link)) 1923 { 1924 @Render(new Link 1925 { 1926 Href = settings.Link, 1927 CssClass = "media-list-item__sticker dw-mod", 1928 ButtonLayout = ButtonLayout.None, 1929 Title = settings.Label, 1930 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1931 }) 1932 } 1933 else if (!string.IsNullOrEmpty(settings.OnClick)) 1934 { 1935 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1936 <span class="u-uppercase">@settings.Label</span> 1937 </span> 1938 } 1939 else 1940 { 1941 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1942 <span class="u-uppercase">@settings.Label</span> 1943 </span> 1944 } 1945 } 1946 <div class="media-list-item__wrap"> 1947 <div class="media-list-item__info dw-mod"> 1948 <div class="media-list-item__header dw-mod"> 1949 @if (!string.IsNullOrEmpty(settings.Title)) 1950 { 1951 if (!string.IsNullOrEmpty(settings.Link)) 1952 { 1953 @Render(new Link 1954 { 1955 Href = settings.Link, 1956 CssClass = "media-list-item__name dw-mod", 1957 ButtonLayout = ButtonLayout.None, 1958 Title = settings.Title, 1959 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1960 }) 1961 } 1962 else if (!string.IsNullOrEmpty(settings.OnClick)) 1963 { 1964 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 1965 } 1966 else 1967 { 1968 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 1969 } 1970 } 1971 1972 @if (!string.IsNullOrEmpty(settings.Status)) 1973 { 1974 <div class="media-list-item__state dw-mod">@settings.Status</div> 1975 } 1976 </div> 1977 @{ 1978 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 1979 } 1980 1981 @Render(settings.InfoTable) 1982 </div> 1983 <div class="media-list-item__actions dw-mod"> 1984 <div class="media-list-item__actions-list dw-mod"> 1985 @{ 1986 var actions = settings.GetActions(); 1987 1988 foreach (ButtonBase action in actions) 1989 { 1990 action.ButtonLayout = ButtonLayout.None; 1991 action.CssClass += " media-list-item__action link"; 1992 1993 @Render(action) 1994 } 1995 } 1996 </div> 1997 1998 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 1999 { 2000 settings.SelectButton.CssClass += " u-no-margin"; 2001 2002 <div class="media-list-item__action-button"> 2003 @Render(settings.SelectButton) 2004 </div> 2005 } 2006 </div> 2007 </div> 2008 </div> 2009 } 2010 @using Dynamicweb.Rapido.Blocks.Components.General 2011 @using Dynamicweb.Rapido.Blocks.Components 2012 2013 @helper RenderTable(Table settings) 2014 { 2015 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2016 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2017 2018 var enumToClasses = new Dictionary<TableDesign, string> 2019 { 2020 { TableDesign.Clean, "table--clean" }, 2021 { TableDesign.Bordered, "table--bordered" }, 2022 { TableDesign.Striped, "table--striped" }, 2023 { TableDesign.Hover, "table--hover" }, 2024 { TableDesign.Compact, "table--compact" }, 2025 { TableDesign.Condensed, "table--condensed" }, 2026 { TableDesign.NoTopBorder, "table--no-top-border" } 2027 }; 2028 string tableDesignClass = ""; 2029 if (settings.Design != TableDesign.None) 2030 { 2031 tableDesignClass = enumToClasses[settings.Design]; 2032 } 2033 2034 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 2035 2036 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2037 2038 <table @ComponentMethods.AddAttributes(resultAttributes)> 2039 @if (settings.Header != null) 2040 { 2041 <thead> 2042 @Render(settings.Header) 2043 </thead> 2044 } 2045 <tbody> 2046 @foreach (var row in settings.Rows) 2047 { 2048 @Render(row) 2049 } 2050 </tbody> 2051 @if (settings.Footer != null) 2052 { 2053 <tfoot> 2054 @Render(settings.Footer) 2055 </tfoot> 2056 } 2057 </table> 2058 } 2059 @using Dynamicweb.Rapido.Blocks.Components.General 2060 @using Dynamicweb.Rapido.Blocks.Components 2061 2062 @helper RenderTableRow(TableRow settings) 2063 { 2064 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2065 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2066 2067 var enumToClasses = new Dictionary<TableRowDesign, string> 2068 { 2069 { TableRowDesign.NoBorder, "table__row--no-border" }, 2070 { TableRowDesign.Border, "table__row--border" }, 2071 { TableRowDesign.TopBorder, "table__row--top-line" }, 2072 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 2073 { TableRowDesign.Solid, "table__row--solid" } 2074 }; 2075 2076 string tableRowDesignClass = ""; 2077 if (settings.Design != TableRowDesign.None) 2078 { 2079 tableRowDesignClass = enumToClasses[settings.Design]; 2080 } 2081 2082 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 2083 2084 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2085 2086 <tr @ComponentMethods.AddAttributes(resultAttributes)> 2087 @foreach (var cell in settings.Cells) 2088 { 2089 if (settings.IsHeaderRow) 2090 { 2091 cell.IsHeader = true; 2092 } 2093 @Render(cell) 2094 } 2095 </tr> 2096 } 2097 @using Dynamicweb.Rapido.Blocks.Components.General 2098 @using Dynamicweb.Rapido.Blocks.Components 2099 @using Dynamicweb.Core 2100 2101 @helper RenderTableCell(TableCell settings) 2102 { 2103 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2104 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2105 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 2106 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 2107 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 2108 2109 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2110 2111 string tagName = settings.IsHeader ? "th" : "td"; 2112 2113 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 2114 @settings.Content 2115 @("</" + tagName + ">"); 2116 } 2117 @using System.Linq 2118 @using Dynamicweb.Rapido.Blocks.Components.General 2119 2120 @* Component *@ 2121 2122 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 2123 { 2124 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 2125 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 2126 2127 if (settings.NumberOfPages > 1) 2128 { 2129 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 2130 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 2131 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 2132 2133 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 2134 @if (settings.ShowPagingInfo) 2135 { 2136 <div class="pager__info dw-mod"> 2137 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 2138 </div> 2139 } 2140 <ul class="pager__list dw-mod"> 2141 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 2142 { 2143 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 2144 } 2145 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 2146 { 2147 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 2148 } 2149 @if (settings.GetPages().Any()) 2150 { 2151 foreach (var page in settings.GetPages()) 2152 { 2153 @Render(page) 2154 } 2155 } 2156 else 2157 { 2158 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 2159 { 2160 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 2161 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 2162 } 2163 } 2164 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 2165 { 2166 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 2167 } 2168 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 2169 { 2170 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 2171 } 2172 </ul> 2173 </div> 2174 } 2175 } 2176 2177 @helper RenderPaginationItem(PaginationItem settings) 2178 { 2179 if (settings.Icon == null) 2180 { 2181 settings.Icon = new Icon(); 2182 } 2183 2184 settings.Icon.Label = settings.Label; 2185 <li class="pager__btn dw-mod"> 2186 @if (settings.IsActive) 2187 { 2188 <span class="pager__num pager__num--current dw-mod"> 2189 @Render(settings.Icon) 2190 </span> 2191 } 2192 else 2193 { 2194 <a href="@settings.Link" class="pager__num dw-mod"> 2195 @Render(settings.Icon) 2196 </a> 2197 } 2198 </li> 2199 } 2200 2201 2202 @using Dynamicweb.Rapido.Blocks.Components.General 2203 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2204 2205 2206 @using Dynamicweb.Rapido.Blocks.Components 2207 @using Dynamicweb.Rapido.Blocks.Components.General 2208 @using Dynamicweb.Rapido.Blocks 2209 @using System.IO 2210 2211 2212 @using Dynamicweb.Rapido.Blocks.Components.General 2213 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2214 2215 2216 @* Component *@ 2217 2218 @helper RenderVariantMatrix(VariantMatrix settings) { 2219 if (settings != null) 2220 { 2221 int productLoopCounter = 0; 2222 int groupCount = 0; 2223 List<VariantOption> firstDimension = new List<VariantOption>(); 2224 List<VariantOption> secondDimension = new List<VariantOption>(); 2225 List<VariantOption> thirdDimension = new List<VariantOption>(); 2226 2227 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 2228 { 2229 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 2230 { 2231 if (groupCount == 0) { 2232 firstDimension.Add(variantOptions); 2233 } 2234 if (groupCount == 1) 2235 { 2236 secondDimension.Add(variantOptions); 2237 } 2238 if (groupCount == 2) 2239 { 2240 thirdDimension.Add(variantOptions); 2241 } 2242 } 2243 groupCount++; 2244 } 2245 2246 int rowCount = 0; 2247 int columnCount = 0; 2248 2249 <script> 2250 var variantsCollection = []; 2251 </script> 2252 2253 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 2254 @if (groupCount == 1) 2255 { 2256 <tbody> 2257 @foreach (VariantOption firstVariantOption in firstDimension) 2258 { 2259 var variantId = firstVariantOption.Id; 2260 <tr> 2261 <td class="u-bold"> 2262 @firstVariantOption.Name 2263 </td> 2264 <td> 2265 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 2266 </td> 2267 </tr> 2268 productLoopCounter++; 2269 } 2270 2271 <tr> 2272 <td>&nbsp;</td> 2273 <td> 2274 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 2275 </td> 2276 </tr> 2277 </tbody> 2278 } 2279 @if (groupCount == 2) 2280 { 2281 <thead> 2282 <tr> 2283 <td>&nbsp;</td> 2284 @foreach (VariantOption variant in secondDimension) 2285 { 2286 <td>@variant.Name</td> 2287 } 2288 </tr> 2289 </thead> 2290 <tbody> 2291 @foreach (VariantOption firstVariantOption in firstDimension) 2292 { 2293 string variantId = ""; 2294 columnCount = 0; 2295 2296 <tr> 2297 <td class="u-min-w120px">@firstVariantOption.Name</td> 2298 2299 @foreach (VariantOption secondVariantOption in secondDimension) 2300 { 2301 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 2302 <td> 2303 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 2304 </td> 2305 2306 columnCount++; 2307 2308 productLoopCounter++; 2309 } 2310 2311 <td> 2312 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 2313 </td> 2314 </tr> 2315 2316 rowCount++; 2317 } 2318 2319 @{ 2320 columnCount = 0; 2321 } 2322 2323 <tr> 2324 <td>&nbsp;</td> 2325 @foreach (VariantOption secondVariantOption in secondDimension) 2326 { 2327 <td> 2328 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 2329 </td> 2330 2331 columnCount++; 2332 } 2333 <td>&nbsp;</td> 2334 </tr> 2335 </tbody> 2336 } 2337 @if (groupCount == 3) 2338 { 2339 <thead> 2340 <tr> 2341 <td>&nbsp;</td> 2342 @foreach (VariantOption thirdVariantOption in thirdDimension) 2343 { 2344 <td>@thirdVariantOption.Name</td> 2345 } 2346 </tr> 2347 </thead> 2348 <tbody> 2349 @foreach (VariantOption firstVariantOption in firstDimension) 2350 { 2351 int colspan = (thirdDimension.Count + 1); 2352 2353 <tr> 2354 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 2355 </tr> 2356 2357 foreach (VariantOption secondVariantOption in secondDimension) 2358 { 2359 string variantId = ""; 2360 columnCount = 0; 2361 2362 <tr> 2363 <td class="u-min-w120px">@secondVariantOption.Name</td> 2364 2365 @foreach (VariantOption thirdVariantOption in thirdDimension) 2366 { 2367 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 2368 2369 <td> 2370 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 2371 </td> 2372 2373 columnCount++; 2374 productLoopCounter++; 2375 } 2376 2377 <td> 2378 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 2379 </td> 2380 </tr> 2381 rowCount++; 2382 } 2383 } 2384 2385 @{ 2386 columnCount = 0; 2387 } 2388 2389 <tr> 2390 <td>&nbsp;</td> 2391 @foreach (VariantOption thirdVariantOption in thirdDimension) 2392 { 2393 <td> 2394 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 2395 </td> 2396 2397 columnCount++; 2398 } 2399 <td>&nbsp;</td> 2400 </tr> 2401 </tbody> 2402 } 2403 </table> 2404 2405 <script> 2406 document.addEventListener("DOMContentLoaded", function (event) { 2407 MatrixUpdateQuantity("@settings.ProductId"); 2408 }); 2409 2410 MatrixUpdateQuantity = function (productId) { 2411 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 2412 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 2413 2414 var qtyRowArr = []; 2415 var qtyColumnArr = []; 2416 2417 var totalQty = 0; 2418 2419 for (var i = 0; i < allQtyFields.length; i++) { 2420 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 2421 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 2422 } 2423 2424 for (var i = 0; i < allQtyFields.length; i++) { 2425 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 2426 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 2427 totalQty += parseFloat(allQtyFields[i].value); 2428 } 2429 2430 //Update row counters 2431 for (var i = 0; i < qtyRowArr.length; i++) { 2432 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 2433 2434 if (qtyRowArr[i] != undefined && qtyCounter != null) { 2435 var currentCount = qtyCounter.innerHTML; 2436 qtyCounter.innerHTML = qtyRowArr[i]; 2437 2438 if (currentCount != qtyCounter.innerHTML) { 2439 qtyCounter.classList.add("qty-field--active"); 2440 } 2441 } 2442 2443 } 2444 2445 //Update column counters 2446 for (var i = 0; i < qtyColumnArr.length; i++) { 2447 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 2448 2449 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 2450 var currentCount = qtyCounter.innerHTML; 2451 qtyCounter.innerHTML = qtyColumnArr[i]; 2452 2453 if (currentCount != qtyCounter.innerHTML) { 2454 qtyCounter.classList.add("qty-field--active"); 2455 } 2456 } 2457 } 2458 2459 if (document.getElementById("TotalQtyCount_" + productId)) { 2460 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 2461 } 2462 2463 //Clean up animations 2464 setTimeout(function () { 2465 for (var i = 0; i < qtyRowArr.length; i++) { 2466 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 2467 if (qtyCounter != null) { 2468 qtyCounter.classList.remove("qty-field--active"); 2469 } 2470 } 2471 for (var i = 0; i < qtyColumnArr.length; i++) { 2472 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 2473 if (qtyCounter != null) { 2474 qtyCounter.classList.remove("qty-field--active"); 2475 } 2476 } 2477 }, 1000); 2478 } 2479 </script> 2480 } 2481 } 2482 2483 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 2484 { 2485 string loopCount = productLoopCounter.ToString(); 2486 2487 bool combinationFound = false; 2488 double stock = 0; 2489 double quantityValue = 0; 2490 string note = ""; 2491 2492 VariantProduct variantProduct = null; 2493 2494 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 2495 { 2496 stock = variantProduct.Stock; 2497 quantityValue = variantProduct.Quantity; 2498 combinationFound = true; 2499 } 2500 2501 if (combinationFound) 2502 { 2503 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 2504 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 2505 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 2506 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 2507 <input type="number" name="Quantity@(loopCount)" id="Quantity_@(settings.ProductId)_@variantId" value="@quantityValue" min="0" class="js-qty u-no-margin u-full-max-width" style="width: 100%; max-width: 100%" onkeyup="MatrixUpdateQuantity('@settings.ProductId')" onmouseup="MatrixUpdateQuantity('@settings.ProductId')" data-qty-row-group="@rowCount" data-qty-column-group="@columnCount"> 2508 2509 if (stock != 0) 2510 { 2511 <small>@Translate("Stock") @stock</small> 2512 } 2513 2514 <script> 2515 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 2516 variantsCollection.push(variants); 2517 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 2518 </script> 2519 } 2520 else 2521 { 2522 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 2523 } 2524 } 2525 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2526 2527 @* Component *@ 2528 2529 @helper RenderAddToCart(AddToCart settings) 2530 { 2531 //set Id for quantity selector to get it's value from button 2532 if (settings.QuantitySelector != null) 2533 { 2534 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 2535 { 2536 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 2537 } 2538 2539 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 2540 2541 if (settings.Disabled) 2542 { 2543 settings.QuantitySelector.Disabled = true; 2544 } 2545 2546 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 2547 { 2548 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 2549 } 2550 } 2551 2552 if (settings.Disabled) 2553 { 2554 settings.AddButton.Disabled = true; 2555 } 2556 2557 settings.AddButton.CssClass += " btn--condensed"; 2558 2559 //unitsSelector 2560 if (settings.UnitSelector != null) 2561 { 2562 if (settings.Disabled) 2563 { 2564 settings.QuantitySelector.Disabled = true; 2565 } 2566 } 2567 2568 if (Pageview.Device.ToString() == "Mobile") { 2569 if (settings.UnitSelector != null) 2570 { 2571 <div class="margin-sm margin-position-bottom"> 2572 @Render(settings.UnitSelector) 2573 </div> 2574 } 2575 } 2576 2577 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 2578 @if (Pageview.Device.ToString() != "Mobile") { 2579 if (settings.UnitSelector != null) 2580 { 2581 @Render(settings.UnitSelector) 2582 } 2583 } 2584 @if (settings.QuantitySelector != null) 2585 { 2586 @Render(settings.QuantitySelector) 2587 } 2588 @Render(settings.AddButton) 2589 </div> 2590 } 2591 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2592 2593 @* Component *@ 2594 2595 @helper RenderAddToCartButton(AddToCartButton settings) 2596 { 2597 if (!settings.HideTitle) 2598 { 2599 if (string.IsNullOrEmpty(settings.Title)) 2600 { 2601 if (settings.BuyForPoints) 2602 { 2603 settings.Title = Translate("Buy with points"); 2604 } 2605 else 2606 { 2607 settings.Title = Translate("Add to cart"); 2608 } 2609 } 2610 } 2611 else 2612 { 2613 settings.Title = ""; 2614 } 2615 2616 if (settings.Icon == null) 2617 { 2618 settings.Icon = new Icon(); 2619 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 2620 } 2621 2622 if (string.IsNullOrEmpty(settings.Icon.Name)) 2623 { 2624 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 2625 } 2626 2627 settings.OnClick = "Cart.AddToCart(event, { " + 2628 "id: '" + settings.ProductId + "'," + 2629 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 2630 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 2631 (settings.BuyForPoints ? "buyForPoints: true," : "") + 2632 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 2633 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 2634 "});" + settings.OnClick; 2635 2636 @RenderButton(settings) 2637 } 2638 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2639 2640 @* Component *@ 2641 2642 @helper RenderUnitSelector(UnitSelector settings) 2643 { 2644 if (string.IsNullOrEmpty(settings.Id)) 2645 { 2646 settings.Id = Guid.NewGuid().ToString("N"); 2647 } 2648 var disabledClass = settings.Disabled ? "disabled" : ""; 2649 2650 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> 2651 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 2652 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> 2653 <div class="dropdown__content dw-mod"> 2654 @settings.OptionsContent 2655 </div> 2656 <label class="dropdown-trigger-off" for="@settings.Id"></label> 2657 </div> 2658 } 2659 @using System.Reflection 2660 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2661 2662 @* Component *@ 2663 2664 @helper RenderQuantitySelector(QuantitySelector settings) 2665 { 2666 var attributes = new Dictionary<string, string>(); 2667 2668 /*base settings*/ 2669 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2670 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 2671 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 2672 if (settings.Disabled) { attributes.Add("disabled", "true"); } 2673 if (settings.Required) { attributes.Add("required", "true"); } 2674 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 2675 /*end*/ 2676 2677 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 2678 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 2679 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 2680 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 2681 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 2682 if (settings.Min == null) { settings.Min = 1; } 2683 attributes.Add("min", settings.Min.ToString()); 2684 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 2685 if (settings.Value == null) { settings.Value = 1; } 2686 attributes.Add("value", settings.Value.ToString()); 2687 attributes.Add("type", "number"); 2688 2689 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 2690 2691 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 2692 } 2693 @using Dynamicweb.Rapido.Blocks.Components 2694 2695 @using Dynamicweb.Frontend 2696 @using Dynamicweb.Frontend.Devices 2697 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2698 @using Dynamicweb.Rapido.Blocks.Components.General 2699 @using System.Collections.Generic; 2700 2701 @* Component *@ 2702 2703 @helper RenderCustomerCenterList(CustomerCenterList settings) 2704 { 2705 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false; 2706 string hideActions = isTouchDevice ? "u-block" : ""; 2707 2708 <table class="table data-list dw-mod"> 2709 @if (settings.GetHeaders().Length > 0) { 2710 <thead> 2711 <tr class="u-bold"> 2712 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders()) 2713 { 2714 var attributes = new Dictionary<string, string>(); 2715 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); } 2716 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); } 2717 attributes.Add("align", header.Align.ToString()); 2718 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 2719 2720 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td> 2721 } 2722 </tr> 2723 </thead> 2724 } 2725 @foreach (CustomerCenterListItem listItem in settings.GetItems()) 2726 { 2727 int columnCount = 0; 2728 int totalColumns = listItem.GetInfoItems().Length; 2729 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : ""; 2730 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N"); 2731 2732 var attributes = new Dictionary<string, string>(); 2733 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); }; 2734 2735 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 2736 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)> 2737 <tr> 2738 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) { 2739 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 2740 2741 <td rowspan="2" @onClick class="data-list__main-item dw-mod"> 2742 @if (!string.IsNullOrEmpty(listItem.Title)) { 2743 <div class="u-bold">@listItem.Title</div> 2744 } 2745 @if (!string.IsNullOrEmpty(listItem.Description)) { 2746 <div>@listItem.Description</div> 2747 } 2748 </td> 2749 } 2750 2751 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems()) 2752 { 2753 var infoAttributes = new Dictionary<string, string>(); 2754 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); }; 2755 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); }; 2756 infoAttributes.Add("align", infoItem.Align.ToString()); 2757 2758 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 2759 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 2760 2761 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod"> 2762 @if (!string.IsNullOrEmpty(infoItem.Title)) { 2763 <div>@infoItem.Title</div> 2764 } 2765 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) { 2766 <div><small>@infoItem.Subtitle</small></div> 2767 } 2768 </td> 2769 2770 columnCount++; 2771 } 2772 </tr> 2773 <tr> 2774 <td colspan="7" align="right" class="u-va-bottom u-no-border"> 2775 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id"> 2776 @foreach (ButtonBase action in listItem.GetActions()) 2777 { 2778 action.ButtonLayout = ButtonLayout.LinkClean; 2779 action.Icon.CssClass += " u-full-height"; 2780 action.CssClass += " data-list__action-button link"; 2781 2782 @Render(action) 2783 } 2784 </div> 2785 </td> 2786 </tr> 2787 </tbody> 2788 } 2789 </table> 2790 } 2791 2792 @* Include the Blocks for the page *@ 2793 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2794 @using Dynamicweb.Core 2795 @using System 2796 @using System.Web 2797 @using System.Collections.Generic 2798 @using Dynamicweb.Rapido.Blocks 2799 2800 @{ 2801 BlocksPage productListProductsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 2802 2803 Block productsBlock = new Block 2804 { 2805 Id = "Views", 2806 SortId = 30, 2807 Template = RenderProducts() 2808 }; 2809 2810 productListProductsBlocksPage.Add("ProductList", productsBlock); 2811 } 2812 2813 @helper RenderProducts() 2814 { 2815 @*This is part of a script template *@ 2816 2817 <div id="ProductsContainer" data-template="{{listTemplate}}" class="grid product-list grid--external-bleed-x dw-mod grid--align-content-start" data-save-cookie="true"> 2818 {{#if SubGroupsCount}} 2819 {{#if OriginalSubGroupsCount}} 2820 <div class="grid grid--external-bleed-x"> 2821 {{#SubGroups}} 2822 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-3 grid__col-xs-6 product-list__grid-item dw-mod"> 2823 {{#if groupLink}} 2824 <a href="http://{{groupLink}}"> 2825 <div class="grid__cell product-list__grid-item__image dw-mod"> 2826 <img class="grid__cell-img grid__cell-img--centered u-padding b-lazy" src="/Files/Images/missing_image.jpg" data-src='/Admin/Public/GetImage.ashx?width=215&amp;height=215&amp;crop=5&amp;FillCanvas=True&amp;Compression=75&amp;DoNotUpscale=true&amp;FillCanvas=true&amp;image={{groupImage}}' alt="{{groupName}}" /> 2827 2828 </div> 2829 <div class="grid__cell product-list__grid-item__price-info dw-mod" style="height: auto;"> 2830 <h6>{{groupName}}</h6> 2831 </div> 2832 </a> 2833 {{else}} 2834 <div class="grid__cell product-list__grid-item__image dw-mod"> 2835 <img class="grid__cell-img grid__cell-img--centered u-padding b-lazy" src="/Files/Images/missing_image.jpg" data-src='/Admin/Public/GetImage.ashx?width=215&amp;height=215&amp;crop=5&amp;FillCanvas=True&amp;Compression=75&amp;DoNotUpscale=true&amp;FillCanvas=true&amp;image={{groupImage}}' alt="{{groupName}}" /> 2836 2837 </div> 2838 <div class="grid__cell product-list__grid-item__price-info dw-mod" style="height: auto;"> 2839 <h6>{{groupName}}</h6> 2840 </div> 2841 {{/if}} 2842 </div> 2843 {{/SubGroups}} 2844 </div> 2845 <div> 2846 <h4></h4> 2847 </div> 2848 {{else}} 2849 @RenderNavigation(new 2850 { 2851 StartLevel = 1, 2852 EndLevel = 2, 2853 Template = "MainGroupList.xslt" 2854 }) 2855 {{/if}} 2856 {{else}} 2857 {{#ProductsContainer}} 2858 {{> (lookup . 'template') }} 2859 {{/ProductsContainer}} 2860 {{/if}} 2861 </div> 2862 } 2863 2864 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2865 @using Dynamicweb.Core 2866 @using System 2867 @using System.Web 2868 @using System.Collections.Generic 2869 @using Dynamicweb.Rapido.Blocks 2870 @using Dynamicweb.Rapido.Services 2871 2872 @functions { 2873 BlocksPage listViewPage = BlocksPage.GetBlockPage("ProductList"); 2874 Dynamicweb.Frontend.ItemViewModel listViewSettings = null; 2875 } 2876 2877 @if (Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableListView")) 2878 { 2879 listViewSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("ListView"); 2880 2881 listViewPage.Add("Views", new Block 2882 { 2883 Id = "ProductItemContainer", 2884 Name = "th-list", 2885 SortId = 10 2886 }); 2887 2888 Block listViewScripts = new Block 2889 { 2890 Id = "ListViewScripts", 2891 SortId = 20, 2892 Template = ListView(), 2893 BlocksList = new List<Block> { 2894 new Block 2895 { 2896 Id = "ListViewItem", 2897 SortId = 10, 2898 Template = RenderListViewItem(), 2899 SkipRenderBlocksList = true, 2900 BlocksList = new List<Block> { 2901 new Block 2902 { 2903 Id = "ListViewItemHiddenProperties", 2904 SortId = 10, 2905 Template = RenderListViewItemHiddenProperties() 2906 }, 2907 new Block 2908 { 2909 Id = "ListViewItemLeft", 2910 SortId = 10, 2911 SkipRenderBlocksList = true, 2912 Template = RenderListViewItemLeft(), 2913 BlocksList = new List<Block> { 2914 new Block 2915 { 2916 Id = "ListViewItemImage", 2917 SortId = 10, 2918 Template = RenderListViewItemImage() 2919 }, 2920 new Block 2921 { 2922 Id = "ListViewItemStickers", 2923 SortId = 20, 2924 Template = RenderListViewItemStickers() 2925 } 2926 } 2927 }, 2928 new Block 2929 { 2930 Id = "ListViewItemRight", 2931 SortId = 20, 2932 Design = new Design 2933 { 2934 RenderType = RenderType.Column, 2935 Size = "auto", 2936 CssClass = "product-list__list-item__right" 2937 }, 2938 BlocksList = new List<Block> { 2939 new Block 2940 { 2941 Id = "ListViewItemInfoContainer", 2942 SortId = 10, 2943 Design = new Design 2944 { 2945 RenderType = RenderType.None 2946 }, 2947 BlocksList = new List<Block> { 2948 new Block { 2949 Id = "ListViewItemInfoContainerLeft", 2950 SortId = 10, 2951 Design = new Design 2952 { 2953 CssClass = "u-pull--left" 2954 }, 2955 BlocksList = new List<Block> { 2956 new Block 2957 { 2958 Id = "ListViewItemTitle", 2959 SortId = 10, 2960 Template = RenderListViewItemTitle() 2961 }, 2962 new Block 2963 { 2964 Id = "ListViewItemDescription", 2965 SortId = 20, 2966 Template = RenderListViewItemDescription() 2967 } 2968 2969 } 2970 }, 2971 new Block { 2972 Id = "ListViewItemInfoContainerRight", 2973 SortId = 20, 2974 Design = new Design 2975 { 2976 CssClass = "u-pull--right" 2977 } 2978 } 2979 } 2980 }, 2981 2982 new Block 2983 { 2984 Id = "ListViewItemFooter", 2985 SortId = 50, 2986 SkipRenderBlocksList = true, 2987 Template = RenderListViewItemFooter(), 2988 BlocksList = new List<Block> { 2989 new Block 2990 { 2991 Id = "ListViewItemActions", 2992 SortId = 20, 2993 Template = RenderListViewItemActions() 2994 } 2995 } 2996 } 2997 } 2998 } 2999 } 3000 } 3001 } 3002 }; 3003 listViewPage.Add("BottomSnippets", listViewScripts); 3004 3005 //number 3006 bool listViewShowNumber = listViewSettings.GetBoolean("ShowProductNumber"); 3007 3008 if (listViewShowNumber) 3009 { 3010 listViewPage.Add("ListViewItemInfoContainerLeft", new Block 3011 { 3012 Id = "ListViewItemNumber", 3013 SortId = 20, 3014 Template = RenderListViewItemNumber() 3015 }); 3016 } 3017 3018 //stock 3019 bool listViewShowStock = listViewSettings.GetBoolean("ShowStockAndShipping"); 3020 if (User.IsStockInfoAllowed() && listViewShowStock || true) 3021 { 3022 listViewPage.Add("ListViewItemInfoContainerLeft", new Block 3023 { 3024 Id = "ListViewItemStock", 3025 SortId = 30, 3026 Template = RenderListViewItemStock() 3027 }); 3028 } 3029 3030 //favorites 3031 bool listViewShowFavoriteButton = !listViewSettings.GetBoolean("HideFavoriteButton"); 3032 3033 if (listViewShowFavoriteButton) 3034 { 3035 listViewPage.Add("ListViewItemInfoContainerRight", new Block 3036 { 3037 Id = "ListViewItemFavorites", 3038 SortId = 10, 3039 Template = RenderListViewItemFavorites() 3040 }); 3041 } 3042 3043 //variant selector 3044 bool listViewShowCartButton = listViewSettings.GetBoolean("ShowAddToCartButton"); 3045 bool listViewShowVariantSelector = listViewSettings.GetList("Variants").SelectedValue == "selector"; 3046 if (listViewShowCartButton && listViewShowVariantSelector) 3047 { 3048 listViewPage.Add("ListViewItemRight", new Block 3049 { 3050 Id = "ListViewItemVariantSelector", 3051 SortId = 30, 3052 Template = RenderListViewItemVariantSelector() 3053 }); 3054 } 3055 3056 //static variants 3057 bool listViewShowStaticVariants = listViewSettings.GetList("Variants").SelectedValue == "static"; 3058 3059 if (listViewShowStaticVariants) 3060 { 3061 listViewPage.Add("ListViewItemRight", new Block 3062 { 3063 Id = "ListViewItemStaticVariants", 3064 SortId = 40, 3065 Template = RenderListViewItemStaticVariants() 3066 }); 3067 } 3068 3069 //download button 3070 bool listViewShowAddToDownloadButton = listViewSettings.GetBoolean("ShowAddToDownloadButton"); 3071 if (listViewShowAddToDownloadButton && Pageview.User != null) 3072 { 3073 listViewPage.Add("ListViewItemRight", new Block 3074 { 3075 Id = "ListViewItemDownloadButton", 3076 SortId = 60, 3077 Template = RenderListViewItemDownloadButton() 3078 }); 3079 } 3080 3081 //price 3082 bool listViewShowPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice"); 3083 if (listViewShowPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 3084 { 3085 listViewPage.Add("ListViewItemFooter", new Block 3086 { 3087 Id = "ListViewItemPrice", 3088 SortId = 10, 3089 Template = RenderListViewItemPrice() 3090 }); 3091 } 3092 } 3093 3094 @helper ListView() 3095 { 3096 <script id="ProductItemContainer" type="text/x-template"> 3097 {{#.}} 3098 <div id="Product{{id}}" class="grid__col-12 js-product dw-mod" data-template="ListViewItem" data-preloader="overlay"> 3099 {{#Product}} 3100 {{>ListViewItem}} 3101 {{/Product}} 3102 </div> 3103 {{/.}} 3104 </script> 3105 } 3106 3107 @helper RenderListViewItem() 3108 { 3109 List<Block> subBlocks = listViewPage.GetBlockListById("ListViewItem"); 3110 3111 <script id="ListViewItem" type="text/x-template"> 3112 {{#.}} 3113 <div class="grid product-list__list-item dw-mod js-product-scroll-trigger" data-params="{{googleImpression}}"> 3114 @RenderBlockList(subBlocks) 3115 </div> 3116 {{/.}} 3117 </script> 3118 3119 } 3120 3121 @helper RenderListViewItemHiddenProperties() 3122 { 3123 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" /> 3124 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" /> 3125 <input type="hidden" name="VariantID{{id}}" value="{{variantid}}" id="Variant_{{id}}" /> 3126 <input type="hidden" name="UnitID{{id}}" value="{{unitId}}" id="Unit_{{id}}" /> 3127 3128 <input type="hidden" name="Quantity{{id}}" value="1" id="Quantity_{{id}}" /> 3129 3130 } 3131 3132 @helper RenderListViewItemLeft() 3133 { 3134 List<Block> subBlocks = listViewPage.GetBlockListById("ListViewItemLeft"); 3135 3136 string imageZoomOnHover = listViewSettings.GetBoolean("HoverImageZoom") ? "image-hover--zoom" : ""; 3137 3138 <div class="grid__col-md-4 {{noImage}} product-list__list-item__left u-no-padding u-color-light--bg dw-mod @imageZoomOnHover"> 3139 <div class="grid__cell"> 3140 @RenderBlockList(subBlocks) 3141 </div> 3142 </div> 3143 } 3144 3145 @helper RenderListViewItemImage() 3146 { 3147 bool secondaryImage = listViewSettings.GetString("HoverAlternatineImage") != null ? listViewSettings.GetBoolean("HoverAlternatineImage") : false; 3148 3149 <a href="{{link}}" 3150 onclick="{{#if googleImpression}}({{googleImpression}}, event){{/if}}" 3151 title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" 3152 class="u-position-relative u-block image-hover__wrapper dw-mod"> 3153 <img class="grid__cell-img grid__cell-img--centered b-lazy" src="/Files/Images/placeholder.gif" 3154 data-src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=true&amp;FillCanvas=true&amp;image={{image}}" 3155 @if (secondaryImage) { <text> 3156 {{#if secondaryImage}} 3157 data-secondary-image-src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;crop=5&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image={{secondaryImage}}" 3158 {{/if}} 3159 </text> } 3160 alt="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" /> 3161 </a> 3162 } 3163 3164 @helper RenderListViewItemStickers() 3165 { 3166 <text> 3167 {{#StickersContainers}} 3168 {{>StickersContainer}} 3169 {{/StickersContainers}} 3170 </text> 3171 } 3172 3173 @helper RenderListViewItemTitle() 3174 { 3175 <a href="{{link}}" onclick="{{#if googleImpression}}({{googleImpression}}, event){{/if}}" title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}"> 3176 <h2 class="u-no-margin">{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}</h2> 3177 </a> 3178 } 3179 3180 @helper RenderListViewItemNumber() 3181 { 3182 <div class="item-number dw-mod">@Translate("Art. no."): {{number}}</div> 3183 } 3184 3185 @helper RenderListViewItemStock() 3186 { 3187 <div> 3188 @Translate("Availability"): 3189 <span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span> {{stockText}}{{deliveryText}} 3190 </div> 3191 } 3192 3193 @helper RenderListViewItemFavorites() 3194 { 3195 <div class="favorites u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}> 3196 {{#Favorite}} 3197 {{>FavoriteTemplate}} 3198 {{/Favorite}} 3199 </div> 3200 } 3201 3202 @helper RenderListViewItemDescription() 3203 { 3204 <div class="u-margin-top u-margin-bottom" style="text-transform: uppercase;"> 3205 {{{description}}} 3206 </div> 3207 } 3208 3209 @helper RenderListViewItemVariantSelector() 3210 { 3211 string pageId = GetGlobalValue("Global:Page.ID"); 3212 var ecommerceSettings = Pageview.AreaSettings.GetItem("Ecommerce"); 3213 string variantsLayout = ecommerceSettings.GetString("VariantsLayout") != null ? ecommerceSettings.GetList("VariantsLayout").SelectedValue : "buttons"; 3214 3215 <div data-template="VariantsTemplate" class="js-variants grid__cell" data-combinations="{{combinationsStringArray}}" data-variants="{{variantsStringArray}}" data-variant-selections="{{variantSelections}}" data-total-variant-groups="{{variantGroupsCount}}" data-selection-complete="UpdateData" data-page-id="@pageId" data-product-id="{{productId}}"> 3216 {{#Variants}} 3217 @if (variantsLayout == "buttons") 3218 { 3219 <text>{{>VariantsTemplate}}</text> 3220 } 3221 else 3222 { 3223 <text>{{>DropdownVariantsTemplate}}</text> 3224 } 3225 {{/Variants}} 3226 </div> 3227 <small class="js-help-text help-text {{hideViewMore}} {{hideHelpText}}">@Translate("Please select variant!")</small> 3228 } 3229 3230 @helper RenderListViewItemStaticVariants() 3231 { 3232 string variantsSize = listViewSettings.GetList("StaticVariantsDisplay") != null ? listViewSettings.GetList("StaticVariantsDisplay").SelectedValue : "sm"; 3233 3234 <text> 3235 {{#Variants}} 3236 @if (variantsSize == "lg") 3237 { 3238 <text> 3239 {{>StaticVariantsLgTemplate}} 3240 </text> 3241 } 3242 else 3243 { 3244 <text> 3245 {{>StaticVariantsTemplate}} 3246 </text> 3247 } 3248 {{/Variants}} 3249 3250 {{#ifCond variantGroupsCount '>' 1}} 3251 <div class="static-variant"> 3252 @Translate("More options available") 3253 </div> 3254 {{/ifCond}} 3255 </text> 3256 } 3257 3258 @helper RenderListViewItemFooter() 3259 { 3260 List<Block> subBlocks = listViewPage.GetBlockListById("ListViewItemFooter"); 3261 3262 if (Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 3263 { 3264 <div class="grid__cell-footer"> 3265 <div class="grid__cell"> 3266 <div class="product-list__list-item__price-actions dw-mod"> 3267 @RenderBlockList(subBlocks) 3268 </div> 3269 </div> 3270 </div> 3271 } 3272 else 3273 { 3274 <button type="button" id="CartButton_{{id}}" class="u-hidden"></button> 3275 } 3276 } 3277 3278 @helper RenderListViewItemPrice() 3279 { 3280 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3281 bool showCartButton = listViewSettings.GetBoolean("ShowAddToCartButton"); 3282 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT"); 3283 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat; 3284 <text> 3285 {{#unless HidePriceDS}} 3286 <div class="u-margin-bottom"> 3287 @if (pointShopOnly) 3288 { 3289 <text> 3290 {{#if havePointPrice}} 3291 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div> 3292 @if (showCartButton) 3293 { 3294 <text> 3295 {{#unless canBePurchasedWithPoints}} 3296 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3297 {{/unless}} 3298 </text> 3299 } 3300 {{else}} 3301 @Translate("Not available") 3302 {{/if}} 3303 </text> 3304 3305 } 3306 else 3307 { 3308 <div class="price price--product-list dw-mod">{{price}} @Translate("Excl. VAT")</div> 3309 <div class="before-price {{onSale}} dw-mod">{{discount}}</div> 3310 if (showVATPrice) 3311 { 3312 <div class="vat-price vat-price--product-list u-margin-top dw-mod"> 3313 @if (isPricesWithVATEnabled) 3314 { 3315 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span> 3316 } 3317 else 3318 { 3319 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span> 3320 } 3321 </div> 3322 } 3323 <text> 3324 {{#if priceRRP}} 3325 <div><small>@Translate("RRP") {{priceRRP}}</small></div> 3326 {{/if}} 3327 </text> 3328 } 3329 </div> 3330 {{/unless}} 3331 </text> 3332 } 3333 3334 @helper RenderListViewItemViewButton() 3335 { 3336 string viewMoreText = listViewSettings.GetString("ViewMoreText"); 3337 viewMoreText = !string.IsNullOrEmpty(viewMoreText) ? viewMoreText : "View"; 3338 3339 @Render(new Link 3340 { 3341 Href = "{{link}}", 3342 Id = "CartButton_{{id}}", 3343 Title = Translate(viewMoreText), 3344 OnClick = "{{#if googleImpression}}({{googleImpression}}, event){{/if}}", 3345 ButtonLayout = ButtonLayout.Secondary, 3346 CssClass = "u-no-margin" 3347 }); 3348 } 3349 3350 @helper RenderListViewItemAddToCart() 3351 { 3352 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3353 string gridCartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetString("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart"; 3354 3355 <text> 3356 {{#unless HidePriceDS}} 3357 {{#if ProductPriceIsMinimum}} 3358 <a href="{{link}}" class="js-cart-btn btn btn--secondary btn--condensed u-no-margin u-pull--right dw-mod" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}"> 3359 @Translate("Select length") 3360 </a> 3361 {{else}} 3362 {{#if outOfStock}} 3363 <label onclick="DisplayAdddToCartDialog('{{ACOAvailability}}','{{productId}}','{{variantid}}','{{unitId}}','{{id}}',{{productInfo}},{{facebookPixelAction}});" type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-pull--right u-no-margin dw-mod {{disabledBuyButton}}" {{disabledBuyButton}}> 3364 <i class="@gridCartIcon"></i> 3365 </label> 3366 {{else}} 3367 <button type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod {{disabledBuyButton}}" name="submit" 3368 onclick="AddToCartProducts('{{stockValue}}','{{productId}}','{{variantid}}','{{unitId}}','{{id}}',{{productInfo}}); {{facebookPixelAction}}" {{disabledBuyButton}}> 3369 <i class="@gridCartIcon"></i> 3370 </button> 3371 {{/if}} 3372 <input type="number" style="margin-right: 10px;" class="u-w80px u-pull--right" id="QuantityBox_{{id}}" name="QuantityBox{{id}}" onchange=CalculateMinOrderQunatity(this,{{purchaseQuantityStep}}) step="{{purchaseQuantityStep}}" value="{{purchaseMinimalQuantity}}" min="{{purchaseMinimalQuantity}}"> 3373 {{/if}} 3374 {{/unless}} 3375 </text> 3376 } 3377 3378 @helper RenderListViewItemActions() 3379 { 3380 bool showCartButton = listViewSettings.GetBoolean("ShowAddToCartButton"); 3381 bool showViewButton = listViewSettings.GetBoolean("ShowViewButton"); 3382 bool hasVariantSelector = listViewSettings.GetList("Variants") != null && listViewSettings.GetList("Variants").SelectedValue == "selector"; 3383 3384 @RenderListViewItemAddToCart() 3385 } 3386 3387 @helper RenderListViewItemDownloadButton() 3388 { 3389 <div class="grid__cell-footer u-margin-top"> 3390 <div class="grid__cell"> 3391 <button type="button" class="btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod js-add-to-downloads" title="@Translate(" Add")" data-product-id="{{productId}}"> 3392 <i class="fas fa-plus js-button-icon"></i> 3393 <span class="js-button-text">@Translate("Add")</span> 3394 </button> 3395 </div> 3396 </div> 3397 } 3398 3399 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3400 @using Dynamicweb.Core 3401 @using System 3402 @using System.Web 3403 @using System.Collections.Generic 3404 @using Dynamicweb.Rapido.Blocks 3405 @using Dynamicweb.Rapido.Blocks.Components 3406 @using Dynamicweb.Rapido.Blocks.Components.General 3407 @using Dynamicweb.Rapido.Services 3408 3409 @functions { 3410 BlocksPage gridViewPage = BlocksPage.GetBlockPage("ProductList"); 3411 Dynamicweb.Frontend.ItemViewModel gridViewSettings = null; 3412 } 3413 3414 @if (Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableGridView")) 3415 { 3416 gridViewSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView"); 3417 3418 BlocksPage gridViewPage = BlocksPage.GetBlockPage("ProductList"); 3419 3420 gridViewPage.Add("Views", new Block 3421 { 3422 Id = "ProductGridItemContainer", 3423 Name = "th", 3424 SortId = 20 3425 }); 3426 3427 Block gridViewScripts = new Block 3428 { 3429 Id = "GridViewScripts", 3430 SortId = 20, 3431 Template = GridView(), 3432 BlocksList = new List<Block> { 3433 new Block 3434 { 3435 Id = "GridViewItem", 3436 SortId = 10, 3437 Template = RenderGridViewItem(), 3438 SkipRenderBlocksList = true, 3439 BlocksList = new List<Block> { 3440 new Block 3441 { 3442 Id = "GridViewItemHiddenProperties", 3443 SortId = 10, 3444 Template = RenderGridViewItemHiddenProperties() 3445 }, 3446 new Block 3447 { 3448 Id = "GridViewItemImageContainer", 3449 SortId = 20, 3450 SkipRenderBlocksList = true, 3451 Template = RenderGridViewItemImageContainer(), 3452 BlocksList = new List<Block> { 3453 new Block 3454 { 3455 Id = "GridViewItemImage", 3456 SortId = 10, 3457 Template = RenderGridViewItemImage() 3458 }, 3459 new Block 3460 { 3461 Id = "GridViewItemStickers", 3462 SortId = 20, 3463 Template = RenderGridViewItemStickers() 3464 } 3465 } 3466 }, 3467 new Block 3468 { 3469 Id = "GridViewItemInfoContainer", 3470 SortId = 30, 3471 SkipRenderBlocksList = true, 3472 Template = RenderGridViewItemInfoContainer(), 3473 BlocksList = new List<Block> { 3474 new Block 3475 { 3476 Id = "GridViewItemTitle", 3477 SortId = 10, 3478 Template = RenderGridViewItemTitle() 3479 } 3480 } 3481 }, 3482 new Block 3483 { 3484 Id = "GridViewItemFooter", 3485 SortId = 40, 3486 SkipRenderBlocksList = true, 3487 Template = RenderGridViewItemFooter(), 3488 BlocksList = new List<Block> { 3489 new Block 3490 { 3491 Id = "GridViewItemActions", 3492 SortId = 10, 3493 Template = RenderGridViewItemActions() 3494 } 3495 } 3496 } 3497 } 3498 } 3499 } 3500 }; 3501 gridViewPage.Add("BottomSnippets", gridViewScripts); 3502 3503 //favorites 3504 bool gridViewShowFavoriteButton = !gridViewSettings.GetBoolean("HideFavoriteButton"); 3505 3506 if (gridViewShowFavoriteButton) 3507 { 3508 gridViewPage.Add("GridViewItemImageContainer", new Block 3509 { 3510 Id = "GridViewItemFavorites", 3511 SortId = 30, 3512 Template = RenderGridViewItemFavorites() 3513 }); 3514 } 3515 3516 //number 3517 bool gridViewShowNumber = gridViewSettings.GetBoolean("ShowProductNumber"); 3518 3519 if (gridViewShowNumber) 3520 { 3521 gridViewPage.Add("GridViewItemInfoContainer", new Block 3522 { 3523 Id = "GridViewItemNumber", 3524 SortId = 20, 3525 Template = RenderGridViewItemNumber() 3526 }); 3527 } 3528 3529 //price 3530 bool gridViewShowPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice"); 3531 if (gridViewShowPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 3532 { 3533 gridViewPage.Add("GridViewItemInfoContainer", new Block 3534 { 3535 Id = "GridViewItemPrice", 3536 SortId = 30, 3537 Template = RenderGridViewItemPrice() 3538 }); 3539 } 3540 3541 //stock 3542 bool gridViewShowStock = gridViewSettings.GetBoolean("ShowStockAndShipping"); 3543 3544 if (User.IsStockInfoAllowed() && gridViewShowStock || true) 3545 { 3546 gridViewPage.Add("GridViewItemFooter", new Block 3547 { 3548 Id = "GridViewItemStockAndDelivery", 3549 SortId = 20, 3550 Template = RenderGridViewItemStockAndDelivery() 3551 }); 3552 } 3553 3554 //static variants 3555 bool gridViewShowStaticVariants = gridViewSettings.GetBoolean("ShowStaticVariants"); 3556 3557 if (gridViewShowStaticVariants) 3558 { 3559 gridViewPage.Add("GridViewItemFooter", new Block 3560 { 3561 Id = "GridViewItemStaticVariants", 3562 SortId = 30, 3563 Template = RenderGridViewItemStaticVariants() 3564 }); 3565 } 3566 3567 //download button 3568 bool gridViewShowAddToDownloadButton = gridViewSettings.GetBoolean("ShowAddToDownloadButton"); 3569 3570 if (gridViewShowAddToDownloadButton && Pageview.User != null) 3571 { 3572 gridViewPage.Add("GridViewItemFooter", new Block 3573 { 3574 Id = "GridViewItemDownloadButton", 3575 SortId = 40, 3576 Template = RenderGridViewItemDownloadButton() 3577 }); 3578 } 3579 } 3580 3581 @helper GridView() 3582 { 3583 int columnsCount = gridViewSettings.GetList("Columns") != null ? Converter.ToInt32(gridViewSettings.GetList("Columns").SelectedValue) : 3; 3584 string imageZoomOnHover = gridViewSettings.GetBoolean("HoverImageZoom") ? "image-hover--zoom" : ""; 3585 3586 <script id="ProductGridItemContainer" type="text/x-template"> 3587 {{#.}} 3588 <div id="Product{{id}}" data-template="GridViewItem" data-preloader="overlay" class="grid__col-lg-@(12 / columnsCount) grid__col-md-@(12 / columnsCount) grid__col-sm-@(12 / columnsCount) grid__col-xs-6 product-list__grid-item @imageZoomOnHover dw-mod"> 3589 {{#Product}} 3590 {{>GridViewItem}} 3591 {{/Product}} 3592 </div> 3593 {{/.}} 3594 </script> 3595 } 3596 3597 @helper RenderGridViewItem() 3598 { 3599 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItem"); 3600 3601 <script id="GridViewItem" type="text/x-template"> 3602 {{#.}} 3603 <div class="grid__col--auto js-product-scroll-trigger u-no-padding u-full-height" data-params="{{googleImpression}}"> 3604 @RenderBlockList(subBlocks) 3605 </div> 3606 {{/.}} 3607 </script> 3608 } 3609 3610 @helper RenderGridViewItemHiddenProperties() 3611 { 3612 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" /> 3613 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" /> 3614 <input type="hidden" name="VariantID{{id}}" value="{{variantid}}" id="Variant_{{id}}" /> 3615 <input type="hidden" name="UnitID{{id}}" value="{{unitId}}" id="Unit_{{id}}" /> 3616 <input type="hidden" name="Quantity{{id}}" value="1" id="Quantity_{{id}}" /> 3617 } 3618 3619 @helper RenderGridViewItemImageContainer() 3620 { 3621 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemImageContainer"); 3622 3623 <div class="grid__cell product-list__grid-item__image dw-mod {{noImage}}"> 3624 @RenderBlockList(subBlocks) 3625 </div> 3626 } 3627 3628 @helper RenderGridViewItemImage() 3629 { 3630 bool secondaryImage = gridViewSettings.GetString("HoverAlternatineImage") != null ? gridViewSettings.GetBoolean("HoverAlternatineImage") : false; 3631 3632 <a href="{{link}}" 3633 onclick="{{#if googleImpression}}({{googleImpression}}, event){{/if}}" 3634 title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" 3635 class="u-block u-position-relative image-hover__wrapper dw-mod"> 3636 <img class="grid__cell-img grid__cell-img--centered u-padding b-lazy" src="/Files/Images/placeholder.gif" 3637 data-src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;crop=5&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image={{image}}" 3638 @if (secondaryImage) { 3639 <text> 3640 {{#if secondaryImage}} 3641 data-secondary-image-src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;crop=5&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image={{secondaryImage}}" 3642 {{/if}} 3643 </text> 3644 } 3645 alt="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" /> 3646 </a> 3647 } 3648 3649 @helper RenderGridViewItemStickers() 3650 { 3651 <text> 3652 {{#StickersContainers}} 3653 {{>StickersContainer}} 3654 {{/StickersContainers}} 3655 </text> 3656 } 3657 3658 @helper RenderGridViewItemFavorites() 3659 { 3660 <div class="favorites favorites--for-grid-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}> 3661 {{#Favorite}} 3662 {{>FavoriteTemplate}} 3663 {{/Favorite}} 3664 </div> 3665 } 3666 3667 @helper RenderGridViewItemInfoContainer() 3668 { 3669 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemInfoContainer"); 3670 3671 <div class="grid__cell product-list__grid-item__price-info dw-mod"> 3672 @RenderBlockList(subBlocks) 3673 </div> 3674 } 3675 3676 @helper RenderGridViewItemTitle() 3677 { 3678 <a href="{{link}}" class="u-color-inherit" onclick="{{#if googleImpression}}({{googleImpression}}, event){{/if}}" title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}"> 3679 <h6 class="u-condensed-text">{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}</h6> 3680 </a> 3681 } 3682 3683 @helper RenderGridViewItemNumber() 3684 { 3685 <div class="item-number dw-mod">@Translate("Art. no."): {{number}}</div> 3686 } 3687 3688 @helper RenderGridViewItemPrice() 3689 { 3690 int columnsCount = gridViewSettings.GetList("Columns") != null ? Converter.ToInt32(gridViewSettings.GetList("Columns").SelectedValue) : 4; 3691 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3692 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowAddToCartButton"); 3693 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT"); 3694 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat; 3695 3696 if (pointShopOnly) 3697 { 3698 <text> 3699 {{#if havePointPrice}} 3700 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div> 3701 @if (showCartButton) 3702 { 3703 <text> 3704 {{#unless canBePurchasedWithPoints}} 3705 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3706 {{/unless}} 3707 </text> 3708 } 3709 {{else}} 3710 @Translate("Not available") 3711 {{/if}} 3712 </text> 3713 3714 } 3715 else 3716 { 3717 <text> 3718 {{#unless HidePriceDS}} 3719 <div class="price price--product-list dw-mod">{{price}} @Translate("Excl. VAT")</div> 3720 <div class="before-price {{onSale}} dw-mod">{{discount}}</div> 3721 @if (showVATPrice) 3722 { 3723 <div class="vat-price vat-price--product-list u-margin-top dw-mod"> 3724 @if (columnsCount <= 4) { 3725 if (isPricesWithVATEnabled) 3726 { 3727 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span> 3728 } 3729 else 3730 { 3731 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span> 3732 } 3733 } else { 3734 if (isPricesWithVATEnabled) 3735 { 3736 <div>@Translate("excl. VAT")</div><div>({{priceWithoutVAT}})</div> 3737 } 3738 else 3739 { 3740 <div>@Translate("incl. VAT")</div><div>({{priceWithVAT}})</div> 3741 } 3742 } 3743 </div> 3744 } 3745 {{/unless}} 3746 </text> 3747 <text> 3748 {{#if priceRRP}} 3749 <div><small>@Translate("RRP") {{priceRRP}}</small></div> 3750 {{/if}} 3751 </text> 3752 } 3753 } 3754 3755 @helper RenderGridViewItemFooter() 3756 { 3757 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemFooter"); 3758 bool showStaticVariants = gridViewSettings.GetBoolean("ShowStaticVariants"); 3759 3760 <div class="product-list__grid-item__footer dw-mod"> 3761 @RenderBlockList(subBlocks) 3762 </div> 3763 } 3764 3765 @helper RenderGridViewItemViewButton() 3766 { 3767 string viewMoreText = gridViewSettings.GetString("ViewMoreText"); 3768 viewMoreText = !string.IsNullOrEmpty(viewMoreText) ? viewMoreText : "View"; 3769 3770 @Render(new Link 3771 { 3772 Href = "{{link}}", 3773 Id = "CartButton_{{id}}", 3774 Title = Translate(viewMoreText), 3775 OnClick = "{{#if googleImpression}}({{googleImpression}}, event){{/if}}", 3776 ButtonLayout = ButtonLayout.Secondary, 3777 CssClass = "u-no-margin" 3778 }); 3779 } 3780 3781 @helper RenderGridViewItemAddToCart() 3782 { 3783 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3784 string wrapperClass = "buttons-collection--center"; 3785 int columnsCount = gridViewSettings.GetList("Columns") != null ? Converter.ToInt32(gridViewSettings.GetList("Columns").SelectedValue) : 4; 3786 bool hideButtonText = columnsCount >= 4 || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet"; 3787 string gridCartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetString("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart"; 3788 3789 if (pointShopOnly && columnsCount <= 4) 3790 { 3791 hideButtonText = false; 3792 } 3793 3794 <text> 3795 {{#unless HidePriceDS}} 3796 {{#if ProductPriceIsMinimum}} 3797 <a href="{{link}}" class="js-cart-btn btn btn--secondary btn--condensed u-no-margin u-pull--right dw-mod" style="margin-bottom: 1.4rem;" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}"> 3798 @Translate("Select length") 3799 </a> 3800 {{else}} 3801 {{#if outOfStock}} 3802 <label 3803 onclick="DisplayAdddToCartDialog('{{ACOAvailability}}','{{productId}}','{{variantid}}','{{unitId}}','{{id}}',{{productInfo}},{{facebookPixelAction}});" type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-pull--right u-no-margin dw-mod {{disabledBuyButton}}" {{disabledBuyButton}}> 3804 <i class="@gridCartIcon"></i> 3805 </label> 3806 {{else}} 3807 @*<button type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod {{disabledBuyButton}}" 3808 onclick="AddToCartProducts('{{stockValue}}','{{productId}}','{{variantid}}','{{unitId}}','{{id}}',{{productInfo}}); {{facebookPixelAction}}" {{disabledBuyButton}}> 3809 <i class="@gridCartIcon"></i> 3810 </button>*@ 3811 3812 <button type="button" id="CartButton_{{id}}" class="buyItemBtn js-cart-btn btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod {{disabledBuyButton}}" 3813 onclick="AddToCartProducts('{{stockValue}}','{{productId}}','{{variantid}}','{{unitId}}','{{id}}',{{productInfo}}); {{facebookPixelAction}}" {{disabledBuyButton}}> 3814 <i class="@gridCartIcon"></i> 3815 </button> 3816 3817 {{/if}} 3818 3819 @*Dignet + IvanB 23.02.23*@ 3820 <input type="number" class="u-w80px u-pull--right" id="QuantityBox_{{id}}" name="QuantityBox{{id}}" onchange=CalculateMinOrderQunatity(this,{{purchaseQuantityStep}}) step="{{purchaseQuantityStep}}" value="{{purchaseMinimalQuantity}}" min="{{purchaseMinimalQuantity}}"> 3821 3822 3823 @*<input type="number" class="u-w80px u-pull--right" id="QuantityBox_{{id}}" name="QuantityBox{{id}}" onchange=CalculateMinOrderQunatity(this,{{purchaseQuantityStep}}) step="{{purchaseQuantityStep}}" value="1" min="{{purchaseMinimalQuantity}}">*@ 3824 @*<input type="number" class="u-w80px u-pull--right" id="QuantityBox_{{id}}" name="QuantityBox{{id}}" onchange=CalculateMinOrderQunatity(this,1) step="{{purchaseQuantityStep}}" value="1" min="1">*@ 3825 3826 @*Dignet - IvanB 23.02.23*@ 3827 3828 {{/if}} 3829 {{/unless}} 3830 3831 </text> 3832 } 3833 3834 @helper RenderGridViewItemActions() 3835 { 3836 bool showCartButton = gridViewSettings.GetBoolean("ShowAddToCartButton"); 3837 bool showViewButton = gridViewSettings.GetBoolean("ShowViewButton"); 3838 3839 @RenderGridViewItemAddToCart() 3840 3841 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && false) 3842 { 3843 if (showCartButton) 3844 { 3845 if (!showViewButton) 3846 { 3847 <text>{{#if hideAddToCartButton}}</text> 3848 <div>@RenderGridViewItemViewButton()</div> 3849 <text>{{else}}</text> 3850 @RenderGridViewItemAddToCart() 3851 <text>{{/if}}</text> 3852 } 3853 else 3854 { 3855 @RenderGridViewItemAddToCart() 3856 } 3857 } 3858 else if (showViewButton) 3859 { 3860 <div>@RenderGridViewItemViewButton()</div> 3861 } 3862 } 3863 else if (showViewButton && false) 3864 { 3865 <div>@RenderGridViewItemViewButton()</div> 3866 } 3867 } 3868 3869 @helper RenderGridViewItemStockAndDelivery() 3870 { 3871 3872 <div class="u-margin-top"> 3873 <div> 3874 @Translate("Availability"): 3875 <span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span> {{stockText}}{{deliveryText}} 3876 </div> 3877 </div> 3878 3879 } 3880 3881 @helper RenderGridViewItemStaticVariants() 3882 { 3883 string variantsSize = gridViewSettings.GetList("StaticVariantsDisplay") != null ? gridViewSettings.GetList("StaticVariantsDisplay").SelectedValue : "sm"; 3884 3885 <text> 3886 {{#Variants}} 3887 @if ( variantsSize == "lg" ) { 3888 <text> 3889 {{>StaticVariantsLgTemplate}} 3890 </text> 3891 } else { 3892 <text> 3893 {{>StaticVariantsTemplate}} 3894 </text> 3895 } 3896 {{/Variants}} 3897 3898 {{#ifCond variantGroupsCount '>' 1}} 3899 <div class="static-variant"> 3900 @Translate("More options available") 3901 </div> 3902 {{/ifCond}} 3903 3904 {{#ifCond variantGroupsCount '==' 0}} 3905 <div class="static-variant"></div> 3906 {{/ifCond}} 3907 </text> 3908 } 3909 3910 @helper RenderGridViewItemDownloadButton() 3911 { 3912 <button type="button" class="btn btn--primary u-no-margin u-margin-top btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}"> 3913 @Render(new Icon { Prefix = "fas", Name = "fa-plus", CssClass = "js-button-icon" }) 3914 <span class="js-button-text">@Translate("Add")</span> 3915 </button> 3916 } 3917 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3918 @using Dynamicweb.Core 3919 @using System 3920 @using System.Web 3921 @using System.Collections.Generic 3922 @using Dynamicweb.Rapido.Blocks 3923 @using Dynamicweb.Rapido.Blocks.Components 3924 @using Dynamicweb.Rapido.Blocks.Components.General 3925 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 3926 @using Dynamicweb.Rapido.Services 3927 3928 @functions { 3929 BlocksPage detailsViewPage = BlocksPage.GetBlockPage("ProductList"); 3930 Dynamicweb.Frontend.ItemViewModel detailsViewSettings = null; 3931 3932 /* this function need because in details view we have specipfic situation 3933 * when price need to be placed between unit selector and quantity selector 3934 */ 3935 3936 UnitSelector getUnitsSelector() 3937 { 3938 return new UnitSelector 3939 { 3940 OptionsContent = "{{#unitOptions}}{{>UnitOption}}{{/unitOptions}}", 3941 Id = "UnitOptions_{{id}}", 3942 SelectedOption = "{{unitName}}", 3943 CssClass = "product-list__details-units-selector {{#if hasOnlyOneUnit}}unit-selector--readonly{{/if}} {{hasUnits}}" 3944 }; 3945 } 3946 } 3947 3948 @if (Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableDetailsView")) 3949 { 3950 detailsViewSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView"); 3951 3952 detailsViewPage.Add("Views", new Block 3953 { 3954 Id = "ProductDetailsItemContainer", 3955 Name = "list", 3956 SortId = 30 3957 }); 3958 3959 Block detailsViewScripts = new Block 3960 { 3961 Id = "DetailsViewScripts", 3962 SortId = 30, 3963 Template = DetailsView(), 3964 BlocksList = new List<Block> 3965 { 3966 new Block 3967 { 3968 Id = "DetailsViewItem", 3969 SortId = 10, 3970 Template = RenderDetailsViewItem(), 3971 SkipRenderBlocksList = true, 3972 BlocksList = new List<Block> { 3973 new Block 3974 { 3975 Id = "DetailsViewItemHiddenProperties", 3976 SortId = 10, 3977 Template = RenderDetailsViewItemHiddenProperties() 3978 }, 3979 new Block 3980 { 3981 Id = "DetailsViewItemLeft", 3982 SortId = 10, 3983 Design = new Design 3984 { 3985 CssClass = "product-list__details-item__left grid__cell dw-mod" 3986 }, 3987 BlocksList = new List<Block> { 3988 new Block 3989 { 3990 Id = "DetailsViewItemInfoContainer", 3991 SortId = 20, 3992 Design = new Design 3993 { 3994 CssClass = "product-list__details-info dw-mod" 3995 }, 3996 BlocksList = new List<Block> { 3997 new Block 3998 { 3999 Id = "DetailsViewItemTitle", 4000 SortId = 10, 4001 Template = RenderDetailsViewItemTitle() 4002 }, 4003 new Block 4004 { 4005 Id = "DetailsViewItemStickers", 4006 SortId = 50, 4007 Template = RenderDetailsViewItemStickers() 4008 } 4009 } 4010 } 4011 } 4012 }, 4013 new Block 4014 { 4015 Id = "DetailsViewItemRight", 4016 SortId = 20, 4017 Design = new Design 4018 { 4019 CssClass = "product-list__details-item__right grid__cell dw-mod" 4020 }, 4021 BlocksList = new List<Block> { 4022 new Block { 4023 Id = "DetailsViewItemRightBottom", 4024 SortId = 20, 4025 Design = new Design 4026 { 4027 CssClass = "u-flex product-list__details-right-bottom-section dw-mod" 4028 }, 4029 BlocksList = new List<Block> { 4030 new Block 4031 { 4032 Id = "DetailsViewItemActions", 4033 SortId = 30, 4034 Template = RenderDetailsViewItemActions() 4035 } 4036 } 4037 } 4038 } 4039 } 4040 } 4041 } 4042 } 4043 }; 4044 detailsViewPage.Add("BottomSnippets", detailsViewScripts); 4045 4046 //image 4047 bool detailsViewShowImage = detailsViewSettings.GetBoolean("ShowImage"); 4048 4049 if (detailsViewShowImage) 4050 { 4051 detailsViewPage.Add("DetailsViewItemLeft", new Block 4052 { 4053 Id = "DetailsViewItemImage", 4054 SortId = 10, 4055 Template = RenderDetailsViewItemImage() 4056 }); 4057 } 4058 4059 //number 4060 bool detailsViewShowNumber = detailsViewSettings.GetBoolean("ShowProductNumber"); 4061 4062 if (detailsViewShowNumber) 4063 { 4064 detailsViewPage.Add("DetailsViewItemInfoContainer", new Block 4065 { 4066 Id = "ProductDetailsItemNumber", 4067 SortId = 30, 4068 Template = RenderDetailsViewItemNumber() 4069 }); 4070 } 4071 4072 //static variants 4073 bool detailsViewShowStaticVariants = detailsViewSettings.GetBoolean("ShowStaticVariants"); 4074 4075 if (detailsViewShowStaticVariants) 4076 { 4077 detailsViewPage.Add("DetailsViewItemInfoContainer", new Block 4078 { 4079 Id = "DetailsViewItemStaticVariants", 4080 SortId = 30, 4081 Template = RenderDetailsViewItemStaticVariants() 4082 }); 4083 } 4084 4085 //stock 4086 bool detailsViewShowStock = detailsViewSettings.GetBoolean("ShowStockAndShipping"); 4087 4088 if (User.IsStockInfoAllowed() && detailsViewShowStock || true) 4089 { 4090 detailsViewPage.Add("DetailsViewItemInfoContainer", new Block 4091 { 4092 Id = "DetailsViewItemStock", 4093 SortId = 40, 4094 Template = RenderDetailsViewItemStock() 4095 }); 4096 } 4097 4098 //price 4099 bool detailsViewShowPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice"); 4100 if (detailsViewShowPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 4101 { 4102 var separatedUnitSelector = getUnitsSelector(); 4103 separatedUnitSelector.CssClass += " product-list__details-units-selector--separated"; 4104 4105 detailsViewPage.Add("DetailsViewItemRightBottom", new Block 4106 { 4107 Id = "DetailsViewUnitSelector", 4108 SortId = 10, 4109 Component = separatedUnitSelector 4110 }); 4111 4112 detailsViewPage.Add("DetailsViewItemRightBottom", new Block 4113 { 4114 Id = "ProductDetailsItemPrice", 4115 SortId = 20, 4116 Template = RenderDetailsViewItemPrice() 4117 }); 4118 } 4119 4120 //favorites 4121 bool detailsViewShowFavoriteButton = !detailsViewSettings.GetBoolean("HideFavoriteButton"); 4122 4123 if (detailsViewShowFavoriteButton && Pageview.User != null) 4124 { 4125 detailsViewPage.Add("DetailsViewItemRightBottom", new Block 4126 { 4127 Id = "DetailsViewItemFavorites", 4128 SortId = 40, 4129 Template = RenderDetailsViewItemFavorites() 4130 }); 4131 } 4132 4133 //download button 4134 bool detailsViewShowAddToDownloadButton = detailsViewSettings.GetBoolean("ShowAddToDownloadButton"); 4135 4136 if (detailsViewShowAddToDownloadButton && Pageview.User != null) 4137 { 4138 detailsViewPage.Add("DetailsViewItemRightBottom", new Block 4139 { 4140 Id = "DetailsViewItemDownloadButton", 4141 SortId = 20, 4142 Template = RenderDetailsViewItemDownloadButton() 4143 }); 4144 } 4145 } 4146 4147 @helper DetailsView() 4148 { 4149 <script id="ProductDetailsItemContainer" type="text/x-template"> 4150 {{#.}} 4151 <div id="Product{{id}}" data-template="DetailsViewItem" data-preloader="overlay" class="grid__col-12 u-no-padding-y js-product dw-mod" style="z-index: {{zIndex}}"> 4152 {{#Product}} 4153 {{>DetailsViewItem}} 4154 {{/Product}} 4155 </div> 4156 {{/.}} 4157 </script> 4158 } 4159 4160 @helper RenderDetailsViewItem() 4161 { 4162 List<Block> subBlocks = detailsViewPage.GetBlockListById("DetailsViewItem"); 4163 4164 <script id="DetailsViewItem" type="text/x-template"> 4165 {{#.}} 4166 <div class="product-list__details-item grid__col-12 dw-mod js-product-scroll-trigger" data-params="{{googleImpression}}"> 4167 @RenderBlockList(subBlocks) 4168 </div> 4169 {{/.}} 4170 </script> 4171 } 4172 4173 @helper RenderDetailsViewItemHiddenProperties() 4174 { 4175 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" /> 4176 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" /> 4177 <input type="hidden" name="VariantID{{id}}" value="{{variantid}}" id="Variant_{{id}}" /> 4178 <input type="hidden" name="UnitID{{id}}" value="{{unitId}}" id="Unit_{{id}}" /> 4179 <input type="hidden" name="Quantity{{id}}" value="1" id="Quantity_{{id}}" /> 4180 } 4181 4182 @helper RenderDetailsViewItemImage() 4183 { 4184 <div class="lightbox"> 4185 <a href="{{link}}" onclick="{{#if googleImpression}}({{googleImpression}}, event){{/if}}" title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}"> 4186 <img class="lightbox__image {{noImage}}" src="/Admin/Public/GetImage.ashx?width=220&amp;height=220&amp;crop=5&amp;Compression=75&amp;image={{image}}" alt="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" /> 4187 <div class="u-margin-right {{noImage}}"> 4188 <img class="b-lazy product-list__details-image" src="/Files/Images/placeholder.gif" 4189 data-src="/Admin/Public/GetImage.ashx?width=75&amp;height=55&amp;crop=5&FillCanvas=true&amp;Compression=75&amp;image={{image}}" 4190 alt="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" /> 4191 </div> 4192 </a> 4193 </div> 4194 } 4195 4196 @helper RenderDetailsViewItemTitle() 4197 { 4198 <a href="{{link}}" onclick="{{#if googleImpression}}({{googleImpression}}, event){{/if}}" title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" class="product-list__details-title u-color-inherit dw-mod"> 4199 <h6 class="u-no-margin">{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}</h6> 4200 </a> 4201 } 4202 4203 @helper RenderDetailsViewItemNumber() 4204 { 4205 <div class="item-number item-number--compressed dw-mod"> 4206 <div class="item-number dw-mod">@Translate("Art. no."): {{number}}</div> 4207 </div> 4208 } 4209 4210 @helper RenderDetailsViewItemStaticVariants() 4211 { 4212 string variantsSize = detailsViewSettings.GetList("StaticVariantsDisplay") != null ? detailsViewSettings.GetList("StaticVariantsDisplay").SelectedValue : "sm"; 4213 4214 <text> 4215 <span> 4216 {{#Variants}} 4217 @if (variantsSize == "lg") 4218 { 4219 <text> 4220 {{>StaticVariantsLgTemplate}} 4221 </text> 4222 } 4223 else 4224 { 4225 <text> 4226 {{>StaticVariantsTemplate}} 4227 </text> 4228 } 4229 {{/Variants}} 4230 </span> 4231 4232 {{#ifCond variantGroupsCount '>' 1}} 4233 <div class="static-variant"> 4234 @Translate("More options available") 4235 </div> 4236 {{/ifCond}} 4237 </text> 4238 } 4239 4240 @helper RenderDetailsViewItemStock() 4241 { 4242 <div class="item-number item-number--compressed dw-mod"> 4243 <div> 4244 @Translate("Availability"): 4245 <span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span> {{stockText}}{{deliveryText}} 4246 </div> 4247 </div> 4248 } 4249 4250 @helper RenderDetailsViewItemStickers() 4251 { 4252 <div class="grid__cell-footer stickers-container stickers-container--row u-margin-top dw-mod"> 4253 {{#StickersContainers}} 4254 {{#Stickers}} 4255 {{>MiniSticker}} 4256 {{/Stickers}} 4257 {{/StickersContainers}} 4258 </div> 4259 } 4260 4261 @helper RenderDetailsViewItemPrice() 4262 { 4263 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 4264 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("DetailsView").GetBoolean("ShowAddToCartButton"); 4265 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT"); 4266 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat; 4267 4268 <div class="product-list__details-price"> 4269 @if (pointShopOnly) 4270 { 4271 <text> 4272 {{#if havePointPrice}} 4273 <div class="price price--product-list price--micro dw-mod">{{points}} @Translate("points")</div> 4274 @if (showCartButton) 4275 { 4276 <text> 4277 {{#unless canBePurchasedWithPoints}} 4278 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 4279 {{/unless}} 4280 </text> 4281 } 4282 {{else}} 4283 @Translate("Not available") 4284 {{/if}} 4285 </text> 4286 4287 } 4288 else 4289 { 4290 <text> 4291 {{#unless HidePriceDS}} 4292 <div class="price price--product-list price--micro dw-mod">{{price}} @Translate("Excl. VAT")</div> 4293 <div class="before-price {{onSale}} before-price--micro dw-mod">{{discount}}</div> 4294 @if (showVATPrice) 4295 { 4296 <div class="vat-price vat-price--product-list u-margin-top dw-mod"> 4297 @if (isPricesWithVATEnabled) 4298 { 4299 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span> 4300 } 4301 else 4302 { 4303 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span> 4304 } 4305 </div> 4306 } 4307 {{/unless}} 4308 </text> 4309 <text> 4310 {{#if priceRRP}} 4311 <div><small>@Translate("RRP") {{priceRRP}}</small></div> 4312 {{/if}} 4313 </text> 4314 } 4315 </div> 4316 } 4317 4318 @helper RenderDetailsViewItemFavorites() 4319 { 4320 <div class="favorites product-list__details-favorites {{hasVariants}} dw-mod" {{hasVariants}}> 4321 {{#Favorite}} 4322 {{>FavoriteTemplate}} 4323 {{/Favorite}} 4324 </div> 4325 } 4326 4327 @helper RenderDetailsViewItemViewButton() 4328 { 4329 string viewMoreText = detailsViewSettings.GetString("ViewMoreText"); 4330 viewMoreText = !string.IsNullOrEmpty(viewMoreText) ? viewMoreText : "View"; 4331 4332 <div class="product-list__details-actions"> 4333 @Render(new Link 4334 { 4335 Href = "{{link}}", 4336 Id = "CartButton_{{id}}", 4337 Title = Translate(viewMoreText), 4338 OnClick = "{{#if googleImpression}}({{googleImpression}}, event){{/if}}", 4339 ButtonLayout = ButtonLayout.Secondary, 4340 CssClass = "u-no-margin" 4341 }) 4342 </div> 4343 } 4344 4345 @helper RenderDetailsViewItemAddToCart() 4346 { 4347 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 4348 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice"); 4349 4350 string gridCartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetString("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart"; 4351 4352 <text> 4353 {{#unless HidePriceDS}} 4354 {{#if ProductPriceIsMinimum}} 4355 <a href="{{link}}" class="js-cart-btn btn btn--secondary btn--condensed u-no-margin u-pull--right dw-mod" onclick="Scroll.SavePosition(event); {{googleImpressionClick}}" title="{{name}}"> 4356 @Translate("Select length") 4357 </a> 4358 {{else}} 4359 <div> 4360 <input type="number" class="u-w80px u-pull--right" id="QuantityBox_{{id}}" style="margin-right:10px;" name="QuantityBox{{id}}" onchange=CalculateMinOrderQunatity(this,{{purchaseQuantityStep}}) step="{{purchaseQuantityStep}}" value="{{purchaseMinimalQuantity}}" min="{{purchaseMinimalQuantity}}"> 4361 </div> 4362 <div> 4363 {{#if outOfStock}} 4364 4365 <label onclick="DisplayAdddToCartDialog('{{ACOAvailability}}','{{productId}}','{{variantid}}','{{unitId}}','{{id}}',{{productInfo}},{{facebookPixelAction}});" type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-pull--right u-no-margin dw-mod {{disabledBuyButton}}" {{disabledBuyButton}}> 4366 <i class="@gridCartIcon"></i> 4367 </label> 4368 {{else}} 4369 <button type="button" id="CartButton_{{id}}" class="js-cart-btn btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod {{disabledBuyButton}}" name="submit" 4370 onclick="AddToCartProducts('{{stockValue}}','{{productId}}','{{variantid}}','{{unitId}}','{{id}}',{{productInfo}}); {{facebookPixelAction}}" {{disabledBuyButton}}> 4371 <i class="@gridCartIcon"></i> 4372 </button> 4373 {{/if}} 4374 </div> 4375 {{/if}} 4376 {{/unless}} 4377 </text> 4378 } 4379 4380 @helper RenderDetailsViewItemActions() 4381 { 4382 bool showCartButton = detailsViewSettings.GetBoolean("ShowAddToCartButton"); 4383 bool showViewButton = detailsViewSettings.GetBoolean("ShowViewButton"); 4384 4385 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 4386 { 4387 if (showCartButton) 4388 { 4389 if (!showViewButton) 4390 { 4391 @RenderDetailsViewItemAddToCart() 4392 } 4393 else 4394 { 4395 <text>{{#if hideAddToCartButton}}</text> 4396 @RenderDetailsViewItemViewButton() 4397 <text>{{else}}</text> 4398 @RenderDetailsViewItemAddToCart() 4399 <text>{{/if}}</text> 4400 } 4401 } 4402 else if (showViewButton) 4403 { 4404 @RenderDetailsViewItemViewButton() 4405 } 4406 } 4407 else if (showViewButton) 4408 { 4409 @RenderDetailsViewItemViewButton() 4410 } 4411 } 4412 4413 @helper RenderDetailsViewItemDownloadButton() 4414 { 4415 <button type="button" class="btn btn--primary u-no-margin u-margin-left btn--condensed dw-mod js-add-to-downloads" title="@Translate(" Add")" data-product-id="{{productId}}"> 4416 @Render(new Icon { Prefix = "fas", Name = "fa-plus", CssClass = "js-button-icon" }) 4417 </button> 4418 } 4419 4420 4421 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4422 @using Dynamicweb.Core 4423 @using System 4424 @using System.Web 4425 @using System.Collections.Generic 4426 @using Dynamicweb.Rapido.Blocks 4427 @using Dynamicweb.Rapido.Blocks.Components 4428 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 4429 @using Dynamicweb.Rapido.Blocks.Components.General 4430 @using Dynamicweb.Rapido.Services 4431 @using System.Web.Helpers 4432 4433 @functions { 4434 BlocksPage tilesView = BlocksPage.GetBlockPage("ProductList"); 4435 Dynamicweb.Frontend.ItemViewModel tilesViewSettings = null; 4436 } 4437 4438 @{ 4439 var settings = Pageview.AreaSettings.GetItem("ProductList"); 4440 var enableTiles = settings.GetBoolean("EnableTilesView"); 4441 4442 if ( enableTiles ) { 4443 tilesViewSettings = settings.GetItem("TilesView"); 4444 BlocksPage tilesView = BlocksPage.GetBlockPage("ProductList"); 4445 4446 Block tiles = new Block { 4447 Id = "ProductTilesViewContainer", 4448 Name ="grip-horizontal", 4449 SortId = 50, 4450 }; 4451 4452 tilesView.Add("Views", tiles); 4453 4454 4455 Block tilesViewScripts = new Block { 4456 Id = "TilesViewScripts", 4457 SortId = 20, 4458 Template = TilesView(), 4459 BlocksList = new List<Block> { 4460 new Block { 4461 Id = "TilesViewItem", 4462 SortId = 10, 4463 Template = RenderTilesViewItem(), 4464 SkipRenderBlocksList = true, 4465 BlocksList = new List<Block> { 4466 new Block { 4467 Id = "TilesViewItemHiddenProperties", 4468 SortId = 10, 4469 Template = RenderTilesViewItemHiddenProperties() 4470 }, 4471 new Block { 4472 Id = "TilesViewItemImageContainer", 4473 SortId = 20, 4474 Template = RenderTilesViewItemImageContainer(), 4475 SkipRenderBlocksList = true, 4476 BlocksList = new List<Block> { 4477 new Block { 4478 Id = "TilesViewItemImage", 4479 SortId = 10, 4480 Template = RenderTilesViewItemImage(), 4481 }, 4482 new Block 4483 { 4484 Id = "TilesViewItemStickers", 4485 SortId = 20, 4486 Template = RenderTilesViewItemStickers() 4487 }, 4488 new Block { 4489 Id = "TilesViewItemFavorites", 4490 SortId = 20, 4491 Template = RenderTilesViewItemFavorites() 4492 }, 4493 }, 4494 }, 4495 new Block { 4496 Id = "TilesViewItemContentContainer", 4497 SortId = 30, 4498 Template = RenderTilesViewItemContentContainer(), 4499 SkipRenderBlocksList = true, 4500 BlocksList = new List<Block> { 4501 new Block { 4502 Id = "TilesViewItemContent", 4503 SortId = 30, 4504 Template = RenderTilesViewItemContent(), 4505 SkipRenderBlocksList = true, 4506 BlocksList = new List<Block> { 4507 new Block { 4508 Id = "TilesViewItemHeader", 4509 SortId = 10, 4510 Template = RenderTilesViewItemHeader(), 4511 SkipRenderBlocksList = true, 4512 BlocksList = new List<Block> { 4513 new Block { 4514 Id = "TilesViewItemTitle", 4515 SortId = 10, 4516 Template = RenderTilesViewItemTitle(), 4517 }, 4518 new Block { 4519 Id = "TilesViewItemNumber", 4520 SortId = 20, 4521 Template = RenderTilesViewItemNumber(), 4522 }, 4523 } 4524 }, 4525 new Block { 4526 Id = "TilesViewItemPrice", 4527 SortId = 30, 4528 Template = RenderTilesViewItemPrice(), 4529 }, 4530 } 4531 }, 4532 new Block { 4533 Id = "TilesViewItemFooter", 4534 SortId = 40, 4535 Template = RenderTilesViewItemFooter(), 4536 SkipRenderBlocksList = true 4537 } 4538 } 4539 } 4540 } 4541 } 4542 } 4543 }; 4544 tilesView.Add("BottomSnippets", tilesViewScripts); 4545 4546 if (tilesViewSettings.GetBoolean("ShowStaticVariants")) { 4547 Block staticVariants = new Block { 4548 Id = "TilesViewItemVariants", 4549 SortId = 10, 4550 Template = RenderTilesViewItemVariants(), 4551 }; 4552 tilesView.Add("TilesViewItemContentContainer", staticVariants); 4553 } 4554 4555 //download button 4556 bool tilesViewShowAddToDownloadButton = tilesViewSettings.GetBoolean("ShowAddToDownloadButton"); 4557 4558 if (tilesViewShowAddToDownloadButton && Pageview.User != null) 4559 { 4560 tilesView.Add("TilesViewItemFooter", new Block 4561 { 4562 Id = "TilesViewItemDownloadButton", 4563 SortId = 20, 4564 Template = RenderTilesViewItemDownloadButton() 4565 }); 4566 } 4567 } 4568 } 4569 4570 @helper TilesView() { 4571 int columnsCount = tilesViewSettings.GetList("Columns") != null ? Converter.ToInt32(tilesViewSettings.GetList("Columns").SelectedValue) : 3; 4572 4573 <script id="ProductTilesViewContainer" type="text/x-template"> 4574 {{#.}} 4575 <div id="Product{{id}}" data-template="TilesViewItem" data-preloader="overlay" class="grid__col-lg-@(12 / columnsCount) grid__col-md-@(12 / columnsCount) grid__col-sm-@(12 / columnsCount) grid__col-xs-6 product-list__tiles-item js-product dw-mod"> 4576 {{#Product}} 4577 {{>TilesViewItem}} 4578 {{/Product}} 4579 </div> 4580 {{/.}} 4581 </script> 4582 } 4583 4584 4585 @helper RenderTilesViewItem() { 4586 List<Block> subBlocks = tilesView.GetBlockListById("TilesViewItem"); 4587 bool showShadow = tilesViewSettings.GetBoolean("HoverShowShadow"); 4588 string addShadow = ( showShadow != null && showShadow ) ? "product-list--shadow" : ""; 4589 4590 <script id="TilesViewItem" type="text/x-template"> 4591 {{#.}} 4592 <div class="grid__col--auto js-product-scroll-trigger u-no-padding u-full-height @addShadow" data-params="{{googleImpression}}"> 4593 @RenderBlockList(subBlocks) 4594 </div> 4595 {{/.}} 4596 </script> 4597 } 4598 4599 4600 @helper RenderTilesViewItemContentContainer() { 4601 List<Block> subBlocks = tilesView.GetBlockListById("TilesViewItemContentContainer"); 4602 4603 <text> 4604 {{#.}} 4605 <div class="grid__cell product-list__tiles-item__price-info u-padding--lg u-flex u-flex--column dw-mod"> 4606 @RenderBlockList(subBlocks) 4607 </div> 4608 {{/.}} 4609 </text> 4610 } 4611 4612 4613 4614 @helper RenderTilesViewItemVariants() { 4615 string variantsSize = tilesViewSettings.GetList("StaticVariantsDisplay") != null ? tilesViewSettings.GetList("StaticVariantsDisplay").SelectedValue : "sm"; 4616 4617 <text> 4618 {{#Variants}} 4619 @if ( variantsSize == "lg" ) { 4620 <text> 4621 {{>StaticVariantsLgTemplate}} 4622 </text> 4623 } else { 4624 <text> 4625 {{>StaticVariantsTemplate}} 4626 </text> 4627 } 4628 {{/Variants}} 4629 4630 {{#ifCond variantGroupsCount '==' 0}} 4631 <div class="static-variant"></div> 4632 {{/ifCond}} 4633 </text> 4634 } 4635 4636 @helper RenderTilesViewItemFavorites() { 4637 bool showFavoriteButton = !tilesViewSettings.GetBoolean("HideFavoriteButton"); 4638 4639 if ( !showFavoriteButton ) { 4640 return; 4641 } 4642 4643 <div class="favorites favorites--for-tiles-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}> 4644 {{#Favorite}} 4645 {{>FavoriteTemplate}} 4646 {{/Favorite}} 4647 </div> 4648 } 4649 4650 @helper RenderTilesViewItemImageContainer() { 4651 List<Block> subBlocks = tilesView.GetBlockListById("TilesViewItemImageContainer"); 4652 4653 <div class="grid__cell dw-mod {{noImage}}"> 4654 @RenderBlockList(subBlocks) 4655 </div> 4656 } 4657 4658 @helper RenderTilesViewItemStickers() 4659 { 4660 <text> 4661 {{#StickersContainers}} 4662 {{>StickersContainer}} 4663 {{/StickersContainers}} 4664 </text> 4665 } 4666 4667 @helper RenderTilesViewItemImage() { 4668 string imageZoomOnHover = tilesViewSettings.GetBoolean("HoverImageZoom") ? "image-hover--zoom" : ""; 4669 bool secondaryImage = tilesViewSettings.GetString("HoverAlternativeImage") != null ? tilesViewSettings.GetBoolean("HoverAlternativeImage") : false; 4670 4671 <a href="{{link}}" 4672 onclick="{{#if googleImpression}}({{googleImpression}}, event){{/if}}" 4673 title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" 4674 class="product-list__tiles-item__image u-block u-position-relative image-hover__wrapper @imageZoomOnHover dw-mod"> 4675 <img class="grid__cell-img u-middle-horizontal b-lazy" src="/Files/Images/placeholder.gif" 4676 data-src="/Admin/Public/GetImage.ashx?width=450&amp;height=450&amp;crop=5&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image={{image}}" 4677 @if (secondaryImage) { 4678 <text> 4679 {{#if secondaryImage}} 4680 data-secondary-image-src="/Admin/Public/GetImage.ashx?width=450&amp;height=450&amp;crop=5&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image={{secondaryImage}}" 4681 {{/if}} 4682 </text> 4683 } 4684 alt="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" /> 4685 </a> 4686 } 4687 4688 4689 @helper RenderTilesViewItemHiddenProperties() { 4690 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" /> 4691 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" /> 4692 <input type="hidden" name="VariantID{{id}}" value="{{variantid}}" id="Variant_{{id}}" /> 4693 <input type="hidden" name="UnitID{{id}}" value="{{unitId}}" id="Unit_{{id}}" /> 4694 <input type="hidden" name="Quantity{{id}}" value="1" id="Quantity_{{id}}" /> 4695 } 4696 4697 4698 @helper RenderTilesViewItemContent() { 4699 List<Block> subBlocks = tilesView.GetBlockListById("TilesViewItemContent"); 4700 4701 <div class="grid__cell dw-mod"> 4702 @RenderBlockList(subBlocks) 4703 </div> 4704 } 4705 4706 4707 @helper RenderTilesViewItemHeader() { 4708 List<Block> subBlocks = tilesView.GetBlockListById("TilesViewItemHeader"); 4709 4710 <div class="u-flex u-justify-content--between u-margin-bottom dw-mod"> 4711 @RenderBlockList(subBlocks) 4712 </div> 4713 } 4714 4715 4716 @helper RenderTilesViewItemTitle() { 4717 <a href="{{link}}" class="u-color-inherit u-flex-basis--50 u-flex-grow--1" onclick="{{#if googleImpression}}({{googleImpression}}, event){{/if}}" title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}"> 4718 <h6 class="u-bold u-capitalize">{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}</h6> 4719 </a> 4720 } 4721 4722 4723 @helper RenderTilesViewItemNumber() { 4724 bool showNumber = tilesViewSettings.GetBoolean("ShowProductNumber"); 4725 4726 if ( !showNumber ) { 4727 return; 4728 } 4729 4730 <div class="item-number u-margin-left--lg dw-mod">{{number}}</div> 4731 } 4732 4733 4734 @helper RenderTilesViewItemPrice() { 4735 <div class="price__wrapper u-flex u-flex--wrap u-justify-content--between"> 4736 <div class="price__inner u-margin-right"> 4737 <div class="price price--product-list u-bold dw-mod">{{price}}</div> 4738 <div class="before-price {{onSale}} dw-mod">{{discount}}</div> 4739 </div> 4740 4741 {{#if priceRRP}} 4742 <div class="price--rrp dw-mod">{{priceRRP}}</div> 4743 {{/if}} 4744 </div> 4745 } 4746 4747 4748 @helper RenderTilesViewItemFooter() { 4749 List<Block> subBlocks = tilesView.GetBlockListById("TilesViewItemFooter"); 4750 4751 <div class="product-list__tiles-item__footer u-margin-top--auto dw-mod"> 4752 @RenderBlockList(subBlocks) 4753 </div> 4754 } 4755 4756 @helper RenderTilesViewItemDownloadButton() { 4757 <button type="button" class="btn btn--primary u-no-margin u-margin-top btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}"> 4758 @Render(new Icon { Prefix = "fas", Name = "fa-plus", CssClass = "js-button-icon" }) 4759 <span class="js-button-text">@Translate("Add")</span> 4760 </button> 4761 } 4762 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4763 @using Dynamicweb.Core 4764 @using System 4765 @using System.Web 4766 @using System.Collections.Generic 4767 @using Dynamicweb.Rapido.Blocks 4768 4769 @{ 4770 BlocksPage productListPromotionsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 4771 4772 Block productListPromotions = new Block 4773 { 4774 Id = "Promotions", 4775 SortId = 10, 4776 Template = RenderProductListPromotions() 4777 }; 4778 productListPromotionsBlocksPage.Add("PageContainer", productListPromotions); 4779 } 4780 4781 @helper RenderProductListPromotions() 4782 { 4783 @*This is part of a script template *@ 4784 4785 string listId = HttpContext.Current.Request.QueryString.Get("ListID"); 4786 bool isFavoriteList = !string.IsNullOrEmpty(listId); 4787 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "u-no-padding" : ""; 4788 4789 if (!isFavoriteList) 4790 { 4791 switch (Pageview.AreaSettings.GetItem("ProductList").GetList("PromotionBlockDesign").SelectedValue) 4792 { 4793 case "OnlyText": 4794 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 4795 <h1>{{groupPromotionHeader}}</h1> 4796 {{{groupDescription}}} 4797 {{#ifCond groupPromotionLinkText "!==" ""}} 4798 <div> 4799 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 4800 </div> 4801 {{/ifCond}} 4802 </article> 4803 break; 4804 case "TextAndImage": 4805 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 4806 <div class="grid grid--bleed"> 4807 <div class="grid__col-md-6"> 4808 <h1>{{groupPromotionHeader}}</h1> 4809 {{{groupDescription}}} 4810 {{#ifCond groupPromotionLinkText "!==" ""}} 4811 <div> 4812 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 4813 </div> 4814 {{/ifCond}} 4815 </div> 4816 {{#ifCond groupPromotionImage "!==" ""}} 4817 <div class="grid__col-md-6"> 4818 <img src="/Admin/Public/GetImage.ashx?width=600&crop=5&Compression=75&DoNotUpscale=true&image={{groupPromotionImage}}" alt="{{groupName}}" class="background-image__cover" /> 4819 </div> 4820 {{/ifCond}} 4821 </div> 4822 </article> 4823 break; 4824 case "Banner": 4825 <text> 4826 {{#ifCond groupPromotionImage "!==" ""}} 4827 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 4828 <div class="u-color-light grid center-container center-container--with-background-image grid__col--bg" style="background-image:url('{{groupPromotionImage}}');"> 4829 <div class="grid__col-12 u-middle"> 4830 <div class="grid__cell"> 4831 {{{groupDescription}}} 4832 {{#ifCond groupPromotionLinkText "!==" ""}} 4833 <div> 4834 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 4835 </div> 4836 {{/ifCond}} 4837 </div> 4838 </div> 4839 </div> 4840 </article> 4841 {{/ifCond}} 4842 </text> 4843 break; 4844 } 4845 } 4846 } 4847 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4848 @using Dynamicweb.Core 4849 @using System 4850 @using System.Web 4851 @using System.Collections.Generic 4852 @using Dynamicweb.Rapido.Blocks 4853 4854 @{ 4855 BlocksPage productListMenuBlocksPage = BlocksPage.GetBlockPage("ProductList"); 4856 4857 if ( 4858 Converter.ToString(Pageview.Page.PropertyItem["LeftMenu"]) == "True" && 4859 Pageview.Page.NavigationSettings != null && 4860 Pageview.Page.NavigationSettings.UseEcomGroups) { 4861 4862 Block productListMenuBlock = new Block 4863 { 4864 Id = "Menu", 4865 SortId = 20, 4866 Template = RenderProductListMenu() 4867 }; 4868 4869 productListMenuBlocksPage.Add("Navigation", productListMenuBlock); 4870 } 4871 } 4872 4873 @helper RenderProductListMenu() 4874 { 4875 var navigationMarkup = RenderNavigation(new 4876 { 4877 id = "leftnav", 4878 cssclass = "dwnavigation", 4879 startLevel = 1, 4880 endlevel = 5, 4881 template = "LeftNavigation.xslt", 4882 mode = "ecom" 4883 }); 4884 4885 <h2 class="u-margin-bottom">@Translate("Product categories")</h2> 4886 4887 <div class="u-padding-bottom--lg"> 4888 @navigationMarkup 4889 </div> 4890 } 4891 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4892 @using Dynamicweb.Core 4893 @using System 4894 @using System.Web 4895 @using System.Collections.Generic 4896 @using Dynamicweb.Rapido.Blocks 4897 @using Dynamicweb.Rapido.Blocks.Components.General 4898 4899 @{ 4900 BlocksPage productListFacetsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 4901 string facetsBlockViewMode = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode")) ? Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode").ToLower() : "left"; 4902 4903 if (facetsBlockViewMode == "left" && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4904 { 4905 Block facetsBlock = new Block 4906 { 4907 Id = "Facets", 4908 SortId = 30, 4909 Template = RenderProductListFacets() 4910 }; 4911 productListFacetsBlocksPage.Add("Navigation", facetsBlock); 4912 } 4913 4914 if (facetsBlockViewMode == "top" || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 4915 { 4916 Block facetsBlock = new Block 4917 { 4918 Id = "Facets", 4919 SortId = 10, 4920 Template = RenderProductListTopFacets() 4921 }; 4922 //productListFacetsBlocksPage.Add("ProductList", facetsBlock); 4923 } 4924 4925 Block facetSelections = new Block 4926 { 4927 Id = "FacetSelections", 4928 SortId = 20, 4929 Template = RenderFacetSelections() 4930 }; 4931 productListFacetsBlocksPage.Add("ProductList", facetSelections); 4932 4933 Block checkboxFacetTemplate = new Block 4934 { 4935 Id = "CheckboxFacet", 4936 SortId = 30, 4937 Template = RenderCheckboxFacets() 4938 }; 4939 productListFacetsBlocksPage.Add("BottomSnippets", checkboxFacetTemplate); 4940 4941 Block tagsFacetTemplate = new Block 4942 { 4943 Id = "TagsFacet", 4944 SortId = 40, 4945 Template = RenderTagsFacets() 4946 }; 4947 productListFacetsBlocksPage.Add("BottomSnippets", tagsFacetTemplate); 4948 4949 Block colorsFacetTemplate = new Block 4950 { 4951 Id = "ColorFacet", 4952 SortId = 50, 4953 Template = RenderColorFacets() 4954 }; 4955 productListFacetsBlocksPage.Add("BottomSnippets", colorsFacetTemplate); 4956 4957 Block selectedFilter = new Block 4958 { 4959 Id = "SelectedFilter", 4960 SortId = 60, 4961 Template = RenderSelectedFilter() 4962 }; 4963 productListFacetsBlocksPage.Add("BottomSnippets", selectedFilter); 4964 4965 Block selectedColorFilter = new Block 4966 { 4967 Id = "SelectedColorFilter", 4968 SortId = 70, 4969 Template = RenderSelectedColorFilter() 4970 }; 4971 productListFacetsBlocksPage.Add("BottomSnippets", selectedColorFilter); 4972 4973 Block resetFilters = new Block 4974 { 4975 Id = "ResetFilters", 4976 SortId = 80, 4977 Template = RenderResetFilters() 4978 }; 4979 productListFacetsBlocksPage.Add("BottomSnippets", resetFilters); 4980 } 4981 4982 @helper RenderFacetSelections() 4983 { 4984 @*This is part of a script template *@ 4985 <text> 4986 {{#if FacetSelections}} 4987 <div class="buttons-collection u-margin-bottom" id="selectedFacets"> 4988 {{#FacetSelections}} 4989 {{>(lookup . 'template')}} 4990 {{/FacetSelections}} 4991 </div> 4992 {{/if}} 4993 </text> 4994 } 4995 4996 @helper RenderProductListFacets() { 4997 var facetSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("Facets"); 4998 string boxDisplay = facetSettings.GetList("BoxDisplay") != null ? facetSettings.GetList("BoxDisplay").SelectedValue : "scroll"; 4999 5000 string facetMoreClass = ( boxDisplay == "view-more" ? "facets-container__list--more" : ""); 5001 5002 @*This is part of a script template *@ 5003 5004 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 5005 <div class="facets-container facets-container--left expandable--collapsed dw-mod" data-trigger="CheckFacetGroups"> 5006 {{#FacetGroups}} 5007 <input type="checkbox" id="OptionsGroup_{{counter}}" class="expand-trigger js-remember-state" {{defaultState}} /> 5008 5009 <div class="expand-container facets-container__box dw-mod js-filter"> 5010 <label class="expand-container__btn facets-container__header dw-mod" for="OptionsGroup_{{counter}}">{{name}}</label> 5011 <div class="expand-container__content js-facet-container dw-mod" data-input="OptionsGroup_{{counter}}"> 5012 <div class="facets-container__search {{showFilter}} dw-mod"> 5013 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" /> 5014 </div> 5015 <div id="facetList{{counter}}" class="facets-container__list @facetMoreClass dw-mod"> 5016 {{#FacetOptions}} 5017 {{#ifCond template "===" "Checkboxes"}} 5018 {{>Checkboxes}} 5019 {{/ifCond}} 5020 {{#ifCond template "===" "Range"}} 5021 {{>Checkboxes}} 5022 {{/ifCond}} 5023 {{#ifCond template "===" "Weight"}} 5024 {{>Checkboxes}} 5025 {{/ifCond}} 5026 {{#ifCond template "===" "Tags"}} 5027 {{>Tags}} 5028 {{/ifCond}} 5029 {{#ifCond template "===" "Colors"}} 5030 {{>Colors}} 5031 {{/ifCond}} 5032 {{/FacetOptions}} 5033 <div class="u-hidden js-filter-not-found"> 5034 @Translate("Your search gave 0 results") 5035 </div> 5036 </div> 5037 5038 @if ( boxDisplay == "view-more" ) { 5039 <div class="facets-container__more js-facet-expand"> 5040 @Render(new Button { 5041 Title = "<span class=js-facet-trigger-text>" + Translate("View more") + "</span>", 5042 ButtonType = ButtonType.Button, 5043 ButtonLayout = ButtonLayout.Clean, 5044 CssClass = "facets-container__more-button js-facet-trigger u-flex u-no-margin u-full-width", 5045 OnClick = "Facets.ExpandToggle(this)", 5046 ExtraAttributes = new Dictionary<string, string>{ 5047 {"data-target", "facetList{{counter}}"}, 5048 {"data-toggle-text", Translate("Show less")}, 5049 }, 5050 Icon = new Icon { 5051 Prefix = "fal", 5052 Name = "fa-angle-down", 5053 } 5054 }) 5055 </div> 5056 } 5057 </div> 5058 </div> 5059 {{/FacetGroups}} 5060 </div> 5061 <label for="CheckFacetGroups" class="btn btn--primary btn--full u-no-margin dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label> 5062 <label for="CheckFacetGroups" class="btn btn--primary btn--full u-no-margin dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label> 5063 } 5064 5065 @helper RenderProductListTopFacets() 5066 { 5067 @*This is part of a script template *@ 5068 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 5069 <div class="grid grid--external-bleed dw-mod expandable--collapsed facets-container facets-container--top u-margin-bottom" data-trigger="CheckFacetGroups"> 5070 @if (Pageview.Device.ToString() == "Mobile"){ 5071 string dropdownCssClass = Pageview.Device.ToString() == "Mobile" ? "u-flex-grow--1" : ""; 5072 5073 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12"> 5074 <input type="checkbox" id="ProductSort" class="dropdown-trigger" /> 5075 <div class="dropdown u-inline-block @dropdownCssClass dw-mod"> 5076 <label class="dropdown__header dropdown__btn dropdown__btn--small dw-mod" for="ProductSort">{{selectedSort}}</label> 5077 <div class="dropdown__content dw-mod"> 5078 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: '', SortOrder: '' }, true);">@Translate("Default")</div> 5079 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Created', SortOrder: 'DESC'}, true);">@Translate("Newest")</div> 5080 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'ASC'}, true);">@Translate("Name A - Z")</div> 5081 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'DESC'}, true);">@Translate("Name Z - A")</div> 5082 @if (Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 5083 { 5084 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'ASC' }, true);">@Translate("Price low - high")</div> 5085 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'DESC' }, true);">@Translate("Price high - low")</div> 5086 } 5087 </div> 5088 <label class="dropdown-trigger-off" for="ProductSort"></label> 5089 </div> 5090 </div> 5091 } 5092 5093 {{#FacetGroups}} 5094 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12"> 5095 <input type="checkbox" id="OptionsGroup_{{counter}}" class="dropdown-trigger" /> 5096 <div class="dropdown dw-mod js-filter"> 5097 <label class="dropdown__header dropdown__btn dw-mod" for="OptionsGroup_{{counter}}">{{name}}</label> 5098 <div class="dropdown__content dropdown__content--padding dw-mod"> 5099 <div class="u-margin-bottom {{showFilter}}"> 5100 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" /> 5101 </div> 5102 {{#FacetOptions}} 5103 {{#ifCond template "===" "Checkboxes"}} 5104 {{>Checkboxes}} 5105 {{/ifCond}} 5106 {{#ifCond template "===" "Range"}} 5107 {{>Checkboxes}} 5108 {{/ifCond}} 5109 {{#ifCond template "===" "Weight"}} 5110 {{>Checkboxes}} 5111 {{/ifCond}} 5112 {{#ifCond template "===" "Tags"}} 5113 {{>Tags}} 5114 {{/ifCond}} 5115 {{#ifCond template "===" "Colors"}} 5116 {{>Colors}} 5117 {{/ifCond}} 5118 {{/FacetOptions}} 5119 <div class="u-hidden js-filter-not-found"> 5120 @Translate("Your search gave 0 results") 5121 </div> 5122 </div> 5123 <label class="dropdown-trigger-off" for="OptionsGroup_{{counter}}"></label> 5124 </div> 5125 </div> 5126 {{/FacetGroups}} 5127 </div> 5128 <label for="CheckFacetGroups" class="btn btn--primary btn--full u-margin-bottom--lg dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label> 5129 <label for="CheckFacetGroups" class="btn btn--primary btn--full u-margin-bottom--lg dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label> 5130 } 5131 5132 @helper RenderCheckboxFacets() 5133 { 5134 <script id="Checkboxes" type="text/x-template"> 5135 <div class="form__field-group u-no-margin dw-mod"> 5136 <input type="checkbox" class="{{selected}} checkbox-facet__checkbox form__control dw-mod" onclick="Facets.UpdateFacets(this);" id="{{queryParameter}}{{value}}" name="{{queryParameter}}" value="[{{value}}]" {{selected}} {{disabled}}> 5137 <label class="{{disabled}} checkbox-facet dw-mod" data-filter-value="{{label}}" for="{{queryParameter}}{{value}}"> 5138 <span class="checkbox-facet__label dw-mod">{{label}}</span> 5139 <span class="checkbox-facet__count dw-mod">({{count}})</span> 5140 </label> 5141 </div> 5142 </script> 5143 } 5144 5145 @helper RenderTagsFacets() 5146 { 5147 <script id="Tags" type="text/x-template"> 5148 <button type="button" class="btn btn--tag {{selected}} {{disabled}} dw-mod" data-filter-value="{{label}}" data-check="{{selected}}" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" {{disabled}}> 5149 {{label}} <span class="facets-group__counter dw-mod">({{count}})</span> 5150 </button> 5151 </script> 5152 } 5153 5154 @helper RenderColorFacets() 5155 { 5156 <script id="Colors" type="text/x-template"> 5157 <button type="button" class="btn btn--colorbox u-margin-right {{selected}} {{disabled}} dw-mod" data-filter-value="{{label}}" style="background-color: {{value}}" title="{{label}}" data-check="{{selected}}" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" {{disabled}}></button> 5158 </script> 5159 } 5160 5161 @helper RenderSelectedFilter() 5162 { 5163 <script id="SelectedFilter" type="text/x-template"> 5164 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")"> 5165 {{group}}: {{label}} &nbsp;<i class="fal fa-times"></i> 5166 </button> 5167 </script> 5168 } 5169 5170 @helper RenderSelectedColorFilter() 5171 { 5172 <script id="SelectedColorFilter" type="text/x-template"> 5173 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")"> 5174 {{group}}: <div class="btn__colorbox dw-mod" style="background-color: {{value}}"></div> <i class="fas fa-times"></i> 5175 </button> 5176 </script> 5177 } 5178 5179 @helper RenderResetFilters() 5180 { 5181 <script id="ResetFilters" type="text/x-template"> 5182 <button type="button" class="btn btn--tag" onclick="Facets.ResetFacets();"> 5183 @Translate("Reset all filters") &nbsp;<i class="fal fa-redo"></i> 5184 </button> 5185 </script> 5186 } 5187 5188 5189 5190 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5191 @using Dynamicweb.Core 5192 @using System 5193 @using System.Web 5194 @using System.Collections.Generic 5195 @using Dynamicweb.Rapido.Blocks 5196 5197 @{ 5198 BlocksPage productListMoreBlocksPage = BlocksPage.GetBlockPage("ProductList"); 5199 5200 Block moreBlock = new Block 5201 { 5202 Id = "More", 5203 SortId = 40, 5204 Template = RenderListMore() 5205 }; 5206 5207 productListMoreBlocksPage.Add("ProductList", moreBlock); 5208 } 5209 5210 @helper RenderListMore() 5211 { 5212 @*This is part of a script template *@ 5213 string groupID = HttpContext.Current.Request.QueryString.Get("groupid"); 5214 string listId = HttpContext.Current.Request.QueryString.Get("ListID"); 5215 bool isFavoriteList = !string.IsNullOrEmpty(listId); 5216 string moreFeedFullUrl = GetGlobalValue("Global:Pageview.Url.Raw") + "&feed=true"; 5217 moreFeedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : ""; 5218 string columnCss = Pageview.Device.ToString() == "Mobile" ? "grid__col--bleed" : "u-no-padding"; 5219 <text> 5220 {{#if SubGroupsCount}} 5221 {{else}} 5222 {{#if ProductsContainer}} 5223 <div class="grid"> 5224 <div class="grid__col-12 @columnCss"> 5225 <button type="button" id="LoadMoreButton" class="btn btn--primary btn--full {{nextdisabled}} dw-mod" data-current="{{currentPage}}" data-page-size="{{pageSize}}" data-total="{{totalPages}}" data-container="ProductsContainer" data-feed-url="@moreFeedFullUrl&groupid=@groupID{{loadMoreFeedParams}}" onclick="LoadMore.Next(this)" {{nextdisabled}}>@Translate("Load") {{pageSizeText}} @Translate("more")</button> 5226 <button type="button" class="btn btn--clean" onclick="window.scroll(0, 0)">@Translate("Return to top")</button> 5227 </div> 5228 </div> 5229 {{/if}} 5230 {{/if}} 5231 </text> 5232 } 5233 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5234 @using Dynamicweb.Core 5235 @using System 5236 @using System.Web 5237 @using System.Collections.Generic 5238 @using Dynamicweb.Rapido.Blocks 5239 @using Dynamicweb.Rapido.Blocks.Components 5240 @using Dynamicweb.Rapido.Blocks.Components.General 5241 5242 @{ 5243 BlocksPage productListBottomSnippetsPage = BlocksPage.GetBlockPage("ProductList"); 5244 5245 Block productListStickers = new Block 5246 { 5247 Id = "Stickers", 5248 SortId = 10, 5249 Template = RenderStickersTemplates() 5250 }; 5251 productListBottomSnippetsPage.Add("BottomSnippets", productListStickers); 5252 5253 Block productListUnits = new Block 5254 { 5255 Id = "Units", 5256 SortId = 20, 5257 Template = RenderUnitTemplates() 5258 }; 5259 productListBottomSnippetsPage.Add("BottomSnippets", productListUnits); 5260 5261 Block productListVariants = new Block 5262 { 5263 Id = "Variants", 5264 SortId = 30, 5265 Template = RenderVariantTemplates() 5266 }; 5267 productListBottomSnippetsPage.Add("BottomSnippets", productListVariants); 5268 5269 Block productListFavorites = new Block 5270 { 5271 Id = "Favorites", 5272 SortId = 40, 5273 Template = RenderFavoritesTemplates() 5274 }; 5275 productListBottomSnippetsPage.Add("BottomSnippets", productListFavorites); 5276 5277 Block productListPreRender = new Block 5278 { 5279 Id = "PreRenders", 5280 SortId = 50, 5281 Template = RenderPreRenderTemplates() 5282 }; 5283 productListBottomSnippetsPage.Add("BottomSnippets", productListPreRender); 5284 5285 Block productListInitializers = new Block 5286 { 5287 Id = "Initializers", 5288 SortId = 60, 5289 Template = RenderInitializers() 5290 }; 5291 productListBottomSnippetsPage.Add("BottomSnippets", productListInitializers); 5292 } 5293 5294 5295 @helper RenderFavoritesTemplates() 5296 { 5297 var selectedFavoriteIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "star"; 5298 string favoriteIcon = "fas fa-" + selectedFavoriteIcon; 5299 string favoriteOutlineIcon = "fal fa-" + selectedFavoriteIcon; 5300 bool useFacebookPixel = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 5301 string currentFavoriteListId = HttpContext.Current.Request.QueryString.Get("ListID"); 5302 5303 <script id="FavoriteTemplate" type="text/x-template"> 5304 <div class="favorites-list u-ta-left js-favorites-list"> 5305 @Render(new Button { 5306 CssClass = "u-no-margin js-favorite-btn", 5307 Icon = new Icon 5308 { 5309 Name = "{{#if isInAnyFavoriteList}}" + favoriteIcon + "{{else}}" + favoriteOutlineIcon + "{{/if}}", 5310 CssClass = "fa-1_5x", 5311 LabelPosition = IconLabelPosition.After 5312 }, 5313 ButtonLayout = ButtonLayout.LinkClean, 5314 ButtonType = ButtonType.Button, 5315 OnClick = "document.getElementById('FavoriteTrigger_{{id}}').checked = true" 5316 }) 5317 <input type="checkbox" id="FavoriteTrigger_{{id}}" class="dropdown-trigger" /> 5318 <div class="dropdown dropdown--position-32px"> 5319 <div class="dropdown__content dropdown__content--show-left dropdown__content--padding u-w220px dw-mod"> 5320 <ul class="list list--clean dw-mod"> 5321 {{#FavoriteLists}} 5322 {{>FavoriteListItem}} 5323 {{/FavoriteLists}} 5324 </ul> 5325 </div> 5326 <label class="dropdown-trigger-off" for="FavoriteTrigger_{{id}}"></label> 5327 </div> 5328 </div> 5329 </script> 5330 5331 <script id="FavoriteListItem" type="text/x-template"> 5332 <li> 5333 @{ 5334 var button = new Button { 5335 CssClass = "list__link u-no-underline", 5336 OnClick = "toggleFavAction(this, event)", 5337 Icon = new Icon { Name = "{{#if isInFavoriteList}}" + favoriteIcon + "{{else}}" + favoriteOutlineIcon + "{{/if}}", LabelPosition = IconLabelPosition.After }, 5338 AltText = "{{#if isInFavoriteList}}" + Translate("Remove from") + " {{name}}{{else}}" + Translate("Add to") + " {{name}}{{/if}}", 5339 Title = "{{name}}", 5340 ButtonType = ButtonType.Button, 5341 ButtonLayout = ButtonLayout.LinkClean, 5342 ExtraAttributes = new Dictionary<string, string> 5343 { 5344 { "data-list-id", "{{listId}}" }, 5345 { "data-list-name", "{{name}}" }, 5346 { "data-remove-link", "{{removeLink}}" }, 5347 { "data-add-link", "{{addLink}}" }, 5348 { "data-is-in-list", "{{isInFavoriteList}}" }, 5349 5350 } 5351 }; 5352 if (useFacebookPixel) 5353 { 5354 button.ExtraAttributes.Add("data-facebook-object", "{{facebookPixelAddAction}}"); 5355 } 5356 } 5357 @Render(button) 5358 </li> 5359 </script> 5360 5361 <script> 5362 @if (!string.IsNullOrEmpty(currentFavoriteListId)) 5363 { 5364 <text> 5365 window.currentFavoriteListId = "@currentFavoriteListId"; 5366 </text> 5367 } 5368 function toggleFavAction(button, event) { 5369 if (button.getAttribute('data-add-link').indexOf('CCCreateNewList') > -1) { 5370 Scroll.SavePosition(event); 5371 @if (useFacebookPixel) 5372 { 5373 <text> 5374 fbq('track', 'AddToWishlist', JSON.parse(button.getAttribute('data-facebook-object'))); 5375 </text> 5376 } 5377 location.href = button.getAttribute('data-add-link'); 5378 return; 5379 } 5380 let isAdd = button.getAttribute('data-is-in-list') == "false"; 5381 Request.Fetch().get( 5382 isAdd ? button.getAttribute('data-add-link') : button.getAttribute('data-remove-link'), 5383 function (result) { 5384 button.querySelector('i').className = isAdd ? '@favoriteIcon u-margin-right--lg' : '@favoriteOutlineIcon u-margin-right--lg'; 5385 button.setAttribute('data-is-in-list', isAdd); 5386 button.setAttribute('title', (!isAdd ? '@Translate("Add to") ' : '@Translate("Remove from") ') + button.getAttribute('data-list-name')) 5387 let favList = button.closest('.js-favorites-list'); 5388 let favBtn = favList.querySelector('.js-favorite-btn i'); 5389 let isInAnyFavoriteList = favList.querySelector('[data-is-in-list=true]') != null; 5390 if (isInAnyFavoriteList) { 5391 favBtn.className = '@favoriteIcon' + ' fa-1_5x'; 5392 } else { 5393 favBtn.className = '@favoriteOutlineIcon' + ' fa-1_5x'; 5394 } 5395 @if (useFacebookPixel) 5396 { 5397 <text> 5398 if (isAdd) { 5399 fbq('track', 'AddToWishlist', JSON.parse(button.getAttribute('data-facebook-object'))); 5400 } 5401 </text> 5402 } 5403 if (window.currentFavoriteListId != null) { //if this page is favorite list 5404 let listId = button.getAttribute("data-list-id"); 5405 if (listId == window.currentFavoriteListId && !isAdd) { 5406 location.reload(); 5407 } 5408 } 5409 }, 5410 function () { 5411 console.error("FavoriteLists: Error in ToggleFavAction request"); 5412 }, 5413 false 5414 ); 5415 } 5416 </script> 5417 } 5418 5419 @helper RenderStickersTemplates() 5420 { 5421 <script id="StickersContainer" type="text/x-template"> 5422 <div class="stickers-container stickers-container--{{{convertStickerPositionToClassName Position}}} dw-mod"> 5423 {{#Stickers}} 5424 {{>Sticker}} 5425 {{/Stickers}} 5426 </div> 5427 </script> 5428 5429 <script id="Sticker" type="text/x-template"> 5430 <div class="stickers-container__tag {{CssClass}} dw-mod">{{Title}}</div> 5431 </script> 5432 5433 <script id="MiniSticker" type="text/x-template"> 5434 <div class="stickers-container__tag stickers-container__tag--micro {{CssClass}} dw-mod">{{Title}}</div> 5435 </script> 5436 } 5437 5438 @helper RenderUnitTemplates() 5439 { 5440 <script id="UnitOption" type="text/x-template"> 5441 <div class="dropdown__item dw-mod" onclick="HandlebarsBolt.UpdateContent(this.closest('.js-product').id, '{{link}}&feed=true&UnitID={{value}}')">{{name}}</div> 5442 </script> 5443 } 5444 5445 @helper RenderVariantTemplates() { 5446 <script id="VariantsTemplate" type="text/x-template"> 5447 {{#.}} 5448 <div> 5449 <div> 5450 {{#VariantOptions}} 5451 {{>VariantOption}} 5452 {{/VariantOptions}} 5453 </div> 5454 </div> 5455 {{/.}} 5456 </script> 5457 5458 <script id="VariantOption" type="text/x-template"> 5459 {{#if color}} 5460 <button type="button" data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" class="btn btn--colorbox u-margin-right {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}} style="background-color: {{color}}"></button> 5461 {{else}} 5462 {{#if image}} 5463 <img data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" src="{{image}}" onclick="MatchVariants.SelectThis(event)" alt="{{name}}" title="{{name}}" class="btn btn--tag {{selected}} js-variant-option" data-check="{{selected}}" /> 5464 {{else}} 5465 <button type="button" data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" class="btn btn--tag {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}}>{{name}}</button> 5466 {{/if}} 5467 {{/if}} 5468 </script> 5469 5470 <script id="DropdownVariantsTemplate" type="text/x-template"> 5471 {{#.}} 5472 <div> 5473 <div class="u-bold">{{name}}</div> 5474 <select id="VariantSelector_{{id}}" class="u-full-width dw-mod" name="VariantSelector_{{id}}" onchange="MatchVariants.SelectOnChange(event)" > 5475 <option>@Translate("Choose")</option> 5476 {{#VariantOptions}} 5477 {{>DropdownVariantOption}} 5478 {{/VariantOptions}} 5479 </select> 5480 </div> 5481 {{/.}} 5482 </script> 5483 5484 <script id="DropdownVariantOption" type="text/x-template"> 5485 <option class="js-variant-option {{selected}}" id="{{groupId}}_{{variantId}}" value="{{groupId}}_{{variantId}}" data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" {{#if selected}}selected{{/if}} data-check="{{selected}}">{{name}}</option> 5486 </script> 5487 5488 <script id="StaticVariantsTemplate" type="text/x-template"> 5489 {{#.}} 5490 {{#if isFirstGroup}} 5491 <div> 5492 {{#VariantOptions}} 5493 {{>StaticVariantOption}} 5494 {{/VariantOptions}} 5495 </div> 5496 {{/if}} 5497 {{/.}} 5498 </script> 5499 5500 <script id="StaticVariantOption" type="text/x-template"> 5501 {{#if color}} 5502 <div class="static-variant static-variant--color dw-mod" style="background-color: {{color}}" title="{{name}}"></div> 5503 {{else}} 5504 <div class="static-variant dw-mod">{{name}} </div> 5505 {{/if}} 5506 </script> 5507 5508 5509 <script id="StaticVariantsLgTemplate" type="text/x-template"> 5510 {{#.}} 5511 {{#if isFirstGroup}} 5512 <div class="padding-size-xs"> 5513 {{#VariantOptions}} 5514 {{>StaticVariantLgOption}} 5515 {{/VariantOptions}} 5516 </div> 5517 {{/if}} 5518 {{/.}} 5519 </script> 5520 5521 <script id="StaticVariantLgOption" type="text/x-template"> 5522 {{#if color}} 5523 <div class="static-variant static-variant--color static-variant--color--lg dw-mod" style="background-color: {{color}}" title="{{name}}"></div> 5524 {{else}} 5525 <div class="static-variant dw-mod">{{name}} </div> 5526 {{/if}} 5527 </script> 5528 5529 <script id="VariantOptionImage" type="text/x-template"> 5530 <img data-variant-id="{{variantId}}" data-friends="{{friendsList}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" src="/Admin/Public/GetImage.ashx?width=100&amp;height=50&amp;crop=5&amp;Compression=75&amp;image=/Images/{{image}}" alt="{{name}}" title="{{name}}" class="btn btn--tag {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}} /> 5531 </script> 5532 } 5533 5534 @helper RenderPreRenderTemplates() { 5535 string facetsViewMode = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode")) ? Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode").ToLower() : "left"; 5536 5537 <script id="ProductPreRenderContainer" type="text/x-template"> 5538 @if (facetsViewMode == "left" && Pageview.Device.ToString() != "Mobile") 5539 { 5540 <div class="grid__col-3"> 5541 <div class="pre-render-element pre-render-element--xs"></div> 5542 <div class="pre-render-element pre-render-element--md"></div> 5543 <div class="pre-render-element pre-render-element--md"></div> 5544 <div class="pre-render-element pre-render-element--md"></div> 5545 </div> 5546 } 5547 <div class="grid__col-auto"> 5548 <div class="pre-render-element pre-render-element--xs"></div> 5549 <div class="pre-render-element pre-render-element--lg"></div> 5550 <div class="pre-render-element pre-render-element--lg"></div> 5551 <div class="pre-render-element pre-render-element--lg"></div> 5552 <div class="pre-render-element pre-render-element--lg"></div> 5553 </div> 5554 </script> 5555 } 5556 5557 @helper RenderInitializers() { 5558 <script> 5559 document.addEventListener("DOMContentLoaded", function (event) { 5560 document.getElementById("productList").addEventListener('contentLoaded', function (e) { 5561 if (getTarget(e).id === "productList") { 5562 Search.Init(); 5563 Facets.Init("selectedFacets", "productList"); 5564 } 5565 }, false); 5566 5567 @{ 5568 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5569 5570 if (useGoogleTagManager) 5571 { 5572 <text> 5573 Scroll.AddIsInViewportListener(".js-product-scroll-trigger", function (elem) { 5574 let googleImpression = JSON.parse(elem.getAttribute("data-params")); 5575 googleEnchantImpression(googleImpression); 5576 elem.classList.remove("js-product-scroll-trigger"); 5577 }); 5578 </text> 5579 } 5580 } 5581 5582 }); 5583 </script> 5584 } 5585 5586 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5587 @using Dynamicweb.Core 5588 @using System 5589 @using System.Web 5590 @using System.Linq 5591 @using System.Collections.Generic 5592 @using Dynamicweb.Rapido.Blocks 5593 @using Dynamicweb.Rapido.Services 5594 5595 @functions { 5596 BlocksPage productListActionsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 5597 } 5598 5599 @{ 5600 string actionsFavoriteListId = HttpContext.Current.Request.QueryString.Get("ListID"); 5601 bool actionsIsFavoriteList = !string.IsNullOrEmpty(actionsFavoriteListId); 5602 string actionsColumnSize = actionsIsFavoriteList ? "4" : "6"; 5603 5604 productListActionsBlocksPage.Add("ProductListHeader", new Block 5605 { 5606 Id = "Actions", 5607 SortId = 30, 5608 Template = RenderListActions(), 5609 Design = new Design 5610 { 5611 CssClass = "grid__col-" + actionsColumnSize + " grid--align-self-center SortMobile" 5612 } 5613 }); 5614 5615 productListActionsBlocksPage.Add("BottomSnippets", new Block() { 5616 Id = "ListViewSelectListener", 5617 Template = RenderListViewSelectListener() 5618 }); 5619 5620 } 5621 5622 @helper RenderListActions() 5623 { 5624 @*This is part of a script template *@ 5625 5626 bool showSorting = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableSorting"); 5627 string listId = HttpContext.Current.Request.QueryString.Get("ListID"); 5628 bool isFavoriteList = !string.IsNullOrEmpty(listId); 5629 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fas fa-shopping-cart"; 5630 5631 List<Block> subBlocks = this.productListActionsBlocksPage.GetBlockListById("Views").OrderBy(item => item.SortId).ToList(); 5632 5633 5634 5635 <div class="buttons-collection"> 5636 @if (showSorting) 5637 { 5638 string dropdownCssClass = Pageview.Device.ToString() == "Mobile" ? "u-flex-grow--1" : ""; 5639 <h5>@Translate("Sort by") </h5> 5640 <input type="checkbox" id="ProductSort" class="dropdown-trigger" /> 5641 <div class="dropdown u-w150px u-inline-block @dropdownCssClass dw-mod"> 5642 <label class="dropdown__header dropdown__btn dropdown__btn--small dw-mod" for="ProductSort">{{selectedSort}}</label> 5643 <div class="dropdown__content dw-mod"> 5644 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: '', SortOrder: '' }, true);">@Translate("Default")</div> 5645 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Created', SortOrder: 'DESC'}, true);">@Translate("Newest")</div> 5646 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'ASC'}, true);">@Translate("Name A - Z")</div> 5647 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'DESC'}, true);">@Translate("Name Z - A")</div> 5648 @if (Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 5649 { 5650 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'ASC' }, true);">@Translate("Price low - high")</div> 5651 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'DESC' }, true);">@Translate("Price high - low")</div> 5652 } 5653 </div> 5654 <label class="dropdown-trigger-off" for="ProductSort"></label> 5655 </div> 5656 } 5657 5658 @if (subBlocks.Count > 1) 5659 { 5660 <div> 5661 @foreach (Block item in subBlocks) 5662 { 5663 <input type="radio" class="tag-btn-trigger" id="ListViewBtn_@item.Id" name="ViewBtnGroup"> 5664 <label for="ListViewBtn_@item.Id" class="btn btn--tag u-no-margin" onclick="HandlebarsBolt.UpdateTemplate('ProductsContainer', '@item.Id')"><i class="fas fa-@item.Name"></i></label> 5665 } 5666 </div> 5667 } 5668 5669 @if (isFavoriteList && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 5670 { 5671 if (Pageview.Device.ToString() != "Mobile") 5672 { 5673 @* <button type="submit" id="buyAllFromFavList" class="btn btn--secondary btn--sm dw-mod">@Translate("Buy all") <i class="@cartIcon"></i></button>*@ 5674 5675 5676 <button id="buyAllFromFavList" onclick="" class="btn btn--secondary btn--sm dw-mod">@Translate("Buy all") <i class="@cartIcon"></i>TEST</button> 5677 5678 } 5679 else 5680 { 5681 <button type="submit" class="btn btn--secondary btn--full btn--sm dw-mod">@Translate("Buy all") <i class="@cartIcon"></i></button> 5682 } 5683 5684 } 5685 5686 5687 5688 </div> 5689 5690 5691 } 5692 5693 @helper RenderListViewSelectListener() 5694 { 5695 /* the same block code placed in ProductListFeed.cshtml */ 5696 Dictionary<string, bool> views = new Dictionary<string, bool>() 5697 { 5698 { "ProductItemContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableListView") }, 5699 { "ProductGridItemContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableGridView") }, 5700 { "ProductDetailsItemContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableDetailsView") }, 5701 { "ProductTilesViewContainer", Pageview.AreaSettings.GetItem("ProductList").GetBoolean("EnableTilesView") } 5702 }; 5703 5704 string defaultView = Pageview.AreaSettings.GetItem("ProductList").GetList("DefaultListView") != null ? Pageview.AreaSettings.GetItem("ProductList").GetList("DefaultListView").SelectedValue : ""; 5705 5706 if (string.IsNullOrEmpty(defaultView) || !views[defaultView]) 5707 { 5708 defaultView = views.FirstOrDefault(x => x.Value).Key ?? "ProductItemContainer"; 5709 } 5710 5711 <script> 5712 let defaultTemplate = '@defaultView'; 5713 let container = 'productList'; 5714 let cookieName = 'ProductsContainerTemplate'; 5715 5716 document.addEventListener('DOMContentLoaded', function (event) { 5717 document.getElementById(container).addEventListener('contentLoaded', function () { 5718 let selectedMode = RememberState.GetCookie(cookieName); 5719 let element = document.getElementById('ListViewBtn_' + (selectedMode ? selectedMode : defaultTemplate)); 5720 if (element != null) { 5721 element.checked = true; 5722 } 5723 }, false); 5724 }); 5725 </script> 5726 } 5727 5728 5729 5730 5731 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5732 @using Dynamicweb.Core 5733 @using System 5734 @using System.Web 5735 @using System.Collections.Generic 5736 @using Dynamicweb.Rapido.Blocks 5737 5738 @{ 5739 BlocksPage customBlocksPage = BlocksPage.GetBlockPage("ProductList"); 5740 5741 } 5742 5743 5744 @if (productListNavigation.BlocksList.Count == 0) 5745 { 5746 productListNavigation.Design.RenderType = RenderType.Hide; 5747 } 5748 5749 <form name="multiForm" id="multiForm" method="post" onkeypress="return event.keyCode != 13;"> 5750 @* onkeypress is the fix for disabling submit form on Enter key from any field in product list *@ 5751 <input type="hidden" name="CartCmd" id="CartCmd" value="addMulti" /> 5752 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 5753 @RenderBlockList(productListPage.BlocksRoot.BlocksList) 5754 5755 </form> 5756 5757 <script> 5758 function CalculateMinOrderQunatity(elem, stepRange) { 5759 elem.value = (Math.ceil(elem.value / stepRange) * stepRange); 5760 elem.setAttribute('value', elem.value ); 5761 } 5762 5763 function DisplayAdddToCartDialog(newDelDate, prodId, variantId, UnitId, qtyId, productInfo, facebookPixelAction) { 5764 5765 document.getElementById("newDeliveryDateSpan").innerHTML = newDelDate; 5766 5767 5768 if (document.getElementById("AddProductModalText2") != null) { document.getElementById("AddProductModalText2").style.display = "none"; } 5769 5770 if (document.getElementById("AddProductModalText") != null) { document.getElementById("AddProductModalText").style.display = "block"; } 5771 5772 let btn = document.getElementById("AddTOCartModalWindowButton"); 5773 5774 if (btn != null) { 5775 let cmdText = "document.getElementById('AddToCartOutOfStockProductModalTrigger').checked = false;"; 5776 cmdText = cmdText + "Cart.AddToCart(event, {"; 5777 cmdText = cmdText + "id: '" + prodId + "', "; 5778 cmdText = cmdText + "variantId: '" + variantId + "', "; 5779 cmdText = cmdText + "unitId: '" + UnitId + "', "; 5780 cmdText = cmdText + "quantity: document.getElementById('QuantityBox_" + qtyId + "').value, " 5781 cmdText = cmdText + "productInfo: " + JSON.stringify(productInfo); 5782 cmdText = cmdText + " }); "; 5783 if (facebookPixelAction != null) { 5784 cmdText = cmdText + facebookPixelAction; 5785 } 5786 btn.setAttribute('onclick', cmdText); 5787 } 5788 5789 document.getElementById("AddToCartOutOfStockProductModalTrigger").checked = true; 5790 } 5791 </script> 5792 5793 <input type="checkbox" id="AddToCartOutOfStockProductModalTrigger" class="modal-trigger"> 5794 <div class="modal-container"> 5795 <label for="AddToCartOutOfStockProductModalTrigger" id="AddToCartOutOfStockProductModalOverlay" class="modal-overlay"></label> 5796 <div class="modal modal--md" id="AddToCartOutOfStockProductModal"> 5797 <div class="modal__header"> 5798 <h2>@Translate("Product not on stock")<label for="AddToCartOutOfStockProductModalTrigger" class="u-pull--right">X</label></h2> 5799 </div> 5800 <div class="modal__body"> 5801 <p id="AddProductModalText">@Translate("ProductModalText")'<span id="newDeliveryDateSpan"></span>'</p> 5802 <p id="AddProductModalText2" style="display:none">@Translate("You are trying to add more products then we have on stock! Do you want to add products with two deliveries")</p> 5803 <div class="product-list__grid-item__footer dw-mod" style="border:0;"> 5804 <button type="submit" class="js-cart-btn btn btn--primary btn--condensed u-no-margin u-pull--right dw-mod" onclick="Buttons.LockButton(event)" id="AddTOCartModalWindowButton">@Translate("Add to cart")</button> 5805 </div> 5806 </div> 5807 </div> 5808 </div> 5809 5810 @helper RenderPageContainer() 5811 { 5812 List<Block> subBlocks = this.productListPage.GetBlockListById("PageContainer").OrderBy(item => item.SortId).ToList(); 5813 5814 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw"); 5815 string feedFullUrl = pageUrl + "&feed=true"; 5816 feedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : ""; 5817 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "" : "u-padding"; 5818 5819 <div class="grid grid--align-content-start @smallDeviceCss js-handlebars-root" id="productList" data-template="ProductContainer" data-pre-render-template="ProductPreRenderContainer" data-json-feed="@feedFullUrl" data-preloader="overlay"></div> 5820 5821 <script id="ProductContainer" type="text/x-template"> 5822 {{#each .}} 5823 @RenderBlockList(subBlocks) 5824 {{else}} 5825 <div class="grid__col-12"> 5826 <h2 class="u-ta-center">@Translate("Your search gave 0 results")</h2> 5827 </div> 5828 {{/each}} 5829 </script> 5830 } 5831 5832 @helper RenderProductList() 5833 { 5834 @*This is part of a script template *@ 5835 5836 List<Block> subBlocks = productListPage.GetBlockListById("ProductList").OrderBy(item => item.SortId).ToList(); 5837 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "u-no-padding" : ""; 5838 string columnClass = "auto"; 5839 5840 if (productListPage.GetBlockListById("Navigation").Count == 0) 5841 { 5842 columnClass = "12"; 5843 } 5844 5845 <div class="grid__col-@columnClass @smallDeviceCss"> 5846 @RenderBlockList(subBlocks) 5847 </div> 5848 } 5849 5850 @helper RenderProductListHeader() 5851 { 5852 List<Block> subBlocks = new List<Block>(); // this.productListPage.GetBlockListById("ProductListHeader"); 5853 subBlocks = this.productListPage.GetBlockListById("ProductListHeader"); 5854 bool enableSeparationLine = productListSettings.GetBoolean("EnableSeparationLine"); 5855 string className = (enableSeparationLine != null && enableSeparationLine ? "u-border-bottom u-padding-bottom" : ""); 5856 <text> 5857 {{#if SubGroupsCount}} 5858 {{else}} 5859 <div class="grid grid--align-content-start grid--justify-end grid--bleed u-margin-bottom--lg u-padding grid--wrap u-flex-grow--0 dw-mod"> 5860 <div class="grid @className"> 5861 @RenderBlockList(subBlocks) 5862 </div> 5863 </div> 5864 {{/if}} 5865 </text> 5866 } 5867 5868 @helper RenderProductListTitle() 5869 { 5870 var header = new Heading { Title = "{{{header}}}", CssClass = "u-no-margin" }; 5871 5872 if (isFavoriteList) 5873 { 5874 var selectedFavoriteIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "star"; 5875 header.Icon = new Icon { Prefix = "fas", Name = "fa-" + selectedFavoriteIcon, LabelPosition = IconLabelPosition.After }; 5876 } 5877 5878 @Render(header) 5879 } 5880 5881 @helper RenderFavoriteListSearch() 5882 { 5883 string pageId = GetGlobalValue("Global:Page.ID"); 5884 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw"); 5885 string feedFullUrl = pageUrl + "&feed=true"; 5886 string searchPlaceholder = Translate("Search favorite products"); 5887 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 5888 5889 <div class="typeahead u-color-inherit typeahead--favorites js-typeahead" data-page-size="10" id="FavoritesSearch" data-list-id="@favoriteListId" data-search-feed-id="@pageId&feed=true" data-result-page-id="@pageId"> 5890 <input type="text" class="typeahead-search-field u-no-margin u-full-width js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 5891 <ul class="dropdown dropdown--absolute-position u-full-width js-handlebars-root js-typeahead-search-content u-min-w220px u-full-width dw-mod" id="FavoritesSearchContent" data-template="SearchProductsTemplate" data-json-feed="@feedFullUrl&ListID=@favoriteListId" data-init-onload="false" data-preloader="minimal"></ul> 5892 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="fas fa-search"></i></button> 5893 </div> 5894 }

We use necessary third-party content (e.g. script libraries) to ensure the function of our site. If you do not want this, please do not visit our site. We use analyses methods (e.g. cookies or fingerprints) to measure how often our site is visited and how it is used. We use tracking technologies for marketing purposes and also use third-party providers for this purpose, which may use cookies, fingerprints, tracking pixels and IP addresses across devices. On our website, we embed third-party content from other providers (e.g. social plugins, map services, external fonts). We have no influence on the further data processing and any tracking by the third-party provider. With your settings in the consent banner you consent to the processes described above. You can withdraw your consent at any time with effect for the future. You can find more information in our privacy policy. Privacy politics

More information...