Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_b498fc5e4571434db883364b026c391f.b__77_0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Lene Bjerre\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 3659
   at CompiledRazorTemplates.Dynamic.RazorEngine_b498fc5e4571434db883364b026c391f.<>c__DisplayClass4_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Lene Bjerre\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 204
   at CompiledRazorTemplates.Dynamic.RazorEngine_b498fc5e4571434db883364b026c391f.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Lene Bjerre\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 168
   at CompiledRazorTemplates.Dynamic.RazorEngine_b498fc5e4571434db883364b026c391f.b__76_0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Lene Bjerre\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 3642
   at CompiledRazorTemplates.Dynamic.RazorEngine_b498fc5e4571434db883364b026c391f.<>c__DisplayClass4_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Lene Bjerre\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 204
   at CompiledRazorTemplates.Dynamic.RazorEngine_b498fc5e4571434db883364b026c391f.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Lene Bjerre\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 168
   at CompiledRazorTemplates.Dynamic.RazorEngine_b498fc5e4571434db883364b026c391f.<>c__DisplayClass4_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Lene Bjerre\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 209
   at CompiledRazorTemplates.Dynamic.RazorEngine_b498fc5e4571434db883364b026c391f.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.Net\Solutions\Lene Bjerre\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 168
   at CompiledRazorTemplates.Dynamic.RazorEngine_b498fc5e4571434db883364b026c391f.Execute() in E:\Dynamicweb.Net\Solutions\Lene Bjerre\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 3615
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 3 @* Rapido version 3.0.1 *@ 4 5 @using System.Web; 6 @using Dynamicweb.Frontend 7 @using Dynamicweb.Frontend.Devices 8 @using Dynamicweb.Extensibility 9 @using Dynamicweb.Content 10 @using Dynamicweb.Security 11 @using Dynamicweb.Core 12 @using System 13 @using System.Web 14 @using System.IO 15 @using Dynamicweb.Rapido.Blocks 16 @using Dynamicweb.Logging; 17 18 @functions { 19 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 20 21 string getFontFamily(params string[] items) 22 { 23 var itemParent = Pageview.AreaSettings; 24 foreach (var item in items) 25 { 26 itemParent = itemParent.GetItem(item); 27 if (itemParent == null) 28 { 29 return null; 30 } 31 } 32 33 var googleFont = itemParent.GetGoogleFont("FontFamily"); 34 if (googleFont == null) 35 { 36 return null; 37 } 38 return googleFont.Family.Replace(" ", "+"); 39 } 40 } 41 42 @{ 43 string fileVersion = Converter.ToString(System.Web.HttpContext.Current.Cache["FileVersion"]); 44 if (string.IsNullOrEmpty(fileVersion)) 45 { 46 try 47 { 48 var assembly = System.Reflection.Assembly.Load("Application"); 49 if (assembly != null) 50 { 51 fileVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion; 52 System.Web.HttpContext.Current.Cache["FileVersion"] = fileVersion; 53 } 54 } 55 catch (Exception ex) 56 { 57 LogManager.Current.GetLogger("Smartpage/Assemblies").Error("Error while loading Application assembly: ", ex); 58 } 59 } 60 } 61 62 @{ 63 //Font settings 64 var fonts = new string[] { 65 getFontFamily("Layout", "HeaderFont"), 66 getFontFamily("Layout", "SubheaderFont"), 67 getFontFamily("Layout", "TertiaryHeaderFont"), 68 getFontFamily("Layout", "Header", "ToolsFont"), 69 getFontFamily("Layout", "Header", "NavigationFont"), 70 getFontFamily("Layout", "MobileNavigation", "Font"), 71 getFontFamily("ProductList", "Facets", "HeaderFont"), 72 getFontFamily("ProductPage", "PriceFontDesign"), 73 getFontFamily("Ecommerce", "SaleSticker", "Font"), 74 getFontFamily("Ecommerce", "NewSticker", "Font"), 75 getFontFamily("Ecommerce", "CustomSticker", "Font") 76 }; 77 78 var version = "2"; 79 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 80 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 81 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 82 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 83 if (useFontAwesomePro) 84 { 85 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 86 } 87 } 88 89 @{ 90 Block master = new Block() 91 { 92 Id = "Master", 93 BlocksList = new List<Block> { 94 new Block { 95 Id = "MasterTopSnippets", 96 SortId = 10 97 }, 98 new Block { 99 Id = "MasterMain", 100 SortId = 20, 101 Template = RenderMain(), 102 SkipRenderBlocksList = true, 103 BlocksList = new List<Block> { 104 new Block 105 { 106 Id = "MasterHeader", 107 SortId = 10, 108 Template = RenderMasterHeader(), 109 SkipRenderBlocksList = true 110 }, 111 new Block { 112 Id = "MasterPageContent", 113 SortId = 20, 114 Template = RenderPageContent() 115 } 116 } 117 }, 118 new Block { 119 Id = "MasterFooter", 120 SortId = 30 121 }, 122 new Block { 123 Id = "MasterReferences", 124 SortId = 40 125 }, 126 new Block { 127 Id = "MasterBottomSnippets", 128 SortId = 50 129 } 130 } 131 }; 132 masterPage.Add(master); 133 } 134 135 @functions{ 136 string GetHrefLang(string cultureName) 137 { 138 var hrefLang = cultureName; 139 switch (cultureName.ToLower()) 140 { 141 case "en-us": 142 hrefLang = "x-default"; 143 break; 144 } 145 return hrefLang; 146 } 147 } 148 149 150 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 151 @using System.Text.RegularExpressions 152 @using System.Collections.Generic 153 @using Dynamicweb.Rapido.Blocks 154 155 156 @*--- START: Base block renderers ---*@ 157 158 @helper RenderBlockList(List<Block> blocks) 159 { 160 blocks = blocks.OrderBy(item => item.SortId).ToList(); 161 162 foreach (Block item in blocks) 163 { 164 <!-- START: @item.Id --> 165 166 if (item.Design == null) 167 { 168 @RenderBlock(item) 169 } 170 else if (item.Design.RenderType != RenderType.Hide) 171 { 172 if (item.Design.RenderType == RenderType.Row) 173 { 174 <div class="grid grid--align-content-start"> 175 @RenderBlock(item) 176 </div> 177 } 178 179 if (item.Design.RenderType == RenderType.Column) 180 { 181 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 182 string size = item.Design.Size != null ? item.Design.Size : "12"; 183 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 184 185 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding" id="Block__@item.Id"> 186 @RenderBlock(item) 187 </div> 188 } 189 190 if (item.SkipRenderBlocksList == true) 191 { 192 @RenderBlock(item) 193 } 194 } 195 196 <!-- END: @item.Id --> 197 } 198 } 199 200 @helper RenderBlock(Block item) 201 { 202 if (item.Template != null) 203 { 204 @BlocksPage.RenderTemplate(item.Template) 205 } 206 207 if (item.BlocksList.Count > 0 && item.SkipRenderBlocksList == false) 208 { 209 @RenderBlockList(item.BlocksList) 210 } 211 } 212 213 @*--- END: Base block renderers ---*@ 214 215 216 @* Include the Blocks for the page *@ 217 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 218 219 @using System 220 @using System.Web 221 @using System.Collections.Generic 222 @using Dynamicweb.Rapido.Blocks.Extensibility 223 @using Dynamicweb.Rapido.Blocks 224 225 @{ 226 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 227 228 Block tagManager = new Block() 229 { 230 Id = "TagManager", 231 SortId = 1, 232 Template = RenderGoogleTagManager() 233 }; 234 235 Block facebookPixel = new Block() 236 { 237 Id = "FacebookPixel", 238 SortId = 2, 239 Template = RenderFacebookPixel() 240 }; 241 242 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 243 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 244 } 245 246 @helper RenderGoogleTagManager(bool isHead = false) { 247 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") != null ? Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") : ""; 248 249 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 250 { 251 if (isHead) 252 { 253 <script> 254 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 255 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 256 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 257 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 258 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 259 </script> 260 } 261 else 262 { 263 <!-- Google Tag Manager (noscript) --> 264 <noscript> 265 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 266 height="0" width="0" style="display:none;visibility:hidden"></iframe> 267 </noscript> 268 <!-- End Google Tag Manager (noscript) --> 269 } 270 } 271 } 272 273 @helper RenderFacebookPixel() { 274 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") != null ? Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") : ""; 275 276 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 277 { 278 <!-- Facebook Pixel Code --> 279 <script> 280 !function(f,b,e,v,n,t,s) 281 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 282 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 283 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 284 n.queue=[];t=b.createElement(e);t.async=!0; 285 t.src=v;s=b.getElementsByTagName(e)[0]; 286 s.parentNode.insertBefore(t,s)}(window, document,'script', 287 'https://connect.facebook.net/en_US/fbevents.js'); 288 fbq('init', '@FacebookPixelID'); 289 fbq('track', 'PageView'); 290 </script> 291 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 292 } 293 } 294 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 295 296 @using System 297 @using System.Web 298 @using System.Collections.Generic 299 @using Dynamicweb.Rapido.Blocks.Extensibility 300 @using Dynamicweb.Rapido.Blocks 301 302 303 @{ 304 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 305 306 Block loginModal = new Block() 307 { 308 Id = "LoginModal", 309 SortId = 10, 310 Template = LoginModal() 311 }; 312 313 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 314 } 315 316 @helper LoginModal() { 317 int pageId = Model.TopPage.ID; 318 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 319 string userSignedInErrorText = ""; 320 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 321 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 322 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 323 324 if (Model.LogOnFailed) { 325 switch (Model.LogOnFailedReason) 326 { 327 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordLengthInvalid: 328 userSignedInErrorText = Translate("Password length is invalid"); 329 break; 330 case Dynamicweb.Security.UserManagement.LogOnFailedReason.IncorrectLogin: 331 userSignedInErrorText = Translate("Invalid email or password"); 332 break; 333 case Dynamicweb.Security.UserManagement.LogOnFailedReason.ExceededFailedLogOnLimit: 334 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 335 break; 336 case Dynamicweb.Security.UserManagement.LogOnFailedReason.LoginLocked: 337 userSignedInErrorText = Translate("The user account is temporarily locked"); 338 break; 339 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordExpired: 340 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 341 break; 342 default: 343 userSignedInErrorText = Translate("An unknown error occured"); 344 break; 345 } 346 } 347 348 <!-- Trigger for the login modal --> 349 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 350 351 <!-- Login modal --> 352 <div class="modal-container"> 353 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 354 <div class="modal modal--xs" id="SignInModal"> 355 <div class="modal__header"> 356 <h2>@Translate("Sign in")</h2> 357 </div> 358 <div class="modal__body"> 359 <form method="post" id="LoginForm" class="u-no-margin"> 360 <input type="hidden" name="ID" value="@pageId" /> 361 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 362 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 363 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Smartpage.login.username.placeholder", "Brugernavn")" /> 364 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 365 <div class="field-error dw-mod">@userSignedInErrorText</div> 366 367 <div class="form__field-group dw-mod"> 368 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 369 <label for="LoginRememberMe"> 370 @Translate("Remember me", "Remember me") 371 </label> 372 </div> 373 374 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 375 376 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 377 378 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 379 </form> 380 </div> 381 </div> 382 </div> 383 } 384 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 385 { 386 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 387 388 @using System 389 @using System.Web 390 @using System.Collections.Generic 391 @using Dynamicweb.Rapido.Blocks.Extensibility 392 @using Dynamicweb.Rapido.Blocks 393 394 395 @functions { 396 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 397 } 398 399 @{ 400 var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 401 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 402 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 403 bool hideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 404 405 406 Block mobileHeader = new Block() 407 { 408 Id = "MobileTop", 409 SortId = 10, 410 Template = RenderMobileTop(), 411 SkipRenderBlocksList = true 412 }; 413 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 414 415 Block mobileHeaderNavigation = new Block() 416 { 417 Id = "MobileHeaderNavigation", 418 SortId = 10, 419 Template = RenderMobileHeaderNavigation(), 420 SkipRenderBlocksList = true, 421 BlocksList = new List<Block> { 422 new Block { 423 Id = "MobileHeaderNavigationTrigger", 424 SortId = 10, 425 Template = RenderMobileHeaderNavigationTrigger() 426 } 427 } 428 }; 429 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 430 431 432 Block mobileHeaderLogo = new Block() 433 { 434 Id = "MobileHeaderLogo", 435 SortId = 20, 436 Template = RenderMobileHeaderLogo(), 437 SkipRenderBlocksList = true 438 }; 439 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 440 441 Block mobileHeaderActions = new Block() 442 { 443 Id = "MobileHeaderActions", 444 SortId = 30, 445 Template = RenderMobileTopActions(), 446 SkipRenderBlocksList = true 447 }; 448 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 449 450 if (hideSearch == false) 451 { 452 Block mobileHeaderSearch = new Block 453 { 454 Id = "MobileHeaderSearch", 455 SortId = 10, 456 Template = RenderMobileTopSearch() 457 }; 458 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 459 } 460 461 Block mobileLanguageSelector = new Block 462 { 463 Id = "MobileLanguageSelector", 464 SortId = 10, 465 Template = RenderMobileLanguageSelectorCustom() 466 }; 467 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileLanguageSelector); 468 469 Block mobileHeaderMiniCart; 470 471 if (hideCart == false) 472 { 473 mobileHeaderMiniCart = new Block 474 { 475 Id = "MobileHeaderMiniCart", 476 SortId = 20, 477 Template = RenderMobileTopMiniCart() 478 }; 479 } 480 else 481 { 482 mobileHeaderMiniCart = new Block 483 { 484 Id = "MobileHeaderMiniCart", 485 SortId = 20 486 }; 487 } 488 489 if (hideSearch == false) 490 { 491 Block mobileHeaderSearchBar = new Block() 492 { 493 Id = "MobileHeaderSearchBar", 494 SortId = 30, 495 Template = RenderMobileTopSearchBar() 496 }; 497 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 498 } 499 500 switch (mobileTopLayout) 501 { 502 case "nav-left": 503 mobileHeaderNavigation.SortId = 10; 504 mobileHeaderLogo.SortId = 20; 505 mobileHeaderActions.SortId = 30; 506 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 507 break; 508 case "nav-right": 509 mobileHeaderLogo.SortId = 10; 510 mobileHeaderActions.SortId = 20; 511 mobileHeaderNavigation.SortId = 30; 512 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 513 break; 514 case "nav-search-left": 515 mobileHeaderNavigation.SortId = 10; 516 mobileHeaderLogo.SortId = 20; 517 mobileHeaderActions.SortId = 30; 518 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 519 break; 520 case "search-left": 521 mobileHeaderActions.SortId = 10; 522 mobileHeaderLogo.SortId = 20; 523 mobileHeaderNavigation.SortId = 30; 524 mobileHeaderMiniCart.SortId = 0; 525 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 526 break; 527 } 528 } 529 530 531 @helper RenderMobileTop() 532 { 533 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 534 535 <nav class="main-navigation-mobile dw-mod"> 536 <div class="center-container top-container__center-container dw-mod"> 537 <div class="grid grid--align-center"> 538 @RenderBlockList(subBlocks) 539 </div> 540 </div> 541 </nav> 542 } 543 544 @helper RenderMobileHeaderNavigation() 545 { 546 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 547 548 <div class="grid__col-auto-width"> 549 <ul class="menu dw-mod"> 550 @RenderBlockList(subBlocks) 551 </ul> 552 </div> 553 } 554 555 @helper RenderMobileHeaderNavigationTrigger() 556 { 557 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 558 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 559 </li> 560 } 561 562 @helper RenderMobileHeaderLogo() 563 { 564 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 565 566 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 567 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 568 569 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 570 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 571 { 572 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 573 } 574 575 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 576 { 577 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 578 } 579 else 580 { 581 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 582 } 583 584 <div class="grid__col-auto"> 585 <div class="logo dw-mod"> 586 <a href="/Default.aspx?ID=@firstPageId"> 587 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 588 </a> 589 </div> 590 591 @RenderBlockList(subBlocks) 592 </div> 593 } 594 595 @helper RenderMobileTopActions() 596 { 597 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 598 599 <div class="grid__col-auto-width"> 600 <ul class="menu dw-mod"> 601 @RenderBlockList(subBlocks) 602 </ul> 603 </div> 604 } 605 606 @helper RenderMobileTopSearch() 607 { 608 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 609 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 610 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 611 </label> 612 </li> 613 } 614 615 @helper RenderMobileLanguageSelectorCustom() 616 { 617 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 618 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu--clean dw-mod"; 619 string languageIcon = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue.ToLower() : "fas fa-globe"; 620 621 if (Model.Languages.Count > 1) 622 { 623 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 624 <a href="javascript:void(0);" class="menu__link menu__link--icon menu__link--mobile dw-mod" onclick="toggleGeolocatorSelector()"> 625 <i class="@languageIcon fa-1_5x"></i> 626 </a> 627 </li> 628 } 629 } 630 631 @helper RenderMobileTopMiniCart() 632 { 633 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 634 int cartPageId = GetPageIdByNavigationTag("CartPage"); 635 double cartProductsCount = Model.Cart.TotalProductsCount; 636 637 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 638 <div class="mini-cart dw-mod"> 639 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="menu__link menu__link--icon menu__link--mobile dw-mod js-mini-cart-button u-w50px"> 640 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 641 <div class="mini-cart__counter mini-cart__counter--inline dw-mod"> 642 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 643 <div class="js-mini-cart-counter-content"> 644 @cartProductsCount 645 </div> 646 </div> 647 </div> 648 </a> 649 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 650 { 651 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 652 } 653 </div> 654 </li> 655 } 656 657 @helper RenderMobileTopSearchBar() 658 { 659 string searchFeedId = ""; 660 string searchSecondFeedId = ""; 661 int groupsFeedId; 662 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 663 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 664 string resultPageLink; 665 string searchPlaceholder; 666 string searchType = "product-search"; 667 string searchTemplate; 668 string searchContentTemplate = ""; 669 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 670 bool showGroups = true; 671 672 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 673 { 674 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 675 resultPageLink = contentSearchPageLink; 676 searchPlaceholder = Translate("Search page"); 677 groupsFeedId = 0; 678 searchType = "content-search"; 679 searchTemplate = "SearchPagesTemplate"; 680 showGroups = false; 681 } 682 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 683 { 684 searchFeedId = productsPageId + "&feed=true"; 685 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 686 resultPageLink = Converter.ToString(productsPageId); 687 searchPlaceholder = Translate("Search products or pages"); 688 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 689 searchType = "combined-search"; 690 searchTemplate = "SearchProductsTemplateWrap"; 691 searchContentTemplate = "SearchPagesTemplateWrap"; 692 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 693 } 694 else 695 { 696 resultPageLink = Converter.ToString(productsPageId); 697 searchFeedId = productsPageId + "&feed=true"; 698 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 699 searchPlaceholder = Translate("Search products"); 700 searchTemplate = "SearchProductsTemplate"; 701 searchType = "product-search"; 702 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 703 } 704 705 706 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 707 708 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 709 <div class="center-container top-container__center-container dw-mod"> 710 <div class="grid"> 711 <div class="grid__col-auto"> 712 <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> 713 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 714 @if (string.IsNullOrEmpty(searchSecondFeedId)) 715 { 716 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 717 } 718 else 719 { 720 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 721 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 722 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="MobileContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 723 </div> 724 } 725 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 726 </div> 727 </div> 728 <div class="grid__col-auto-width"> 729 <ul class="menu dw-mod"> 730 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 731 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 732 <i class="fas fa-times fa-1_5x"></i> 733 </label> 734 </li> 735 </ul> 736 </div> 737 </div> 738 </div> 739 </div> 740 } </text> 741 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 742 743 @using System 744 @using System.Web 745 @using System.Collections.Generic 746 @using Dynamicweb.Rapido.Blocks.Extensibility 747 @using Dynamicweb.Rapido.Blocks 748 749 @functions { 750 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 751 } 752 753 @{ 754 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 755 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 756 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 757 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 758 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 759 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 760 761 Block mobileNavigation = new Block() 762 { 763 Id = "MobileNavigation", 764 SortId = 10, 765 Template = MobileNavigation(), 766 SkipRenderBlocksList = true 767 }; 768 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 769 770 if (Model.CurrentUser.ID > 0 && !hideMyProfileLink) 771 { 772 Block mobileNavigationSignIn = new Block 773 { 774 Id = "MobileNavigationSignIn", 775 SortId = 10, 776 Template = RenderMobileNavigationSignIn() 777 }; 778 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 779 } 780 781 Block mobileNavigationMenu = new Block 782 { 783 Id = "MobileNavigationMenu", 784 SortId = 20, 785 Template = RenderMobileNavigationMenu() 786 }; 787 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 788 789 Block mobileNavigationActions = new Block 790 { 791 Id = "MobileNavigationActions", 792 SortId = 30, 793 Template = RenderMobileNavigationActions(), 794 SkipRenderBlocksList = true 795 }; 796 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 797 798 if (!navigationItemsHideSignIn) 799 { 800 if (Model.CurrentUser.ID <= 0) 801 { 802 Block mobileNavigationSignInAction = new Block 803 { 804 Id = "MobileNavigationSignInAction", 805 SortId = 10, 806 Template = RenderMobileNavigationSignInAction() 807 }; 808 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 809 810 if (!hideCreateAccountLink) 811 { 812 Block mobileNavigationCreateAccountAction = new Block 813 { 814 Id = "MobileNavigationCreateAccountAction", 815 SortId = 20, 816 Template = RenderMobileNavigationCreateAccountAction() 817 }; 818 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 819 } 820 } 821 else 822 { 823 if (!hideMyOrdersLink) 824 { 825 Block mobileNavigationOrdersAction = new Block 826 { 827 Id = "MobileNavigationOrdersAction", 828 SortId = 20, 829 Template = RenderMobileNavigationOrdersAction() 830 }; 831 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 832 } 833 if (!hideMyFavoritesLink) 834 { 835 Block mobileNavigationFavoritesAction = new Block 836 { 837 Id = "MobileNavigationFavoritesAction", 838 SortId = 30, 839 Template = RenderMobileNavigationFavoritesAction() 840 }; 841 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 842 } 843 if (!hideMySavedCardsLink) 844 { 845 Block mobileNavigationSavedCardsAction = new Block 846 { 847 Id = "MobileNavigationSavedCardsAction", 848 SortId = 30, 849 Template = RenderMobileNavigationSavedCardsAction() 850 }; 851 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 852 } 853 854 Block mobileNavigationSignOutAction = new Block 855 { 856 Id = "MobileNavigationSignOutAction", 857 SortId = 40, 858 Template = RenderMobileNavigationSignOutAction() 859 }; 860 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 861 } 862 } 863 864 /* 865 if (Model.Languages.Count > 1) 866 { 867 Block mobileNavigationLanguagesAction = new Block 868 { 869 Id = "MobileNavigationLanguagesAction", 870 SortId = 50, 871 Template = RenderMobileNavigationLanguagesAction() 872 }; 873 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 874 }*/ 875 } 876 877 878 @helper MobileNavigation() 879 { 880 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 881 882 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 883 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 884 int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 885 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 886 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 887 888 <!-- Trigger for mobile navigation --> 889 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 890 891 <!-- Mobile navigation --> 892 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 893 @RenderBlockList(subBlocks) 894 </nav> 895 896 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 897 898 if (!onlyPreview) 899 { 900 <div class="u-visually-hidden js-handlebars-root js-mini-cart" id="miniCart" data-template="MiniCartContent" data-cart-id="@cartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 901 } 902 } 903 904 @helper RenderMobileNavigationSignIn() 905 { 906 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 907 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 908 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 909 string myProfilePageLink = linkStart + myProfilePageId; 910 string userName = Model.CurrentUser.FirstName != null ? Model.CurrentUser.FirstName : ""; 911 userName += " " + Model.CurrentUser.LastName != null ? Model.CurrentUser.LastName : ""; 912 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 913 914 <ul class="menu menu-mobile"> 915 <li class="menu-mobile__item"> 916 <a href="@myProfilePageLink" class="menu-mobile__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @userName</a> 917 </li> 918 </ul> 919 } 920 921 @helper RenderMobileNavigationMenu() 922 { 923 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 924 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 925 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 926 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 927 int startLevel = renderPagesInToolBar ? 1 : 0; 928 929 @RenderNavigation(new 930 { 931 id = "mobilenavigation", 932 cssclass = "menu menu-mobile dwnavigation", 933 startLevel = @startLevel, 934 ecomStartLevel = @startLevel + 1, 935 // VG20190329 I needed to increment levels to get the correct amount of levels 936 endlevel = @levels + 1, 937 expandmode = "all", 938 template = @menuTemplate 939 }) 940 941 if (renderPagesInToolBar) 942 { 943 @RenderNavigation(new 944 { 945 id = "topToolsMobileNavigation", 946 cssclass = "menu menu-mobile dwnavigation", 947 template = "ToolsMenuForMobile.xslt" 948 }) 949 } 950 } 951 952 @helper RenderMobileNavigationActions() 953 { 954 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 955 956 <ul class="menu menu-mobile"> 957 @RenderBlockList(subBlocks) 958 </ul> 959 } 960 961 @helper RenderMobileNavigationSignInAction() 962 { 963 <li class="menu-mobile__item"> 964 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign in")</label> 965 </li> 966 } 967 968 @helper RenderMobileNavigationCreateAccountAction() 969 { 970 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 971 972 <li class="menu-mobile__item"> 973 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@createAccountPageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Create account")</a> 974 </li> 975 } 976 977 @helper RenderMobileNavigationProfileAction() 978 { 979 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 980 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 981 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 982 string myProfilePageLink = linkStart + myProfilePageId; 983 984 <li class="menu-mobile__item"> 985 <a href="@myProfilePageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Profile")</a> 986 </li> 987 } 988 989 @helper RenderMobileNavigationOrdersAction() 990 { 991 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 992 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 993 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 994 string myOrdersPageLink = linkStart + myOrdersPageId; 995 996 <li class="menu-mobile__item"> 997 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="fas fa-list menu-mobile__link-icon"></i> @Translate("My Orders")</a> 998 </li> 999 } 1000 1001 @helper RenderMobileNavigationFavoritesAction() 1002 { 1003 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1004 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 1005 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1006 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1007 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; 1008 1009 1010 <li class="menu-mobile__item"> 1011 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@favoritesIcon menu-mobile__link-icon"></i> @Translate("My Favorites")</a> 1012 </li> 1013 } 1014 1015 @helper RenderMobileNavigationSavedCardsAction() 1016 { 1017 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1018 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 1019 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 1020 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 1021 string savedCardsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards").SelectedValue : "fas fa-credit-card"; 1022 1023 <li class="menu-mobile__item"> 1024 <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@savedCardsIcon menu-mobile__link-icon"></i> @Translate("My Saved Cards")</a> 1025 </li> 1026 } 1027 1028 @helper RenderMobileNavigationSignOutAction() 1029 { 1030 int pageId = Model.TopPage.ID; 1031 string signOutIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon").SelectedValue : "far fa-sign-out-alt"; 1032 1033 1034 <li class="menu-mobile__item"> 1035 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> 1036 </li> 1037 } 1038 1039 @helper RenderMobileNavigationLanguagesAction() 1040 { 1041 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 1042 1043 string selectedLanguage = ""; 1044 foreach (var lang in Model.Languages) 1045 { 1046 if (lang.IsCurrent) 1047 { 1048 selectedLanguage = lang.Name; 1049 } 1050 } 1051 1052 <li class="menu-mobile__item dw-mod"> 1053 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 1054 <div class="menu-mobile__link__wrap"> 1055 <label for="MobileMenuCheck_Language" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue menu-mobile__link-icon"></i> @selectedLanguage</label> 1056 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 1057 </div> 1058 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 1059 @if (isSlidesDesign) 1060 { 1061 <li class="menu-mobile__item dw-mod"> 1062 <div class="menu-mobile__link__wrap"> 1063 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 1064 <label for="MobileMenuCheck_Language" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 1065 </div> 1066 </li> 1067 } 1068 @foreach (var lang in Model.Languages) 1069 { 1070 <li class="menu-mobile__item dw-mod"> 1071 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a> 1072 </li> 1073 } 1074 </ul> 1075 </li> 1076 }</text> 1077 } 1078 else 1079 { 1080 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1081 1082 @using System 1083 @using System.Web 1084 @using System.Collections.Generic 1085 @using Dynamicweb.Rapido.Blocks.Extensibility 1086 @using Dynamicweb.Rapido.Blocks 1087 1088 @functions { 1089 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 1090 } 1091 1092 @{ 1093 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 1094 bool navigationActionHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 1095 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 1096 bool showSearchIcon = false; 1097 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1098 1099 if (topLayout == "minimal" || topLayout == "minimal-right" || topLayout == "two-lines" || topLayout == "two-lines-centered") 1100 { 1101 showSearchIcon = true; 1102 } 1103 bool headerOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 1104 1105 if (renderPagesInToolBar && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 1106 { 1107 Block masterTools = new Block() 1108 { 1109 Id = "MasterDesktopTools", 1110 SortId = 10, 1111 Template = RenderDesktopTools(), 1112 SkipRenderBlocksList = true, 1113 BlocksList = new List<Block> 1114 { 1115 new Block { 1116 Id = "MasterDesktopToolsText", 1117 SortId = 10, 1118 Template = RenderDesktopToolsText(), 1119 Design = new Design 1120 { 1121 Size = "auto", 1122 HidePadding = true, 1123 RenderType = RenderType.Column 1124 } 1125 }, 1126 new Block { 1127 Id = "MasterDesktopToolsNavigation", 1128 SortId = 20, 1129 Template = RenderDesktopToolsNavigation(), 1130 Design = new Design 1131 { 1132 Size = "auto-width", 1133 HidePadding = true, 1134 RenderType = RenderType.Column 1135 } 1136 } 1137 } 1138 }; 1139 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterTools); 1140 }; 1141 1142 Block masterDesktopExtra = new Block() 1143 { 1144 Id = "MasterDesktopExtra", 1145 SortId = 10, 1146 Template = RenderDesktopExtra(), 1147 SkipRenderBlocksList = true 1148 }; 1149 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopExtra); 1150 1151 Block masterDesktopNavigation = new Block() 1152 { 1153 Id = "MasterDesktopNavigation", 1154 SortId = 20, 1155 Template = RenderDesktopNavigation(), 1156 SkipRenderBlocksList = true 1157 }; 1158 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopNavigation); 1159 1160 Block masterDesktopLogo = new Block 1161 { 1162 Id = "MasterDesktopLogo", 1163 SortId = 10, 1164 Template = RenderDesktopLogo(), 1165 Design = new Design 1166 { 1167 Size = "auto-width", 1168 HidePadding = true, 1169 RenderType = RenderType.Column 1170 } 1171 }; 1172 1173 Block masterDesktopMenu = new Block 1174 { 1175 Id = "MasterDesktopMenu", 1176 SortId = 20, 1177 Template = RenderDesktopMenu(), 1178 Design = new Design() 1179 { 1180 Size = "auto", 1181 HidePadding = true, 1182 RenderType = RenderType.Column 1183 } 1184 }; 1185 1186 Block masterDesktopActionsMenuContainer = new Block 1187 { 1188 Id = "MasterDesktopActionsMenuContainer", 1189 SortId = 30, 1190 Design = new Design 1191 { 1192 RenderType = RenderType.Column, 1193 Size = "auto" 1194 } 1195 }; 1196 1197 Block masterDesktopActionsMenu = new Block 1198 { 1199 Id = "MasterDesktopActionsMenu", 1200 SortId = 10, 1201 Template = RenderDesktopActionsMenu(), 1202 SkipRenderBlocksList = true 1203 }; 1204 1205 if (!navigationActionHideSearch && showSearchIcon) 1206 { 1207 Block masterDesktopActionsMenuSearch = new Block 1208 { 1209 Id = "MasterDesktopActionsMenuSearch", 1210 SortId = 10, 1211 Template = RenderMiniSearch() 1212 }; 1213 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSearch); 1214 } 1215 1216 Block masterDesktopActionsMenuSignIn = new Block 1217 { 1218 Id = "MasterDesktopActionsMenuSignIn", 1219 SortId = 20, 1220 Template = RenderSignIn() 1221 }; 1222 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSignIn); 1223 1224 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 1225 { 1226 Block masterDesktopActionsMenuFavorites = new Block 1227 { 1228 Id = "MasterDesktopActionsMenuFavorites", 1229 SortId = 30, 1230 Template = RenderFavorites() 1231 }; 1232 masterDesktopActionsMenu.Add(masterDesktopActionsMenuFavorites); 1233 } 1234 1235 Block masterDesktopActionsMenuLanguageSelector = new Block 1236 { 1237 Id = "MasterDesktopActionsMenuLanguageSelector", 1238 SortId = 40, 1239 Template = RenderLanguageSelector() 1240 }; 1241 masterDesktopActionsMenu.Add(masterDesktopActionsMenuLanguageSelector); 1242 1243 if (!headerOnlyPreview) 1244 { 1245 Block masterDesktopActionsMenuMiniCart = new Block 1246 { 1247 Id = "MasterDesktopActionsMenuMiniCart", 1248 SortId = 50, 1249 Template = RenderMiniCart() 1250 }; 1251 masterDesktopActionsMenu.Add(masterDesktopActionsMenuMiniCart); 1252 } 1253 1254 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 1255 { 1256 Block masterDesktopActionsHeaderButton = new Block 1257 { 1258 Id = "MasterDesktopActionsHeaderButton", 1259 SortId = 60, 1260 Template = RenderHeaderButton() 1261 }; 1262 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 1263 } 1264 1265 Block searchBar = new Block() 1266 { 1267 Id = "SearchBar", 1268 SortId = 40, 1269 Template = RenderSearchBar(), 1270 Design = new Design() 1271 { 1272 Size = "auto", 1273 HidePadding = true, 1274 RenderType = RenderType.Column 1275 } 1276 }; 1277 1278 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 1279 { 1280 Block impersonationBar = new Block() 1281 { 1282 Id = "ImpersonationBar", 1283 SortId = 50, 1284 Template = RenderImpersonationBar(), 1285 Design = new Design() 1286 { 1287 Size = "auto-width", 1288 HidePadding = true, 1289 RenderType = RenderType.Column 1290 } 1291 }; 1292 headerBlocksPage.Add(MasterBlockId.MasterHeader, impersonationBar); 1293 } 1294 1295 switch (topLayout) 1296 { 1297 case "condensed": //2 1298 masterDesktopLogo.SortId = 10; 1299 masterDesktopLogo.Design.Size = "auto-width"; 1300 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1301 masterDesktopMenu.SortId = 20; 1302 masterDesktopMenu.Design.Size = "auto"; 1303 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1304 masterDesktopActionsMenuContainer.SortId = 30; 1305 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1306 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1307 if (!navigationActionHideSearch) 1308 { 1309 searchBar.SortId = 40; 1310 searchBar.Design.Size = "12"; 1311 masterDesktopExtra.SortId = 50; 1312 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1313 } 1314 break; 1315 case "minimal": //4 1316 masterDesktopLogo.SortId = 10; 1317 masterDesktopLogo.Design.Size = "auto-width"; 1318 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1319 masterDesktopMenu.SortId = 10; 1320 masterDesktopMenu.Design.Size = "auto"; 1321 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1322 masterDesktopActionsMenuContainer.SortId = 20; 1323 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1324 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1325 break; 1326 case "minimal-right": //5 1327 masterDesktopLogo.SortId = 10; 1328 masterDesktopLogo.Design.Size = "auto-width"; 1329 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1330 masterDesktopMenu.SortId = 10; 1331 masterDesktopMenu.Design.Size = "auto"; 1332 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1333 masterDesktopActionsMenuContainer.SortId = 20; 1334 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1335 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1336 break; 1337 case "two-lines": //6 1338 masterDesktopLogo.SortId = 10; 1339 masterDesktopLogo.Design.Size = "auto"; 1340 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1341 masterDesktopMenu.SortId = 10; 1342 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1343 masterDesktopActionsMenuContainer.SortId = 20; 1344 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1345 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1346 break; 1347 case "two-lines-centered": //7 1348 masterDesktopLogo.SortId = 10; 1349 masterDesktopLogo.Design.Size = "auto"; 1350 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1351 masterDesktopMenu.SortId = 10; 1352 masterDesktopMenu.Design.Size = "auto"; 1353 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1354 masterDesktopActionsMenuContainer.SortId = 20; 1355 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1356 break; 1357 case "splitted": //3 1358 masterDesktopLogo.SortId = 10; 1359 masterDesktopLogo.Design.Size = "auto"; 1360 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1361 if (!navigationActionHideSearch) 1362 { 1363 searchBar.SortId = 20; 1364 searchBar.Design.Size = "auto"; 1365 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1366 } 1367 masterDesktopMenu.SortId = 10; 1368 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1369 masterDesktopActionsMenuContainer.SortId = 20; 1370 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1371 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1372 break; 1373 case "normal": //1 1374 default: 1375 masterDesktopLogo.SortId = 10; 1376 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1377 if (!navigationActionHideSearch) 1378 { 1379 searchBar.SortId = 20; 1380 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1381 } 1382 masterDesktopActionsMenuContainer.SortId = 30; 1383 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopActionsMenuContainer); 1384 masterDesktopMenu.SortId = 10; 1385 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1386 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1387 break; 1388 } 1389 1390 headerBlocksPage.Add("MasterDesktopActionsMenuContainer", masterDesktopActionsMenu); 1391 } 1392 1393 @helper RenderDesktopTools() 1394 { 1395 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 1396 1397 <div class="tools-navigation dw-mod"> 1398 <div class="center-container grid top-container__center-container dw-mod"> 1399 @RenderBlockList(subBlocks) 1400 </div> 1401 </div> 1402 } 1403 1404 @helper RenderDesktopToolsText() 1405 { 1406 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 1407 1408 <div class="u-margin-top">@toolsText</div> 1409 } 1410 1411 @helper RenderDesktopToolsNavigation() 1412 { 1413 <div> 1414 @RenderNavigation(new 1415 { 1416 id = "topToolsNavigation", 1417 cssclass = "menu menu-tools dw-mod dwnavigation", 1418 template = "TopMenu.xslt" 1419 }) 1420 </div> 1421 } 1422 1423 @helper RenderDesktopNavigation() 1424 { 1425 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 1426 1427 <nav class="main-navigation dw-mod"> 1428 <div class="center-container top-container__center-container grid grid--align-center dw-mod"> 1429 @RenderBlockList(subBlocks) 1430 </div> 1431 </nav> 1432 } 1433 1434 @helper RenderDesktopExtra() 1435 { 1436 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 1437 1438 if (subBlocks.Count > 0) 1439 { 1440 <div class="header header-top dw-mod"> 1441 <div class="center-container top-container__center-container grid grid--align-center grid--justify-space-between dw-mod"> 1442 @RenderBlockList(subBlocks) 1443 </div> 1444 </div> 1445 } 1446 } 1447 1448 @helper RenderDesktopLogo() 1449 { 1450 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 1451 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1452 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 1453 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 1454 string logoHeight = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetString("LogoHeight")) ? Model.Area.Item.GetItem("Layout").GetString("LogoHeight") : "40"; 1455 logoHeight = logoHeight != "0" ? logoHeight : "40"; 1456 if (Path.GetExtension(logo).ToLower() != ".svg") 1457 { 1458 logo = "/Admin/Public/GetImage.ashx?height=" + logoHeight + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 1459 1460 if (Pageview.Device.ToString() == "Mobile") 1461 { 1462 logoHeight = "40"; 1463 } 1464 } 1465 else 1466 { 1467 logo = HttpUtility.UrlDecode(logo); 1468 } 1469 1470 <div class="logo @alignClass dw-mod"> 1471 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 1472 <img class="grid__cell-img logo__img dw-mod" src="@logo" /> 1473 </a> 1474 </div> 1475 } 1476 1477 @helper RenderDesktopMenu() 1478 { 1479 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1480 string menuAlignment = topLayout == "two-lines-centered" || topLayout == "minimal-right" ? "u-pull--right" : ""; 1481 1482 bool megaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue.ToLower() == "true" ? true : false; 1483 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 1484 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 1485 int startLevel = renderPagesInToolBar ? 1 : 0; 1486 1487 <div class="grid__cell"> 1488 <div class="@menuAlignment"> 1489 @if (!megaMenu) 1490 { 1491 @RenderNavigation(new 1492 { 1493 id = "topnavigation", 1494 cssclass = "menu dw-mod dwnavigation u-full-max-width", 1495 startLevel = @startLevel, 1496 ecomStartLevel = @startLevel + 1, 1497 endlevel = 5, 1498 expandmode = "all", 1499 template = "BaseMenuWithDropdown.xslt" 1500 }); 1501 } 1502 else 1503 { 1504 @RenderNavigation(new 1505 { 1506 id = "topnavigation", 1507 cssclass = "menu dw-mod dwnavigation u-full-max-width", 1508 startLevel = @startLevel, 1509 ecomStartLevel = @startLevel + 1, 1510 endlevel = 5, 1511 promotionImage = megamenuPromotionImage, 1512 promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"), 1513 expandmode = "all", 1514 template = "BaseMegaMenu.xslt" 1515 }); 1516 } 1517 </div> 1518 </div> 1519 } 1520 1521 @helper RenderDesktopActionsMenu() 1522 { 1523 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 1524 1525 <ul class="menu dw-mod"> 1526 @RenderBlockList(subBlocks) 1527 </ul> 1528 } 1529 1530 @helper RenderLanguageSelector() 1531 { 1532 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1533 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1534 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1535 string languageViewType = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : ""; 1536 1537 if (Model.Languages.Count > 1) 1538 { 1539 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1540 <div class="@menuLinkClass menu__link--icon dw-mod"> 1541 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 1542 </div> 1543 <div class="menu menu--dropdown dw-mod"> 1544 @foreach (var lang in Model.Languages) 1545 { 1546 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 1547 1548 if (languageViewType == "flag") 1549 { 1550 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + "\"></span>"; 1551 } 1552 1553 if (languageViewType == "name") 1554 { 1555 langInfo = lang.Name; 1556 } 1557 1558 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__item menu-dropdown__item--link dw-mod">@langInfo</a> 1559 } 1560 </div> 1561 </li> 1562 } 1563 } 1564 1565 @helper RenderMiniCart() 1566 { 1567 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 1568 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 1569 int cartPageId = GetPageIdByNavigationTag("CartPage"); 1570 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 1571 1572 if (!onlyPreview && !navigationItemsHideCart) 1573 { 1574 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1575 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1576 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1577 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 1578 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue; 1579 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 1580 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 1581 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 1582 1583 if (showPrice && counterPosition == "right") 1584 { 1585 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 1586 } 1587 1588 1589 <li class="@liClasses" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 1590 <div class="mini-cart dw-mod"> 1591 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="@menuLinkClass menu__link--icon dw-mod js-mini-cart-button"> 1592 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 1593 <div class="mini-cart__counter dw-mod"> 1594 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 1595 <div class="js-mini-cart-counter-content"> 1596 @cartProductsCount 1597 @cartProductsTotalPrice 1598 </div> 1599 </div> 1600 </div> 1601 </a> 1602 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 1603 { 1604 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 1605 } 1606 </div> 1607 </li> 1608 } 1609 } 1610 1611 @helper RenderSignIn() 1612 { 1613 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 1614 string userInitials = ""; 1615 int pageId = Model.TopPage.ID; 1616 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 1617 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 1618 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 1619 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 1620 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1621 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 1622 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1623 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 1624 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 1625 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 1626 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 1627 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 1628 1629 string linkStart = "/Default.aspx?ID="; 1630 if (Model.CurrentUser.ID <= 0) 1631 { 1632 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1633 } 1634 1635 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 1636 string myProfilePageLink = linkStart + myProfilePageId; 1637 string myOrdersPageLink = linkStart + myOrdersPageId; 1638 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1639 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 1640 1641 if (Model.CurrentUser.ID != 0) 1642 { 1643 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 1644 { 1645 string[] names = Model.CurrentUser.Name.Split(' '); 1646 userInitials += Model.CurrentUser.Name.Substring(0, 1); 1647 1648 if (names.Length > 1) 1649 { 1650 userInitials += names[names.Length - 1].Substring(0, 1); 1651 } 1652 } 1653 else 1654 { 1655 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 1656 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 1657 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 1658 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 1659 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 1660 } 1661 } 1662 1663 if (!navigationItemsHideSignIn) 1664 { 1665 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1666 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu__item--clean dw-mod"; 1667 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1668 1669 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1670 <div class="@menuLinkClass menu__link--icon dw-mod"> 1671 @if (Model.CurrentUser.ID <= 0) 1672 { 1673 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 1674 } 1675 else 1676 { 1677 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 1678 } 1679 </div> 1680 <div class="menu menu--dropdown sign-in-dropdown dw-mod"> 1681 <ul class="list list--clean dw-mod"> 1682 @if (Model.CurrentUser.ID <= 0) 1683 { 1684 <li> 1685 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label> 1686 </li> 1687 if (!hideCreateAccountLink) 1688 { 1689 <li> 1690 <a href="/default.aspx?ID=@createAccountPageId" class="list__link dw-mod">@Translate("Create account")</a> 1691 </li> 1692 } 1693 <li> 1694 <a href="@forgotPasswordPageLink" class="list__link dw-mod">@Translate("Forgot your password?")</a> 1695 </li> 1696 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1697 { 1698 <li class="list__seperator dw-mod"></li> 1699 } 1700 } 1701 @if (!hideMyProfileLink) 1702 { 1703 <li> 1704 <a href="@myProfilePageLink" class="list__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue u-margin-right"></i>@Translate("My Profile")</a> 1705 </li> 1706 } 1707 @if (!hideMyOrdersLink) 1708 { 1709 <li> 1710 <a href="@myOrdersPageLink" class="list__link dw-mod"><i class="fas fa-list u-margin-right"></i>@Translate("My Orders")</a> 1711 </li> 1712 } 1713 @if (!hideMyFavoritesLink) 1714 { 1715 <li> 1716 <a href="@myFavoritesPageLink" class="list__link dw-mod"><i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue u-margin-right"></i>@Translate("My Favorites")</a> 1717 </li> 1718 } 1719 @if (!hideMySavedCardsLink) 1720 { 1721 <li> 1722 <a href="@mySavedCardsPageLink" class="list__link dw-mod"><i class="fas fa-credit-card u-margin-right"></i>@Translate("My Saved cards")</a> 1723 </li> 1724 } 1725 @if (Model.CurrentUser.ID > 0) 1726 { 1727 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1728 { 1729 <li class="list__seperator dw-mod"></li> 1730 } 1731 <li> 1732 <a href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" class="list__link dw-mod">@Translate("Sign out")</a> 1733 </li> 1734 } 1735 </ul> 1736 </div> 1737 </li> 1738 } 1739 } 1740 1741 @helper RenderFavorites() 1742 { 1743 bool navigationItemsHideFavorites = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 1744 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1745 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1746 1747 string linkStart = "/Default.aspx?ID="; 1748 if (Model.CurrentUser.ID <= 0) 1749 { 1750 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1751 } 1752 1753 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1754 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1755 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1756 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1757 1758 <li class="@liClasses"> 1759 <a href="@myFavoritesPageLink" class="@menuLinkClass menu__link--icon dw-mod"> 1760 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 1761 </a> 1762 </li> 1763 } 1764 1765 @helper RenderHeaderButton() 1766 { 1767 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 1768 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 1769 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 1770 1771 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 1772 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 1773 </li> 1774 } 1775 1776 @helper RenderSearchBar(string alignment = "left") 1777 { 1778 string searchFeedId = ""; 1779 string searchSecondFeedId = ""; 1780 int groupsFeedId; 1781 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1782 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1783 string resultPageLink; 1784 string searchPlaceholder; 1785 string searchType = "product-search"; 1786 string searchTemplate; 1787 string searchContentTemplate = ""; 1788 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1789 bool showGroups = true; 1790 1791 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1792 { 1793 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1794 resultPageLink = contentSearchPageLink; 1795 searchPlaceholder = Translate("Search page"); 1796 groupsFeedId = 0; 1797 searchType = "content-search"; 1798 searchTemplate = "SearchPagesTemplate"; 1799 showGroups = false; 1800 } 1801 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1802 { 1803 searchFeedId = productsPageId + "&feed=true"; 1804 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1805 resultPageLink = Converter.ToString(productsPageId); 1806 searchPlaceholder = Translate("Search products or pages"); 1807 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1808 searchType = "combined-search"; 1809 searchTemplate = "SearchProductsTemplateWrap"; 1810 searchContentTemplate = "SearchPagesTemplateWrap"; 1811 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1812 } 1813 else 1814 { 1815 resultPageLink = Converter.ToString(productsPageId); 1816 searchFeedId = productsPageId + "&feed=true"; 1817 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1818 searchPlaceholder = Translate("Search products"); 1819 searchTemplate = "SearchProductsTemplate"; 1820 searchType = "product-search"; 1821 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1822 } 1823 1824 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" data-page-size="7" id="ProductSearchBar" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-groups-page-id="@groupsFeedId" data-search-type="@searchType"> 1825 @if (showGroups) 1826 { 1827 <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button> 1828 <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul> 1829 } 1830 <div class="typeahead-search-field"> 1831 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 1832 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1833 { 1834 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 1835 } 1836 else 1837 { 1838 <div class="dropdown dropdown--absolute-position dropdown--combined grid @(alignment == "right" ? "dropdown--right-aligned" : "")"> 1839 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 1840 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 1841 </div> 1842 } 1843 </div> 1844 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 1845 </div> 1846 } 1847 1848 @helper RenderMiniSearch() 1849 { 1850 string searchFeedId = ""; 1851 string searchSecondFeedId = ""; 1852 int groupsFeedId; 1853 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1854 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1855 string resultPageLink; 1856 string searchPlaceholder; 1857 string searchType = "product-search"; 1858 string searchTemplate; 1859 string searchContentTemplate = ""; 1860 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1861 bool showGroups = true; 1862 1863 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1864 { 1865 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1866 resultPageLink = contentSearchPageLink; 1867 searchPlaceholder = Translate("Search page"); 1868 groupsFeedId = 0; 1869 searchType = "content-search"; 1870 searchTemplate = "SearchPagesTemplate"; 1871 showGroups = false; 1872 } 1873 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1874 { 1875 searchFeedId = productsPageId + "&feed=true"; 1876 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1877 resultPageLink = Converter.ToString(productsPageId); 1878 searchPlaceholder = Translate("Search products or pages"); 1879 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1880 searchType = "combined-search"; 1881 searchTemplate = "SearchProductsTemplateWrap"; 1882 searchContentTemplate = "SearchPagesTemplateWrap"; 1883 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1884 } 1885 else 1886 { 1887 resultPageLink = Converter.ToString(productsPageId); 1888 searchFeedId = productsPageId + "&feed=true"; 1889 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1890 searchPlaceholder = Translate("Search products"); 1891 searchTemplate = "SearchProductsTemplate"; 1892 searchType = "product-search"; 1893 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1894 } 1895 1896 <li class="menu__item menu__item--horizontal menu__item--top-level u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" onmouseover="document.getElementById('headerSearch').focus()"> 1897 <div class="menu__link menu__link--icon dw-mod"> 1898 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 1899 </div> 1900 <div class="menu menu--dropdown u-w380px top-micro-search dw-mod"> 1901 <div class="typeahead js-typeahead" data-page-size="7" id="ProductSearchBar" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> 1902 <div class="typeahead-search-field"> 1903 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@searchPlaceholder" value="@searchValue"> 1904 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1905 { 1906 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 1907 } 1908 else 1909 { 1910 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 1911 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 1912 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 1913 </div> 1914 } 1915 </div> 1916 </div> 1917 </div> 1918 </li> 1919 } 1920 1921 @helper RenderImpersonationBar() 1922 { 1923 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 1924 1925 <div class="u-color-warning--bg"> 1926 <div class="center-container top-container__center-container dw-mod"> 1927 @*Impersonation*@ 1928 <div class="grid"> 1929 <div class="grid--align-self-center grid__col-x"> 1930 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 1931 { 1932 string stopImpersonateTranslation = Translate("Stop impersonation"); 1933 string username = ""; 1934 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 1935 { 1936 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 1937 } 1938 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 1939 { 1940 username = Model.CurrentSecondaryUser.Name; 1941 } 1942 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 1943 { 1944 username = Model.CurrentSecondaryUser.Email; 1945 } 1946 else 1947 { 1948 username = Model.CurrentSecondaryUser.UserName; 1949 } 1950 <div class="grid-cell"> 1951 <div class="u-pull--left u-bold u-margin-top"> 1952 <i class="fas fa-user-secret"></i> 1953 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 1954 </div> 1955 <form method="post" class="u-pull--right u-no-margin"> 1956 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 1957 </form> 1958 </div> 1959 } 1960 else 1961 { 1962 string viewListTranslation = Translate("View the list of users you can impersonate"); 1963 <div class="grid-cell u-bold"> 1964 <i class="fas fa-user-secret"></i> 1965 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 1966 </div> 1967 } 1968 </div> 1969 </div> 1970 </div> 1971 </div> 1972 } 1973 1974 </text> 1975 } 1976 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1977 1978 @using System 1979 @using System.Web 1980 @using System.Collections.Generic 1981 @using Dynamicweb.Rapido.Blocks.Extensibility 1982 @using Dynamicweb.Rapido.Blocks 1983 1984 @functions { 1985 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 1986 } 1987 1988 @{ 1989 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content") : ""; 1990 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content") : ""; 1991 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content") : ""; 1992 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header") : ""; 1993 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header") : ""; 1994 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header") : ""; 1995 1996 Block masterFooterContent = new Block() 1997 { 1998 Id = "MasterFooterContent", 1999 SortId = 10, 2000 Template = RenderFooter(), 2001 SkipRenderBlocksList = true 2002 }; 2003 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 2004 2005 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 2006 { 2007 Block masterFooterColumnOne = new Block 2008 { 2009 Id = "MasterFooterColumnOne", 2010 SortId = 10, 2011 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 2012 Design = new Design { 2013 Size = "auto", 2014 RenderType = RenderType.Column 2015 } 2016 }; 2017 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 2018 } 2019 2020 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 2021 { 2022 Block masterFooterColumnTwo = new Block 2023 { 2024 Id = "MasterFooterColumnTwo", 2025 SortId = 20, 2026 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 2027 Design = new Design 2028 { 2029 Size = "auto", 2030 RenderType = RenderType.Column 2031 } 2032 }; 2033 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 2034 } 2035 2036 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 2037 { 2038 Block masterFooterColumnThree = new Block 2039 { 2040 Id = "MasterFooterColumnThree", 2041 SortId = 30, 2042 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 2043 Design = new Design 2044 { 2045 Size = "auto", 2046 RenderType = RenderType.Column 2047 } 2048 }; 2049 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 2050 } 2051 2052 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 2053 { 2054 Block masterFooterNewsletterSignUp = new Block 2055 { 2056 Id = "MasterFooterNewsletterSignUp", 2057 SortId = 40, 2058 Template = RenderFooterNewsletterSignUp(), 2059 Design = new Design 2060 { 2061 Size = "auto", 2062 RenderType = RenderType.Column 2063 } 2064 }; 2065 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 2066 } 2067 2068 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 2069 { 2070 Block masterFooterSocialLinks = new Block 2071 { 2072 Id = "MasterFooterSocialLinks", 2073 SortId = 50, 2074 Template = RenderFooterSocialLinks(), 2075 Design = new Design 2076 { 2077 Size = "auto", 2078 RenderType = RenderType.Column 2079 } 2080 }; 2081 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 2082 } 2083 2084 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 2085 { 2086 Block masterFooterPayments = new Block 2087 { 2088 Id = "MasterFooterPayments", 2089 SortId = 60, 2090 Template = RenderFooterPayments(), 2091 Design = new Design 2092 { 2093 Size = "12", 2094 RenderType = RenderType.Column 2095 } 2096 }; 2097 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 2098 } 2099 2100 Block masterFooterCopyright = new Block 2101 { 2102 Id = "MasterFooterCopyright", 2103 SortId = 70, 2104 Template = RenderFooterCopyright(), 2105 Design = new Design 2106 { 2107 Size = "12", 2108 RenderType = RenderType.Column 2109 } 2110 }; 2111 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 2112 } 2113 2114 @helper RenderFooter() { 2115 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 2116 2117 <footer class="footer dw-mod"> 2118 <div class="center-container top-container__center-container dw-mod"> 2119 <div class="grid grid--external-bleed-x"> 2120 @RenderBlockList(subBlocks) 2121 </div> 2122 </div> 2123 </footer> 2124 } 2125 2126 @helper RenderFooterColumn(string header, string content) { 2127 <h3 class="footer__heading dw-mod">@header</h3> 2128 <div class="footer__content dw-mod"> 2129 @content 2130 </div> 2131 } 2132 2133 @helper RenderFooterNewsletterSignUp() { 2134 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 2135 2136 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 2137 <div class="footer__content dw-mod"> 2138 <p>@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us").</p> 2139 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 2140 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 2141 <div class="form__field-combi"> 2142 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' /> 2143 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 2144 </div> 2145 </form> 2146 </div> 2147 } 2148 2149 @helper RenderFooterSocialLinks() { 2150 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 2151 <div class="footer__content dw-mod"> 2152 <div class="collection dw-mod"> 2153 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 2154 { 2155 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 2156 string socialIconClass = socialIcon.SelectedValue; 2157 string socialIconTitle = socialIcon.SelectedName; 2158 string socialLink = socialitem.GetString("Link"); 2159 2160 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px"><i class="@socialIconClass fa-2x"></i></a> 2161 } 2162 </div> 2163 </div> 2164 } 2165 2166 @helper RenderFooterPayments() { 2167 <div class="footer__content dw-mod"> 2168 <div class="collection dw-mod"> 2169 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 2170 { 2171 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 2172 string paymentImage = null; 2173 string paymentTitle = paymentItem.SelectedName; 2174 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 2175 if (selected != null) 2176 { 2177 paymentImage = selected.Icon; 2178 } 2179 2180 <div class="footer__card-type"> 2181 <img src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 2182 </div> 2183 } 2184 </div> 2185 </div> 2186 } 2187 2188 @helper RenderFooterCopyright() { 2189 <div class="grid__col-12 footer__copyright dw-mod"> 2190 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 2191 </div> 2192 } 2193 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2194 2195 @using System 2196 @using System.Web 2197 @using System.Collections.Generic 2198 @using Dynamicweb.Rapido.Blocks.Extensibility 2199 @using Dynamicweb.Rapido.Blocks 2200 2201 @{ 2202 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 2203 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2204 2205 if (!navigationItemsHideCart) 2206 { 2207 Block miniCartScriptTemplates = new Block() 2208 { 2209 Id = "MasterMiniCartTemplates", 2210 SortId = 1, 2211 Template = RenderMiniCartScriptTemplates(), 2212 SkipRenderBlocksList = true, 2213 BlocksList = new List<Block> 2214 { 2215 new Block { 2216 Id = "MiniCartHeader", 2217 SortId = 10, 2218 Template = RenderMiniCartHeader() 2219 }, 2220 new Block { 2221 Id = "MiniCartOrderLines", 2222 SortId = 20, 2223 Template = RenderMiniCartOrderLines() 2224 }, 2225 new Block { 2226 Id = "MiniCartFees", 2227 SortId = 30, 2228 Template = RenderMiniCartFees() 2229 }, 2230 new Block { 2231 Id = "MiniCartPoints", 2232 SortId = 40, 2233 Template = RenderMiniCartPoints() 2234 }, 2235 new Block { 2236 Id = "MiniCartTotal", 2237 SortId = 50 , 2238 Template = RenderMiniCartTotal() 2239 } 2240 } 2241 }; 2242 2243 miniCartBlocksPage.Add(MasterBlockId.MasterBottomSnippets, miniCartScriptTemplates); 2244 } 2245 } 2246 2247 @helper RenderMiniCartScriptTemplates() 2248 { 2249 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 2250 2251 int cartPageId = GetPageIdByNavigationTag("CartPage"); 2252 bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 2253 showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; 2254 showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; 2255 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2256 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2257 string addingToCartNotification = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 2258 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 2259 2260 2261 <script id="MiniCartCounterContent" type="text/x-template"> 2262 {{#.}} 2263 <div class="js-mini-cart-counter-content dw-mod"> 2264 @if (showPriceInMiniCartCounter) { 2265 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 2266 } else { 2267 <text>{{numberofproducts}}</text> 2268 } 2269 </div> 2270 {{/.}} 2271 </script> 2272 2273 <script id="MiniCartContent" type="text/x-template"> 2274 {{#.}} 2275 @if (useGoogleTagManager) 2276 { 2277 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 2278 } 2279 <div class="mini-cart-dropdown__inner {{isempty}} dw-mod"> 2280 <h4 class="u-ta-center u-no-margin u-margin-bottom u-margin-top">@Translate("Shopping cart")</h4> 2281 <div class="mini-cart-dropdown__body dw-mod"> 2282 <table class="table mini-cart-table dw-mod"> 2283 @RenderBlockList(subBlocks) 2284 </table> 2285 </div> 2286 2287 <table class="table mini-cart-table dw-mod"> 2288 <tr class="mini-cart-orderlines__footer dw-mod"> 2289 <td colspan="2">@*<button type="button" class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button>*@</td> 2290 <td colspan="2" class="u-ta-right"><a href="/Default.aspx?ID=@cartPageId" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a></td> 2291 </tr> 2292 </table> 2293 </div> 2294 {{/.}} 2295 </script> 2296 2297 <script id="MiniCartOrderline" type="text/x-template"> 2298 <tr class="{{isempty}}"> 2299 <td><a href="{{link}}" class="{{hideimage}}"><img src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}"></a></td> 2300 <td> 2301 <a href="{{link}}" class="mini-cart-orderlines__name" title="{{name}}">{{name}}</a> 2302 {{#if variantname}} 2303 <a href="{{link}}" class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{variantname}}</a> 2304 {{/if}} 2305 {{#if unitname}} 2306 <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{unitname}}</div> 2307 {{/if}} 2308 {{#ifCond ExpectedDeliveryDateFormated "!==" ""}} 2309 <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">@Translate("Expected Delivery Date"):<br />{{ExpectedDeliveryDateFormated}}</div> 2310 {{/ifCond}} 2311 </td> 2312 <td class="u-ta-right">{{quantity}}</td> 2313 <td class="u-ta-right"> 2314 {{#if pointsTotal}} 2315 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 2316 {{else}} 2317 {{totalprice}} 2318 {{/if}} 2319 </td> 2320 </tr> 2321 </script> 2322 2323 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 2324 <tr class="table__row--no-border {{isempty}}"> 2325 <td>&nbsp;</td> 2326 <td><div class="mini-cart-orderlines__name dw-mod">{{name}}</div></td> 2327 <td class="u-ta-right">&nbsp;</td> 2328 <td class="u-ta-right">{{totalprice}}</td> 2329 </tr> 2330 </script> 2331 2332 if (!onlyPreview && addingToCartNotification == "modal") 2333 { 2334 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 2335 2336 <script id="LastAddedProductTemplate" type="text/x-template"> 2337 <!-- Trigger for the login modal --> 2338 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 2339 2340 <!-- Login modal --> 2341 <div class="modal-container"> 2342 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 2343 <div class="modal modal--md"> 2344 <div class="modal__header"> 2345 <h2>@Translate("Product is added to the cart")</h2> 2346 </div> 2347 <div class="modal__body"> 2348 <div class="grid"> 2349 <div class="grid__col-2"> 2350 <a href="{{productInfo.link}}"> 2351 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 2352 </a> 2353 </div> 2354 <div class="u-padding grid--align-self-center"> 2355 <span>{{quantity}}</span> x 2356 </div> 2357 <div class="grid__col-auto grid--align-self-center"> 2358 <div>{{productInfo.name}}</div> 2359 {{#if productInfo.variantName}} 2360 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 2361 {{/if}} 2362 {{#if productInfo.unitName}} 2363 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 2364 {{/if}} 2365 </div> 2366 </div> 2367 <div class="modal__footer u-margin-top--lg"> 2368 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 2369 <a href="/cart" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 2370 </div> 2371 </div> 2372 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 2373 </div> 2374 </div> 2375 </script> 2376 <script> 2377 document.addEventListener('addToCart', function (event) { 2378 Cart.ShowLastAddedProductModal(event.detail); 2379 }); 2380 </script> 2381 } 2382 else if (!onlyPreview && addingToCartNotification == "toggle") 2383 { 2384 <script> 2385 document.addEventListener('addToCart', function () { 2386 Cart.ToggleMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 2387 }); 2388 </script> 2389 } 2390 } 2391 2392 @helper RenderMiniCartHeader() { 2393 <thead> 2394 <tr> 2395 <td>&nbsp;</td> 2396 <td>@Translate("Product")</td> 2397 <td class="u-ta-right">@Translate("Qty")</td> 2398 <td class="u-ta-right" width="120">@Translate("Price")</td> 2399 </tr> 2400 </thead> 2401 } 2402 2403 @helper RenderMiniCartOrderLines() { 2404 <text> 2405 {{#OrderLines}} 2406 {{#ifCond template "===" "CartOrderline"}} 2407 {{>MiniCartOrderline}} 2408 {{/ifCond}} 2409 {{#ifCond template "===" "CartOrderlineMobile"}} 2410 {{>MiniCartOrderline}} 2411 {{/ifCond}} 2412 {{#ifCond template "===" "CartOrderlineDiscount"}} 2413 {{>MiniCartOrderlineDiscount}} 2414 {{/ifCond}} 2415 {{/OrderLines}} 2416 </text> 2417 } 2418 2419 @helper RenderMiniCartFees() { 2420 <tr> 2421 <td><i class="fas fa-credit-card"></i></td> 2422 <td>{{paymentmethod}}</td> 2423 <td colspan="2" class="u-ta-right" width="130">{{paymentfee}}</td> 2424 </tr> 2425 <tr> 2426 <td><i class="fas fa-truck"></i></td> 2427 <td>{{shippingmethod}}</td> 2428 <td colspan="2" class="u-ta-right" width="130">{{shippingfee}}</td> 2429 </tr> 2430 } 2431 2432 @helper RenderMiniCartPoints() { 2433 <text> 2434 {{#if earnings}} 2435 <tr> 2436 <td colspan="2">@Translate("Earnings")</td> 2437 <td colspan="2" class="u-ta-right" width="130"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</td> 2438 </tr> 2439 {{/if}} 2440 </text> 2441 } 2442 2443 @helper RenderMiniCartTotal() { 2444 <tr class="mini-cart-totals dw-mod"> 2445 <td colspan="2">@Translate("Total")</td> 2446 <td class="u-ta-right">{{numberofproducts}}</td> 2447 <td class="u-ta-right" width="130">{{totalprice}}</td> 2448 </tr> 2449 } 2450 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2451 2452 @using System 2453 @using System.Web 2454 @using System.Collections.Generic 2455 @using Dynamicweb.Rapido.Blocks.Extensibility 2456 @using Dynamicweb.Rapido.Blocks 2457 @using Dynamicweb.Ecommerce.Common 2458 2459 @{ 2460 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 2461 2462 Block masterScriptReferences = new Block() 2463 { 2464 Id = "MasterScriptReferences", 2465 SortId = 1, 2466 Template = RenderMasterScriptReferences() 2467 }; 2468 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 2469 } 2470 2471 @helper RenderMasterScriptReferences() 2472 { 2473 var version = System.Web.HttpContext.Current.Cache["FileVersion"]; 2474 2475 <script src="@("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js?v" + version)"></script> 2476 <script src="@("/Files/Templates/Designs/Rapido/js/master.min.js?v" + version)"></script> 2477 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js?v" + version); 2478 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js?v" + version); 2479 2480 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 2481 { 2482 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js?v=4.0.18"); 2483 <script src="@("/Files/Templates/Designs/Rapido/js/custom.min.js?v=4.0.18")"></script> 2484 } 2485 } 2486 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2487 2488 @using System 2489 @using System.Web 2490 @using System.Collections.Generic 2491 @using Dynamicweb.Rapido.Blocks.Extensibility 2492 @using Dynamicweb.Rapido.Blocks 2493 2494 @{ 2495 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 2496 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2497 2498 if (!navigationItemsHideSearch) 2499 { 2500 Block masterSearchScriptTemplates = new Block() 2501 { 2502 Id = "MasterSearchScriptTemplates", 2503 SortId = 1, 2504 Template = RenderSearchScriptTemplates() 2505 }; 2506 2507 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 2508 } 2509 } 2510 2511 @helper RenderSearchScriptTemplates() 2512 { 2513 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 2514 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 2515 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 2516 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2517 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 2518 bool isDigitalWarehouse = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("EnableDigitalWarehouse"); 2519 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 2520 2521 <script id="SearchGroupsTemplate" type="text/x-template"> 2522 {{#.}} 2523 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 2524 {{/.}} 2525 </script> 2526 2527 <script id="SearchProductsTemplate" type="text/x-template"> 2528 {{#each .}} 2529 {{#Product}} 2530 {{#ifCond template "!==" "SearchMore"}} 2531 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2532 @if (useFacebookPixel) 2533 { 2534 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 2535 } 2536 @if (useGoogleTagManager) 2537 { 2538 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 2539 } 2540 <div> 2541 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 2542 <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}"></div> 2543 <div class="u-pull--left"> 2544 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 2545 @if (!onlyPreview) 2546 { 2547 if (pointShopOnly) 2548 { 2549 <text> 2550 {{#if havePointPrice}} 2551 <div> 2552 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 2553 </div> 2554 {{else}} 2555 <small class="help-text u-no-margin">@Translate("Not available")</small> 2556 {{/if}} 2557 {{#unless canBePurchasedWithPoints}} 2558 {{#if havePointPrice}} 2559 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 2560 {{/if}} 2561 {{/unless}} 2562 </text> 2563 } 2564 else 2565 { 2566 <div>{{price}}</div> 2567 } 2568 } 2569 </div> 2570 </a> 2571 <div class="u-margin-left u-pull--right"> 2572 @if (!onlyPreview) 2573 { 2574 if (pointShopOnly) 2575 { 2576 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints" 2577 onclick="Cart.AddToCart(event, { 2578 id: '{{productId}}', 2579 quantity: 1, 2580 buyForPoints: true, 2581 productInfo: {{productInfo}} 2582 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 2583 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 2584 </button> 2585 } 2586 else 2587 { 2588 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 2589 onclick="Cart.AddToCart(event, { 2590 id: '{{productId}}', 2591 quantity: 1, 2592 productInfo: {{productInfo}} 2593 }); {{facebookPixelAction}}"> 2594 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 2595 </button> 2596 } 2597 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 2598 } 2599 else if (isDigitalWarehouse) 2600 { 2601 <a class="btn btn--primary u-no-margin btn--condensed dw-mod" href="{{listLink}}"><i class="fas {{listIcon}}"></i></a> 2602 } 2603 else 2604 { 2605 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 2606 } 2607 </div> 2608 </div> 2609 </li> 2610 {{/ifCond}} 2611 {{#ifCond template "===" "SearchMore"}} 2612 {{>SearchMoreProducts}} 2613 {{/ifCond}} 2614 {{/Product}} 2615 {{else}} 2616 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2617 @Translate("Your search gave 0 results") 2618 </li> 2619 {{/each}} 2620 </script> 2621 2622 <script id="SearchMoreProducts" type="text/x-template"> 2623 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2624 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2625 @Translate("View all") 2626 </a> 2627 </li> 2628 </script> 2629 2630 <script id="SearchMorePages" type="text/x-template"> 2631 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2632 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2633 @Translate("View all") 2634 </a> 2635 </li> 2636 </script> 2637 2638 <script id="SearchPagesTemplate" type="text/x-template"> 2639 {{#each .}} 2640 {{#ifCond template "!==" "SearchMore"}} 2641 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2642 <div> 2643 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 2644 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 2645 <div class="u-pull--left"> 2646 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 2647 </div> 2648 </a> 2649 </div> 2650 </li> 2651 {{/ifCond}} 2652 {{#ifCond template "===" "SearchMore"}} 2653 {{>SearchMorePages}} 2654 {{/ifCond}} 2655 {{else}} 2656 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2657 @Translate("Your search gave 0 results") 2658 </li> 2659 {{/each}} 2660 </script> 2661 2662 <script id="SearchPagesTemplateWrap" type="text/x-template"> 2663 <div class="dropdown__column-header">@Translate("Pages")</div> 2664 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2665 {{>SearchPagesTemplate}} 2666 </ul> 2667 </script> 2668 2669 <script id="SearchProductsTemplateWrap" type="text/x-template"> 2670 <div class="dropdown__column-header">@Translate("Products")</div> 2671 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2672 {{>SearchProductsTemplate}} 2673 </ul> 2674 </script> 2675 } 2676 2677 2678 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2679 2680 @using System 2681 @using System.Web 2682 @using System.Collections.Generic 2683 @using Dynamicweb.Rapido.Blocks.Extensibility 2684 @using Dynamicweb.Rapido.Blocks 2685 2686 @{ 2687 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2688 2689 Block primaryBottomSnippets = new Block() 2690 { 2691 Id = "MasterJavascriptInitializers", 2692 SortId = 100, 2693 Template = RenderPrimaryBottomSnippets() 2694 }; 2695 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 2696 } 2697 2698 @helper RenderPrimaryBottomSnippets() 2699 { 2700 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 2701 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2702 2703 if (isWireframeMode) 2704 { 2705 <script> 2706 Wireframe.Init(true); 2707 </script> 2708 } 2709 2710 2711 if (useGoogleTagManager) 2712 { 2713 <script> 2714 document.addEventListener('addToCart', function(event) { 2715 var googleImpression = event.detail.productInfo.googleImpression; 2716 dataLayer.push({ 2717 'event': 'addToCart', 2718 'ecommerce': { 2719 'currencyCode': '@Dynamicweb.Ecommerce.Common.Context.Currency.Code', 2720 'actionField': { 'list': googleImpression.list }, // Optional list property. 2721 'add': { 2722 'products': [{ 2723 'name': googleImpression.name, 2724 'id': googleImpression.id, 2725 'price': googleImpression.price, 2726 'brand': googleImpression.brand, 2727 'category': googleImpression.category, 2728 'variant': googleImpression.variant, 2729 'quantity': event.detail.quantity 2730 }] 2731 } 2732 } 2733 }); 2734 }); 2735 </script> 2736 } 2737 2738 <!--@Javascripts--> 2739 } 2740 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2741 2742 @using System 2743 @using System.Globalization 2744 @using Dynamicweb.Core 2745 @using Dynamicweb.Rapido.Blocks 2746 2747 @{ 2748 BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master"); 2749 2750 var masterDesktopToolsNavigationRapido = masterBlocksBlocksPage.GetBlockById("MasterDesktopToolsNavigation"); 2751 if (masterDesktopToolsNavigationRapido != null) 2752 { 2753 masterDesktopToolsNavigationRapido.Template = RenderDesktopToolsNavigationCustom(); 2754 } 2755 2756 var mobileNavigationQuotesActionRapido = masterBlocksBlocksPage.GetBlockById("MobileNavigationActions"); 2757 if (mobileNavigationQuotesActionRapido != null) 2758 { 2759 var hideMyQuotesLink = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetBoolean("SignInHideQuotes"); 2760 if (!hideMyQuotesLink) 2761 { 2762 masterBlocksBlocksPage.Add("MobileNavigationActions", new Block 2763 { 2764 Id = "MobileNavigationQuotesAction", 2765 SortId = 31, 2766 Template = RenderMobileNavigationQuotesActionCustom() 2767 }); 2768 } 2769 } 2770 2771 var MobileNavigationSavedCardsActionRapido = masterBlocksBlocksPage.GetBlockById("MobileNavigationSavedCardsAction"); 2772 if (MobileNavigationSavedCardsActionRapido != null) 2773 { 2774 MobileNavigationSavedCardsActionRapido.SortId = 32; 2775 } 2776 2777 var masterDesktopActionsMenuLanguageSelectorRapido = masterBlocksBlocksPage.GetBlockById("MasterDesktopActionsMenuLanguageSelector"); 2778 if (masterDesktopActionsMenuLanguageSelectorRapido != null) 2779 { 2780 masterDesktopActionsMenuLanguageSelectorRapido.Template = RenderLanguageSelectorCustom(); 2781 } 2782 2783 var masterDesktopActionsMenuSignInRapido = masterBlocksBlocksPage.GetBlockById("MasterDesktopActionsMenuSignIn"); 2784 if (masterDesktopActionsMenuSignInRapido != null) 2785 { 2786 masterDesktopActionsMenuSignInRapido.Template = RenderSignInCustom(); 2787 } 2788 2789 var masterFooterPaymentsRapido = masterBlocksBlocksPage.GetBlockById("MasterFooterPayments"); 2790 if (masterFooterPaymentsRapido != null) 2791 { 2792 masterFooterPaymentsRapido.Template = RenderFooterPaymentsCustom(); 2793 } 2794 2795 masterBlocksBlocksPage.Add(MasterBlockId.MasterReferences, new Block() 2796 { 2797 Id = "GeoLocation", 2798 SortId = 100, 2799 Template = GeoLocationCustom() 2800 }); 2801 2802 masterBlocksBlocksPage.Add(MasterBlockId.MasterReferences, new Block() 2803 { 2804 Id = "StockModal", 2805 SortId = 110, 2806 Template = RenderStockModal() 2807 }); 2808 2809 var masterDesktopMenuRapido = masterBlocksBlocksPage.GetBlockById("MasterDesktopMenu"); 2810 if (masterDesktopMenuRapido != null) 2811 { 2812 masterDesktopMenuRapido.Template = RenderDesktopMenuCustom(); 2813 } 2814 2815 var masterScriptReferencesRapido = masterBlocksBlocksPage.GetBlockById("MasterScriptReferences"); 2816 if (masterScriptReferencesRapido != null) 2817 { 2818 masterScriptReferencesRapido.Template = RenderMasterScriptReferencesCustom(version); 2819 } 2820 2821 var masterLoginModal = masterBlocksBlocksPage.GetBlockById("LoginModal"); 2822 if (masterLoginModal != null) 2823 { 2824 masterLoginModal.Template = LoginModalCustom(); 2825 } 2826 2827 var masterSearch = masterBlocksBlocksPage.GetBlockById("MasterSearchScriptTemplates"); 2828 if (masterSearch != null) 2829 { 2830 masterSearch.Template = RenderSearchScriptTemplatesCustom(); 2831 } 2832 } 2833 2834 @helper RenderDesktopToolsNavigationCustom() 2835 { 2836 <div> 2837 @RenderNavigation(new 2838 { 2839 id = "topToolsNavigation", 2840 cssclass = "menu menu-tools dw-mod dwnavigation", 2841 endlevel = 2, 2842 expandmode = "all", 2843 template = "TopMenu.xslt" 2844 }) 2845 </div> 2846 } 2847 2848 @helper RenderMobileNavigationQuotesActionCustom() 2849 { 2850 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 2851 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 2852 int myQuotesPageId = GetPageIdByNavigationTag("QuotesPage"); 2853 string myQuotesPageLink = linkStart + myQuotesPageId; 2854 string quotesIcon = "fa fa-star"; 2855 2856 <li class="menu-mobile__item"> 2857 <a href="@myQuotesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@quotesIcon menu-mobile__link-icon"></i> @Translate("My Quotes")</a> 2858 </li> 2859 } 2860 2861 @helper RenderLanguageSelectorCustom() 2862 { 2863 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 2864 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu--clean dw-mod"; 2865 string languageIcon = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue.ToLower() : "fas fa-globe"; 2866 2867 if (Model.Languages.Count > 1) 2868 { 2869 <li class="@liClasses"> 2870 <a href="javascript:void(0);" class="header-menu__link u-w50px dw-mod" onclick="toggleGeolocatorSelector()"> 2871 <i class="@languageIcon fa-1_5x"></i> 2872 </a> 2873 </li> 2874 } 2875 } 2876 2877 @helper RenderSignInCustom() 2878 { 2879 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 2880 string userInitials = ""; 2881 int pageId = Model.TopPage.ID; 2882 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 2883 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 2884 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 2885 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 2886 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 2887 int myQuotesPageId = GetPageIdByNavigationTag("QuotesPage"); 2888 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 2889 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 2890 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 2891 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 2892 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 2893 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 2894 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 2895 bool hideMyQuotesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideQuotes"); 2896 2897 string linkStart = "/Default.aspx?ID="; 2898 if (Model.CurrentUser.ID <= 0) 2899 { 2900 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 2901 } 2902 2903 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 2904 string myProfilePageLink = linkStart + myProfilePageId; 2905 string myOrdersPageLink = linkStart + myOrdersPageId; 2906 string myFavoritesPageLink = linkStart + myFavoritesPageId; 2907 string myQuotesPageLink = linkStart + myQuotesPageId; 2908 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 2909 2910 if (Model.CurrentUser.ID != 0) 2911 { 2912 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 2913 { 2914 2915 2916 string[] names = Model.CurrentUser.Name.Split(' '); 2917 userInitials += Model.CurrentUser.Name.Substring(0, 1); 2918 2919 2920 try{ 2921 if (names.Length > 1) 2922 { 2923 userInitials += names[names.Length - 1].Substring(0, 1); 2924 } 2925 } 2926 catch{} 2927 } 2928 else 2929 { 2930 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 2931 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 2932 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 2933 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 2934 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 2935 } 2936 } 2937 2938 if (!navigationItemsHideSignIn) 2939 { 2940 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 2941 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu__item--clean dw-mod"; 2942 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 2943 2944 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 2945 <div class="@menuLinkClass menu__link--icon dw-mod"> 2946 @if (Model.CurrentUser.ID <= 0) 2947 { 2948 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 2949 } 2950 else 2951 { 2952 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 2953 } 2954 </div> 2955 <div class="menu menu--dropdown sign-in-dropdown dw-mod"> 2956 <ul class="list list--clean dw-mod"> 2957 @if (Model.CurrentUser.ID <= 0) 2958 { 2959 <li> 2960 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label> 2961 </li> 2962 if (!hideCreateAccountLink) 2963 { 2964 <li> 2965 <a href="/default.aspx?ID=@createAccountPageId" class="list__link dw-mod">@Translate("Create account")</a> 2966 </li> 2967 } 2968 <li> 2969 <a href="@forgotPasswordPageLink" class="list__link dw-mod">@Translate("Forgot your password?")</a> 2970 </li> 2971 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 2972 { 2973 <li class="list__seperator dw-mod"></li> 2974 } 2975 } 2976 @if (!hideMyProfileLink) 2977 { 2978 <li> 2979 <a href="@myProfilePageLink" class="list__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue u-margin-right"></i>@Translate("My Profile")</a> 2980 </li> 2981 } 2982 @if (!hideMyOrdersLink) 2983 { 2984 <li> 2985 <a href="@myOrdersPageLink" class="list__link dw-mod"><i class="fas fa-list u-margin-right"></i>@Translate("My Orders")</a> 2986 </li> 2987 } 2988 @if (!hideMyFavoritesLink) 2989 { 2990 <li> 2991 <a href="@myFavoritesPageLink" class="list__link dw-mod"><i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue u-margin-right"></i>@Translate("My Favorites")</a> 2992 </li> 2993 } 2994 @if (!hideMyQuotesLink) 2995 { 2996 <li> 2997 <a href="@myQuotesPageLink" class="list__link dw-mod"><i class="fa fa-star u-margin-right"></i>@Translate("My Quotes")</a> 2998 </li> 2999 } 3000 @if (!hideMySavedCardsLink) 3001 { 3002 <li> 3003 <a href="@mySavedCardsPageLink" class="list__link dw-mod"><i class="fas fa-credit-card u-margin-right"></i>@Translate("My Saved cards")</a> 3004 </li> 3005 } 3006 @if (Model.CurrentUser.ID > 0) 3007 { 3008 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 3009 { 3010 <li class="list__seperator dw-mod"></li> 3011 } 3012 <li> 3013 <a href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" class="list__link dw-mod">@Translate("Sign out")</a> 3014 </li> 3015 } 3016 </ul> 3017 </div> 3018 </li> 3019 } 3020 } 3021 3022 @helper RenderFooterPaymentsCustom() 3023 { 3024 <div class="footer__content dw-mod"> 3025 <div class="grid--justify-center dw-mod"> 3026 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 3027 { 3028 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 3029 string paymentImage = null; 3030 string paymentTitle = paymentItem.SelectedName; 3031 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 3032 if (selected != null) 3033 { 3034 paymentImage = selected.Icon; 3035 } 3036 3037 <div class="footer__card-type"> 3038 <img src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 3039 </div> 3040 } 3041 </div> 3042 </div> 3043 } 3044 3045 @helper GeoLocationCustom() 3046 { 3047 string detectedCountry; 3048 var currentTemplate = PageView.Current().Template; 3049 if (currentTemplate.TagExists("Smartpage:GeoLocator.SelectedCountry")) 3050 { 3051 detectedCountry = currentTemplate.Tags["Smartpage:GeoLocator.SelectedCountry"].Value; 3052 } 3053 else 3054 { 3055 detectedCountry = currentTemplate.Tags["Smartpage:GeoLocator.DetectedCountry"].Value; 3056 } 3057 3058 bool showLangSelector = false; 3059 if (currentTemplate.TagExists("Smartpage:Geolocator.ShowLangSelector") && HttpContext.Current.Request.RawUrl == "/") 3060 { 3061 showLangSelector = Converter.ToBoolean(currentTemplate.Tags["Smartpage:Geolocator.ShowLangSelector"].Value); 3062 } 3063 3064 string overrideCountryCode = ""; 3065 string disabledAttr = ""; 3066 if (currentTemplate.Tags.Any(i => i.Name == "Smartpage:GeoLocator.DisableCountrySelection"))// && currentTemplate.TagExists("Smartpage:GeoLocator.DisableCountrySelection")) 3067 { 3068 overrideCountryCode = currentTemplate.Tags["Smartpage:GeoLocator.DisableCountrySelection"].Value;//currentTemplate.Tags["Smartpage:GeoLocator.DisableCountrySelection"].Value; 3069 disabledAttr = "disabled"; 3070 } 3071 3072 var cs = new Dynamicweb.Ecommerce.International.CountryService(); 3073 /* 3074 var areaService = new Dynamicweb.Content.AreaService(); 3075 var pageService = new Dynamicweb.Content.PageService(); 3076 var currencyService = new Dynamicweb.Ecommerce.International.CurrencyService(); 3077 */ 3078 3079 var allowedCountries = string.Empty; 3080 3081 if (!string.IsNullOrEmpty(Converter.ToString(Dynamicweb.Context.Current.Session["AllowedCountries" + Converter.ToString(Model.Area.ID)]))) 3082 { 3083 allowedCountries = Converter.ToString(Dynamicweb.Context.Current.Session["AllowedCountries" + Converter.ToString(Model.Area.ID)]); 3084 } 3085 else 3086 { 3087 allowedCountries = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetList("AllowedCountries").SelectedValue; 3088 3089 Dynamicweb.Context.Current.Session["AllowedCountries" + Converter.ToString(Model.Area.ID)] = allowedCountries; 3090 } 3091 3092 string[] allowedCountriesArray = allowedCountries.Replace(" ","").Split(','); 3093 3094 <!-- Trigger for the geolocation modal --> 3095 <input type="checkbox" id="GeoLocationTrigger" class="modal-trigger" /> 3096 3097 <!-- Login modal --> 3098 <div class="modal-container"> 3099 <label for="GeoLocationTrigger" id="GeoLocationModalOverlay" class="modal-overlay geo-location-overlay js-geo-location-overlay"></label> 3100 <div class="modal modal--md" id="GeoLocationModal"> 3101 <div class="modal__header"> 3102 <h2>@Translate("Smartpage:Geolocator.SelectCountryAndLanguage", "Vælg land og sprog")</h2> 3103 </div> 3104 <div class="modal__body"> 3105 <p>@Translate("Smartpage:Geolocator.InfoText", "Din placering stemmer ikke med den del af hjemmesiden du befinder dig på. Du kan vælge hvilket land du handler fra herunder:")</p> 3106 <div class="grid"> 3107 <div class="grid__col-12"> 3108 <p class="u-margin-bottom-5px">@Translate("Smartpage:Geolocator.SelectCountry", "Vælg land"):</p> 3109 <select name="geoCountry" id="js-geoCountry" class="u-margin-bottom-5px" @disabledAttr> 3110 @foreach (var country in cs.GetCountries().Where(x => allowedCountriesArray.Contains(x.Code2)).OrderBy(x => x.Name)) 3111 { 3112 var value = "CurrencyCode=" + country.CurrencyCode + "&CountryCode=" + country.Code2; 3113 bool isSelected; 3114 if (!string.IsNullOrEmpty(overrideCountryCode)) 3115 { 3116 isSelected = country.Code2 == overrideCountryCode; 3117 } 3118 else 3119 { 3120 isSelected = country.Code2 == detectedCountry; 3121 } 3122 3123 <option value="@value" selected="@isSelected"> 3124 @country.Name 3125 </option> 3126 } 3127 </select> 3128 </div> 3129 <div class="grid__col-12"> 3130 <p class="u-margin-bottom-5px">@Translate("Smartpage:Geolocator.SelectLanguage", "Vælg sprog"):</p> 3131 <select name="geoLanguage" id="js-geoLanguage" class="u-margin-bottom-5px"> 3132 @foreach (var lang in Model.Languages) 3133 { 3134 var area = Dynamicweb.Services.Areas.GetArea(lang.ID); 3135 var cultureInfo = new CultureInfo(area.CultureInfo.Name); 3136 var countryCode = new RegionInfo(cultureInfo.LCID).Name; 3137 3138 var value = "/Default.aspx?ID=" + lang.Page.ID + "&LanguageId=" + area.EcomLanguageId; 3139 var isSelected = showLangSelector ? (countryCode == detectedCountry) : lang.IsCurrent; 3140 3141 <option value="@value" selected="@isSelected"> 3142 @cultureInfo.NativeName 3143 </option> 3144 } 3145 </select> 3146 </div> 3147 <div class="grid__col-12"> 3148 <button onclick="changeGeoOptions();"> 3149 @Translate("Smartpage:Geolocator.Change", "Ændre") 3150 </button> 3151 </div> 3152 </div> 3153 </div> 3154 </div> 3155 </div> 3156 3157 <script> 3158 3159 function toggleGeolocatorSelector() { 3160 var geoTrigger = document.getElementById("GeoLocationTrigger"); 3161 3162 if (geoTrigger.checked == false) { 3163 geoTrigger.checked = true; 3164 } else { 3165 geoTrigger.checked = false; 3166 } 3167 } 3168 3169 function changeGeoOptions() { 3170 var geoCountry = document.getElementById("js-geoCountry"); 3171 var geoLanguage = document.getElementById("js-geoLanguage"); 3172 3173 var selectedCountry = geoCountry.options[geoCountry.selectedIndex].value; 3174 var selectedLanguage = geoLanguage.options[geoLanguage.selectedIndex].value; 3175 3176 location.href = selectedLanguage + "&" + selectedCountry; 3177 } 3178 3179 @if (showLangSelector) 3180 { 3181 <text> 3182 toggleGeolocatorSelector(); 3183 </Text> 3184 } 3185 3186 </script> 3187 } 3188 3189 @helper RenderDesktopMenuCustom() 3190 { 3191 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3192 string menuAlignment = topLayout == "two-lines-centered" || topLayout == "minimal-right" ? "u-pull--right" : ""; 3193 3194 bool megaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue.ToLower() == "true" ? true : false; 3195 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 3196 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3197 int startLevel = renderPagesInToolBar ? 1 : 0; 3198 var breakpoint = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetValue("BaseMenuWithDropdownColumnBreakpoint"); 3199 3200 <div class="grid__cell"> 3201 <div class="@menuAlignment"> 3202 @if (!megaMenu) 3203 { 3204 @RenderNavigation(new 3205 { 3206 id = "topnavigation", 3207 cssclass = "menu dw-mod dwnavigation u-full-max-width", 3208 startLevel = @startLevel, 3209 ecomStartLevel = @startLevel + 1, 3210 endlevel = 5, 3211 expandmode = "all", 3212 template = "SpBaseMenuWithDropdown.xslt", 3213 breakepoint = @breakpoint, 3214 }); 3215 } 3216 else 3217 { 3218 @RenderNavigation(new 3219 { 3220 id = "topnavigation", 3221 cssclass = "menu dw-mod dwnavigation u-full-max-width", 3222 startLevel = @startLevel, 3223 ecomStartLevel = @startLevel + 1, 3224 endlevel = 5, 3225 promotionImage = megamenuPromotionImage, 3226 promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"), 3227 expandmode = "all", 3228 template = "BaseMegaMenu.xslt" 3229 }); 3230 } 3231 </div> 3232 </div> 3233 } 3234 3235 @helper RenderMasterScriptReferencesCustom(string version) 3236 { 3237 <script src="@("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js?v" + version)"></script> 3238 <script src="@("/Files/Templates/Designs/Rapido/js/master.min.js?v" + version)"></script> 3239 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js?v" + version); 3240 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js?v" + version); 3241 3242 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 3243 { 3244 <script src="@("/Files/Templates/Designs/Rapido/js/custom.js?v" + version)"></script> 3245 PushPromise("/Files/Templates/Designs/Rapido/js/custom.js?v" + version); 3246 } 3247 } 3248 3249 @helper LoginModalCustom() 3250 { 3251 int pageId = Model.TopPage.ID; 3252 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 3253 string userSignedInErrorText = ""; 3254 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3255 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 3256 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3257 string currentUrl = Dynamicweb.Frontend.PageView.Current().SearchFriendlyUrl; 3258 string actionUrl = currentUrl.Contains("?") ? currentUrl.Split('?').FirstOrDefault() : currentUrl; 3259 3260 if (Model.LogOnFailed) 3261 { 3262 switch (Model.LogOnFailedReason) 3263 { 3264 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordLengthInvalid: 3265 userSignedInErrorText = Translate("Password length is invalid"); 3266 break; 3267 case Dynamicweb.Security.UserManagement.LogOnFailedReason.IncorrectLogin: 3268 userSignedInErrorText = Translate("Invalid email or password"); 3269 break; 3270 case Dynamicweb.Security.UserManagement.LogOnFailedReason.ExceededFailedLogOnLimit: 3271 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 3272 break; 3273 case Dynamicweb.Security.UserManagement.LogOnFailedReason.LoginLocked: 3274 userSignedInErrorText = Translate("The user account is temporarily locked"); 3275 break; 3276 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordExpired: 3277 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 3278 break; 3279 default: 3280 userSignedInErrorText = Translate("An unknown error occured"); 3281 break; 3282 } 3283 } 3284 3285 <!-- Trigger for the login modal --> 3286 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 3287 3288 <!-- Login modal --> 3289 <div class="modal-container"> 3290 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 3291 <div class="modal modal--xs" id="SignInModal"> 3292 <div class="modal__header"> 3293 <h2>@Translate("Sign in")</h2> 3294 </div> 3295 <div class="modal__body"> 3296 <form action="@actionUrl" method="post" id="LoginForm" class="u-no-margin"> 3297 <input type="hidden" name="ID" value="@pageId" /> 3298 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 3299 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 3300 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Smartpage.login.username.placeholder", "Brugernavn")" /> 3301 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 3302 <div class="field-error dw-mod">@userSignedInErrorText</div> 3303 3304 <div class="form__field-group dw-mod"> 3305 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 3306 <label for="LoginRememberMe"> 3307 @Translate("Remember me", "Remember me") 3308 </label> 3309 </div> 3310 3311 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 3312 3313 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 3314 3315 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 3316 </form> 3317 </div> 3318 </div> 3319 </div> 3320 } 3321 3322 @helper RenderSearchScriptTemplatesCustom() 3323 { 3324 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3325 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3326 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 3327 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 3328 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 3329 bool isDigitalWarehouse = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("EnableDigitalWarehouse"); 3330 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3331 3332 <script id="SearchGroupsTemplate" type="text/x-template"> 3333 {{#.}} 3334 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 3335 {{/.}} 3336 </script> 3337 3338 <script id="SearchProductsTemplate" type="text/x-template"> 3339 {{#each .}} 3340 {{#Product}} 3341 {{#ifCond template "!==" "SearchMore"}} 3342 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3343 @if (useFacebookPixel) 3344 { 3345 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 3346 } 3347 @if (useGoogleTagManager) 3348 { 3349 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 3350 } 3351 <div> 3352 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 3353 <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}"></div> 3354 <div class="u-pull--left"> 3355 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 3356 @if (!onlyPreview) 3357 { 3358 if (pointShopOnly) 3359 { 3360 <text> 3361 {{#if havePointPrice}} 3362 <div> 3363 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 3364 </div> 3365 {{else}} 3366 <small class="help-text u-no-margin">@Translate("Not available")</small> 3367 {{/if}} 3368 {{#unless canBePurchasedWithPoints}} 3369 {{#if havePointPrice}} 3370 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3371 {{/if}} 3372 {{/unless}} 3373 </text> 3374 } 3375 else 3376 { 3377 <text>{{notBuyableText}}</text> 3378 <div class="{{hideBuyOptions}}">{{price}}</div> 3379 } 3380 } 3381 </div> 3382 </a> 3383 <div class="u-margin-left u-pull--right"> 3384 @if (!onlyPreview) 3385 { 3386 if (pointShopOnly) 3387 { 3388 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints" 3389 onclick="Cart.AddToCart(event, { 3390 id: '{{productId}}', 3391 variantId: '{{variantId}}', 3392 unitId: '{{unitId}}', 3393 quantity: 1, 3394 buyForPoints: true, 3395 productInfo: {{productInfo}} 3396 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 3397 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 3398 </button> 3399 } 3400 else 3401 { 3402 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 3403 onclick="Cart.AddToCart(event, { 3404 id: '{{productId}}', 3405 variantId: '{{variantId}}', 3406 unitId: '{{unitId}}', 3407 quantity: 1, 3408 productInfo: {{productInfo}} 3409 }); {{facebookPixelAction}}"> 3410 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 3411 </button> 3412 } 3413 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 3414 } 3415 else if (isDigitalWarehouse) 3416 { 3417 <a class="btn btn--primary u-no-margin btn--condensed dw-mod" href="{{listLink}}"><i class="fas {{listIcon}}"></i></a> 3418 } 3419 else 3420 { 3421 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 3422 } 3423 </div> 3424 </div> 3425 </li> 3426 {{/ifCond}} 3427 {{#ifCond template "===" "SearchMore"}} 3428 {{>SearchMoreProducts}} 3429 {{/ifCond}} 3430 {{/Product}} 3431 {{else}} 3432 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3433 @Translate("Your search gave 0 results") 3434 </li> 3435 {{/each}} 3436 </script> 3437 3438 <script id="SearchMoreProducts" type="text/x-template"> 3439 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 3440 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 3441 @Translate("View all") 3442 </a> 3443 </li> 3444 </script> 3445 3446 <script id="SearchMorePages" type="text/x-template"> 3447 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 3448 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 3449 @Translate("View all") 3450 </a> 3451 </li> 3452 </script> 3453 3454 <script id="SearchPagesTemplate" type="text/x-template"> 3455 {{#each .}} 3456 {{#ifCond template "!==" "SearchMore"}} 3457 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3458 <div> 3459 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 3460 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 3461 <div class="u-pull--left"> 3462 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 3463 </div> 3464 </a> 3465 </div> 3466 </li> 3467 {{/ifCond}} 3468 {{#ifCond template "===" "SearchMore"}} 3469 {{>SearchMorePages}} 3470 {{/ifCond}} 3471 {{else}} 3472 <li class="dropdown__item dropdown__item--seperator dw-mod"> 3473 @Translate("Your search gave 0 results") 3474 </li> 3475 {{/each}} 3476 </script> 3477 3478 <script id="SearchPagesTemplateWrap" type="text/x-template"> 3479 <div class="dropdown__column-header">@Translate("Pages")</div> 3480 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 3481 {{>SearchPagesTemplate}} 3482 </ul> 3483 </script> 3484 3485 <script id="SearchProductsTemplateWrap" type="text/x-template"> 3486 <div class="dropdown__column-header">@Translate("Products")</div> 3487 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 3488 {{>SearchProductsTemplate}} 3489 </ul> 3490 </script> 3491 } 3492 3493 @helper RenderStockModal() 3494 { 3495 <input type="checkbox" id="StockModalTrigger" class="modal-trigger" /> 3496 3497 <div class="modal-container"> 3498 <label for="StockModalTrigger" id="StockModalOverlay" class="modal-overlay"></label> 3499 <div class="modal modal--md" id="StockModal"> 3500 <div class="modal__header"> 3501 <h2 class="stock-exceeded">@Translate("Smartpage:StockModal.StockExceeded.Title", "Ikke nok på lager")</h2> 3502 <h2 class="sold-out">@Translate("Smartpage:StockModal.SoldOut.Title", "Ikke tilgængelig")</h2> 3503 </div> 3504 <div class="modal__body"> 3505 <p class="stock-exceeded">@Translate("Smartpage:StockModal.StockExceeded.Info", "Der er desværre ikke nok af den valgte vare på lager. Prøv istedet med et antal under:") <span class="js-max-quantity"></span></p> 3506 <p class="sold-out">@Translate("Smartpage:StockModal.SoldOut.Info", "Varen er desværre ikke tilgænglig.")</p> 3507 <div class="grid"> 3508 <div class="grid__col-3"> 3509 <button onclick="dismissStockModal();"> 3510 @Translate("Smartpage:StockModal.ButtonText", "Ok") 3511 </button> 3512 </div> 3513 </div> 3514 </div> 3515 </div> 3516 </div> 3517 3518 <script> 3519 function dismissStockModal() { 3520 document.getElementById("StockModalTrigger").checked = false; 3521 } 3522 </script> 3523 } 3524 3525 <!DOCTYPE html> 3526 3527 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 3528 <head> 3529 <meta charset="utf-8" /> 3530 <title>@Model.Title</title> 3531 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> 3532 <meta name="robots" content="index, follow"> 3533 3534 @Model.MetaTags 3535 3536 <!-- Favicon --> 3537 <link href="@favicon" rel="icon" type="image/png"> 3538 3539 <!-- Font awesome --> 3540 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 3541 <!-- Flag icon --> 3542 <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/css/flag-icon.min.css" type="text/css"> 3543 3544 <!-- Base (Default, wireframe) styles --> 3545 <link rel="stylesheet" href="@("/Files/Templates/Designs/Rapido/css/base/base.min.css?v" + version)" type="text/css"> 3546 3547 <!-- Rapido Css from Website Settings --> 3548 <link id="rapidoCss" rel="stylesheet" href="@autoCssLink" type="text/css"> 3549 3550 <!-- Ignite Css (Custom site specific styles) --> 3551 <link id="igniteCss" type="text/css" href="@("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css?v" + fileVersion)" rel="stylesheet"> 3552 3553 @{ 3554 PushPromise(favicon); 3555 PushPromise(fontAwesomeCssLink); 3556 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css?v" + version); 3557 PushPromise(autoCssLink); 3558 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css?v" + fileVersion); 3559 PushPromise("/Files/Images/placeholder.gif"); 3560 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 3561 } 3562 3563 <!--HREFLANG START--> 3564 @foreach (var language in Model.Languages) 3565 { 3566 if (!string.IsNullOrEmpty(language.PrimaryDomain)) 3567 { 3568 var qs = HttpUtility.ParseQueryString(System.Web.HttpContext.Current.Request.QueryString.ToString()); 3569 qs.Set("ID", Convert.ToString(language.Page.ID)); 3570 3571 var page = Dynamicweb.Services.Pages.GetPage(language.FirstActivePage.ID); 3572 3573 string url = language.PrimaryDomain + Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(language.Page.ID); 3574 3575 foreach (string key in qs) 3576 { 3577 if (key == null || key.Equals("ID", StringComparison.InvariantCultureIgnoreCase)) 3578 { 3579 continue; 3580 } 3581 3582 var urlFromHandler = Dynamicweb.Frontend.UrlProviders.Handler.GetUrlFromQueryString(key, qs[key], page.Area.EcomLanguageId); 3583 if (Dynamicweb.Frontend.SearchEngineFriendlyURLs.UseExtensionLessUrls) 3584 { 3585 url += urlFromHandler.Replace(".aspx", ""); 3586 } 3587 else 3588 { 3589 url = url.Replace(".aspx", urlFromHandler); 3590 } 3591 3592 } 3593 3594 <link rel="alternate" hreflang='@GetHrefLang(language.Culture)' href="@("https://" + url)" /> 3595 } 3596 } 3597 <!--HREFLANG END--> 3598 <!-- Google fonts --> 3599 @{ 3600 var family = string.Join("%7C", fonts.Where(x => !string.IsNullOrEmpty(x)).Distinct().Select(x => string.Format("{0}:100,200,300,400,500,600,700,800,900", x))); 3601 } 3602 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 3603 @RenderGoogleTagManager(true) 3604 @Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetString("ScriptHeadAfter") 3605 3606 <script id="mcjs">!function(c,h,i,m,p){m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/24b294760d5509c8fdc7be0f3/337aae56ce93ce6813a8c536c.js");</script> 3607 3608 </head> 3609 3610 <body> 3611 3612 @Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetString("ScriptBodyBefore") 3613 3614 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 3615 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 3616 3617 @helper RenderMasterHeader() 3618 { 3619 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 3620 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 3621 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 3622 bool erpConnection = Pageview.GlobalTags.GetTagByName("SpNavConnectionStatus") != null ? Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("SpNavConnectionStatus").Value) : true; 3623 3624 <header class="top-container @stickyTop dw-mod" id="Top"> 3625 @if (!erpConnection) 3626 { 3627 <div class="nav-error-container"> 3628 <div class="center-container top-container__center-container dw-mod"> 3629 <div class="error-block">@Translate("Smartpage:LiveIntegration.Connection.Error", "ERP communication currently fails. Please try again in a moment.")</div> 3630 </div> 3631 </div> 3632 } 3633 @RenderBlockList(subBlocks) 3634 </header> 3635 } 3636 3637 @helper RenderMain() 3638 { 3639 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 3640 3641 <main class="site dw-mod"> 3642 @RenderBlockList(subBlocks) 3643 </main> 3644 } 3645 3646 @helper RenderPageContent() 3647 { 3648 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 3649 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 3650 3651 <div id="Page" class="page @pagePos"> 3652 <section class="center-container content-container dw-mod" id="content"> 3653 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3654 3655 3656 @{ 3657 string columnClass = "12"; 3658 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null ? true : false; 3659 string backgroundColorClass = Model.PropertyItem.GetString("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 3660 } 3661 3662 @if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 3663 { 3664 <div class="grid__col-12 grid__col--bleed-y"> 3665 @RenderNavigation(new 3666 { 3667 id = "breadcrumb", 3668 template = "Breadcrumb.xslt" 3669 }) 3670 </div> 3671 } 3672 3673 <div class="grid" ordertime="@Dynamicweb.Ecommerce.Common.Context.OrderTime"> 3674 @if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) 3675 { 3676 var navigationMarkup = RenderNavigation(new 3677 { 3678 id = "leftnav", 3679 cssclass = "dwnavigation", 3680 startLevel = 2, 3681 expandmode = "all", 3682 endlevel = 5, 3683 template = "LeftNavigation.xslt" 3684 }); 3685 3686 if (!string.IsNullOrEmpty(navigationMarkup)) 3687 { 3688 <nav class="grid__col-md-3"> 3689 <div class="grid__cell"> 3690 @navigationMarkup 3691 </div> 3692 </nav> 3693 columnClass = "9"; 3694 } 3695 } 3696 <div class="grid__col-md-@columnClass grid__col--bleed"> 3697 <div class="grid"> 3698 @Model.Placeholder("dwcontent", "content", "default:true;sort:1") 3699 </div> 3700 </div> 3701 </div> 3702 3703 3704 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 3705 @if (backgroundColorClass != "") 3706 { 3707 <script> 3708 document.getElementById("Page").classList.add("@backgroundColorClass"); 3709 </script> 3710 } 3711 </section> 3712 </div> 3713 } 3714 3715 </body> 3716 </html> 3717 3718