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_49c6f3f7ac91447fb1c790ab7050b971.b__63_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\HR\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2666
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_49c6f3f7ac91447fb1c790ab7050b971.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\HR\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_49c6f3f7ac91447fb1c790ab7050b971.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\HR\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_49c6f3f7ac91447fb1c790ab7050b971.b__62_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\HR\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2650
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_49c6f3f7ac91447fb1c790ab7050b971.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\HR\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_49c6f3f7ac91447fb1c790ab7050b971.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\HR\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_49c6f3f7ac91447fb1c790ab7050b971.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\HR\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_49c6f3f7ac91447fb1c790ab7050b971.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\HR\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_49c6f3f7ac91447fb1c790ab7050b971.Execute() in C:\inetpub\wwwroot\eCommerce\HR\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2633
   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 *@ 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 17 @functions { 18 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 19 20 string getFontFamily(params string[] items) 21 { 22 var itemParent = Pageview.AreaSettings; 23 foreach (var item in items) 24 { 25 itemParent = itemParent.GetItem(item); 26 if (itemParent == null) 27 { 28 return null; 29 } 30 } 31 32 var googleFont = itemParent.GetGoogleFont("FontFamily"); 33 if (googleFont == null) 34 { 35 return null; 36 } 37 return googleFont.Family.Replace(" ", "+"); 38 } 39 } 40 @{ 41 //Font settings 42 var fonts = new string[] { 43 getFontFamily("Layout", "HeaderFont"), 44 getFontFamily("Layout", "SubheaderFont"), 45 getFontFamily("Layout", "TertiaryHeaderFont"), 46 getFontFamily("Layout", "Header", "ToolsFont"), 47 getFontFamily("Layout", "Header", "NavigationFont"), 48 getFontFamily("Layout", "MobileNavigation", "Font"), 49 getFontFamily("ProductList", "Facets", "HeaderFont"), 50 getFontFamily("ProductPage", "PriceFontDesign"), 51 getFontFamily("Ecommerce", "SaleSticker", "Font"), 52 getFontFamily("Ecommerce", "NewSticker", "Font"), 53 getFontFamily("Ecommerce", "CustomSticker", "Font") 54 }; 55 56 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 57 58 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 59 } 60 61 @{ 62 Block master = new Block() 63 { 64 Id = "Master", 65 BlocksList = new List<Block> { 66 new Block { 67 Id = "MasterTopSnippets", 68 SortId = 10 69 }, 70 new Block { 71 Id = "MasterMain", 72 SortId = 20, 73 Template = RenderMain(), 74 SkipRenderBlocksList = true, 75 BlocksList = new List<Block> { 76 new Block 77 { 78 Id = "MasterHeader", 79 SortId = 10, 80 Template = RenderMasterHeader(), 81 SkipRenderBlocksList = true 82 }, 83 new Block { 84 Id = "MasterPageContent", 85 SortId = 20, 86 Template = RenderPageContent() 87 } 88 } 89 }, 90 new Block { 91 Id = "MasterFooter", 92 SortId = 30 93 }, 94 new Block { 95 Id = "MasterReferences", 96 SortId = 40 97 }, 98 new Block { 99 Id = "MasterBottomSnippets", 100 SortId = 50 101 } 102 } 103 }; 104 masterPage.Add(master); 105 } 106 107 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 108 @using System.Text.RegularExpressions 109 @using System.Collections.Generic 110 @using Dynamicweb.Rapido.Blocks 111 112 113 @*--- START: Base block renderers ---*@ 114 115 @helper RenderBlockList(List<Block> blocks) 116 { 117 blocks = blocks.OrderBy(item => item.SortId).ToList(); 118 119 foreach (Block item in blocks) 120 { 121 <!-- START: @item.Id --> 122 123 if (item.Design == null) 124 { 125 @RenderBlock(item) 126 } 127 else if (item.Design.RenderType != RenderType.Hide) 128 { 129 if (item.Design.RenderType == RenderType.Row) 130 { 131 <div class="grid grid--align-content-start"> 132 @RenderBlock(item) 133 </div> 134 } 135 136 if (item.Design.RenderType == RenderType.Column) 137 { 138 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 139 string size = item.Design.Size != null ? item.Design.Size : "12"; 140 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 141 142 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding" id="Block__@item.Id"> 143 @RenderBlock(item) 144 </div> 145 } 146 147 if (item.SkipRenderBlocksList == true) 148 { 149 @RenderBlock(item) 150 } 151 } 152 153 <!-- END: @item.Id --> 154 } 155 } 156 157 @helper RenderBlock(Block item) 158 { 159 if (item.Template != null) 160 { 161 @BlocksPage.RenderTemplate(item.Template) 162 } 163 164 if (item.BlocksList.Count > 0 && item.SkipRenderBlocksList == false) 165 { 166 @RenderBlockList(item.BlocksList) 167 } 168 } 169 170 @*--- END: Base block renderers ---*@ 171 172 173 @* Include the Blocks for the page *@ 174 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 175 176 @using System 177 @using System.Web 178 @using System.Collections.Generic 179 @using Dynamicweb.Rapido.Blocks.Extensibility 180 @using Dynamicweb.Rapido.Blocks 181 182 @{ 183 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 184 185 Block tagManager = new Block() 186 { 187 Id = "TagManager", 188 SortId = 1, 189 Template = RenderGoogleTagManager() 190 }; 191 192 Block facebookPixel = new Block() 193 { 194 Id = "FacebookPixel", 195 SortId = 2, 196 Template = RenderFacebookPixel() 197 }; 198 199 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 200 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 201 } 202 203 @helper RenderGoogleTagManager() { 204 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") != null ? Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") : ""; 205 206 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 207 { 208 <script> 209 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 210 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 211 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 212 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 213 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 214 </script> 215 <!-- Google Tag Manager (noscript) --> 216 <noscript> 217 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 218 height="0" width="0" style="display:none;visibility:hidden"></iframe> 219 </noscript> 220 <!-- End Google Tag Manager (noscript) --> 221 } 222 } 223 224 @helper RenderFacebookPixel() { 225 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") != null ? Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") : ""; 226 227 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 228 { 229 <!-- Facebook Pixel Code --> 230 <script> 231 !function(f,b,e,v,n,t,s) 232 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 233 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 234 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 235 n.queue=[];t=b.createElement(e);t.async=!0; 236 t.src=v;s=b.getElementsByTagName(e)[0]; 237 s.parentNode.insertBefore(t,s)}(window, document,'script', 238 'https://connect.facebook.net/en_US/fbevents.js'); 239 fbq('init', '@FacebookPixelID'); 240 fbq('track', 'PageView'); 241 </script> 242 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 243 } 244 } 245 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 246 247 @using System 248 @using System.Web 249 @using System.Collections.Generic 250 @using Dynamicweb.Rapido.Blocks.Extensibility 251 @using Dynamicweb.Rapido.Blocks 252 253 254 @{ 255 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 256 257 Block loginModal = new Block() 258 { 259 Id = "LoginModal", 260 SortId = 10, 261 Template = LoginModal() 262 }; 263 264 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 265 } 266 267 @helper LoginModal() { 268 int pageId = Model.TopPage.ID; 269 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 270 string userSignedInErrorText = ""; 271 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 272 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 273 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 274 275 if (Model.LogOnFailed) { 276 switch (Model.LogOnFailedReason) 277 { 278 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordLengthInvalid: 279 userSignedInErrorText = Translate("Password length is invalid"); 280 break; 281 case Dynamicweb.Security.UserManagement.LogOnFailedReason.IncorrectLogin: 282 userSignedInErrorText = Translate("Invalid email or password"); 283 break; 284 case Dynamicweb.Security.UserManagement.LogOnFailedReason.ExceededFailedLogOnLimit: 285 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 286 break; 287 case Dynamicweb.Security.UserManagement.LogOnFailedReason.LoginLocked: 288 userSignedInErrorText = Translate("The user account is temporarily locked"); 289 break; 290 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordExpired: 291 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 292 break; 293 default: 294 userSignedInErrorText = Translate("An unknown error occured"); 295 break; 296 } 297 } 298 299 <!-- Trigger for the login modal --> 300 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 301 302 <!-- Login modal --> 303 <div class="modal-container"> 304 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 305 <div class="modal modal--xs" id="SignInModal"> 306 <div class="modal__header"> 307 <h2>@Translate("Sign in")</h2> 308 </div> 309 <div class="modal__body"> 310 <form method="post" id="LoginForm" class="u-no-margin"> 311 <input type="hidden" name="ID" value="@pageId" /> 312 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 313 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 314 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 315 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 316 <div class="field-error dw-mod">@userSignedInErrorText</div> 317 318 <div class="form__field-group dw-mod"> 319 <input type="checkbox" id="rememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 320 <label for="rememberMe"> 321 @Translate("Remember me", "Remember me") 322 </label> 323 </div> 324 325 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 326 327 @*<a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 328 329 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a>*@ 330 </form> 331 </div> 332 </div> 333 </div> 334 } 335 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 336 { 337 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 338 339 @using System 340 @using System.Web 341 @using System.Collections.Generic 342 @using Dynamicweb.Rapido.Blocks.Extensibility 343 @using Dynamicweb.Rapido.Blocks 344 345 346 @functions { 347 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 348 } 349 350 @{ 351 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"; 352 353 Block mobileHeader = new Block() 354 { 355 Id = "MobileTop", 356 SortId = 10, 357 Template = RenderMobileTop(), 358 SkipRenderBlocksList = true 359 }; 360 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 361 362 Block mobileHeaderNavigation = new Block() 363 { 364 Id = "MobileHeaderNavigation", 365 SortId = 10, 366 Template = RenderMobileHeaderNavigation(), 367 SkipRenderBlocksList = true, 368 BlocksList = new List<Block> { 369 new Block { 370 Id = "MobileHeaderNavigationTrigger", 371 SortId = 10, 372 Template = RenderMobileHeaderNavigationTrigger() 373 } 374 } 375 }; 376 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 377 378 379 Block mobileHeaderLogo = new Block() 380 { 381 Id = "MobileHeaderLogo", 382 SortId = 20, 383 Template = RenderMobileHeaderLogo(), 384 SkipRenderBlocksList = true 385 }; 386 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 387 388 Block mobileHeaderActions = new Block() 389 { 390 Id = "MobileHeaderActions", 391 SortId = 30, 392 Template = RenderMobileTopActions(), 393 SkipRenderBlocksList = true 394 }; 395 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 396 397 Block mobileHeaderSearch = new Block 398 { 399 Id = "MobileHeaderSearch", 400 SortId = 10, 401 Template = RenderMobileTopSearch() 402 }; 403 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 404 405 Block mobileHeaderMiniCart = new Block 406 { 407 Id = "MobileHeaderMiniCart", 408 SortId = 20, 409 Template = RenderMobileTopMiniCart() 410 }; 411 412 Block mobileHeaderSearchBar = new Block() 413 { 414 Id = "MobileHeaderSearchBar", 415 SortId = 30, 416 Template = RenderMobileTopSearchBar() 417 }; 418 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 419 420 switch (mobileTopLayout) 421 { 422 case "nav-left": 423 mobileHeaderNavigation.SortId = 10; 424 mobileHeaderLogo.SortId = 20; 425 mobileHeaderActions.SortId = 30; 426 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 427 break; 428 case "nav-right": 429 mobileHeaderLogo.SortId = 10; 430 mobileHeaderActions.SortId = 20; 431 mobileHeaderNavigation.SortId = 30; 432 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 433 break; 434 case "nav-search-left": 435 mobileHeaderNavigation.SortId = 10; 436 mobileHeaderLogo.SortId = 20; 437 mobileHeaderActions.SortId = 30; 438 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 439 break; 440 case "search-left": 441 mobileHeaderActions.SortId = 10; 442 mobileHeaderLogo.SortId = 20; 443 mobileHeaderNavigation.SortId = 30; 444 mobileHeaderMiniCart.SortId = 0; 445 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 446 break; 447 } 448 } 449 450 451 @helper RenderMobileTop() { 452 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 453 454 <nav class="main-navigation-mobile dw-mod"> 455 <div class="center-container top-container__center-container dw-mod"> 456 <div class="grid grid--align-center"> 457 @RenderBlockList(subBlocks) 458 </div> 459 </div> 460 </nav> 461 } 462 463 @helper RenderMobileHeaderNavigation() { 464 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 465 466 <div class="grid__col-auto-width"> 467 <ul class="menu dw-mod"> 468 @RenderBlockList(subBlocks) 469 </ul> 470 </div> 471 } 472 473 @helper RenderMobileHeaderNavigationTrigger() { 474 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 475 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 476 </li> 477 } 478 479 @helper RenderMobileHeaderLogo() { 480 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 481 482 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 483 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 484 485 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 486 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 487 { 488 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 489 } 490 491 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 492 { 493 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 494 } 495 else 496 { 497 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 498 } 499 500 <div class="grid__col-auto"> 501 <div class="logo dw-mod"> 502 <a href="/Default.aspx?ID=@firstPageId"> 503 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 504 </a> 505 </div> 506 507 @RenderBlockList(subBlocks) 508 </div> 509 } 510 511 @helper RenderMobileTopActions() { 512 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 513 514 <div class="grid__col-auto-width"> 515 <ul class="menu dw-mod"> 516 @RenderBlockList(subBlocks) 517 </ul> 518 </div> 519 } 520 521 @helper RenderMobileTopSearch() { 522 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 523 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 524 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 525 </label> 526 </li> 527 } 528 529 @helper RenderMobileTopMiniCart() { 530 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 531 int cartPageId = GetPageIdByNavigationTag("CartPage"); 532 double cartProductsCount = Model.Cart.TotalProductsCount; 533 534 <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')"> 535 <div class="mini-cart dw-mod"> 536 <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"> 537 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 538 <div class="mini-cart__counter mini-cart__counter--inline dw-mod"> 539 <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"> 540 <div class="js-mini-cart-counter-content"> 541 @cartProductsCount 542 </div> 543 </div> 544 </div> 545 </a> 546 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 547 { 548 <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> 549 } 550 </div> 551 </li> 552 } 553 554 @helper RenderMobileTopSearchBar() { 555 string searchFeedId = ""; 556 string searchSecondFeedId = ""; 557 int groupsFeedId; 558 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 559 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 560 string resultPageLink; 561 string searchPlaceholder; 562 string searchType = "product-search"; 563 string searchTemplate; 564 string searchContentTemplate = ""; 565 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 566 bool showGroups = true; 567 568 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 569 { 570 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 571 resultPageLink = contentSearchPageLink; 572 searchPlaceholder = Translate("Search page"); 573 groupsFeedId = 0; 574 searchType = "content-search"; 575 searchTemplate = "SearchPagesTemplate"; 576 showGroups = false; 577 } 578 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 579 { 580 searchFeedId = productsPageId + "&feed=true"; 581 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 582 resultPageLink = Converter.ToString(productsPageId); 583 searchPlaceholder = Translate("Search products or pages"); 584 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 585 searchType = "combined-search"; 586 searchTemplate = "SearchProductsTemplateWrap"; 587 searchContentTemplate = "SearchPagesTemplateWrap"; 588 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 589 } 590 else 591 { 592 resultPageLink = Converter.ToString(productsPageId); 593 searchFeedId = productsPageId + "&feed=true"; 594 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 595 searchPlaceholder = Translate("Search products"); 596 searchTemplate = "SearchProductsTemplate"; 597 searchType = "product-search"; 598 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 599 } 600 601 602 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 603 604 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 605 <div class="center-container top-container__center-container dw-mod"> 606 <div class="grid"> 607 <div class="grid__col-auto"> 608 <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"> 609 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 610 @if (string.IsNullOrEmpty(searchSecondFeedId)) 611 { 612 <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> 613 } 614 else 615 { 616 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 617 <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> 618 <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> 619 </div> 620 } 621 <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> 622 </div> 623 </div> 624 <div class="grid__col-auto-width"> 625 <ul class="menu dw-mod"> 626 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 627 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 628 <i class="fas fa-times fa-1_5x"></i> 629 </label> 630 </li> 631 </ul> 632 </div> 633 </div> 634 </div> 635 </div> 636 } </text> 637 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 638 639 @using System 640 @using System.Web 641 @using System.Collections.Generic 642 @using Dynamicweb.Rapido.Blocks.Extensibility 643 @using Dynamicweb.Rapido.Blocks 644 645 @functions { 646 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 647 } 648 649 @{ 650 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 651 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideAccount"); 652 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 653 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 654 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 655 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 656 657 Block mobileNavigation = new Block() 658 { 659 Id = "MobileNavigation", 660 SortId = 10, 661 Template = MobileNavigation(), 662 SkipRenderBlocksList = true 663 }; 664 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 665 666 if (Model.CurrentUser.ID > 0) 667 { 668 Block mobileNavigationSignIn = new Block 669 { 670 Id = "MobileNavigationSignIn", 671 SortId = 10, 672 Template = RenderMobileNavigationSignIn() 673 }; 674 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 675 } 676 677 Block mobileNavigationMenu = new Block 678 { 679 Id = "MobileNavigationMenu", 680 SortId = 20, 681 Template = RenderMobileNavigationMenu() 682 }; 683 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 684 685 Block mobileNavigationActions = new Block 686 { 687 Id = "MobileNavigationActions", 688 SortId = 30, 689 Template = RenderMobileNavigationActions(), 690 SkipRenderBlocksList = true 691 }; 692 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 693 694 if (!navigationItemsHideSignIn) 695 { 696 if (Model.CurrentUser.ID <= 0) 697 { 698 Block mobileNavigationSignInAction = new Block 699 { 700 Id = "MobileNavigationSignInAction", 701 SortId = 10, 702 Template = RenderMobileNavigationSignInAction() 703 }; 704 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 705 706 if (hideCreateAccountLink) 707 { 708 Block mobileNavigationCreateAccountAction = new Block 709 { 710 Id = "MobileNavigationCreateAccountAction", 711 SortId = 20, 712 Template = RenderMobileNavigationCreateAccountAction() 713 }; 714 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 715 } 716 } 717 else 718 { 719 if (hideMyProfileLink) 720 { 721 Block mobileNavigationProfileAction = new Block 722 { 723 Id = "MobileNavigationProfileAction", 724 SortId = 10, 725 Template = RenderMobileNavigationProfileAction() 726 }; 727 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationProfileAction); 728 } 729 if (hideMyOrdersLink) 730 { 731 Block mobileNavigationOrdersAction = new Block 732 { 733 Id = "MobileNavigationOrdersAction", 734 SortId = 20, 735 Template = RenderMobileNavigationOrdersAction() 736 }; 737 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 738 } 739 if (hideMyFavoritesLink) 740 { 741 Block mobileNavigationFavoritesAction = new Block 742 { 743 Id = "MobileNavigationFavoritesAction", 744 SortId = 30, 745 Template = RenderMobileNavigationFavoritesAction() 746 }; 747 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 748 } 749 750 Block mobileNavigationSignOutAction = new Block 751 { 752 Id = "MobileNavigationSignOutAction", 753 SortId = 40, 754 Template = RenderMobileNavigationSignOutAction() 755 }; 756 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 757 } 758 } 759 760 if (false) // Model.Languages.Count > 1) 761 { 762 Block mobileNavigationLanguagesAction = new Block 763 { 764 Id = "MobileNavigationLanguagesAction", 765 SortId = 50, 766 Template = RenderMobileNavigationLanguagesAction() 767 }; 768 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 769 } 770 } 771 772 773 @helper MobileNavigation() { 774 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 775 776 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 777 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 778 int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 779 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 780 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 781 782 <!-- Trigger for mobile navigation --> 783 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 784 785 <!-- Mobile navigation --> 786 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 787 @RenderBlockList(subBlocks) 788 </nav> 789 790 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 791 792 if (!onlyPreview) 793 { 794 <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> 795 } 796 } 797 798 @helper RenderMobileNavigationSignIn() { 799 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 800 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 801 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 802 string myProfilePageLink = linkStart + myProfilePageId; 803 string userName = Model.CurrentUser.FirstName != null ? Model.CurrentUser.FirstName : ""; 804 userName += " " + Model.CurrentUser.LastName != null ? Model.CurrentUser.LastName : ""; 805 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 806 807 <ul class="menu menu-mobile"> 808 <li class="menu-mobile__item"> 809 <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> 810 </li> 811 </ul> 812 } 813 814 @helper RenderMobileNavigationMenu() { 815 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 816 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 817 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 818 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 819 int startLevel = renderPagesInToolBar ? 1 : 0; 820 821 @RenderNavigation(new 822 { 823 id = "mobilenavigation", 824 cssclass = "menu menu-mobile dwnavigation", 825 startLevel = @startLevel, 826 ecomStartLevel = @startLevel + 1, 827 endlevel = @levels, 828 expandmode = "all", 829 template = @menuTemplate 830 }) 831 832 if (renderPagesInToolBar) 833 { 834 @RenderNavigation(new 835 { 836 id = "topToolsMobileNavigation", 837 cssclass = "menu menu-mobile dwnavigation", 838 template = "ToolsMenuForMobile.xslt" 839 }) 840 } 841 } 842 843 @helper RenderMobileNavigationActions() { 844 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 845 846 <ul class="menu menu-mobile"> 847 @RenderBlockList(subBlocks) 848 </ul> 849 } 850 851 @helper RenderMobileNavigationSignInAction() { 852 <li class="menu-mobile__item"> 853 <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> 854 </li> 855 } 856 857 @helper RenderMobileNavigationCreateAccountAction() { 858 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 859 860 <li class="menu-mobile__item"> 861 <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> 862 </li> 863 } 864 865 @helper RenderMobileNavigationProfileAction() { 866 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 867 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 868 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 869 string myProfilePageLink = linkStart + myProfilePageId; 870 871 <li class="menu-mobile__item"> 872 <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> 873 </li> 874 } 875 876 @helper RenderMobileNavigationOrdersAction() { 877 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 878 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 879 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 880 string myOrdersPageLink = linkStart + myOrdersPageId; 881 882 <li class="menu-mobile__item"> 883 <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> 884 </li> 885 } 886 887 @helper RenderMobileNavigationFavoritesAction() { 888 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 889 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 890 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 891 string myFavoritesPageLink = linkStart + myFavoritesPageId; 892 893 <li class="menu-mobile__item"> 894 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Favorites")</a> 895 </li> 896 } 897 898 @helper RenderMobileNavigationSignOutAction() { 899 int pageId = Model.TopPage.ID; 900 901 <li class="menu-mobile__item"> 902 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign out")</a> 903 </li> 904 } 905 906 @helper RenderMobileNavigationLanguagesAction() { 907 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 908 909 string selectedLanguage = ""; 910 foreach (var lang in Model.Languages) 911 { 912 if (lang.IsCurrent) 913 { 914 selectedLanguage = lang.Name; 915 } 916 } 917 918 <li class="menu-mobile__item dw-mod"> 919 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 920 <div class="menu-mobile__link__wrap"> 921 <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> 922 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 923 </div> 924 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 925 @if (isSlidesDesign) 926 { 927 <li class="menu-mobile__item dw-mod"> 928 <div class="menu-mobile__link__wrap"> 929 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 930 <label for="MobileMenuCheck_Language" class="menu-mobile__link dw-mod ">Back</label> 931 </div> 932 </li> 933 } 934 @foreach (var lang in Model.Languages) 935 { 936 <li class="menu-mobile__item dw-mod"> 937 <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> 938 </li> 939 } 940 </ul> 941 </li> 942 }</text> 943 } 944 else 945 { 946 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 947 948 @using System 949 @using System.Web 950 @using System.Collections.Generic 951 @using Dynamicweb.Rapido.Blocks.Extensibility 952 @using Dynamicweb.Rapido.Blocks 953 954 @functions { 955 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 956 } 957 958 @{ 959 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 960 bool navigationActionHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 961 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 962 bool showSearchIcon = false; 963 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 964 965 if (topLayout == "minimal" || topLayout == "minimal-right" || topLayout == "two-lines" || topLayout == "two-lines-centered") 966 { 967 showSearchIcon = true; 968 } 969 bool headerOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 970 971 if (renderPagesInToolBar && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 972 { 973 Block masterTools = new Block() 974 { 975 Id = "MasterDesktopTools", 976 SortId = 10, 977 Template = RenderDesktopTools(), 978 SkipRenderBlocksList = true, 979 BlocksList = new List<Block> 980 { 981 new Block { 982 Id = "MasterDesktopToolsText", 983 SortId = 10, 984 Template = RenderDesktopToolsText(), 985 Design = new Design 986 { 987 Size = "auto", 988 HidePadding = true, 989 RenderType = RenderType.Column 990 } 991 }, 992 new Block { 993 Id = "MasterDesktopToolsNavigation", 994 SortId = 20, 995 Template = RenderDesktopToolsNavigation(), 996 Design = new Design 997 { 998 Size = "auto-width", 999 HidePadding = true, 1000 RenderType = RenderType.Column 1001 } 1002 } 1003 } 1004 }; 1005 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterTools); 1006 }; 1007 1008 Block masterDesktopExtra = new Block() 1009 { 1010 Id = "MasterDesktopExtra", 1011 SortId = 10, 1012 Template = RenderDesktopExtra(), 1013 SkipRenderBlocksList = true 1014 }; 1015 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopExtra); 1016 1017 Block masterDesktopNavigation = new Block() 1018 { 1019 Id = "MasterDesktopNavigation", 1020 SortId = 20, 1021 Template = RenderDesktopNavigation(), 1022 SkipRenderBlocksList = true 1023 }; 1024 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopNavigation); 1025 1026 Block masterDesktopLogo = new Block 1027 { 1028 Id = "MasterDesktopLogo", 1029 SortId = 10, 1030 Template = RenderDesktopLogo(), 1031 Design = new Design 1032 { 1033 Size = "auto-width", 1034 HidePadding = true, 1035 RenderType = RenderType.Column 1036 } 1037 }; 1038 1039 Block masterDesktopMenu = new Block 1040 { 1041 Id = "MasterDesktopMenu", 1042 SortId = 20, 1043 Template = RenderDesktopMenu(), 1044 Design = new Design() 1045 { 1046 Size = "auto", 1047 HidePadding = true, 1048 RenderType = RenderType.Column 1049 } 1050 }; 1051 1052 Block masterDesktopActionsMenuContainer = new Block 1053 { 1054 Id = "MasterDesktopActionsMenuContainer", 1055 SortId = 30, 1056 Design = new Design 1057 { 1058 RenderType = RenderType.Column, 1059 Size = "auto" 1060 } 1061 }; 1062 1063 Block masterDesktopActionsMenu = new Block 1064 { 1065 Id = "MasterDesktopActionsMenu", 1066 SortId = 10, 1067 Template = RenderDesktopActionsMenu(), 1068 SkipRenderBlocksList = true 1069 }; 1070 1071 if (!navigationActionHideSearch && showSearchIcon) 1072 { 1073 Block masterDesktopActionsMenuSearch = new Block 1074 { 1075 Id = "MasterDesktopActionsMenuSearch", 1076 SortId = 10, 1077 Template = RenderMiniSearch() 1078 }; 1079 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSearch); 1080 } 1081 1082 Block masterDesktopActionsMenuSignIn = new Block 1083 { 1084 Id = "MasterDesktopActionsMenuSignIn", 1085 SortId = 20, 1086 Template = RenderSignIn() 1087 }; 1088 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSignIn); 1089 1090 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 1091 { 1092 Block masterDesktopActionsMenuFavorites = new Block 1093 { 1094 Id = "MasterDesktopActionsMenuFavorites", 1095 SortId = 30, 1096 Template = RenderFavorites() 1097 }; 1098 masterDesktopActionsMenu.Add(masterDesktopActionsMenuFavorites); 1099 } 1100 1101 Block masterDesktopActionsMenuLanguageSelector = new Block 1102 { 1103 Id = "MasterDesktopActionsMenuLanguageSelector", 1104 SortId = 40, 1105 Template = RenderLanguageSelector() 1106 }; 1107 //masterDesktopActionsMenu.Add(masterDesktopActionsMenuLanguageSelector); 1108 1109 if (!headerOnlyPreview) 1110 { 1111 Block masterDesktopActionsMenuMiniCart = new Block 1112 { 1113 Id = "MasterDesktopActionsMenuMiniCart", 1114 SortId = 50, 1115 Template = RenderMiniCart() 1116 }; 1117 masterDesktopActionsMenu.Add(masterDesktopActionsMenuMiniCart); 1118 } 1119 1120 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 1121 { 1122 Block masterDesktopActionsHeaderButton = new Block 1123 { 1124 Id = "MasterDesktopActionsHeaderButton", 1125 SortId = 60, 1126 Template = RenderHeaderButton() 1127 }; 1128 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 1129 } 1130 1131 Block searchBar = new Block() 1132 { 1133 Id = "SearchBar", 1134 SortId = 40, 1135 Template = RenderSearchBar(), 1136 Design = new Design() 1137 { 1138 Size = "auto", 1139 HidePadding = true, 1140 RenderType = RenderType.Column 1141 } 1142 }; 1143 1144 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 1145 { 1146 Block impersonationBar = new Block() 1147 { 1148 Id = "ImpersonationBar", 1149 SortId = 50, 1150 Template = RenderImpersonationBar(), 1151 Design = new Design() 1152 { 1153 Size = "auto-width", 1154 HidePadding = true, 1155 RenderType = RenderType.Column 1156 } 1157 }; 1158 headerBlocksPage.Add(MasterBlockId.MasterHeader, impersonationBar); 1159 } 1160 1161 switch (topLayout) 1162 { 1163 case "condensed": //2 1164 masterDesktopLogo.SortId = 10; 1165 masterDesktopLogo.Design.Size = "auto-width"; 1166 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1167 masterDesktopMenu.SortId = 20; 1168 masterDesktopMenu.Design.Size = "auto"; 1169 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1170 masterDesktopActionsMenuContainer.SortId = 30; 1171 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1172 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1173 if (!navigationActionHideSearch) 1174 { 1175 searchBar.SortId = 40; 1176 searchBar.Design.Size = "12"; 1177 masterDesktopExtra.SortId = 50; 1178 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1179 } 1180 break; 1181 case "minimal": //4 1182 masterDesktopLogo.SortId = 10; 1183 masterDesktopLogo.Design.Size = "auto-width"; 1184 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1185 masterDesktopMenu.SortId = 10; 1186 masterDesktopMenu.Design.Size = "auto"; 1187 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1188 masterDesktopActionsMenuContainer.SortId = 20; 1189 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1190 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1191 break; 1192 case "minimal-right": //5 1193 masterDesktopLogo.SortId = 10; 1194 masterDesktopLogo.Design.Size = "auto-width"; 1195 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1196 masterDesktopMenu.SortId = 10; 1197 masterDesktopMenu.Design.Size = "auto"; 1198 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1199 masterDesktopActionsMenuContainer.SortId = 20; 1200 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1201 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1202 break; 1203 case "two-lines": //6 1204 masterDesktopLogo.SortId = 10; 1205 masterDesktopLogo.Design.Size = "auto"; 1206 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1207 masterDesktopMenu.SortId = 10; 1208 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1209 masterDesktopActionsMenuContainer.SortId = 20; 1210 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1211 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1212 break; 1213 case "two-lines-centered": //7 1214 masterDesktopLogo.SortId = 10; 1215 masterDesktopLogo.Design.Size = "auto"; 1216 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1217 masterDesktopMenu.SortId = 10; 1218 masterDesktopMenu.Design.Size = "auto"; 1219 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1220 masterDesktopActionsMenuContainer.SortId = 20; 1221 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1222 break; 1223 case "splitted": //3 1224 masterDesktopLogo.SortId = 10; 1225 masterDesktopLogo.Design.Size = "auto"; 1226 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1227 if (!navigationActionHideSearch) 1228 { 1229 searchBar.SortId = 20; 1230 searchBar.Design.Size = "auto"; 1231 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1232 } 1233 masterDesktopMenu.SortId = 10; 1234 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1235 masterDesktopActionsMenuContainer.SortId = 20; 1236 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1237 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1238 break; 1239 case "normal": //1 1240 default: 1241 masterDesktopLogo.SortId = 10; 1242 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1243 if (!navigationActionHideSearch) 1244 { 1245 searchBar.SortId = 20; 1246 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1247 } 1248 masterDesktopActionsMenuContainer.SortId = 30; 1249 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopActionsMenuContainer); 1250 masterDesktopMenu.SortId = 10; 1251 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1252 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1253 break; 1254 } 1255 1256 headerBlocksPage.Add("MasterDesktopActionsMenuContainer", masterDesktopActionsMenu); 1257 } 1258 1259 @helper RenderDesktopTools() 1260 { 1261 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 1262 1263 <div class="tools-navigation dw-mod"> 1264 <div class="center-container grid top-container__center-container dw-mod"> 1265 @RenderBlockList(subBlocks) 1266 </div> 1267 </div> 1268 } 1269 1270 @helper RenderDesktopToolsText() 1271 { 1272 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 1273 1274 <div class="u-margin-top">@toolsText</div> 1275 } 1276 1277 @helper RenderDesktopToolsNavigation() 1278 { 1279 <div> 1280 @RenderNavigation(new 1281 { 1282 id = "topToolsNavigation", 1283 cssclass = "menu menu-tools dw-mod dwnavigation", 1284 template = "TopMenu.xslt" 1285 }) 1286 </div> 1287 } 1288 1289 @helper RenderDesktopNavigation() 1290 { 1291 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 1292 1293 <nav class="main-navigation dw-mod"><input id="show-menu" type="checkbox" /> 1294 <div class="center-container top-container__center-container grid grid--align-center dw-mod"> 1295 @RenderBlockList(subBlocks) 1296 </div> 1297 </nav> 1298 } 1299 1300 @helper RenderDesktopExtra() 1301 { 1302 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 1303 1304 if (subBlocks.Count > 0) 1305 { 1306 <input id="show-menu" type="checkbox" /><div class="header header-top dw-mod"> 1307 <div class="center-container top-container__center-container grid grid--align-center dw-mod"> 1308 @RenderBlockList(subBlocks) 1309 </div> 1310 </div> 1311 } 1312 } 1313 1314 @helper RenderDesktopLogo() 1315 { 1316 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 1317 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1318 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 1319 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 1320 string logoHeight = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetString("LogoHeight")) ? Model.Area.Item.GetItem("Layout").GetString("LogoHeight") : "40"; 1321 logoHeight = logoHeight != "0" ? logoHeight : "40"; 1322 if (Path.GetExtension(logo).ToLower() != ".svg") 1323 { 1324 logo = "/Admin/Public/GetImage.ashx?height=" + logoHeight + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 1325 1326 if (Pageview.Device.ToString() == "Mobile") 1327 { 1328 logoHeight = "40"; 1329 } 1330 } 1331 else 1332 { 1333 logo = HttpUtility.UrlDecode(logo); 1334 } 1335 1336 <div class="logo @alignClass dw-mod"> 1337 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 1338 <img class="grid__cell-img logo__img dw-mod" src="@logo" /> 1339 </a> 1340 </div><div class="menu_gumb" id="menu_hide"><label class="show-menu" for="show-menu"><i class="fa fa-bars" style="margin-left: 10px;"></i></label></div> 1341 } 1342 1343 @helper RenderDesktopMenu() 1344 { 1345 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1346 string menuAlignment = topLayout == "two-lines-centered" || topLayout == "minimal-right" ? "u-pull--right" : ""; 1347 1348 bool megaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue.ToLower() == "true" ? true : false; 1349 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 1350 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 1351 int startLevel = renderPagesInToolBar ? 1 : 0; 1352 1353 <div class="grid__cell"> 1354 <div class="@menuAlignment"> 1355 @if (!megaMenu) 1356 { 1357 @RenderNavigation(new 1358 { 1359 id = "topnavigation", 1360 cssclass = "menu dw-mod dwnavigation u-full-max-width hiddenDS", 1361 startLevel = @startLevel, 1362 ecomStartLevel = @startLevel + 1, 1363 endlevel = 5, 1364 expandmode = "all", 1365 template = "BaseMenuWithDropdown.xslt" 1366 }); 1367 } 1368 else 1369 { 1370 @RenderNavigation(new 1371 { 1372 id = "topnavigation", 1373 cssclass = "menu dw-mod dwnavigation u-full-max-width hiddenDS", 1374 startLevel = @startLevel, 1375 ecomStartLevel = @startLevel + 1, 1376 endlevel = 5, 1377 promotionImage = megamenuPromotionImage, 1378 promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"), 1379 expandmode = "all", 1380 template = "BaseMegaMenu.xslt" 1381 }); 1382 } 1383 </div> 1384 </div> 1385 } 1386 1387 @helper RenderDesktopActionsMenu() 1388 { 1389 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 1390 1391 <ul class="menu dw-mod hiddenDS"> 1392 @RenderBlockList(subBlocks) 1393 </ul> 1394 } 1395 1396 @helper RenderLanguageSelector() 1397 { 1398 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1399 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"; 1400 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1401 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() : ""; 1402 1403 if (Model.Languages.Count > 1) 1404 { 1405 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1406 <div class="@menuLinkClass menu__link--icon dw-mod hiddenDS"> 1407 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 1408 </div> 1409 <div class="menu menu--dropdown dw-mod"> 1410 @foreach (var lang in Model.Languages) 1411 { 1412 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 1413 1414 if (languageViewType == "flag") 1415 { 1416 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + "\"></span>"; 1417 } 1418 1419 if (languageViewType == "name") 1420 { 1421 langInfo = lang.Name; 1422 } 1423 1424 <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> 1425 } 1426 </div> 1427 </li> 1428 } 1429 } 1430 1431 @helper RenderMiniCart() 1432 { 1433 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 1434 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 1435 int cartPageId = GetPageIdByNavigationTag("CartPage"); 1436 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 1437 if (user != null) 1438 { 1439 var groups = user.Groups; 1440 foreach(var group in groups) 1441 { 1442 if (group.ID == 65) 1443 { 1444 cartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 1445 } 1446 } 1447 } 1448 1449 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 1450 1451 if (!onlyPreview && !navigationItemsHideCart) 1452 { 1453 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1454 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1455 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1456 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 1457 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue; 1458 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 1459 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 1460 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 1461 1462 if (showPrice && counterPosition == "right") 1463 { 1464 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 1465 } 1466 1467 1468 <li class="@liClasses" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 1469 <div class="mini-cart dw-mod"> 1470 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="@menuLinkClass menu__link--icon dw-mod js-mini-cart-button"> 1471 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 1472 <div class="mini-cart__counter dw-mod"> 1473 <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"> 1474 <div class="js-mini-cart-counter-content"> 1475 @cartProductsCount 1476 @cartProductsTotalPrice 1477 </div> 1478 </div> 1479 </div> 1480 </a> 1481 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 1482 { 1483 <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> 1484 } 1485 </div> 1486 </li> 1487 } 1488 } 1489 1490 @helper RenderSignIn() 1491 { 1492 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 1493 string userInitials = ""; 1494 int pageId = Model.TopPage.ID; 1495 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 1496 int sendInquiryPageId = GetPageIdByNavigationTag("SendInquiry"); 1497 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 1498 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 1499 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 1500 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1501 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 1502 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1503 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideAccount"); 1504 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 1505 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 1506 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 1507 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 1508 1509 string linkStart = "/Default.aspx?ID="; 1510 if (Model.CurrentUser.ID <= 0) 1511 { 1512 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1513 } 1514 1515 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 1516 string myProfilePageLink = linkStart + myProfilePageId; 1517 string myOrdersPageLink = linkStart + myOrdersPageId; 1518 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1519 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 1520 string SendInquiryPageLink = linkStart + sendInquiryPageId; 1521 1522 if (Model.CurrentUser.ID != 0) 1523 { 1524 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 1525 { 1526 string[] names = Model.CurrentUser.Name.Split(' '); 1527 userInitials += Model.CurrentUser.Name.Substring(0, 1); 1528 1529 if (names.Length > 1) 1530 { 1531 userInitials += names[names.Length - 1].Substring(0, 1); 1532 } 1533 } 1534 else 1535 { 1536 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 1537 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 1538 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 1539 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 1540 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 1541 } 1542 } 1543 1544 if (!navigationItemsHideSignIn) 1545 { 1546 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1547 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"; 1548 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1549 1550 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1551 <div class="@menuLinkClass menu__link--icon dw-mod"> 1552 @if (Model.CurrentUser.ID <= 0) 1553 { 1554 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 1555 } 1556 else 1557 { 1558 <a href="/default.aspx?ID=@myProfilePageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 1559 } 1560 </div> 1561 <div class="menu menu--dropdown sign-in-dropdown dw-mod"> 1562 <ul class="list list--clean dw-mod"> 1563 @if (Model.CurrentUser.ID <= 0) 1564 { 1565 <li> 1566 <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> 1567 </li> 1568 @*if (!hideCreateAccountLink) 1569 { 1570 <li> 1571 <a href="/default.aspx?ID=@createAccountPageId" class="list__link dw-mod">@Translate("Create account")</a> 1572 </li> 1573 1574 <li> 1575 <a href="@forgotPasswordPageLink" class="list__link dw-mod">@Translate("Forgot your password?")</a> 1576 </li> 1577 }*@ 1578 } 1579 else 1580 { 1581 1582 @*if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1583 { 1584 <li class="list__seperator dw-mod"></li> 1585 }*@ 1586 1587 if (!hideMyProfileLink) 1588 { 1589 <li> 1590 <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> 1591 </li> 1592 } 1593 if (!hideMyOrdersLink) 1594 { 1595 <li> 1596 <a href="@myOrdersPageLink" class="list__link dw-mod"><i class="fas fa-list u-margin-right"></i>@Translate("My Orders")</a> 1597 </li> 1598 } 1599 if (!hideMyFavoritesLink) 1600 { 1601 <li> 1602 <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> 1603 </li> 1604 } 1605 if (!hideMySavedCardsLink) 1606 { 1607 <li> 1608 <a href="@mySavedCardsPageLink" class="list__link dw-mod"><i class="fas fa-credit-card u-margin-right"></i>@Translate("My Saved cards")</a> 1609 </li> 1610 } 1611 } 1612 @if (Model.CurrentUser.ID > 0) 1613 { 1614 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1615 { 1616 <li class="list__seperator dw-mod"></li> 1617 } 1618 <li> 1619 <a href="@SendInquiryPageLink" class="list__link dw-mod"><i class="fas fa-question u-margin-right"></i>@Translate("Send inquiry")</a> 1620 </li> 1621 1622 <li> 1623 <a href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" class="list__link dw-mod">@Translate("Sign out")</a> 1624 </li> 1625 } 1626 </ul> 1627 </div> 1628 </li> 1629 } 1630 } 1631 1632 @helper RenderFavorites() 1633 { 1634 bool navigationItemsHideFavorites = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 1635 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1636 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1637 1638 string linkStart = "/Default.aspx?ID="; 1639 if (Model.CurrentUser.ID <= 0) 1640 { 1641 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1642 } 1643 1644 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1645 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1646 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"; 1647 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1648 1649 <li class="@liClasses"> 1650 <a href="@myFavoritesPageLink" class="@menuLinkClass menu__link--icon dw-mod"> 1651 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 1652 </a> 1653 </li> 1654 } 1655 1656 @helper RenderHeaderButton() 1657 { 1658 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 1659 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 1660 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 1661 1662 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 1663 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 1664 </li> 1665 } 1666 1667 @helper RenderSearchBar(string alignment = "left") 1668 { 1669 string searchFeedId = ""; 1670 string searchSecondFeedId = ""; 1671 int groupsFeedId; 1672 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1673 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1674 string resultPageLink; 1675 string searchPlaceholder; 1676 string searchType = "product-search"; 1677 string searchTemplate; 1678 string searchContentTemplate = ""; 1679 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1680 bool showGroups = true; 1681 1682 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1683 { 1684 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1685 resultPageLink = contentSearchPageLink; 1686 searchPlaceholder = Translate("Search page"); 1687 groupsFeedId = 0; 1688 searchType = "content-search"; 1689 searchTemplate = "SearchPagesTemplate"; 1690 showGroups = false; 1691 } 1692 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1693 { 1694 searchFeedId = productsPageId + "&feed=true"; 1695 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1696 resultPageLink = Converter.ToString(productsPageId); 1697 searchPlaceholder = Translate("Search products or pages"); 1698 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1699 searchType = "combined-search"; 1700 searchTemplate = "SearchProductsTemplateWrap"; 1701 searchContentTemplate = "SearchPagesTemplateWrap"; 1702 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1703 } 1704 else 1705 { 1706 resultPageLink = Converter.ToString(productsPageId); 1707 searchFeedId = productsPageId + "&feed=true"; 1708 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1709 searchPlaceholder = Translate("Search products"); 1710 searchTemplate = "SearchProductsTemplate"; 1711 searchType = "product-search"; 1712 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1713 } 1714 1715 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod hiddenDS" 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"> 1716 @if (showGroups) 1717 { 1718 <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> 1719 <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> 1720 } 1721 <div class="typeahead-search-field"> 1722 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 1723 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1724 { 1725 <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> 1726 } 1727 else 1728 { 1729 <div class="dropdown dropdown--absolute-position dropdown--combined grid @(alignment == "right" ? "dropdown--right-aligned" : "")"> 1730 <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> 1731 <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> 1732 </div> 1733 } 1734 </div> 1735 <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> 1736 </div> 1737 } 1738 1739 @helper RenderMiniSearch() 1740 { 1741 string searchFeedId = ""; 1742 string searchSecondFeedId = ""; 1743 int groupsFeedId; 1744 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1745 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1746 string resultPageLink; 1747 string searchPlaceholder; 1748 string searchType = "product-search"; 1749 string searchTemplate; 1750 string searchContentTemplate = ""; 1751 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1752 bool showGroups = true; 1753 1754 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1755 { 1756 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1757 resultPageLink = contentSearchPageLink; 1758 searchPlaceholder = Translate("Search page"); 1759 groupsFeedId = 0; 1760 searchType = "content-search"; 1761 searchTemplate = "SearchPagesTemplate"; 1762 showGroups = false; 1763 } 1764 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1765 { 1766 searchFeedId = productsPageId + "&feed=true"; 1767 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1768 resultPageLink = Converter.ToString(productsPageId); 1769 searchPlaceholder = Translate("Search products or pages"); 1770 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1771 searchType = "combined-search"; 1772 searchTemplate = "SearchProductsTemplateWrap"; 1773 searchContentTemplate = "SearchPagesTemplateWrap"; 1774 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1775 } 1776 else 1777 { 1778 resultPageLink = Converter.ToString(productsPageId); 1779 searchFeedId = productsPageId + "&feed=true"; 1780 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1781 searchPlaceholder = Translate("Search products"); 1782 searchTemplate = "SearchProductsTemplate"; 1783 searchType = "product-search"; 1784 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1785 } 1786 1787 <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()"> 1788 <div class="menu__link menu__link--icon dw-mod"> 1789 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 1790 </div> 1791 <div class="menu menu--dropdown u-w380px top-micro-search dw-mod"> 1792 <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"> 1793 <div class="typeahead-search-field"> 1794 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@searchPlaceholder" value="@searchValue"> 1795 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1796 { 1797 <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> 1798 } 1799 else 1800 { 1801 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 1802 <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> 1803 <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> 1804 </div> 1805 } 1806 </div> 1807 </div> 1808 </div> 1809 </li> 1810 } 1811 1812 @helper RenderImpersonationBar() 1813 { 1814 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 1815 1816 <div class="u-color-warning--bg"> 1817 <div class="center-container top-container__center-container dw-mod"> 1818 @*Impersonation*@ 1819 <div class="grid"> 1820 <div class="grid--align-self-center grid__col-x"> 1821 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 1822 { 1823 string stopImpersonateTranslation = Translate("Stop impersonation"); 1824 string username = ""; 1825 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 1826 { 1827 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 1828 } 1829 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 1830 { 1831 username = Model.CurrentSecondaryUser.Name; 1832 } 1833 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 1834 { 1835 username = Model.CurrentSecondaryUser.Email; 1836 } 1837 else 1838 { 1839 username = Model.CurrentSecondaryUser.UserName; 1840 } 1841 <div class="grid-cell"> 1842 <div class="u-pull--left u-bold u-margin-top"> 1843 <i class="fas fa-user-secret"></i> 1844 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 1845 </div> 1846 <form method="post" class="u-pull--right u-no-margin"> 1847 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 1848 </form> 1849 </div> 1850 } 1851 else 1852 { 1853 string viewListTranslation = Translate("View the list of users you can impersonate"); 1854 <div class="grid-cell u-bold"> 1855 <i class="fas fa-user-secret"></i> 1856 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 1857 </div> 1858 } 1859 </div> 1860 </div> 1861 </div> 1862 </div> 1863 } 1864 1865 </text> 1866 } 1867 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1868 1869 @using System 1870 @using System.Web 1871 @using System.Collections.Generic 1872 @using Dynamicweb.Rapido.Blocks.Extensibility 1873 @using Dynamicweb.Rapido.Blocks 1874 1875 @functions { 1876 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 1877 } 1878 1879 @{ 1880 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content") : ""; 1881 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content") : ""; 1882 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content") : ""; 1883 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header") : ""; 1884 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header") : ""; 1885 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header") : ""; 1886 1887 Block masterFooterContent = new Block() 1888 { 1889 Id = "MasterFooterContent", 1890 SortId = 10, 1891 Template = RenderFooter(), 1892 SkipRenderBlocksList = true 1893 }; 1894 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 1895 1896 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 1897 { 1898 Block masterFooterColumnOne = new Block 1899 { 1900 Id = "MasterFooterColumnOne", 1901 SortId = 10, 1902 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 1903 Design = new Design { 1904 Size = "auto", 1905 RenderType = RenderType.Column 1906 } 1907 }; 1908 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 1909 } 1910 1911 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 1912 { 1913 Block masterFooterColumnTwo = new Block 1914 { 1915 Id = "MasterFooterColumnTwo", 1916 SortId = 20, 1917 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 1918 Design = new Design 1919 { 1920 Size = "auto", 1921 RenderType = RenderType.Column 1922 } 1923 }; 1924 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 1925 } 1926 1927 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 1928 { 1929 Block masterFooterColumnThree = new Block 1930 { 1931 Id = "MasterFooterColumnThree", 1932 SortId = 30, 1933 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 1934 Design = new Design 1935 { 1936 Size = "auto", 1937 RenderType = RenderType.Column 1938 } 1939 }; 1940 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 1941 } 1942 1943 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 1944 { 1945 Block masterFooterNewsletterSignUp = new Block 1946 { 1947 Id = "MasterFooterNewsletterSignUp", 1948 SortId = 40, 1949 Template = RenderFooterNewsletterSignUp(), 1950 Design = new Design 1951 { 1952 Size = "auto", 1953 RenderType = RenderType.Column 1954 } 1955 }; 1956 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 1957 } 1958 1959 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 1960 { 1961 Block masterFooterSocialLinks = new Block 1962 { 1963 Id = "MasterFooterSocialLinks", 1964 SortId = 50, 1965 Template = RenderFooterSocialLinks(), 1966 Design = new Design 1967 { 1968 Size = "auto", 1969 RenderType = RenderType.Column 1970 } 1971 }; 1972 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 1973 } 1974 1975 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 1976 { 1977 Block masterFooterPayments = new Block 1978 { 1979 Id = "MasterFooterPayments", 1980 SortId = 60, 1981 Template = RenderFooterPayments(), 1982 Design = new Design 1983 { 1984 Size = "12", 1985 RenderType = RenderType.Column 1986 } 1987 }; 1988 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 1989 } 1990 1991 Block masterFooterCopyright = new Block 1992 { 1993 Id = "MasterFooterCopyright", 1994 SortId = 70, 1995 Template = RenderFooterCopyright(), 1996 Design = new Design 1997 { 1998 Size = "12", 1999 RenderType = RenderType.Column 2000 } 2001 }; 2002 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 2003 } 2004 2005 @helper RenderFooter() { 2006 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 2007 2008 <footer class="footer dw-mod"> 2009 <div class="center-container top-container__center-container dw-mod"> 2010 <div class="grid grid--external-bleed-x"> 2011 @RenderBlockList(subBlocks) 2012 </div> 2013 </div> 2014 </footer> 2015 } 2016 2017 @helper RenderFooterColumn(string header, string content) { 2018 <h3 class="footer__heading dw-mod">@header</h3> 2019 <div class="footer__content dw-mod"> 2020 @content 2021 </div> 2022 } 2023 2024 @helper RenderFooterNewsletterSignUp() { 2025 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 2026 2027 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 2028 <div class="footer__content dw-mod"> 2029 <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> 2030 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 2031 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 2032 <div class="form__field-combi"> 2033 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' /> 2034 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 2035 </div> 2036 </form> 2037 </div> 2038 } 2039 2040 @helper RenderFooterSocialLinks() { 2041 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 2042 <div class="footer__content dw-mod"> 2043 <div class="collection dw-mod"> 2044 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 2045 { 2046 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 2047 string socialIconClass = socialIcon.SelectedValue; 2048 string socialIconTitle = socialIcon.SelectedName; 2049 string socialLink = socialitem.GetString("Link"); 2050 2051 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px"><i class="@socialIconClass fa-2x" style="color:#CC0000;"></i></a> 2052 } 2053 </div> 2054 </div> 2055 } 2056 2057 @helper RenderFooterPayments() { 2058 <div class="footer__content dw-mod"> 2059 <div class="collection dw-mod"> 2060 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 2061 { 2062 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 2063 string paymentImage = null; 2064 string paymentTitle = paymentItem.SelectedName; 2065 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 2066 if (selected != null) 2067 { 2068 paymentImage = selected.Icon; 2069 } 2070 2071 <div class="footer__card-type"> 2072 <img src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 2073 </div> 2074 } 2075 </div> 2076 </div> 2077 } 2078 2079 @helper RenderFooterCopyright() { 2080 <div class="grid__col-12 footer__copyright dw-mod"> 2081 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 2082 </div> 2083 } 2084 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2085 2086 @using System 2087 @using System.Web 2088 @using System.Collections.Generic 2089 @using Dynamicweb.Rapido.Blocks.Extensibility 2090 @using Dynamicweb.Rapido.Blocks 2091 2092 @{ 2093 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 2094 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2095 2096 if (!navigationItemsHideCart) 2097 { 2098 Block miniCartScriptTemplates = new Block() 2099 { 2100 Id = "MasterMiniCartTemplates", 2101 SortId = 1, 2102 Template = RenderMiniCartScriptTemplates(), 2103 SkipRenderBlocksList = true, 2104 BlocksList = new List<Block> 2105 { 2106 new Block { 2107 Id = "MiniCartHeader", 2108 SortId = 10, 2109 Template = RenderMiniCartHeader() 2110 }, 2111 new Block { 2112 Id = "MiniCartOrderLines", 2113 SortId = 20, 2114 Template = RenderMiniCartOrderLines() 2115 }, 2116 new Block { 2117 Id = "MiniCartFees", 2118 SortId = 30, 2119 Template = RenderMiniCartFees() 2120 }, 2121 new Block { 2122 Id = "MiniCartPoints", 2123 SortId = 40, 2124 Template = RenderMiniCartPoints() 2125 }, 2126 new Block { 2127 Id = "MiniCartTotal", 2128 SortId = 50 , 2129 Template = RenderMiniCartTotal() 2130 } 2131 } 2132 }; 2133 2134 miniCartBlocksPage.Add(MasterBlockId.MasterBottomSnippets, miniCartScriptTemplates); 2135 } 2136 } 2137 2138 @helper RenderMiniCartScriptTemplates() 2139 { 2140 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 2141 2142 int cartPageId = GetPageIdByNavigationTag("CartPage"); 2143 var user = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser(); 2144 if (user != null) 2145 { 2146 var groups = user.Groups; 2147 foreach (var group in groups) 2148 { 2149 if (group.ID == 65) 2150 { 2151 cartPageId = GetPageIdByNavigationTag("QuotesCartPage"); 2152 } 2153 } 2154 } 2155 bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 2156 showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; 2157 showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; 2158 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2159 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2160 string addingToCartNotification = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 2161 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 2162 2163 2164 <script id="MiniCartCounterContent" type="text/x-template"> 2165 {{#.}} 2166 <div class="js-mini-cart-counter-content dw-mod"> 2167 @if (showPriceInMiniCartCounter) { 2168 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 2169 } else { 2170 <text>{{numberofproducts}}</text> 2171 } 2172 </div> 2173 {{/.}} 2174 </script> 2175 2176 <script id="MiniCartContent" type="text/x-template"> 2177 {{#.}} 2178 @if (useGoogleTagManager) 2179 { 2180 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 2181 } 2182 <div class="mini-cart-dropdown__inner {{isempty}} dw-mod"> 2183 <h4 class="u-ta-center u-no-margin u-margin-bottom u-margin-top">@Translate("Shopping cart")</h4> 2184 <div class="mini-cart-dropdown__body dw-mod"> 2185 <table class="table mini-cart-table dw-mod"> 2186 @RenderBlockList(subBlocks) 2187 </table> 2188 </div> 2189 2190 <table class="table mini-cart-table dw-mod"> 2191 <tr class="mini-cart-orderlines__footer dw-mod"> 2192 <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> 2193 <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> 2194 </tr> 2195 </table> 2196 </div> 2197 {{/.}} 2198 </script> 2199 2200 <script id="MiniCartOrderline" type="text/x-template"> 2201 <tr class="{{isempty}}"> 2202 <td style="width:50px;"><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> 2203 <td> 2204 <a href="{{link}}" class="mini-cart-orderlines__name" title="{{name}}">{{name}}</a> 2205 {{#if variantname}} 2206 <a href="{{link}}" class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{variantname}}</a> 2207 {{/if}} 2208 {{#if unitname}} 2209 <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{unitname}}</div> 2210 {{/if}} 2211 </td> 2212 <td class="u-ta-right">{{quantity}}</td> 2213 <td class="u-ta-right" style="min-width:150px;"> 2214 {{#if pointsTotal}} 2215 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 2216 {{else}} 2217 {{totalprice}} 2218 {{/if}} 2219 </td> 2220 </tr> 2221 </script> 2222 2223 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 2224 <tr class="table__row--no-border {{isempty}}"> 2225 <td>&nbsp;</td> 2226 <td><div class="mini-cart-orderlines__name dw-mod">{{name}}</div></td> 2227 <td class="u-ta-right">&nbsp;</td> 2228 <td class="u-ta-right">{{totalprice}}</td> 2229 </tr> 2230 </script> 2231 2232 if (!onlyPreview && addingToCartNotification == "modal") 2233 { 2234 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 2235 2236 <script id="LastAddedProductTemplate" type="text/x-template"> 2237 <!-- Trigger for the login modal --> 2238 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 2239 2240 <!-- Login modal --> 2241 <div class="modal-container"> 2242 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 2243 <div class="modal modal--md"> 2244 <div class="modal__header"> 2245 <h2>@Translate("Product is added to the cart")</h2> 2246 </div> 2247 <div class="modal__body"> 2248 <div class="grid"> 2249 <div> 2250 <a href="{{productInfo.link}}"><img src="{{productInfo.image}}" alt="{{productInfo.name}}" /></a> 2251 </div> 2252 <div class="u-padding"> 2253 <span>{{quantity}}</span> x 2254 </div> 2255 <div class="grid__col-auto"> 2256 <div>{{productInfo.name}}</div> 2257 {{#if productInfo.variantName}} 2258 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 2259 {{/if}} 2260 {{#if productInfo.unitName}} 2261 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 2262 {{/if}} 2263 </div> 2264 </div> 2265 <div class="modal__footer u-margin-top--lg"> 2266 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 2267 <a href="/cart" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 2268 </div> 2269 </div> 2270 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 2271 </div> 2272 </div> 2273 </script> 2274 <script> 2275 document.addEventListener('addToCart', function (event) { 2276 Cart.ShowLastAddedProductModal(event.detail); 2277 }); 2278 </script> 2279 } 2280 else if (!onlyPreview && addingToCartNotification == "toggle") 2281 { 2282 <script> 2283 document.addEventListener('addToCart', function () { 2284 Cart.ToggleMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 2285 }); 2286 </script> 2287 } 2288 } 2289 2290 @helper RenderMiniCartHeader() { 2291 <thead> 2292 <tr> 2293 <td>&nbsp;</td> 2294 <td>@Translate("Product")</td> 2295 <td class="u-ta-right">@Translate("Qty")</td> 2296 <td class="u-ta-right" width="120">@Translate("Price")</td> 2297 </tr> 2298 </thead> 2299 } 2300 2301 @helper RenderMiniCartOrderLines() { 2302 <text> 2303 {{#OrderLines}} 2304 {{#ifCond template "===" "CartOrderline"}} 2305 {{>MiniCartOrderline}} 2306 {{/ifCond}} 2307 {{#ifCond template "===" "CartOrderlineMobile"}} 2308 {{>MiniCartOrderline}} 2309 {{/ifCond}} 2310 {{#ifCond template "===" "CartOrderlineDiscount"}} 2311 {{>MiniCartOrderlineDiscount}} 2312 {{/ifCond}} 2313 {{/OrderLines}} 2314 </text> 2315 } 2316 2317 @helper RenderMiniCartFees() { 2318 <tr> 2319 <td class="u-ta-center"><i class="fas fa-credit-card"></i></td> 2320 <td>{{paymentmethod}}</td> 2321 <td colspan="2" class="u-ta-right" width="130">{{paymentfee}}</td> 2322 </tr> 2323 <tr> 2324 <td class="u-ta-center"><i class="fas fa-truck"></i></td> 2325 <td>{{shippingmethod}}</td> 2326 <td colspan="2" class="u-ta-right" width="130">{{shippingfee}}</td> 2327 </tr> 2328 } 2329 2330 @helper RenderMiniCartPoints() { 2331 <text> 2332 {{#if earnings}} 2333 <tr> 2334 <td colspan="2">@Translate("Earnings")</td> 2335 <td colspan="2" class="u-ta-right" width="130"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</td> 2336 </tr> 2337 {{/if}} 2338 </text> 2339 } 2340 2341 @helper RenderMiniCartTotal() { 2342 <tr class="mini-cart-totals dw-mod"> 2343 <td colspan="2">@Translate("Total")</td> 2344 <td class="u-ta-right">{{numberofproducts}}</td> 2345 <td class="u-ta-right" width="130">{{totalprice}}</td> 2346 </tr> 2347 } 2348 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2349 2350 @using System 2351 @using System.Web 2352 @using System.Collections.Generic 2353 @using Dynamicweb.Rapido.Blocks.Extensibility 2354 @using Dynamicweb.Rapido.Blocks 2355 @using Dynamicweb.Ecommerce.Common 2356 2357 @{ 2358 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 2359 2360 Block masterScriptReferences = new Block() 2361 { 2362 Id = "MasterScriptReferences", 2363 SortId = 1, 2364 Template = RenderMasterScriptReferences() 2365 }; 2366 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 2367 } 2368 2369 @helper RenderMasterScriptReferences() { 2370 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js"></script> 2371 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 2372 2373 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 2374 2375 } 2376 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2377 2378 @using System 2379 @using System.Web 2380 @using System.Collections.Generic 2381 @using Dynamicweb.Rapido.Blocks.Extensibility 2382 @using Dynamicweb.Rapido.Blocks 2383 2384 @{ 2385 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 2386 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2387 2388 if (!navigationItemsHideSearch) 2389 { 2390 Block masterSearchScriptTemplates = new Block() 2391 { 2392 Id = "MasterSearchScriptTemplates", 2393 SortId = 1, 2394 Template = RenderSearchScriptTemplates() 2395 }; 2396 2397 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 2398 } 2399 } 2400 2401 @helper RenderSearchScriptTemplates() 2402 { 2403 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 2404 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 2405 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 2406 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2407 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 2408 2409 <script id="SearchGroupsTemplate" type="text/x-template"> 2410 {{#.}} 2411 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 2412 {{/.}} 2413 </script> 2414 2415 <script id="SearchProductsTemplate" type="text/x-template"> 2416 {{#each .}} 2417 {{#Product}} 2418 {{#ifCond template "!==" "SearchMore"}} 2419 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2420 @if (useFacebookPixel) 2421 { 2422 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 2423 } 2424 @if (useGoogleTagManager) 2425 { 2426 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 2427 } 2428 <div> 2429 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 2430 <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> 2431 <div class="u-pull--left"> 2432 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 2433 @if (!onlyPreview) 2434 { 2435 <div>{{price}}</div> 2436 } 2437 </div> 2438 </a> 2439 <div class="u-margin-left u-pull--right u-w80px"> 2440 <button class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 2441 onclick="Cart.AddToCart(event, { 2442 id: '{{productId}}', 2443 quantity: 1, 2444 productInfo: {{productInfo}} 2445 }); {{facebookPixelAction}}"> 2446 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 2447 </button> 2448 <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> 2449 </div> 2450 </div> 2451 </li> 2452 {{/ifCond}} 2453 {{#ifCond template "===" "SearchMore"}} 2454 {{>SearchMoreProducts}} 2455 {{/ifCond}} 2456 {{/Product}} 2457 {{else}} 2458 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2459 @Translate("Your search gave 0 results") 2460 </li> 2461 {{/each}} 2462 </script> 2463 2464 <script id="SearchMoreProducts" type="text/x-template"> 2465 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2466 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2467 @Translate("View all") 2468 </a> 2469 </li> 2470 </script> 2471 2472 <script id="SearchMorePages" type="text/x-template"> 2473 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2474 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2475 @Translate("View all") 2476 </a> 2477 </li> 2478 </script> 2479 2480 <script id="SearchPagesTemplate" type="text/x-template"> 2481 {{#each .}} 2482 {{#ifCond template "!==" "SearchMore"}} 2483 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2484 <div> 2485 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 2486 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 2487 <div class="u-pull--left"> 2488 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 2489 </div> 2490 </a> 2491 </div> 2492 </li> 2493 {{/ifCond}} 2494 {{#ifCond template "===" "SearchMore"}} 2495 {{>SearchMorePages}} 2496 {{/ifCond}} 2497 {{else}} 2498 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2499 @Translate("Your search gave 0 results") 2500 </li> 2501 {{/each}} 2502 </script> 2503 2504 <script id="SearchPagesTemplateWrap" type="text/x-template"> 2505 <div class="dropdown__column-header">@Translate("Pages")</div> 2506 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2507 {{>SearchPagesTemplate}} 2508 </ul> 2509 </script> 2510 2511 <script id="SearchProductsTemplateWrap" type="text/x-template"> 2512 <div class="dropdown__column-header">@Translate("Products")</div> 2513 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2514 {{>SearchProductsTemplate}} 2515 </ul> 2516 </script> 2517 } 2518 2519 2520 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2521 2522 @using System 2523 @using System.Web 2524 @using System.Collections.Generic 2525 @using Dynamicweb.Rapido.Blocks.Extensibility 2526 @using Dynamicweb.Rapido.Blocks 2527 2528 @{ 2529 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2530 2531 Block primaryBottomSnippets = new Block() 2532 { 2533 Id = "MasterJavascriptInitializers", 2534 SortId = 1, 2535 Template = RenderPrimaryBottomSnippets() 2536 }; 2537 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 2538 } 2539 2540 @helper RenderPrimaryBottomSnippets() { 2541 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode") != null ? Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode") : false; 2542 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2543 2544 <script> 2545 Wireframe.Init(@Converter.ToString(isWireframeMode).ToLower()); 2546 </script> 2547 2548 <script> 2549 document.addEventListener("shiftSlide", function () { 2550 if (bLazy != null) { 2551 bLazy.revalidate(); 2552 } 2553 }); 2554 2555 </script> 2556 if (useGoogleTagManager) 2557 { 2558 <script> 2559 document.addEventListener('addToCart', function(event) { 2560 var googleImpression = event.detail.cartItem.productInfo.googleImpression; 2561 dataLayer.push({ 2562 'event': 'addToCart', 2563 'ecommerce': { 2564 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency()', 2565 'add': { 2566 'products': [{ 2567 'name': googleImpression.name, 2568 'id': googleImpression.id, 2569 'price': googleImpression.price, 2570 'brand': googleImpression.brand, 2571 'category': googleImpression.category, 2572 'variant': googleImpression.variant, 2573 'quantity': event.detail.cartItem.quantity 2574 }] 2575 } 2576 } 2577 }); 2578 }); 2579 </script> 2580 } 2581 2582 <!--@Javascripts--> 2583 } 2584 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2585 2586 @using System 2587 @using System.Web 2588 @using System.Collections.Generic 2589 @using Dynamicweb.Rapido.Blocks 2590 2591 @{ 2592 BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master"); 2593 2594 } 2595 2596 <!DOCTYPE html> 2597 2598 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 2599 <head> 2600 <meta charset="utf-8" /> 2601 <title>@Model.Title</title> 2602 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> 2603 <meta name="robots" content="index, follow"> 2604 2605 <!-- Favicon --> 2606 <link href="@favicon" rel="icon" type="image/png"> 2607 2608 <!-- Font awesome --> 2609 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css" type="text/css"> 2610 2611 <!-- Flag icon --> 2612 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/css/flag-icon.min.css" type="text/css"> 2613 2614 <!-- Base (Default, wireframe) styles --> 2615 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 2616 2617 <!-- Rapido Css from Website Settings --> 2618 <link id="rapidoCss" rel="stylesheet" href="@autoCssLink" type="text/css"> 2619 2620 <!-- Ignite Css (Custom site specific styles) --> 2621 <link id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css" rel="stylesheet"> 2622 2623 <!-- Google fonts --> 2624 @{ 2625 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))); 2626 } 2627 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 2628 </head> 2629 2630 <body> 2631 2632 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 2633 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 2634 2635 2636 @helper RenderMasterHeader() { 2637 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 2638 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 2639 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 2640 2641 <header class="top-container @stickyTop dw-mod" id="Top"> 2642 @RenderBlockList(subBlocks) 2643 </header> 2644 } 2645 2646 @helper RenderMain() { 2647 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 2648 2649 <main class="site dw-mod"> 2650 @RenderBlockList(subBlocks) 2651 </main> 2652 } 2653 2654 @helper RenderPageContent() { 2655 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 2656 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 2657 2658 <div id="Page" class="page @pagePos"> 2659 <section class="center-container content-container dw-mod" id="content"> 2660 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2661 2662 2663 @{ 2664 string columnClass = "12"; 2665 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null ? true : false; 2666 string backgroundColorClass = Model.PropertyItem.GetString("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 2667 } 2668 2669 @if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 2670 { 2671 <div class="grid__col-12 grid__col--bleed-y"> 2672 @RenderNavigation(new 2673 { 2674 id = "breadcrumb", 2675 template = "Breadcrumb.xslt" 2676 }) 2677 </div> 2678 } 2679 2680 <div class="grid"> 2681 @if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) 2682 { 2683 var navigationMarkup = RenderNavigation(new 2684 { 2685 id = "leftnav", 2686 cssclass = "dwnavigation", 2687 startLevel = 2, 2688 expandmode = "all", 2689 endlevel = 5, 2690 template = "LeftNavigation.xslt" 2691 }); 2692 2693 if (!string.IsNullOrEmpty(navigationMarkup)) 2694 { 2695 <nav class="grid__col-md-3"> 2696 <div class="grid__cell"> 2697 @navigationMarkup 2698 </div> 2699 </nav> 2700 columnClass = "9"; 2701 } 2702 } 2703 <div class="grid__col-md-@columnClass grid__col--bleed"> 2704 <div class="grid"> 2705 @Model.Placeholder("dwcontent", "content", "default:true;sort:1") 2706 </div> 2707 </div> 2708 </div> 2709 2710 2711 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 2712 @if (backgroundColorClass != "") 2713 { 2714 <script> 2715 document.getElementById("Page").classList.add("@backgroundColorClass"); 2716 </script> 2717 } 2718 </section> 2719 </div> 2720 } 2721 2722 </body> 2723 </html> 2724 2725