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_ed41ba65365642e9844b472da1229eaa.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.Website.Services 4 @using Co3.Espresso.Website.Models.FrontEnd 5 @using Co3.Espresso.Website.Models.FrontEnd.Settings 6 @using Co3.Espresso.Website.Models.FrontEnd.Ecommerce 7 @using Co3.Espresso.Website.Models.FrontEnd.Handlebars 8 @using Co3.Lilly.Website.Models.Frontend.Ecommerce 9 @using Co3.Lilly.Website.Services 10 @using Dynamicweb.Core 11 @using Dynamicweb.Ecommerce.Common 12 @using Dynamicweb.Ecommerce.Products 13 @using Dynamicweb.Security.UserManagement 14 @using Group = Dynamicweb.Security.UserManagement.Group 15 @using ProductService = Co3.Espresso.Website.Services.ProductService 16 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 double productPriceBefore = 0; 37 if ( LillyProductService.Instance.GetBeforePrices( espressoProduct.Id, Context.LanguageID ) != null ) 38 { 39 productPriceBefore = (double) LillyProductService.Instance.GetBeforePrices( espressoProduct.Id, Context.LanguageID ); 40 } 41 42 } 43 44 @RenderingService.Instance.SectionEnd() 45 46 <div class="e-product js-e-product" data-product-id="@espressoProduct.Id" data-has-variants="@espressoProduct.HasVariants.ToString().ToLower()" data-variant-id="@espressoProduct.VariantId"> 47 48 @RenderingService.Instance.SectionStart( new SectionSettings 49 { 50 Classes = new ClassList( "e-section lilly-product-section" ) 51 } ) 52 <div class="col-12"> 53 <div class="row"> 54 <div class="col-12 col-sm-6 p-2 p-lg-6 mt-6 mt-sm-3"> 55 <div class="e-product-text-container py-lg-2"> 56 <h4 class="mb-1"> 57 @Translate( "eCom Product - Product Number - Text", "Number" ) @espressoProduct.Number 58 </h4> 59 <h1 class="e-product-name mt-0 mb-1 h2"> 60 @espressoProduct.Name <span class="@LillyProductService.Instance.HidePrices()">@espressoProduct.Price.Format()</span> 61 </h1> 62 @if ( productPriceBefore > 0 ) 63 { 64 <span class="@LillyProductService.Instance.HidePrices() text-muted" style="text-decoration: line-through;"> 65 @PriceService.Instance.FormatPrice( productPriceBefore ) 66 </span> 67 } 68 69 70 <div class="e-product-text mb-2 p-0 col-12 col-lg-9"> 71 @espressoProduct.DescriptionLong 72 </div> 73 74 <hr class="mt-3 mb-0" /> 75 76 <div class="@LillyProductService.Instance.HideBuyButton()"> 77 @RenderingService.Instance.PartialView( "ecom/product/partials/add-to-cart.cshtml", espressoProduct ) 78 </div> 79 @RenderingService.Instance.PartialView( "ecom/product/partials/add-to-favorites.cshtml", espressoProduct ) 80 @* } *@ 81 </div> 82 <a class="hidden-sm-down js-p-banner-next-section-link p-banner-next-section-link text-primary" style="left: 1.85em;" href=""> 83 <i class="material-icons p-banner-next-section-link-icon">keyboard_arrow_down</i> 84 </a> 85 </div> 86 87 <div class="col-12 col-sm-6 order-first"> 88 @RenderingService.Instance.PartialView( "ecom/product/partials/images.cshtml", espressoProduct ) 89 </div> 90 </div> 91 </div> 92 @RenderingService.Instance.SectionEnd() 93 94 @RenderingService.Instance.SectionStart( new SectionSettings 95 { 96 Classes = new ClassList( "col-12 pt-5" ), 97 ContentClasses = new ClassList( "col-12" ), 98 Collapsible = false 99 } )100 <p>101 <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>102 </p>103 @RenderingService.Instance.SectionEnd()104105106 @foreach ( KeyValuePair<string, EspressoProductList> relatedGroup in espressoProduct.RelatedGroups )107 {108 if ( relatedGroup.Value.Products.Any() )109 {110111 HandlebarsProductListItemTemplate handlebarsProductListItemTemplate = HandlebarsService.Instance.GetProductListItemTemplate( new HandlebarsProductListItemTemplateSettings() );112 string handlebarsTemplateName = string.Format( "{0}-{1}", espressoProduct.Id, "related-group" ).ToLower();113 string jsonSrc = string.Format( "{0}.{1}", jsDataPropertyPath, "relatedGroups" );114115 @RenderingService.Instance.SectionStart( new SectionSettings116 {117 Classes = new ClassList( "e-section py-2" )118 } )119 <div class="col-12">120 <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">121 <script class="js-e-handlebars-tmpl-@handlebarsTemplateName" type="text/x-handlebars-template">122 <div class="e-productlist-header">123 <p class="h2 text-center">{{name}}</p>124 </div>125 <div class="e-productlist-main">126 <div class="row">127 <div class="col-12">128 <div class="e-productlist">129 {{#if products}}130 <div class="row justify-content-center">131 {{#each products}}132 @RenderingService.Instance.PartialView( "ecom/productlist/partials/item.cshtml", handlebarsProductListItemTemplate )133 {{/each}}134 </div>135 {{/if}}136 </div>137 </div>138 </div>139 </div>140 </script>141142 </div>143 </div>144 @RenderingService.Instance.SectionEnd()145 }146 }147148149 @RenderingService.Instance.PartialView( "ecom/product/partials/metadata.cshtml", espressoProduct )150 @RenderingService.Instance.PartialView( "ecom/product/partials/gtm-tracking.cshtml", espressoProduct )151152 <code class="js-e-breadcrumb-item-append" data-text="@HttpUtility.HtmlAttributeEncode( espressoProduct.Name )" data-link="@HttpUtility.HtmlAttributeEncode( espressoProduct.Link )"></code>153154 <script>155 e4.data.set( '@jsDataPropertyPath', JSON.parse('@HttpUtility.JavaScriptStringEncode( JsonService.Instance.ToJson( espressoProduct ) )') )156 </script>157158 </div>159 @RenderingService.Instance.SectionStart( new SectionSettings() )160
keyboard_arrow_up