Error executing template "Designs/lilly/eCom/Product/espresso.cshtml"System.Exception: Product is not embedded in a list and does not have a variant id or a primary variant idat Co3.Espresso.Website.Models.FrontEnd.Ecommerce.EspressoProduct.Populate(ProductSettings settings) in C:\git\Espresso\Co3.Espresso.Website\Models\FrontEnd\Ecommerce\EspressoProduct.cs:line 635at Co3.Espresso.Website.Services.ProductService.GetEspressoProduct(ProductSettings settings) in C:\git\Espresso\Co3.Espresso.Website\Services\ProductService.cs:line 159at CompiledRazorTemplates.Dynamic.RazorEngine_ebeb4ae4f92f4b32b47011c87116effc.Execute() in E:\dynamicweb.net\SolutionsCustom\lilly.espresso4.dk\files\Templates\Designs\lilly\eCom\Product\espresso.cshtml:line 20at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Co3.Espresso.Website.TemplateBases.Paragraphs.Module 2 @using System.Web 3 @using Co3.Espresso.Base.Extensions 4 @using Co3.Espresso.Website.Services 5 @using Co3.Espresso.Website.Models.FrontEnd 6 @using Co3.Espresso.Website.Models.FrontEnd.Settings 7 @using Co3.Espresso.Website.Models.FrontEnd.Ecommerce 8 @using Co3.Espresso.Website.Models.FrontEnd.Handlebars 9 @using Co3.Lilly.Website.Models.Frontend.Ecommerce 10 @using Co3.Lilly.Website.Services 11 @using Dynamicweb.Core 12 @using Dynamicweb.Ecommerce.Common 13 @using Dynamicweb.Ecommerce.Products 14 @using Dynamicweb.Security.UserManagement 15 @using Group = Dynamicweb.Security.UserManagement.Group 16 @using ProductService = Co3.Espresso.Website.Services.ProductService 17 18 @{ 19 bool isUserAuthenticated = User.IsExtranetUserLoggedIn(); 20 LillyProduct espressoProduct = (LillyProduct) ProductService.Instance.GetEspressoProduct( 21 new ProductSettings() 22 { 23 Id = GetString( "Ecom:Product.ID" ), 24 VariantId = GetString( "Ecom:Product.VariantID" ), 25 PrimaryVariantId = GetString( "Ecom:Product.DefaultVariantComboID" ) 26 } 27 ); 28 string jsDataPropertyPath = espressoProduct.Id; 29 30 /*espressoProduct.RelatedGroups.Add( espressoProduct.LillyProductsInThisGroup.Id, espressoProduct.LillyProductsInThisGroup );*/ 31 espressoProduct.RelatedGroups.Add( espressoProduct.WhatAboutTheseProducts.Id, espressoProduct.WhatAboutTheseProducts ); 32 espressoProduct.RelatedGroups.Add( espressoProduct.CustomersWhoSawThisAlsoSaw.Id, espressoProduct.CustomersWhoSawThisAlsoSaw ); 33 espressoProduct.RelatedGroups.Add( espressoProduct.CustomersWhoBoughtThisItemAlsoBought.Id, espressoProduct.CustomersWhoBoughtThisItemAlsoBought ); 34 espressoProduct.RelatedGroups.Add( espressoProduct.YouHaveSeenTheseProducts.Id, espressoProduct.YouHaveSeenTheseProducts ); 35 } 36 37 @RenderingService.Instance.SectionEnd() 38 39 40 41 <div class="e-product js-e-product" data-product-id="@espressoProduct.Id" data-has-variants="@espressoProduct.HasVariants.ToString().ToLower()" data-variant-id="@espressoProduct.VariantId"> 42 43 @RenderingService.Instance.SectionStart( new SectionSettings 44 { 45 Classes = new ClassList( "e-section lilly-product-section" ) 46 } ) 47 <div class="col-12"> 48 <div class="row"> 49 <div class="col-12 col-sm-6 p-2 p-lg-6 mt-6 mt-sm-3"> 50 <div class="e-product-text-container py-lg-2"> 51 <h4 class="mb-1"> 52 @Translate( "eCom Product - Product Number - Text", "Number" ) @espressoProduct.Number 53 </h4> 54 <h1 class="e-product-name mt-0 mb-1 h2"> 55 @espressoProduct.Name <span class="@LillyProductService.Instance.HidePrices()">@espressoProduct.Price.Format()</span> 56 </h1> 57 @if ( espressoProduct.ShowBeforePrice && @espressoProduct.BeforePrice.Value > 0 && espressoProduct.BeforePrice.Value > espressoProduct.Price.Value ) 58 { 59 <span class="@LillyProductService.Instance.HidePrices() text-muted" style="text-decoration: line-through;"> 60 @espressoProduct.BeforePrice.Format() 61 </span> 62 } 63 64 <p></p> 65 66 <div class="e-product-text mb-2 p-0 col-12 col-lg-9"> 67 @espressoProduct.DescriptionLong 68 </div> 69 70 <hr class="mt-3 mb-0" /> 71 72 <div class="@LillyProductService.Instance.HideBuyButton()"> 73 <div class="d-flex"> 74 @RenderingService.Instance.PartialView( "ecom/product/partials/add-to-cart.cshtml", espressoProduct ) 75 </div> 76 </div> 77 78 @if ( isUserAuthenticated ) 79 { 80 81 if ( espressoProduct.IsPreorder == true ) 82 { 83 84 <div class="mb-2 js-lilly-preorder-info d-none"> 85 86 <span class="d-flex h4 small w-100"> 87 @Translate( "Preorder", "Preorder" ) <i class="font-weight-bold material-icons material-icons-fixed" style="font-size: 1.25em;">done</i> 88 </span> 89 90 <span class="d-flex small w-100"> 91 @Translate( "Preorder delivery text", "2-3 weeks delivery" ) 92 </span> 93 94 @if ( espressoProduct.PreorderDeliveryDate > DateTime.MinValue ) 95 { 96 if ( espressoProduct.PreorderDeliveryDate > DateTime.Today ) 97 { 98 <span class="d-flex small w-100">@Translate( "Expected delivery date", "Expected delivery date" ): @espressoProduct.PreorderDeliveryDateFormatted</span> 99 }100 }101102 </div>103 }104 }105106 @RenderingService.Instance.PartialView( "ecom/product/partials/add-to-favorites.cshtml", espressoProduct )107 @* } *@108 </div>109 <a class="hidden-sm-down js-p-banner-next-section-link p-banner-next-section-link text-primary" style="left: 1.85em;" href="">110 <i class="material-icons p-banner-next-section-link-icon">keyboard_arrow_down</i>111 </a>112 </div>113114 <div class="col-12 col-sm-6 order-first">115 @RenderingService.Instance.PartialView( "ecom/product/partials/images.cshtml", espressoProduct )116 </div>117 </div>118 </div>119 @RenderingService.Instance.SectionEnd()120121122 @if ( LillyProductService.Instance.IsB2B != true )123 {124 @RenderingService.Instance.SectionStart( new SectionSettings125 {126 Classes = new ClassList( "col-12 pt-5" ),127 ContentClasses = new ClassList( "col-12" ),128 Collapsible = false129 } )130 <p>131 <a href="/book-en-tid" class="arrow-right text-secondary h2">@Translate( "Book en tid i din LILLY butik", "Book en tid i din LILLY butik" )</a>132 </p>133 @RenderingService.Instance.SectionEnd()134 }135136 @foreach ( KeyValuePair<string, EspressoProductList> relatedGroup in espressoProduct.RelatedGroups )137 {138 if ( relatedGroup.Value.Products.Any() )139 {140141 HandlebarsProductListItemTemplate handlebarsProductListItemTemplate = HandlebarsService.Instance.GetProductListItemTemplate( new HandlebarsProductListItemTemplateSettings() );142 string handlebarsTemplateName = string.Format( "{0}-{1}", espressoProduct.Id, "related-group" ).ToLower();143 string jsonSrc = string.Format( "{0}.{1}", jsDataPropertyPath, "relatedGroups" );144145 @RenderingService.Instance.SectionStart( new SectionSettings146 {147 Classes = new ClassList( "e-section py-2" )148 } )149 <div class="col-12">150 <div class="e-productlist js-e-jsonpublisher" data-json-src="@jsonSrc" data-json-src-prop="@relatedGroup.Key" data-json-template-prop="" data-json-item-count="3" data-template-helpers="compare" data-json-item-count-prop="products" data-template=".js-e-handlebars-tmpl-@handlebarsTemplateName">151 <script class="js-e-handlebars-tmpl-@handlebarsTemplateName" type="text/x-handlebars-template">152 <div class="e-productlist-header">153 <p class="h2 text-center">{{name}}</p>154 </div>155 <div class="e-productlist-main">156 <div class="row">157 <div class="col-12">158 <div class="e-productlist">159 {{#if products}}160 <div class="row justify-content-center">161 {{#each products}}162 {{#if imagePrimary}}163 {{#compare stock.quantity '||' IsPreorder }}164 @RenderingService.Instance.PartialView( "ecom/productlist/partials/item.cshtml", handlebarsProductListItemTemplate )165 {{/compare}}166 {{/if}}167 {{/each}}168 </div>169 {{/if}}170 </div>171 </div>172 </div>173 </div>174 </script>175176 </div>177 </div>178 @RenderingService.Instance.SectionEnd()179 }180 }181182183 @RenderingService.Instance.PartialView( "ecom/product/partials/metadata.cshtml", espressoProduct )184 @RenderingService.Instance.PartialView( "ecom/product/partials/gtm-tracking.cshtml", espressoProduct )185186 <code class="js-e-breadcrumb-item-append" data-text="@HttpUtility.HtmlAttributeEncode( espressoProduct.Name )" data-link="@HttpUtility.HtmlAttributeEncode( espressoProduct.Link )"></code>187188 <script>189 e4.data.set( '@jsDataPropertyPath', JSON.parse('@HttpUtility.JavaScriptStringEncode( JsonService.Instance.ToJson( espressoProduct ) )') )190 @*e4.data.set( '@jsDataPropertyPath', JSON.parse('@HttpUtility.JavaScriptStringEncode( JsonService.Instance.ToJson( new191 {192 beforePrice = espressoProduct.BeforePrice,193 IsPreorder = espressoProduct.IsPreorder,194 PreorderDeliveryDate = espressoProduct.PreorderDeliveryDate,195 PreorderDeliveryDateFormatted = espressoProduct.PreorderDeliveryDateFormatted,196 QuickorderProductNumber = espressoProduct.QuickorderProductNumber,197 ShowBeforePrice = espressoProduct.ShowBeforePrice,198 //customersWhoBoughtThisItemAlsoBought = espressoProduct.CustomersWhoBoughtThisItemAlsoBought,199 customersWhoSawThisAlsoSaw = espressoProduct.CustomersWhoSawThisAlsoSaw,200 descriptionLong = espressoProduct.DescriptionLong,201 descriptionOneLine = espressoProduct.DescriptionOneLine,202 descriptionShort = espressoProduct.DescriptionShort,203 hasVariants = espressoProduct.HasVariants,204 id = espressoProduct.Id,205 imageCarouselVideoCount = espressoProduct.ImageCarouselVideoCount,206 imageDetails = espressoProduct.ImageDetails,207 imagePrimary = espressoProduct.ImagePrimary,208 isVariant = espressoProduct.IsVariant,209 isVariantMaster = espressoProduct.IsVariantMaster,210 lillyProductsInThisGroup = espressoProduct.LillyProductsInThisGroup,211 link = espressoProduct.Link,212 name = espressoProduct.Name,213 number = espressoProduct.Number,214 price = espressoProduct.Price,215 //relatedGroups = espressoProduct.RelatedGroups,216 stock = espressoProduct.Stock,217 variantCombinationTree = espressoProduct.VariantCombinationTree,218 variantCombinations = espressoProduct.VariantCombinations,219 variantGroups = espressoProduct.VariantGroups,220 variantId = espressoProduct.VariantId,221 variantSelectedOption = espressoProduct.VariantSelectedOption,222 vimeoVideoPlayerEmbedUrl = espressoProduct.VimeoVideoPlayerEmbedUrl,223 whatAboutTheseProducts = espressoProduct.WhatAboutTheseProducts,224 youHaveSeenTheseProducts = espressoProduct.YouHaveSeenTheseProducts225 }) )') )*@226 </script>227228229 </div>230 @RenderingService.Instance.SectionStart( new SectionSettings() )231
keyboard_arrow_up