Error executing template "Designs/SkanskaMaskin/_parsed/index.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Dynamicweb.Data.DatabaseConnectionProvider.CreateConnection(Boolean open)
   at Dynamicweb.Data.Database.CreateConnection()
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
   at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductsBySql(CommandBuilder query, Boolean doRefactoring, Boolean bulkFill, Boolean useAssortments)
   at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductsByGroupIdAndSearchValue(String groupId, String topValue, String searchValue, String productVariantId, Boolean isFrontend, String productLanguageId, Boolean useAssortments)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.TryAddProducts(GroupNavigationItem groupItem, Group group, Int32 currentLevel, Int32 maxLevel, Page productPage, Page currentPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(GroupCollection groups, Page page, NavigationItem parentNode, Int32 thisLevel, Int32 maxLevel, Page productPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(Page page, NavigationItem parentNode)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.Process(NavigationItem node)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.ProcessTree(RootNavigationItem rootNode, NavigationType navigationType)
   at Dynamicweb.Frontend.XmlNavigation.MakeXml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, Int32 selectedAreaId)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, String name, String xsltPath, Int32 selectedAreaId, Boolean sitemapMode, NameValueCollection settings, NameValueCollection attributes, IncludeMode mode)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(NameValueCollection settings, NameValueCollection attributes)
   at CompiledRazorTemplates.Dynamic.RazorEngine_42652f6ad1604d6a9a8bc25254c32821.Execute() in D:\wwwroot\rental.skanska.se\Files\Templates\Designs\SkanskaMaskin\_parsed\index.parsed.cshtml:line 157
   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()
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:53,State:0,Class:20

1 <!DOCTYPE html> 2 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3 @using Newtonsoft.Json; 4 @using Newtonsoft.Json.Linq; 5 @using System.Xml; 6 @using System.Web; 7 @using Dynamicweb 8 @using Dynamicweb.Environment 9 @using Softgear.SkanskaMaskin.DataAccess.Helpers; 10 @using Softgear.SkanskaMaskin.Data.Business 11 @using Softgear.SkanskaMaskin.Data.Entities.Common 12 @using Softgear.SkanskaMaskin.Data.Entities.Product 13 14 @{ 15 /* Header */ 16 var headerHtml = ""; 17 var hbh = new HandleBarsHelper(); 18 var inputsList = new List<object>(); 19 20 var textData = new 21 { 22 empty = "Inga produkter hittades", 23 more = "Visa fler" 24 }; 25 26 inputsList.Add(new { name = "id", value = "" }); 27 inputsList.Add(new { name = "pid", value = "" }); 28 29 var autoCompleteData = new 30 { 31 method = "get", 32 action = "/service/search" 33 }; 34 35 var queryData = new 36 { 37 name = "q", 38 placeholder = @Translate("SOK_PRODUKT", "Sök produkt") 39 }; 40 41 var formData = new 42 { 43 method = "get", 44 action = "/sok", 45 useLoader = true, 46 autocomplete = autoCompleteData, 47 query = queryData, 48 inputs = inputsList.ToArray() 49 }; 50 51 var searchData = new 52 { 53 text = textData, 54 form = formData 55 }; 56 57 bool empty = true, single = false, plural = false; 58 if (string.IsNullOrWhiteSpace(GetGlobalValue("Global:Ecommerce.Order.OrderLines.TotalProductQuantity"))) 59 { 60 empty = true; 61 single = false; 62 plural = false; 63 } 64 else if (GetGlobalValue("Global:Ecommerce.Order.OrderLines.TotalProductQuantity") == "1") 65 { 66 empty = false; 67 single = true; 68 plural = false; 69 } 70 else 71 { 72 empty = false; 73 single = false; 74 plural = true; 75 } 76 77 var cartToggle = new 78 { 79 href = "/varukorg/", 80 textEmpty = @Translate("KUNDVAGNEN_AR_TOM", "Varukorgen är tom"), 81 textSingle = @Translate("PRODUKT_SINGULAR", "Produkt"), 82 textPlural = @Translate("PRODUKT_PLURAL", "Produkter"), 83 isEmpty = empty, 84 isSingle = single, 85 isPlural = plural, 86 count = string.IsNullOrWhiteSpace(GetGlobalValue("Global:Ecommerce.Order.OrderLines.TotalProductQuantity")) ? "0" : GetGlobalValue("Global:Ecommerce.Order.OrderLines.TotalProductQuantity") 87 }; 88 89 var navAccountData = new 90 { 91 authorized = new 92 { 93 href = "/dashboard/pahyra/produktgrupp", 94 toggle = "Byt" 95 }, 96 unauthorized = new 97 { 98 href = "/form/login", 99 text = "Logga in" 100 }, 101 form = new 102 { 103 method = "post", 104 actions = new 105 { 106 number = new 107 { 108 name = "code", 109 type = "tel", 110 pattern = "^[0-9-]{3,30}$", 111 placeholder = "Projektnr t.ex. 12345 eller 1234-56" 112 } 113 }, 114 inputs = new[]{ 115 new { 116 name = "accountcmd", 117 value = "changeProject" 118 } 119 } 120 } 121 }; 122 123 var headerJson = new 124 { 125 href = "/", 126 title = "Rental", 127 search = searchData, 128 cartToggle = cartToggle, 129 navAccount = navAccountData, 130 counter = new 131 { 132 counterLabel = "produkter valda", 133 emptyCount = "Inga", 134 actions = new 135 { 136 @return = new 137 { 138 text = "Beställ retur", 139 enable = "returns.selected" 140 } 141 } 142 }, 143 loginReminder = new 144 { 145 isBubble = true, 146 heading = "Är du redan kund?", 147 body = "Glöm då inte att logga in för att se priser och dina påbörjade varukorgar! <a href='/form/login' class='js-overlayTrigger'>Logga in</a>." 148 } 149 }; 150 hbh.registerHelper("json", "loginReminder"); 151 hbh.registerHelper("json", JsonConvert.SerializeObject(navAccountData)); 152 153 var partialPathList = new List<string> { "cart-toggle/index.hbs", "search/index.hbs", "nav-account/index.hbs", "return/index.hbs", "order-list/counter.hbs" }; 154 headerHtml = hbh.render("header/index.hbs", partialPathList, headerJson); 155 156 /* Navigering */ 157 var navigationData = RenderNavigation(new { template = "top-navigation.xslt", id = "top-navigation", startlevel = "1", endlevel = "1" }); 158 var formInputs = new List<object>(); 159 160 var formInput1 = new { name = "id", value = "" }; 161 var formInput2 = new { name = "pid", value = "" }; 162 163 formInputs.Add(formInput1); 164 formInputs.Add(formInput2); 165 166 var doc = new XmlDocument(); 167 168 /* Footer */ 169 var footerHtml = ""; 170 var primaryFooterNavData = RenderNavigation(new { template = "footer-primary-navigation.xslt", parenttag = "FooterPrimary" }); 171 doc.LoadXml(primaryFooterNavData); 172 var primaryJson = JObject.Parse(JsonConvert.SerializeXmlNode(doc)); 173 174 var secondaryFooterNavData = RenderNavigation(new { template = "footer-secondary-navigation.xslt", parenttag = "FooterSecondary" }); 175 doc.LoadXml(secondaryFooterNavData); 176 var secondaryJson = JObject.Parse(JsonConvert.SerializeXmlNode(doc)); 177 178 var footerText = GetString("Item.Area.Footer_Content"); 179 var copyrightText = GetString("Item.Area.Copyright"); 180 var customerCenters = CacheManager.GetFromCache<Dynamicweb.Security.UserManagement.UserCollection>(60, "customerCentersGroup4", () => Dynamicweb.Security.UserManagement.User.GetUsersByGroupID(4)); 181 var storeList = (from user in customerCenters.Where(y => y.Active) 182 select new 183 { 184 value = string.Format("?id=5&ObjectID={0}&Action=Detail", user.ID), 185 text = user.Name 186 }).OrderBy(x => x.text).ToList(); 187 188 storeList.Insert(0, new { value = "choose", text = Translate("Choose_KC", "Välj kundcenter") }); 189 190 var storesData = new 191 { 192 baseUrl = "/default.aspx", 193 redirect = "true", 194 className = "Control--light", 195 items = storeList.ToArray() 196 }; 197 198 var secondaryNavData = new 199 { 200 copyright = copyrightText, 201 target = "_blank", 202 items = secondaryJson.SelectToken("nav.secondaryNav"), 203 stores = storesData 204 }; 205 206 var footerJson2 = new 207 { 208 about = footerText, 209 primaryNav = primaryJson.SelectToken("nav.primaryNav"), 210 secondaryNav = secondaryNavData, 211 stores = storesData 212 }; 213 214 var partialList = new List<string> { "control/index.hbs" }; 215 footerHtml = hbh.render("footer/index.hbs", partialList, footerJson2); 216 217 var isLoggedIn = !string.IsNullOrEmpty(GetGlobalValue("Global:Extranet.UserID")); 218 var scriptloggedinhead = GetString("Item.Area.ScriptInloggadIHead"); 219 var scriptloggedinbody = GetString("Item.Area.ScriptInloggadIBody"); 220 } 221 222 <html class="App" lang="sv-se"> 223 <head> 224 @GetString("Item.Area.Script") 225 @RenderSnippet("scriptIHeadSnippet") 226 @if (isLoggedIn) 227 { 228 if (Context.Current.Request.GetString("authcmd") == "login") 229 { 230 @scriptloggedinhead 231 } 232 @RenderSnippet("scriptInloggadIHeadSnippet") 233 } 234 235 <!-- Begin Inspectlet Embed Code --> 236 <script type="text/javascript" id="inspectletjs"> 237 window 238 .__insp = window.__insp || []; 239 __insp 240 .push(['wid', 992683141]); 241 (function () { 242 function ldinsp() { if (typeof window.__inspld != "undefined") return; window.__inspld = 1; var insp = document.createElement('script'); insp.type = 'text/javascript'; insp.async = true; insp.id = "inspsync"; insp.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://cdn.inspectlet.com/inspectlet.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(insp, x); }; 243 setTimeout 244 (ldinsp, 500); document.readyState != "complete" ? (window.attachEvent ? window.attachEvent('onload', ldinsp) : window.addEventListener('load', ldinsp, false)) : ldinsp(); 245 })(); 246 </script> 247 <!-- End Inspectlet Embed Code --> 248 <meta charset="utf-8"> 249 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> 250 @GetValue("MetaTags") 251 252 @RenderSnippet("OGMetaTags") 253 254 <title>@GetValue("Title")</title> 255 @GetValue("CopyRightNotice") 256 257 @WebHelper.renderIcons() 258 @{ 259 260 var eyeBg = "url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8I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NyAtNDYgYzI3MyAtMTgyIDYzOSAtNDUxIDg3NwotNjQyIDI4NSAtMjI5IDczNCAtNjIwIDg2NSAtNzU1IGw0OSAtNTEgLTQ5IC01MSBjLTI4IC0yOCAtMTMzIC0xMjYgLTIzNQotMjE4IC02MzYgLTU3NCAtMTI1OCAtMTA0MCAtMTk2NSAtMTQ2OCAtOTMgLTU3IC0xNzMgLTEwMyAtMTc3IC0xMDMgLTUgMCAyCjE3IDE2IDM4IDQ3IDc2IDE3MCAzMTAgMjIzIDQyNyAxOTMgNDI1IDMxNyA4NzAgMzc5IDEzNTUgMjEgMTcxIDMwIDY4OCAxNQo4NzMgLTE4IDIxMyAtNzQgNTgwIC05OCA2NDQgLTggMjIgNCAxNiAxMDAgLTQ5eiIvPgo8cGF0aCBkPSJNNzc2MCA5OTg1IGMtNTQ4IC05NCAtOTg4IC00NTkgLTExNzUgLTk3NSAtNjAgLTE2NCAtODUgLTMxNyAtODUKLTUxMCAwIC0xNTEgMTAgLTIzOCA0MSAtMzY1IDY2IC0yNjUgMTkzIC00OTEgMzg3IC02ODkgMjMyIC0yMzYgNTI1IC0zODUgODU5Ci00MzUgOTMgLTE0IDMzMyAtMTQgNDI2IDAgMzI2IDQ5IDYwNyAxODggODQxIDQxNyAyMzYgMjMyIDM4NSA1MjUgNDM1IDg1OSAxNAo5MyAxNCAzMzMgMCA0MjYgLTQ5IDMyNiAtMTg4IDYwNyAtNDE3IDg0MSAtMjMyIDIzNiAtNTI1IDM4NSAtODU5IDQzNSAtOTUgMTUKLTM1OSAxMiAtNDUzIC00eiIvPgo8L2c+Cjwvc3ZnPgo=');"; 261 } 262 <link rel="stylesheet" href="/Files/Templates/Designs/SkanskaMaskin/css/index.css"> 263 <link rel="stylesheet" href="/Files/Templates/Designs/SkanskaMaskin/css/rental/rental.css?v1.11"> 264 <link rel="stylesheet" href="/Files/Templates/Designs/SkanskaMaskin/css/slimselect.min.css"> 265 <link rel="stylesheet" href="/Files/Templates/Designs/SkanskaMaskin/css/sg/product-panel.css"> 266 <style> 267 .Icon--eye { 268 background-image: @eyeBg width: 25px; 269 } 270 </style> 271 @GetValue("Stylesheets") 272 @GetValue("Javascripts") 273 </head> 274 <body class="App-body"> 275 276 @GetString("Item.Area.ScriptBody") 277 @WebHelper.renderIconHtml() 278 @headerHtml 279 <div class="Canvas" data-controller="canvas"> 280 <div class="Canvas-body"> 281 <div class="Canvas-col Canvas-col--left"> 282 @NavigationManager.renderMainNavigation(navigationData) 283 </div> 284 <div class="Canvas-col Canvas-col--right"> 285 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 286 @using Dynamicweb.Rendering; 287 @using Newtonsoft.Json.Linq 288 @using Softgear.SkanskaMaskin.Data.Business 289 @using Softgear.SkanskaMaskin.Data.Entities.Cart 290 @using Softgear.SkanskaMaskin.Data.Entities.Common 291 @using Softgear.SkanskaMaskin.Data.Entities.Product 292 @{ 293 var cartPreview = new CartPreview(); 294 var jr = new JsonRenderer(); 295 296 cartPreview.text = new CartText { empty = @Translate("Din varukorg är tom"), count = "Antal" }; 297 cartPreview.products = new List<ProductHolder>(); 298 299 foreach (LoopItem orderLine in GetLoop("OrderLines")) 300 { 301 cartPreview.products.Add(new ProductHolder { product = WebHelper.populateProduct(orderLine) }); 302 } 303 304 cartPreview.button = new Link { text = @Translate("Till varukorgen"), href = "/varukorg/" }; 305 306 var hbh2 = new HandleBarsHelper(); 307 var partialPathList2 = new List<string> { "cart-preview/items.hbs" }; 308 hbh2.registerHelper("json", WebHelper.serializeToJson(cartPreview)); 309 var cartPreviewHtml = hbh2.render("cart-preview/index.hbs", partialPathList2, cartPreview); 310 311 foreach (LoopItem orderLine in GetLoop("OrderLines")) 312 { 313 cartPreview.products.Add(new ProductHolder { product = WebHelper.populateProduct(orderLine) }); 314 } 315 316 var cartItems = GetLoop("OrderLines"); 317 cartItems = cartItems.OrderBy(item => item.GetString("Ecom:Product.Number")).ToList(); 318 } 319 320 <div class="CartPreview" data-controller=""> 321 <div class="CartPreview-content js-cartPreviewContent"> 322 <div class="Grid Grid--withGutter Grid--push"> 323 <div class="CartPreview-wrapper"> 324 <a href="/varukorg/" class="Button Button--fill Button--secondary"> 325 @Translate("Till varukorgen") 326 </a> 327 </div> 328 <ul class="CartPreview-list" id="js-CartPreviewList"> 329 330 @foreach (LoopItem orderLine in cartItems) 331 { 332 var imageSrc = WebHelper.getCdnImageUrl(orderLine.GetString("Ecom:Product.Number")); 333 var productName = orderLine.GetString("Ecom:Product.Name"); 334 var productNumber = orderLine.GetString("Ecom:Product.Number"); 335 var quantity = orderLine.GetString("Ecom:Order:OrderLine.Quantity"); 336 var orderLineId = orderLine.GetString("Ecom:Order:OrderLine.Id"); 337 338 <li class="CartPreview-listItem js-CartPreview-listItem" data-productid="@productNumber" data-quantity="@quantity" data-rentalperiod="@GetRentalPeriod(orderLine)" data-orderlineid="@orderLineId"> 339 <div class="Grid Grid--alignMiddle"> 340 <div class="Grid-cell u-size4of4"> 341 <div class="Product-tag"> 342 <div class="Product-tagText"> 343 @productNumber 344 </div> 345 </div> 346 347 <div class="CartPreview-description"> 348 <img src="@imageSrc" alt="@productName" class="CartPreview-image"> 349 <div class="CartPreview-header"> 350 351 <div><strong>@productName</strong></div> 352 <div class="js-CartPreview-price">308,00 kr/kalenderdag </div> 353 <div><strong><span class="CartPreview-countValue js-CartPreview-countValue">@quantity</span> st</strong>&nbsp;&nbsp;&nbsp; <span class="js-cartPreview-RentalPeriod">@GetRentalPeriod(orderLine)</span> </div> 354 <div class="CartPreview-price js-CartPreview-totalPrice"> 3 0000 kr(616 kr/dag)</div> 355 <p class="ProductPrice-error">Exakt pris kan ej hämtas</p> 356 </div> 357 </div> 358 </div> 359 </div> 360 </li> 361 362 } 363 </ul> 364 <div class="CartPreview-wrapper"> 365 <a href="/varukorg/" class="Button Button--fill Button--secondary"> 366 @Translate("Till varukorgen") 367 </a> 368 </div> 369 </div> 370 </div> 371 <script class="js-cartPreviewModel" type="application/json"> 372 @WebHelper.serializeToJson(cartPreview) 373 </script> 374 </div> 375 376 @functions { 377 string GetRentalPeriod(LoopItem item) 378 { 379 var rentalPeriod = string.Empty; 380 381 foreach (var i in item.GetLoop("Order.OrderLineFields")) 382 { 383 if (i.GetString("Ecom:Order:OrderLine.OrderLineField.SystemName") == "RentalPeriod") 384 { 385 rentalPeriod = i.GetString("Ecom:Order:OrderLine.OrderLineField.Value"); 386 break; 387 } 388 } 389 390 return rentalPeriod; 391 } 392 } 393 394 <script id="hb-cartPreview" type="text/x-handlebars-template"> 395 {{#each ./cartPreviewOrderlineList}} 396 <li class="CartPreview-listItem js-CartPreview-listItem" data-productid="{{productNumber}}" data-quantity="{{productQuantity}}" data-rentalperiod="{{productRentalPeriod}}" data-orderlineid="{{productOrderLineId}}"> 397 <div class="Grid Grid--alignMiddle"> 398 <div class="Grid-cell u-size4of4"> 399 <div class="Product-tag"> 400 <div class="Product-tagText"> 401 {{productNumber}} 402 </div> 403 </div> 404 405 <div class="CartPreview-description"> 406 <img src="{{productImage}}" alt="{{productName}}" class="CartPreview-image"> 407 <div class="CartPreview-header"> 408 409 <div><strong>{{productName}}</strong></div> 410 <div class="js-CartPreview-price"></div> 411 <div><strong><span class="CartPreview-countValue js-CartPreview-countValue">{{productQuantity}}</span> st</strong>&nbsp;&nbsp;&nbsp; <span class="js-cartPreview-RentalPeriod">{{productRentalPeriod}}</span> </div> 412 <div class="CartPreview-price js-CartPreview-totalPrice"></div> 413 <p class="ProductPrice-error">Exakt pris kan ej hämtas</p> 414 </div> 415 </div> 416 </div> 417 </div> 418 </li> 419 {{/each}} 420 </script> 421 <script id="hb-cartTotalQuantity" type="text/x-handlebars-template"> 422 <a class="CartToggle" href="/varukorg/" data-controller="cart-toggle" data-canvas="right" data-count="{{totalQuantity}}" data-empty-text="@Translate("Varukorgen är tom")" data-single-text="Produkt" data-plural-text="Produkter"> 423 <button class="CartToggle-close" role="button" aria-pressed="false"> 424 <div class="CartToggle-closeBars"> 425 <span class="CartToggle-closeBar"></span> 426 <span class="CartToggle-closeBar"></span> 427 </div> 428 </button> 429 <div class="CartToggle-wrapper"> 430 431 <span class="CartToggle-alt1">{{totalQuantity}}</span> 432 <span class="CartToggle-alt2">{{totalQuantity}} Produkt</span> 433 </div> 434 </a> 435 </script> 436 </div> 437 <div class="Canvas-bodyInner"> 438 <div class="Canvas-bodyState"></div> 439 <div class="Canvas-bodyContent"> 440 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 441 442 443 @{ 444 var scriptIHead = GetString("Item.Page.ScriptIHead.Value"); 445 var scriptIBody = GetString("Item.Page.ScriptIBody.Value"); 446 var scriptInloggadIHead = GetString("Item.Page.ScriptInloggadIHead.Value"); 447 var scriptInloggadIBody = GetString("Item.Page.ScriptInloggadIBody.Value"); 448 } 449 450 <section> 451 <div class="Stack"> 452 <div class="Container"> 453 @GetValue("DwContent(maincontent)") 454 </div> 455 </div> 456 </section> 457 458 @SnippetStart("scriptIHeadSnippet") 459 @scriptIHead 460 @SnippetEnd("scriptIHeadSnippet") 461 462 @SnippetStart("scriptIBodySnippet") 463 @scriptIBody 464 @SnippetEnd("scriptIBodySnippet") 465 466 @SnippetStart("scriptInloggadIHeadSnippet") 467 @scriptInloggadIHead 468 @SnippetEnd("scriptInloggadIHeadSnippet") 469 470 @SnippetStart("scriptInloggadIBodySnippet") 471 @scriptInloggadIBody 472 @SnippetEnd("scriptInloggadIBodySnippet") 473 </div> 474 @HttpContext.Current.Server.HtmlDecode(footerHtml) 475 </div> 476 </div> 477 </div> 478 479 <script> 480 (function(global) { 481 global.SKANSKA = @AccountManager.setGlobalState() 482 }(window)); 483 </script> 484 485 @GetString("Item.Area.ScriptBody") 486 @RenderSnippet("scriptIBodySnippet") 487 @if (isLoggedIn) 488 { 489 @scriptloggedinbody 490 @RenderSnippet("scriptInloggadIBodySnippet") 491 } 492 <script src="https://cdn.jsdelivr.net/npm/handlebars@latest/dist/handlebars.js"></script> 493 <script src="https://code.softgear.se/js/1.0/sg-query.es5.min.js"></script> 494 <!-- Polyfill to make LitePicker work with IE11 --> 495 <script> 496 window.MSInputMethodContext && document.documentMode && 497 document.write('<script src = "https://cdn.jsdelivr.net/npm/ie11-custom-properties@latest/ie11CustomProperties.js" ><\x2fscript > ');</script> 498 <script src="/Files/Templates/Designs/SkanskaMaskin/js/vendor/litepicker.min.js?v=1.0"></script> 499 <script src="/Files/Templates/Designs/SkanskaMaskin/js/vendor/slimselect.min.js?v=1.0"></script> 500 <script src="/Files/Templates/Designs/SkanskaMaskin/js/public/index.es5.min.js?v=1.9"></script> 501 <script src="/Files/Templates/Designs/SkanskaMaskin/js/public/sg.skanska.es5.min.js?v=1.58"></script> 502 </body> 503 </html>