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