Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.IO.IOException: The process cannot access the file 'E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\Translations.xml' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Dynamicweb.Rendering.Translation.Source.WriteDocument(XmlDocument document)
   at Dynamicweb.Rendering.Translation.Source.Save()
   at Dynamicweb.Rendering.Translation.Source.UpdateTranslationSource(Source source, IEnumerable`1 newKeys, String designName, IEnumerable`1 cultures)
   at Dynamicweb.Rendering.Template.TranslateText(String text, String defaultValue, String cultureName)
   at Dynamicweb.Rendering.TemplateBase`1.Translate(String text)
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<RenderSignInCustom>b__71_0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 3259
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<RenderDesktopToolsNavigationCustom>b__67_0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 3010
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 143
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<RenderDesktopTools>b__30_0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 1325
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<RenderMasterHeaderCustom>b__65_0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2986
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<RenderMainCustom>b__64_0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2972
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_62db7dfbfe9d4993a506036a3d558140.Execute() in E:\Dynamicweb\Solutions\Kruuse\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 4379
   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.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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