Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at Dynamicweb.Data.Database.CreateDataReader(IDbCommand command, CommandBehavior behavior)
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, CommandBehavior behavior, Int32 commandTimeout)
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
   at Dynamicweb.Ecommerce.Assortments.AssortmentRepository.GetAssortmentGroupHierarchy()
   at Dynamicweb.Ecommerce.Assortments.AssortmentService.GetCachedAssortmentHierarchies()
   at Dynamicweb.Ecommerce.Assortments.AssortmentService.GetAssortmentGroupHierarchy(String assortmentId, String languageId)
   at Dynamicweb.Ecommerce.Assortments.AssortmentService._Closure$__89-0._Lambda$__0(String id)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Dynamicweb.Ecommerce.Assortments.AssortmentService.HasAccessToGroup(Group group, User user)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(GroupCollection groups, Page page, NavigationItem parentNode, Int32 thisLevel, Int32 maxLevel, Page productPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(Page page, NavigationItem parentNode)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.Process(NavigationItem node)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.ProcessTree(RootNavigationItem rootNode, NavigationType navigationType)
   at Dynamicweb.Frontend.XmlNavigation.MakeXml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, Int32 selectedAreaId)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, String name, String xsltPath, Int32 selectedAreaId, Boolean sitemapMode, NameValueCollection settings, NameValueCollection attributes, IncludeMode mode)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(NameValueCollection settings, NameValueCollection attributes)
   at Dynamicweb.Rendering.TemplateBase`1.RenderNavigation(Object settings)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.b__66_0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.b__30_0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.b__64_0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.b__63_0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_b4d72f3e6e3c470db9a4aa81c8cd2203.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
ClientConnectionId:82d4282b-a67a-4d9d-9754-273e7283045d
Error Number:-2,State:0,Class:11

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