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