No product found
Error executing template "Designs/randers-tegl/eCom7/CartV2/Step/sample-cart.roof.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_6a3e2c0eeac84bbf85fe69e9255bf7a1.Execute() in D:\dynamicweb.net\Solutions\Gotcha\randerstegl.cloud.dynamicweb-cms.com\files\Templates\Designs\randers-tegl\eCom7\CartV2\Step\sample-cart.roof.cshtml:line 3
   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 @{ 2 int orderlineCount = GetInteger("Ecom:Order.OrderLines.Count"); 3 var sampleIsInCart = System.Web.HttpContext.Current.Items["CurrentSampleInCart"].ToString().ToLower(); 4 } 5 6 @SnippetStart("ProductSampleCart") 7 @if (orderlineCount > 0) { 8 string cssClass = sampleIsInCart == "true" ? "product-cta__cart product-cta__cart--tease" : "product-cta__cart"; 9 10 <a href="/Default.aspx?Id=7921" class="@cssClass" data-orderline-count="@orderlineCount"><span class="product-cta__cart-text">@Translate("Translate_Your-cart")</span> 11 @if (System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/randers-tegl/images/icon-sample-cart.svg"))) { 12 <span class="icon icon-sample-cart"> 13 @System.IO.File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/randers-tegl/images/icon-sample-cart.svg")) 14 <span class="product-cta__cart-count">@orderlineCount</span></span> 15 } 16 </a> 17 } 18 @SnippetEnd("ProductSampleCart") 19 20 <script> 21 const cartTeaserText = document.querySelector('.product-cta__cart--tease .product-cta__cart-text'); 22 23 function stopTeasing(e) { 24 const cart = e.currentTarget; 25 26 if (cart) { 27 cartTeaserText.closest('.product-cta__cart--tease').classList.remove('product-cta__cart--tease'); 28 cartTeaserText.removeEventListener('transitionend', stopTeasing); 29 } 30 } 31 32 if (cartTeaserText) { 33 cartTeaserText.addEventListener('transitionend', stopTeasing); 34 } 35 </script> 36