Exception in template (Designs/Rapido/_parsed/Page.parsed.cshtml): System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.dcdbebaeadcb.b__5f(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.dcdbebaeadcb.<>c__DisplayClass6.b__5(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.dcdbebaeadcb.<>c__DisplayClass2.b__0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.dcdbebaeadcb.b__5c(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.dcdbebaeadcb.<>c__DisplayClass6.b__5(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.dcdbebaeadcb.<>c__DisplayClass2.b__0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.dcdbebaeadcb.<>c__DisplayClass6.b__5(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.dcdbebaeadcb.<>c__DisplayClass2.b__0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.Write(TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.dcdbebaeadcb.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, DynamicViewBag viewBag, String cacheName)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @* Rapido version 3.0 *@ @using System.Web; @using Dynamicweb.Frontend @using Dynamicweb.Frontend.Devices @using Dynamicweb.Extensibility @using Dynamicweb.Content @using Dynamicweb.Security @using Dynamicweb.Core @using System @using System.Web @using System.IO @using Dynamicweb.Rapido.Blocks @functions { BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); string getFontFamily(params string[] items) { var itemParent = Pageview.AreaSettings; foreach (var item in items) { itemParent = itemParent.GetItem(item); if (itemParent == null) { return null; } } var googleFont = itemParent.GetGoogleFont("FontFamily"); if (googleFont == null) { return null; } return googleFont.Family.Replace(" ", "+"); } } @{ //Font settings var fonts = new string[] { getFontFamily("Layout", "HeaderFont"), getFontFamily("Layout", "SubheaderFont"), getFontFamily("Layout", "TertiaryHeaderFont"), getFontFamily("Layout", "Header", "ToolsFont"), getFontFamily("Layout", "Header", "NavigationFont"), getFontFamily("Layout", "MobileNavigation", "Font"), getFontFamily("ProductList", "Facets", "HeaderFont"), getFontFamily("ProductPage", "PriceFontDesign"), getFontFamily("Ecommerce", "SaleSticker", "Font"), getFontFamily("Ecommerce", "NewSticker", "Font"), getFontFamily("Ecommerce", "CustomSticker", "Font") }; string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; } @{ Block master = new Block() { Id = "Master", BlocksList = new List<Block> { new Block { Id = "MasterTopSnippets", SortId = 10 }, new Block { Id = "MasterMain", SortId = 20, Template = RenderMain(), SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MasterHeader", SortId = 10, Template = RenderMasterHeader(), SkipRenderBlocksList = true }, new Block { Id = "MasterPageContent", SortId = 20, Template = RenderPageContent() } } }, new Block { Id = "MasterFooter", SortId = 30 }, new Block { Id = "MasterReferences", SortId = 40 }, new Block { Id = "MasterBottomSnippets", SortId = 50 } } }; masterPage.Add(master); } @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ @using System.Text.RegularExpressions @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @*--- START: Base block renderers ---*@ @helper RenderBlockList(List<Block> blocks) { blocks = blocks.OrderBy(item => item.SortId).ToList(); foreach (Block item in blocks) { <!-- START: @item.Id --> if (item.Design == null) { @RenderBlock(item) } else if (item.Design.RenderType != RenderType.Hide) { if (item.Design.RenderType == RenderType.Row) { <div class="grid grid--align-content-start"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.Column) { string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; string size = item.Design.Size != null ? item.Design.Size : "12"; size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; <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"> @RenderBlock(item) </div> } if (item.SkipRenderBlocksList == true) { @RenderBlock(item) } } <!-- END: @item.Id --> } } @helper RenderBlock(Block item) { if (item.Template != null) { @BlocksPage.RenderTemplate(item.Template) } if (item.BlocksList.Count > 0 && item.SkipRenderBlocksList == false) { @RenderBlockList(item.BlocksList) } } @*--- END: Base block renderers ---*@ @* Include the Blocks for the page *@ @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); Block tagManager = new Block() { Id = "TagManager", SortId = 1, Template = RenderGoogleTagManager() }; Block facebookPixel = new Block() { Id = "FacebookPixel", SortId = 2, Template = RenderFacebookPixel() }; topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); } @helper RenderGoogleTagManager() { string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") != null ? Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") : ""; if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) { <script> (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','@GoogleTagManagerID'); </script> <!-- Google Tag Manager (noscript) --> <noscript> <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" height="0" width="0" style="display:none;visibility:hidden"></iframe> </noscript> <!-- End Google Tag Manager (noscript) --> } } @helper RenderFacebookPixel() { string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") != null ? Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") : ""; if (!string.IsNullOrWhiteSpace(FacebookPixelID)) { <!-- Facebook Pixel Code --> <script> !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '@FacebookPixelID'); fbq('track', 'PageView'); </script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> } } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); Block loginModal = new Block() { Id = "LoginModal", SortId = 10, Template = LoginModal() }; loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); } @helper LoginModal() { int pageId = Model.TopPage.ID; string userSignedInError = !Model.LogOnFailed ? "" : "checked"; string userSignedInErrorText = ""; int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); if (Model.LogOnFailed) { switch (Model.LogOnFailedReason) { case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordLengthInvalid: userSignedInErrorText = Translate("Password length is invalid"); break; case Dynamicweb.Security.UserManagement.LogOnFailedReason.IncorrectLogin: userSignedInErrorText = Translate("Invalid email or password"); break; case Dynamicweb.Security.UserManagement.LogOnFailedReason.ExceededFailedLogOnLimit: userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); break; case Dynamicweb.Security.UserManagement.LogOnFailedReason.LoginLocked: userSignedInErrorText = Translate("The user account is temporarily locked"); break; case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordExpired: userSignedInErrorText = Translate("The password has expired and needs to be renewed"); break; default: userSignedInErrorText = Translate("An unknown error occured"); break; } } <!-- Trigger for the login modal --> <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> <!-- Login modal --> <div class="modal-container"> <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> <div class="modal modal--xs" id="SignInModal"> <div class="modal__header"> <h2>@Translate("Sign in")</h2> </div> <div class="modal__body"> <form method="post" id="LoginForm" class="u-no-margin"> <input type="hidden" name="ID" value="@pageId" /> <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> <div class="field-error dw-mod">@userSignedInErrorText</div> <div class="form__field-group dw-mod"> <input type="checkbox" id="rememberMe" name="Autologin" checked="checked" value="True" class="form__control"> <label for="rememberMe"> @Translate("Remember me", "Remember me") </label> </div> <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> </form> </div> </div> </div> } @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") { <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ 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"; Block mobileHeader = new Block() { Id = "MobileTop", SortId = 10, Template = RenderMobileTop(), SkipRenderBlocksList = true }; mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); Block mobileHeaderNavigation = new Block() { Id = "MobileHeaderNavigation", SortId = 10, Template = RenderMobileHeaderNavigation(), SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MobileHeaderNavigationTrigger", SortId = 10, Template = RenderMobileHeaderNavigationTrigger() } } }; mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); Block mobileHeaderLogo = new Block() { Id = "MobileHeaderLogo", SortId = 20, Template = RenderMobileHeaderLogo(), SkipRenderBlocksList = true }; mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); Block mobileHeaderActions = new Block() { Id = "MobileHeaderActions", SortId = 30, Template = RenderMobileTopActions(), SkipRenderBlocksList = true }; mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); Block mobileHeaderSearch = new Block { Id = "MobileHeaderSearch", SortId = 10, Template = RenderMobileTopSearch() }; mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); Block mobileHeaderMiniCart = new Block { Id = "MobileHeaderMiniCart", SortId = 20, Template = RenderMobileTopMiniCart() }; Block mobileHeaderSearchBar = new Block() { Id = "MobileHeaderSearchBar", SortId = 30, Template = RenderMobileTopSearchBar() }; mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); switch (mobileTopLayout) { case "nav-left": mobileHeaderNavigation.SortId = 10; mobileHeaderLogo.SortId = 20; mobileHeaderActions.SortId = 30; mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); break; case "nav-right": mobileHeaderLogo.SortId = 10; mobileHeaderActions.SortId = 20; mobileHeaderNavigation.SortId = 30; mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); break; case "nav-search-left": mobileHeaderNavigation.SortId = 10; mobileHeaderLogo.SortId = 20; mobileHeaderActions.SortId = 30; mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); break; case "search-left": mobileHeaderActions.SortId = 10; mobileHeaderLogo.SortId = 20; mobileHeaderNavigation.SortId = 30; mobileHeaderMiniCart.SortId = 0; mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); break; } } @helper RenderMobileTop() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); <nav class="main-navigation-mobile dw-mod"> <div class="center-container top-container__center-container dw-mod"> <div class="grid grid--align-center"> @RenderBlockList(subBlocks) </div> </div> </nav> } @helper RenderMobileHeaderNavigation() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); <div class="grid__col-auto-width"> <ul class="menu dw-mod"> @RenderBlockList(subBlocks) </ul> </div> } @helper RenderMobileHeaderNavigationTrigger() { <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> </li> } @helper RenderMobileHeaderLogo() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); string firstPageId = Model.Area.FirstActivePage.ID.ToString(); string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); string mobileLogo = "/Files/Images/logo-dynamicweb.png"; if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) { mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; } if (Path.GetExtension(mobileLogo).ToLower() != ".svg") { mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; } else { mobileLogo = HttpUtility.UrlDecode(mobileLogo); } <div class="grid__col-auto"> <div class="logo dw-mod"> <a href="/Default.aspx?ID=@firstPageId"> <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> </a> </div> @RenderBlockList(subBlocks) </div> } @helper RenderMobileTopActions() { List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); <div class="grid__col-auto-width"> <ul class="menu dw-mod"> @RenderBlockList(subBlocks) </ul> </div> } @helper RenderMobileTopSearch() { <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> </label> </li> } @helper RenderMobileTopMiniCart() { int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); int cartPageId = GetPageIdByNavigationTag("CartPage"); double cartProductsCount = Model.Cart.TotalProductsCount; <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')"> <div class="mini-cart dw-mod"> <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"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> <div class="mini-cart__counter mini-cart__counter--inline dw-mod"> <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"> <div class="js-mini-cart-counter-content"> @cartProductsCount </div> </div> </div> </a> @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") { <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> } </div> </li> } @helper RenderMobileTopSearchBar() { string searchFeedId = ""; string searchSecondFeedId = ""; int groupsFeedId; int productsPageId = GetPageIdByNavigationTag("ProductsPage"); string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; string resultPageLink; string searchPlaceholder; string searchType = "product-search"; string searchTemplate; string searchContentTemplate = ""; string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; bool showGroups = true; if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") { searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = contentSearchPageLink; searchPlaceholder = Translate("Search page"); groupsFeedId = 0; searchType = "content-search"; searchTemplate = "SearchPagesTemplate"; showGroups = false; } else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") { searchFeedId = productsPageId + "&feed=true"; searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = Converter.ToString(productsPageId); searchPlaceholder = Translate("Search products or pages"); groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchType = "combined-search"; searchTemplate = "SearchProductsTemplateWrap"; searchContentTemplate = "SearchPagesTemplateWrap"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } else { resultPageLink = Converter.ToString(productsPageId); searchFeedId = productsPageId + "&feed=true"; groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchPlaceholder = Translate("Search products"); searchTemplate = "SearchProductsTemplate"; searchType = "product-search"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> <div class="main-navigation-mobile typeahead-mobile dw-mod"> <div class="center-container top-container__center-container dw-mod"> <div class="grid"> <div class="grid__col-auto"> <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"> <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> @if (string.IsNullOrEmpty(searchSecondFeedId)) { <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> } else { <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> <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> <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> </div> } <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> </div> </div> <div class="grid__col-auto-width"> <ul class="menu dw-mod"> <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> <i class="fas fa-times fa-1_5x"></i> </label> </li> </ul> </div> </div> </div> </div> } </text> <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideAccount"); bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); Block mobileNavigation = new Block() { Id = "MobileNavigation", SortId = 10, Template = MobileNavigation(), SkipRenderBlocksList = true }; mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); if (Model.CurrentUser.ID > 0) { Block mobileNavigationSignIn = new Block { Id = "MobileNavigationSignIn", SortId = 10, Template = RenderMobileNavigationSignIn() }; mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); } Block mobileNavigationMenu = new Block { Id = "MobileNavigationMenu", SortId = 20, Template = RenderMobileNavigationMenu() }; mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); Block mobileNavigationActions = new Block { Id = "MobileNavigationActions", SortId = 30, Template = RenderMobileNavigationActions(), SkipRenderBlocksList = true }; mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); if (!navigationItemsHideSignIn) { if (Model.CurrentUser.ID <= 0) { Block mobileNavigationSignInAction = new Block { Id = "MobileNavigationSignInAction", SortId = 10, Template = RenderMobileNavigationSignInAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); if (hideCreateAccountLink) { Block mobileNavigationCreateAccountAction = new Block { Id = "MobileNavigationCreateAccountAction", SortId = 20, Template = RenderMobileNavigationCreateAccountAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); } } else { if (hideMyProfileLink) { Block mobileNavigationProfileAction = new Block { Id = "MobileNavigationProfileAction", SortId = 10, Template = RenderMobileNavigationProfileAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationProfileAction); } if (hideMyOrdersLink) { Block mobileNavigationOrdersAction = new Block { Id = "MobileNavigationOrdersAction", SortId = 20, Template = RenderMobileNavigationOrdersAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); } if (hideMyFavoritesLink) { Block mobileNavigationFavoritesAction = new Block { Id = "MobileNavigationFavoritesAction", SortId = 30, Template = RenderMobileNavigationFavoritesAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); } Block mobileNavigationSignOutAction = new Block { Id = "MobileNavigationSignOutAction", SortId = 40, Template = RenderMobileNavigationSignOutAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); } } if (Model.Languages.Count > 1) { Block mobileNavigationLanguagesAction = new Block { Id = "MobileNavigationLanguagesAction", SortId = 50, Template = RenderMobileNavigationLanguagesAction() }; mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); } } @helper MobileNavigation() { List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; <!-- Trigger for mobile navigation --> <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> <!-- Mobile navigation --> <nav class="mobile-navigation mobile-navigation--@position dw-mod"> @RenderBlockList(subBlocks) </nav> <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> if (!onlyPreview) { <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> } } @helper RenderMobileNavigationSignIn() { int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; string myProfilePageLink = linkStart + myProfilePageId; string userName = Model.CurrentUser.FirstName != null ? Model.CurrentUser.FirstName : ""; userName += " " + Model.CurrentUser.LastName != null ? Model.CurrentUser.LastName : ""; userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; <ul class="menu menu-mobile"> <li class="menu-mobile__item"> <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> </li> </ul> } @helper RenderMobileNavigationMenu() { bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); int startLevel = renderPagesInToolBar ? 1 : 0; @RenderNavigation(new { id = "mobilenavigation", cssclass = "menu menu-mobile dwnavigation", startLevel = @startLevel, ecomStartLevel = @startLevel + 1, endlevel = @levels, expandmode = "all", template = @menuTemplate }) if (renderPagesInToolBar) { @RenderNavigation(new { id = "topToolsMobileNavigation", cssclass = "menu menu-mobile dwnavigation", template = "ToolsMenuForMobile.xslt" }) } } @helper RenderMobileNavigationActions() { List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; <ul class="menu menu-mobile"> @RenderBlockList(subBlocks) </ul> } @helper RenderMobileNavigationSignInAction() { <li class="menu-mobile__item"> <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> </li> } @helper RenderMobileNavigationCreateAccountAction() { int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); <li class="menu-mobile__item"> <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> </li> } @helper RenderMobileNavigationProfileAction() { int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); string myProfilePageLink = linkStart + myProfilePageId; <li class="menu-mobile__item"> <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> </li> } @helper RenderMobileNavigationOrdersAction() { int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); string myOrdersPageLink = linkStart + myOrdersPageId; <li class="menu-mobile__item"> <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> </li> } @helper RenderMobileNavigationFavoritesAction() { int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); string myFavoritesPageLink = linkStart + myFavoritesPageId; <li class="menu-mobile__item"> <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> </li> } @helper RenderMobileNavigationSignOutAction() { int pageId = Model.TopPage.ID; <li class="menu-mobile__item"> <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> </li> } @helper RenderMobileNavigationLanguagesAction() { bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; string selectedLanguage = ""; foreach (var lang in Model.Languages) { if (lang.IsCurrent) { selectedLanguage = lang.Name; } } <li class="menu-mobile__item dw-mod"> <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> <div class="menu-mobile__link__wrap"> <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> <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> </div> <ul class="menu-mobile menu-mobile__submenu expand-menu"> @if (isSlidesDesign) { <li class="menu-mobile__item dw-mod"> <div class="menu-mobile__link__wrap"> <label for="MobileMenuCheck_Language" class="menu-mobile__trigger menu-mobile__trigger--back"></label> <label for="MobileMenuCheck_Language" class="menu-mobile__link dw-mod ">Back</label> </div> </li> } @foreach (var lang in Model.Languages) { <li class="menu-mobile__item dw-mod"> <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> </li> } </ul> </li> }</text> } else { <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); bool navigationActionHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); bool showSearchIcon = false; string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; if (topLayout == "minimal" || topLayout == "minimal-right" || topLayout == "two-lines" || topLayout == "two-lines-centered") { showSearchIcon = true; } bool headerOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; if (renderPagesInToolBar && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") { Block masterTools = new Block() { Id = "MasterDesktopTools", SortId = 10, Template = RenderDesktopTools(), SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MasterDesktopToolsText", SortId = 10, Template = RenderDesktopToolsText(), Design = new Design { Size = "auto", HidePadding = true, RenderType = RenderType.Column } }, new Block { Id = "MasterDesktopToolsNavigation", SortId = 20, Template = RenderDesktopToolsNavigation(), Design = new Design { Size = "auto-width", HidePadding = true, RenderType = RenderType.Column } } } }; headerBlocksPage.Add(MasterBlockId.MasterHeader, masterTools); }; Block masterDesktopExtra = new Block() { Id = "MasterDesktopExtra", SortId = 10, Template = RenderDesktopExtra(), SkipRenderBlocksList = true }; headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopExtra); Block masterDesktopNavigation = new Block() { Id = "MasterDesktopNavigation", SortId = 20, Template = RenderDesktopNavigation(), SkipRenderBlocksList = true }; headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopNavigation); Block masterDesktopLogo = new Block { Id = "MasterDesktopLogo", SortId = 10, Template = RenderDesktopLogo(), Design = new Design { Size = "auto-width", HidePadding = true, RenderType = RenderType.Column } }; Block masterDesktopMenu = new Block { Id = "MasterDesktopMenu", SortId = 20, Template = RenderDesktopMenu(), Design = new Design() { Size = "auto", HidePadding = true, RenderType = RenderType.Column } }; Block masterDesktopActionsMenuContainer = new Block { Id = "MasterDesktopActionsMenuContainer", SortId = 30, Design = new Design { RenderType = RenderType.Column, Size = "auto" } }; Block masterDesktopActionsMenu = new Block { Id = "MasterDesktopActionsMenu", SortId = 10, Template = RenderDesktopActionsMenu(), SkipRenderBlocksList = true }; if (!navigationActionHideSearch && showSearchIcon) { Block masterDesktopActionsMenuSearch = new Block { Id = "MasterDesktopActionsMenuSearch", SortId = 10, Template = RenderMiniSearch() }; masterDesktopActionsMenu.Add(masterDesktopActionsMenuSearch); } Block masterDesktopActionsMenuSignIn = new Block { Id = "MasterDesktopActionsMenuSignIn", SortId = 20, Template = RenderSignIn() }; masterDesktopActionsMenu.Add(masterDesktopActionsMenuSignIn); if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) { Block masterDesktopActionsMenuFavorites = new Block { Id = "MasterDesktopActionsMenuFavorites", SortId = 30, Template = RenderFavorites() }; masterDesktopActionsMenu.Add(masterDesktopActionsMenuFavorites); } Block masterDesktopActionsMenuLanguageSelector = new Block { Id = "MasterDesktopActionsMenuLanguageSelector", SortId = 40, Template = RenderLanguageSelector() }; masterDesktopActionsMenu.Add(masterDesktopActionsMenuLanguageSelector); if (!headerOnlyPreview) { Block masterDesktopActionsMenuMiniCart = new Block { Id = "MasterDesktopActionsMenuMiniCart", SortId = 50, Template = RenderMiniCart() }; masterDesktopActionsMenu.Add(masterDesktopActionsMenuMiniCart); } if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) { Block masterDesktopActionsHeaderButton = new Block { Id = "MasterDesktopActionsHeaderButton", SortId = 60, Template = RenderHeaderButton() }; masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); } Block searchBar = new Block() { Id = "SearchBar", SortId = 40, Template = RenderSearchBar(), Design = new Design() { Size = "auto", HidePadding = true, RenderType = RenderType.Column } }; if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) { Block impersonationBar = new Block() { Id = "ImpersonationBar", SortId = 50, Template = RenderImpersonationBar(), Design = new Design() { Size = "auto-width", HidePadding = true, RenderType = RenderType.Column } }; headerBlocksPage.Add(MasterBlockId.MasterHeader, impersonationBar); } switch (topLayout) { case "condensed": //2 masterDesktopLogo.SortId = 10; masterDesktopLogo.Design.Size = "auto-width"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); masterDesktopMenu.SortId = 20; masterDesktopMenu.Design.Size = "auto"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); masterDesktopActionsMenuContainer.SortId = 30; masterDesktopActionsMenuContainer.Design.Size = "auto-width"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); if (!navigationActionHideSearch) { searchBar.SortId = 40; searchBar.Design.Size = "12"; masterDesktopExtra.SortId = 50; headerBlocksPage.Add("MasterDesktopExtra", searchBar); } break; case "minimal": //4 masterDesktopLogo.SortId = 10; masterDesktopLogo.Design.Size = "auto-width"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); masterDesktopMenu.SortId = 10; masterDesktopMenu.Design.Size = "auto"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); masterDesktopActionsMenuContainer.SortId = 20; masterDesktopActionsMenuContainer.Design.Size = "auto-width"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); break; case "minimal-right": //5 masterDesktopLogo.SortId = 10; masterDesktopLogo.Design.Size = "auto-width"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); masterDesktopMenu.SortId = 10; masterDesktopMenu.Design.Size = "auto"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); masterDesktopActionsMenuContainer.SortId = 20; masterDesktopActionsMenuContainer.Design.Size = "auto-width"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); break; case "two-lines": //6 masterDesktopLogo.SortId = 10; masterDesktopLogo.Design.Size = "auto"; headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); masterDesktopMenu.SortId = 10; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); masterDesktopActionsMenuContainer.SortId = 20; masterDesktopActionsMenuContainer.Design.Size = "auto-width"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); break; case "two-lines-centered": //7 masterDesktopLogo.SortId = 10; masterDesktopLogo.Design.Size = "auto"; headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); masterDesktopMenu.SortId = 10; masterDesktopMenu.Design.Size = "auto"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); masterDesktopActionsMenuContainer.SortId = 20; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); break; case "splitted": //3 masterDesktopLogo.SortId = 10; masterDesktopLogo.Design.Size = "auto"; headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); if (!navigationActionHideSearch) { searchBar.SortId = 20; searchBar.Design.Size = "auto"; headerBlocksPage.Add("MasterDesktopExtra", searchBar); } masterDesktopMenu.SortId = 10; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); masterDesktopActionsMenuContainer.SortId = 20; masterDesktopActionsMenuContainer.Design.Size = "auto-width"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); break; case "normal": //1 default: masterDesktopLogo.SortId = 10; headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); if (!navigationActionHideSearch) { searchBar.SortId = 20; headerBlocksPage.Add("MasterDesktopExtra", searchBar); } masterDesktopActionsMenuContainer.SortId = 30; headerBlocksPage.Add("MasterDesktopExtra", masterDesktopActionsMenuContainer); masterDesktopMenu.SortId = 10; masterDesktopActionsMenuContainer.Design.Size = "auto-width"; headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); break; } headerBlocksPage.Add("MasterDesktopActionsMenuContainer", masterDesktopActionsMenu); } @helper RenderDesktopTools() { List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); <div class="tools-navigation dw-mod"> <div class="center-container grid top-container__center-container dw-mod"> @RenderBlockList(subBlocks) </div> </div> } @helper RenderDesktopToolsText() { string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); <div class="u-margin-top">@toolsText</div> } @helper RenderDesktopToolsNavigation() { <div> @RenderNavigation(new { id = "topToolsNavigation", cssclass = "menu menu-tools dw-mod dwnavigation", template = "TopMenu.xslt" }) </div> } @helper RenderDesktopNavigation() { List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); <nav class="main-navigation dw-mod"> <div class="center-container top-container__center-container grid grid--align-center dw-mod"> @RenderBlockList(subBlocks) </div> </nav> } @helper RenderDesktopExtra() { List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); if (subBlocks.Count > 0) { <div class="header header-top dw-mod"> <div class="center-container top-container__center-container grid grid--align-center dw-mod"> @RenderBlockList(subBlocks) </div> </div> } } @helper RenderDesktopLogo() { string firstPageId = Model.Area.FirstActivePage.ID.ToString(); string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; string logoHeight = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetString("LogoHeight")) ? Model.Area.Item.GetItem("Layout").GetString("LogoHeight") : "40"; logoHeight = logoHeight != "0" ? logoHeight : "40"; if (Path.GetExtension(logo).ToLower() != ".svg") { logo = "/Admin/Public/GetImage.ashx?height=" + logoHeight + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; if (Pageview.Device.ToString() == "Mobile") { logoHeight = "40"; } } else { logo = HttpUtility.UrlDecode(logo); } <div class="logo @alignClass dw-mod"> <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> <img class="grid__cell-img logo__img dw-mod" src="@logo" /> </a> </div> } @helper RenderDesktopMenu() { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string menuAlignment = topLayout == "two-lines-centered" || topLayout == "minimal-right" ? "u-pull--right" : ""; bool megaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue.ToLower() == "true" ? true : false; string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); int startLevel = renderPagesInToolBar ? 1 : 0; <div class="grid__cell"> <div class="@menuAlignment"> @if (!megaMenu) { @RenderNavigation(new { id = "topnavigation", cssclass = "menu dw-mod dwnavigation u-full-max-width", startLevel = @startLevel, ecomStartLevel = @startLevel + 1, endlevel = 5, expandmode = "all", template = "BaseMenuWithDropdown.xslt" }); } else { @RenderNavigation(new { id = "topnavigation", cssclass = "menu dw-mod dwnavigation u-full-max-width", startLevel = @startLevel, ecomStartLevel = @startLevel + 1, endlevel = 5, promotionImage = megamenuPromotionImage, promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"), expandmode = "all", template = "BaseMegaMenu.xslt" }); } </div> </div> } @helper RenderDesktopActionsMenu() { List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); <ul class="menu dw-mod"> @RenderBlockList(subBlocks) </ul> } @helper RenderLanguageSelector() { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 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"; string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 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() : ""; if (Model.Languages.Count > 1) { <li class="@liClasses is-dropdown is-dropdown--no-icon"> <div class="@menuLinkClass menu__link--icon dw-mod"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> </div> <div class="menu menu--dropdown dw-mod"> @foreach (var lang in Model.Languages) { string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; if (languageViewType == "flag") { langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + "\"></span>"; } if (languageViewType == "name") { langInfo = lang.Name; } <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> } </div> </li> } } @helper RenderMiniCart() { bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); int cartPageId = GetPageIdByNavigationTag("CartPage"); bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; if (!onlyPreview && !navigationItemsHideCart) { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod" : "menu__item menu__item--horizontal menu--clean dw-mod"; string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue; bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; if (showPrice && counterPosition == "right") { cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; } <li class="@liClasses" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> <div class="mini-cart dw-mod"> <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="@menuLinkClass menu__link--icon dw-mod js-mini-cart-button"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> <div class="mini-cart__counter dw-mod"> <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"> <div class="js-mini-cart-counter-content"> @cartProductsCount @cartProductsTotalPrice </div> </div> </div> </a> @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") { <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> } </div> </li> } } @helper RenderSignIn() { bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); string userInitials = ""; int pageId = Model.TopPage.ID; int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideAccount"); bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); string linkStart = "/Default.aspx?ID="; if (Model.CurrentUser.ID <= 0) { linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; } string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; string myProfilePageLink = linkStart + myProfilePageId; string myOrdersPageLink = linkStart + myOrdersPageId; string myFavoritesPageLink = linkStart + myFavoritesPageId; string mySavedCardsPageLink = linkStart + mySavedCardsPageId; if (Model.CurrentUser.ID != 0) { if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) { string[] names = Model.CurrentUser.Name.Split(' '); userInitials += Model.CurrentUser.Name.Substring(0, 1); if (names.Length > 1) { userInitials += names[names.Length - 1].Substring(0, 1); } } else { userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; } } if (!navigationItemsHideSignIn) { string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 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"; string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; <li class="@liClasses is-dropdown is-dropdown--no-icon"> <div class="@menuLinkClass menu__link--icon dw-mod"> @if (Model.CurrentUser.ID <= 0) { <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> } else { <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> } </div> <div class="menu menu--dropdown sign-in-dropdown dw-mod"> <ul class="list list--clean dw-mod"> @if (Model.CurrentUser.ID <= 0) { <li> <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> </li> if (!hideCreateAccountLink) { <li> <a href="/default.aspx?ID=@createAccountPageId" class="list__link dw-mod">@Translate("Create account")</a> </li> } <li> <a href="@forgotPasswordPageLink" class="list__link dw-mod">@Translate("Forgot your password?")</a> </li> if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) { <li class="list__seperator dw-mod"></li> } } @if (!hideMyProfileLink) { <li> <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> </li> } @if (!hideMyOrdersLink) { <li> <a href="@myOrdersPageLink" class="list__link dw-mod"><i class="fas fa-list u-margin-right"></i>@Translate("My Orders")</a> </li> } @if (!hideMyFavoritesLink) { <li> <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> </li> } @if (!hideMySavedCardsLink) { <li> <a href="@mySavedCardsPageLink" class="list__link dw-mod"><i class="fas fa-credit-card u-margin-right"></i>@Translate("My Saved cards")</a> </li> } @if (Model.CurrentUser.ID > 0) { if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) { <li class="list__seperator dw-mod"></li> } <li> <a href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" class="list__link dw-mod">@Translate("Sign out")</a> </li> } </ul> </div> </li> } } @helper RenderFavorites() { bool navigationItemsHideFavorites = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); string linkStart = "/Default.aspx?ID="; if (Model.CurrentUser.ID <= 0) { linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; } string myFavoritesPageLink = linkStart + myFavoritesPageId; string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 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"; string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; <li class="@liClasses"> <a href="@myFavoritesPageLink" class="@menuLinkClass menu__link--icon dw-mod"> <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> </a> </li> } @helper RenderHeaderButton() { string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; <li class="menu__item menu__item--horizontal menu--clean dw-mod"> <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> </li> } @helper RenderSearchBar(string alignment = "left") { string searchFeedId = ""; string searchSecondFeedId = ""; int groupsFeedId; int productsPageId = GetPageIdByNavigationTag("ProductsPage"); string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; string resultPageLink; string searchPlaceholder; string searchType = "product-search"; string searchTemplate; string searchContentTemplate = ""; string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; bool showGroups = true; if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") { searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = contentSearchPageLink; searchPlaceholder = Translate("Search page"); groupsFeedId = 0; searchType = "content-search"; searchTemplate = "SearchPagesTemplate"; showGroups = false; } else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") { searchFeedId = productsPageId + "&feed=true"; searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = Converter.ToString(productsPageId); searchPlaceholder = Translate("Search products or pages"); groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchType = "combined-search"; searchTemplate = "SearchProductsTemplateWrap"; searchContentTemplate = "SearchPagesTemplateWrap"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } else { resultPageLink = Converter.ToString(productsPageId); searchFeedId = productsPageId + "&feed=true"; groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchPlaceholder = Translate("Search products"); searchTemplate = "SearchProductsTemplate"; searchType = "product-search"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" data-page-size="7" id="ProductSearchBar" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-groups-page-id="@groupsFeedId" data-search-type="@searchType"> @if (showGroups) { <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> <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> } <div class="typeahead-search-field"> <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> @if (string.IsNullOrEmpty(searchSecondFeedId)) { <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> } else { <div class="dropdown dropdown--absolute-position dropdown--combined grid @(alignment == "right" ? "dropdown--right-aligned" : "")"> <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> <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> </div> } </div> <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> </div> } @helper RenderMiniSearch() { string searchFeedId = ""; string searchSecondFeedId = ""; int groupsFeedId; int productsPageId = GetPageIdByNavigationTag("ProductsPage"); string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; string resultPageLink; string searchPlaceholder; string searchType = "product-search"; string searchTemplate; string searchContentTemplate = ""; string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; bool showGroups = true; if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") { searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = contentSearchPageLink; searchPlaceholder = Translate("Search page"); groupsFeedId = 0; searchType = "content-search"; searchTemplate = "SearchPagesTemplate"; showGroups = false; } else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") { searchFeedId = productsPageId + "&feed=true"; searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; resultPageLink = Converter.ToString(productsPageId); searchPlaceholder = Translate("Search products or pages"); groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchType = "combined-search"; searchTemplate = "SearchProductsTemplateWrap"; searchContentTemplate = "SearchPagesTemplateWrap"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } else { resultPageLink = Converter.ToString(productsPageId); searchFeedId = productsPageId + "&feed=true"; groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); searchPlaceholder = Translate("Search products"); searchTemplate = "SearchProductsTemplate"; searchType = "product-search"; showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); } <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()"> <div class="menu__link menu__link--icon dw-mod"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> </div> <div class="menu menu--dropdown u-w380px top-micro-search dw-mod"> <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"> <div class="typeahead-search-field"> <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@searchPlaceholder" value="@searchValue"> @if (string.IsNullOrEmpty(searchSecondFeedId)) { <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> } else { <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> <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> <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> </div> } </div> </div> </div> </li> } @helper RenderImpersonationBar() { int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); <div class="u-color-warning--bg"> <div class="center-container top-container__center-container dw-mod"> @*Impersonation*@ <div class="grid"> <div class="grid--align-self-center grid__col-x"> @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) { string stopImpersonateTranslation = Translate("Stop impersonation"); string username = ""; if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) { username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; } else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) { username = Model.CurrentSecondaryUser.Name; } else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) { username = Model.CurrentSecondaryUser.Email; } else { username = Model.CurrentSecondaryUser.UserName; } <div class="grid-cell"> <div class="u-pull--left u-bold u-margin-top"> <i class="fas fa-user-secret"></i> @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username </div> <form method="post" class="u-pull--right u-no-margin"> <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> </form> </div> } else { string viewListTranslation = Translate("View the list of users you can impersonate"); <div class="grid-cell u-bold"> <i class="fas fa-user-secret"></i> <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> </div> } </div> </div> </div> </div> } </text> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @functions { BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); } @{ string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content") : ""; string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content") : ""; string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content") : ""; string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header") : ""; string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header") : ""; string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header") : ""; Block masterFooterContent = new Block() { Id = "MasterFooterContent", SortId = 10, Template = RenderFooter(), SkipRenderBlocksList = true }; footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) { Block masterFooterColumnOne = new Block { Id = "MasterFooterColumnOne", SortId = 10, Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); } if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) { Block masterFooterColumnTwo = new Block { Id = "MasterFooterColumnTwo", SortId = 20, Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); } if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) { Block masterFooterColumnThree = new Block { Id = "MasterFooterColumnThree", SortId = 30, Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); } if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) { Block masterFooterNewsletterSignUp = new Block { Id = "MasterFooterNewsletterSignUp", SortId = 40, Template = RenderFooterNewsletterSignUp(), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); } if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) { Block masterFooterSocialLinks = new Block { Id = "MasterFooterSocialLinks", SortId = 50, Template = RenderFooterSocialLinks(), Design = new Design { Size = "auto", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); } if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) { Block masterFooterPayments = new Block { Id = "MasterFooterPayments", SortId = 60, Template = RenderFooterPayments(), Design = new Design { Size = "12", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); } Block masterFooterCopyright = new Block { Id = "MasterFooterCopyright", SortId = 70, Template = RenderFooterCopyright(), Design = new Design { Size = "12", RenderType = RenderType.Column } }; footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); } @helper RenderFooter() { List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); <footer class="footer dw-mod"> <div class="center-container top-container__center-container dw-mod"> <div class="grid grid--external-bleed-x"> @RenderBlockList(subBlocks) </div> </div> </footer> } @helper RenderFooterColumn(string header, string content) { <h3 class="footer__heading dw-mod">@header</h3> <div class="footer__content dw-mod"> @content </div> } @helper RenderFooterNewsletterSignUp() { string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> <div class="footer__content dw-mod"> <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> <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> <div class="form__field-combi"> <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' /> <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> </div> </form> </div> } @helper RenderFooterSocialLinks() { <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> <div class="footer__content dw-mod"> <div class="collection dw-mod"> @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) { var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; string socialIconClass = socialIcon.SelectedValue; string socialIconTitle = socialIcon.SelectedName; string socialLink = socialitem.GetString("Link"); <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px"><i class="@socialIconClass fa-2x"></i></a> } </div> </div> } @helper RenderFooterPayments() { <div class="footer__content dw-mod"> <div class="collection dw-mod"> @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) { var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; string paymentImage = null; string paymentTitle = paymentItem.SelectedName; ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); if (selected != null) { paymentImage = selected.Icon; } <div class="footer__card-type"> <img src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> </div> } </div> </div> } @helper RenderFooterCopyright() { <div class="grid__col-12 footer__copyright dw-mod"> <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> </div> } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); if (!navigationItemsHideCart) { Block miniCartScriptTemplates = new Block() { Id = "MasterMiniCartTemplates", SortId = 1, Template = RenderMiniCartScriptTemplates(), SkipRenderBlocksList = true, BlocksList = new List<Block> { new Block { Id = "MiniCartHeader", SortId = 10, Template = RenderMiniCartHeader() }, new Block { Id = "MiniCartOrderLines", SortId = 20, Template = RenderMiniCartOrderLines() }, new Block { Id = "MiniCartFees", SortId = 30, Template = RenderMiniCartFees() }, new Block { Id = "MiniCartPoints", SortId = 40, Template = RenderMiniCartPoints() }, new Block { Id = "MiniCartTotal", SortId = 50 , Template = RenderMiniCartTotal() } } }; miniCartBlocksPage.Add(MasterBlockId.MasterBottomSnippets, miniCartScriptTemplates); } } @helper RenderMiniCartScriptTemplates() { List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); int cartPageId = GetPageIdByNavigationTag("CartPage"); bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; string addingToCartNotification = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); <script id="MiniCartCounterContent" type="text/x-template"> {{#.}} <div class="js-mini-cart-counter-content dw-mod"> @if (showPriceInMiniCartCounter) { @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> } else { <text>{{numberofproducts}}</text> } </div> {{/.}} </script> <script id="MiniCartContent" type="text/x-template"> {{#.}} @if (useGoogleTagManager) { <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> } <div class="mini-cart-dropdown__inner {{isempty}} dw-mod"> <h4 class="u-ta-center u-no-margin u-margin-bottom u-margin-top">@Translate("Shopping cart")</h4> <div class="mini-cart-dropdown__body dw-mod"> <table class="table mini-cart-table dw-mod"> @RenderBlockList(subBlocks) </table> </div> <table class="table mini-cart-table dw-mod"> <tr class="mini-cart-orderlines__footer dw-mod"> <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> <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> </tr> </table> </div> {{/.}} </script> <script id="MiniCartOrderline" type="text/x-template"> <tr class="{{isempty}}"> <td><a href="{{link}}" class="{{hideimage}}"><img src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}"></a></td> <td> <a href="{{link}}" class="mini-cart-orderlines__name" title="{{name}}">{{name}}</a> {{#if variantname}} <a href="{{link}}" class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{variantname}}</a> {{/if}} {{#if unitname}} <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{unitname}}</div> {{/if}} </td> <td class="u-ta-right">{{quantity}}</td> <td class="u-ta-right"> {{#if pointsTotal}} <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") {{else}} {{totalprice}} {{/if}} </td> </tr> </script> <script id="MiniCartOrderlineDiscount" type="text/x-template"> <tr class="table__row--no-border {{isempty}}"> <td>&nbsp;</td> <td><div class="mini-cart-orderlines__name dw-mod">{{name}}</div></td> <td class="u-ta-right">&nbsp;</td> <td class="u-ta-right">{{totalprice}}</td> </tr> </script> if (!onlyPreview && addingToCartNotification == "modal") { <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> <script id="LastAddedProductTemplate" type="text/x-template"> <!-- Trigger for the login modal --> <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> <!-- Login modal --> <div class="modal-container"> <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> <div class="modal modal--md"> <div class="modal__header"> <h2>@Translate("Product is added to the cart")</h2> </div> <div class="modal__body"> <div class="grid"> <div> <a href="{{productInfo.link}}"><img src="{{productInfo.image}}" alt="{{productInfo.name}}" /></a> </div> <div class="u-padding"> <span>{{quantity}}</span> x </div> <div class="grid__col-auto"> <div>{{productInfo.name}}</div> {{#if productInfo.variantName}} <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> {{/if}} {{#if productInfo.unitName}} <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> {{/if}} </div> </div> <div class="modal__footer u-margin-top--lg"> <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> <a href="/cart" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> </div> </div> <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> </div> </div> </script> <script> document.addEventListener('addToCart', function (event) { Cart.ShowLastAddedProductModal(event.detail); }); </script> } else if (!onlyPreview && addingToCartNotification == "toggle") { <script> document.addEventListener('addToCart', function () { Cart.ToggleMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); }); </script> } } @helper RenderMiniCartHeader() { <thead> <tr> <td>&nbsp;</td> <td>@Translate("Product")</td> <td class="u-ta-right">@Translate("Qty")</td> <td class="u-ta-right" width="120">@Translate("Price")</td> </tr> </thead> } @helper RenderMiniCartOrderLines() { <text> {{#OrderLines}} {{#ifCond template "===" "CartOrderline"}} {{>MiniCartOrderline}} {{/ifCond}} {{#ifCond template "===" "CartOrderlineMobile"}} {{>MiniCartOrderline}} {{/ifCond}} {{#ifCond template "===" "CartOrderlineDiscount"}} {{>MiniCartOrderlineDiscount}} {{/ifCond}} {{/OrderLines}} </text> } @helper RenderMiniCartFees() { <tr> <td><i class="fas fa-credit-card"></i></td> <td>{{paymentmethod}}</td> <td colspan="2" class="u-ta-right" width="130">{{paymentfee}}</td> </tr> <tr> <td><i class="fas fa-truck"></i></td> <td>{{shippingmethod}}</td> <td colspan="2" class="u-ta-right" width="130">{{shippingfee}}</td> </tr> } @helper RenderMiniCartPoints() { <text> {{#if earnings}} <tr> <td colspan="2">@Translate("Earnings")</td> <td colspan="2" class="u-ta-right" width="130"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</td> </tr> {{/if}} </text> } @helper RenderMiniCartTotal() { <tr class="mini-cart-totals dw-mod"> <td colspan="2">@Translate("Total")</td> <td class="u-ta-right">{{numberofproducts}}</td> <td class="u-ta-right" width="130">{{totalprice}}</td> </tr> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @using Dynamicweb.Ecommerce.Common @{ BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); Block masterScriptReferences = new Block() { Id = "MasterScriptReferences", SortId = 1, Template = RenderMasterScriptReferences() }; referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); } @helper RenderMasterScriptReferences() { <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js"></script> <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> if (Model.Area.Item.GetItem("Settings").GetBoolean("UseCustomJavascript")) { <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> } } @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); if (!navigationItemsHideSearch) { Block masterSearchScriptTemplates = new Block() { Id = "MasterSearchScriptTemplates", SortId = 1, Template = RenderSearchScriptTemplates() }; searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); } } @helper RenderSearchScriptTemplates() { int productsPageId = GetPageIdByNavigationTag("ProductsPage"); string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); <script id="SearchGroupsTemplate" type="text/x-template"> {{#.}} <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> {{/.}} </script> <script id="SearchProductsTemplate" type="text/x-template"> {{#each .}} {{#Product}} {{#ifCond template "!==" "SearchMore"}} <li class="dropdown__item dropdown__item--seperator dw-mod"> @if (useFacebookPixel) { <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> } @if (useGoogleTagManager) { <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> } <div> <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> <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> <div class="u-pull--left"> <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> @if (!onlyPreview) { <div>{{price}}</div> } </div> </a> <div class="u-margin-left u-pull--right u-w80px"> <button class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" onclick="Cart.AddToCart(event, { id: '{{productId}}', quantity: 1, productInfo: {{productInfo}} }); {{facebookPixelAction}}"> <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> </button> <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> </div> </div> </li> {{/ifCond}} {{#ifCond template "===" "SearchMore"}} {{>SearchMoreProducts}} {{/ifCond}} {{/Product}} {{else}} <li class="dropdown__item dropdown__item--seperator dw-mod"> @Translate("Your search gave 0 results") </li> {{/each}} </script> <script id="SearchMoreProducts" type="text/x-template"> <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> @Translate("View all") </a> </li> </script> <script id="SearchMorePages" type="text/x-template"> <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> @Translate("View all") </a> </li> </script> <script id="SearchPagesTemplate" type="text/x-template"> {{#each .}} {{#ifCond template "!==" "SearchMore"}} <li class="dropdown__item dropdown__item--seperator dw-mod"> <div> <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> <div class="u-pull--left"> <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> </div> </a> </div> </li> {{/ifCond}} {{#ifCond template "===" "SearchMore"}} {{>SearchMorePages}} {{/ifCond}} {{else}} <li class="dropdown__item dropdown__item--seperator dw-mod"> @Translate("Your search gave 0 results") </li> {{/each}} </script> <script id="SearchPagesTemplateWrap" type="text/x-template"> <div class="dropdown__column-header">@Translate("Pages")</div> <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> {{>SearchPagesTemplate}} </ul> </script> <script id="SearchProductsTemplateWrap" type="text/x-template"> <div class="dropdown__column-header">@Translate("Products")</div> <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> {{>SearchProductsTemplate}} </ul> </script> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks.Extensibility @using Dynamicweb.Rapido.Blocks @{ BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); Block primaryBottomSnippets = new Block() { Id = "MasterJavascriptInitializers", SortId = 1, Template = RenderPrimaryBottomSnippets() }; bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); } @helper RenderPrimaryBottomSnippets() { bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode") != null ? Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode") : false; bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); <script> Wireframe.Init(@Converter.ToString(isWireframeMode).ToLower()); </script> if (useGoogleTagManager) { <script> document.addEventListener('addToCart', function(event) { var googleImpression = event.detail.cartItem.productInfo.googleImpression; dataLayer.push({ 'event': 'addToCart', 'ecommerce': { 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency()', 'add': { 'products': [{ 'name': googleImpression.name, 'id': googleImpression.id, 'price': googleImpression.price, 'brand': googleImpression.brand, 'category': googleImpression.category, 'variant': googleImpression.variant, 'quantity': event.detail.cartItem.quantity }] } } }); }); </script> } <!--@Javascripts--> } @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using System @using System.Web @using System.Collections.Generic @using Dynamicweb.Rapido.Blocks @{ BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master"); } <!DOCTYPE html> <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> <head> <meta charset="utf-8" /> <title>@Model.Title</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <meta name="robots" content="index, follow"> <!-- Favicon --> <link href="@favicon" rel="icon" type="image/png"> <!-- Font awesome --> <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css" type="text/css"> <!-- Flag icon --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/css/flag-icon.min.css" type="text/css"> <!-- Base (Default, wireframe) styles --> <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> <!-- Rapido Css from Website Settings --> <link id="rapidoCss" rel="stylesheet" href="@autoCssLink" type="text/css"> <!-- Ignite Css (Custom site specific styles) --> <link id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css" rel="stylesheet"> <!-- Google fonts --> @{ 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))); } <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> </head> <body> @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ @RenderBlockList(masterPage.BlocksRoot.BlocksList) @helper RenderMasterHeader() { List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; <header class="top-container @stickyTop dw-mod" id="Top"> @RenderBlockList(subBlocks) </header> } @helper RenderMain() { List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); <main class="site dw-mod"> @RenderBlockList(subBlocks) </main> } @helper RenderPageContent() { bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; <div id="Page" class="page @pagePos"> <section class="center-container content-container dw-mod" id="content"> @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> @{ string columnClass = "12"; bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null ? true : false; string backgroundColorClass = Model.PropertyItem.GetString("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; } @if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") { <div class="grid__col-12 grid__col--bleed-y"> @RenderNavigation(new { id = "breadcrumb", template = "Breadcrumb.xslt" }) </div> } <div class="grid"> @if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) { var navigationMarkup = RenderNavigation(new { id = "leftnav", cssclass = "dwnavigation", startLevel = 2, expandmode = "all", endlevel = 5, template = "LeftNavigation.xslt" }); if (!string.IsNullOrEmpty(navigationMarkup)) { <nav class="grid__col-md-3"> <div class="grid__cell"> @navigationMarkup </div> </nav> columnClass = "9"; } } <div class="grid__col-md-@columnClass grid__col--bleed"> <div class="grid"> @Model.Placeholder("dwcontent", "content", "default:true;sort:1") </div> </div> </div> @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ @if (backgroundColorClass != "") { <script> document.getElementById("Page").classList.add("@backgroundColorClass"); </script> } </section> </div> } </body> </html>