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