Restsalg af Type 2 ladekabler til attraktive priser

Log ind for at handle

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