Error executing template "Designs/identity_v2/eCom/Product/espresso.cshtml"
System.Exception: _dynamicwebProduct has variants and is not embedded in a list and VariantId or PrimaryVariantId is null/empty. Settings are: {"Product":null,"Id":"PM20143","LanguageId":null,"VariantId":"","PrimaryVariantId":"","EmbeddedInModelList":false}
at Co3.Espresso.Website.Models.FrontEnd.Ecommerce.EspressoProduct.Populate(ProductSettings settings)
at Co3.Espresso.Website.Services.ProductService.GetEspressoProduct(ProductSettings settings)
at CompiledRazorTemplates.Dynamic.RazorEngine_84936174ffa34933a81a7dbebb955dd3.Execute() in D:\dynamicweb.net\Solutions\id.espresso4.dk-e5\Files\Templates\Designs\identity_v2\eCom\Product\espresso.cshtml:line 30
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 Co3.Espresso.Website.TemplateBases.Paragraphs.Module
2 @using System.Web
3 @using Co3.Espresso.Base.Extensions
4 @using Co3.Espresso.Website.Models
5 @using Co3.Espresso.Website.Services
6 @using Co3.Espresso.Website.Models.FrontEnd
7 @using Co3.Espresso.Website.Models.FrontEnd.Settings
8 @using Co3.Espresso.Website.Models.FrontEnd.Ecommerce
9 @using Co3.Espresso.Website.Models.FrontEnd.Elements
10 @using Co3.Espresso.Website.Models.FrontEnd.Handlebars
11 @using Co3.ID.Dw.Helpers
12 @using Co3.ID.Dw.Models.Frontend.Ecommerce
13 @using Co3.ID.Dw.Models.Frontend.Users
14 @using Co3.ID.Dw.Services
15 @using Dynamicweb.Content.Items
16 @using Dynamicweb.Ecommerce.Common
17 @using Dynamicweb.Ecommerce.Products
18 @using Dynamicweb.Ecommerce.Products.Categories
19 @using Dynamicweb.Frontend
20 @using Dynamicweb.Security.UserManagement
21 @using Newtonsoft.Json
22 @using ProductService = Co3.Espresso.Website.Services.ProductService
23 @using RenderingService = Co3.Espresso.Website.Services.RenderingService
24
25 @{
26 ShopType shopContext = SiteContext.CurrentSiteContext();
27 User currentUser = PageView.Current().User;
28 bool isCustomerShop = (PageView.Current().Area.Item["IsCustomerShop"] != null && (bool)PageView.Current().Area.Item["IsCustomerShop"] == true);
29
30 IdentityProduct espressoProduct = (IdentityProduct) ProductService.Instance.GetEspressoProduct(
31 new ProductSettings()
32 {
33 Id = GetString("Ecom:Product.ID"),
34 VariantId = GetString("Ecom:Product.VariantID"),
35 PrimaryVariantId = GetString("Ecom:Product.DefaultVariantComboID")
36 }
37 );
38
39 HttpContext.Current.Items["IdentityProduct"] = espressoProduct;
40 string relewiseRecommendationsSettings = PageView.Current().Area.Item["RelewiseProductDetailsRecommendations"]?.ToString();
41 string relewiseShowRecommendations = PageView.Current().Area.Item["ShowRecommendations"]?.ToString();
42
43 ScriptService.Instance.AddScript("identity.pdf");
44 ScriptService.Instance.AddScript("identity.ui.popover");
45 ScriptService.Instance.AddScript("identity.swiper");
46
47 KeyValuePair<string, EspressoProductList> replacementProductGroup = espressoProduct.RelatedGroups.FirstOrDefault(rg => string.Equals(rg.Key, "RELGRP13"));
48 EspressoProduct replacementProduct = null;
49 if (replacementProductGroup.Value != null && replacementProductGroup.Value.Products.Any())
50 {
51 replacementProduct = replacementProductGroup.Value.Products.FirstOrDefault();
52 Product dwProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(replacementProduct.Id, replacementProduct.VariantId, Context.LanguageID);
53 if (dwProduct == null || !dwProduct.ShowInProductList || !dwProduct.Active)
54 {
55 replacementProduct = null;
56 }
57 }
58 }
59 @RenderingService.Instance.SectionEnd()
60
61 <div class="e-product js-e-product" data-has-variants="@espressoProduct.HasVariants.ToString().ToLower()" data-product-id="@espressoProduct.Id" data-variant-id="@espressoProduct.VariantId" data-show-in-list="@espressoProduct.ShowInProductList" data-active="@espressoProduct.DynamicwebProduct.Active">
62
63 @RenderingService.Instance.SectionStart(new SectionSettings
64 {
65 Classes = new ClassList("e-section pb-0 px-0"),
66 ContainerClasses = new ClassList("container-fluid overflow-hidden p-0"),
67 OuterRowClasses = new ClassList("row"),
68 InnerRowClasses = new ClassList("row"),
69 })
70 <div class="col-12">
71 <div class="row">
72 <div class="col-12 col-sm-4 px-sm-3">
73 <div class="e-product-text-container">
74 @if (!isCustomerShop)
75 {
76 <div class="d-block d-sm-none text-center no-gutters">
77 @RenderingService.Instance.PartialView("ecom/product/partials/identity-part-genders.cshtml", espressoProduct)
78 </div>
79 }
80 <div class="identity-corner-brackets-container identity-corner-brackets-left border-primary @(!isCustomerShop ? "py-1 px-2" : string.Empty ) my-2 bracket-productname">
81 <div class="identity-corner-brackets-wrapper border-primary">
82 <h1 class="e-product-name font-weight-bold h2 mb-0 ">
83 @espressoProduct.Name
84 </h1>
85 <p class="lead font-weight-normal mb-0">
86 @Translate("eCom Product - Product Number - Text", "Number") @espressoProduct.Number
87 </p>
88 </div>
89 </div>
90
91 @if (!isCustomerShop)
92 {
93 <div class="d-none d-sm-block no-gutters">
94 @RenderingService.Instance.PartialView("ecom/product/partials/identity-part-genders.cshtml", espressoProduct)
95 </div>
96 }
97 <div class="js-identity-prices-container d-flex justify-content-start">
98 @RenderingService.Instance.PartialView("ecom/product/partials/prices.cshtml", espressoProduct)
99 </div>
100 <div class="e-product-text mb-2 d-none d-sm-block">
101 @{
102 bool doTruncate = espressoProduct.DescriptionLong.StripHtml().Length > 180;
103 }
104 @RenderingService.Instance.SectionStart(new SectionSettings
105 {
106 Classes = new ClassList("identity-product-text js-identity-product-text p-0 m-0 position-relative"),
107 ContainerClasses = new ClassList("p-0 m-0"),
108 ContentClasses = new ClassList("col-12"),
109 Collapsible = doTruncate,
110 CollapseToggleTextCollapse = " ",
111 CollapseToggleTextExpand = " "
112 })
113 <div class="col-12">
114 @{
115 string description = espressoProduct.DescriptionLong;
116
117 if (doTruncate)
118 {
119 string truncatedDescription = espressoProduct.DescriptionLong.StripHtml().Substring(0, Math.Min(180, espressoProduct.DescriptionLong.StripHtml().Length));
120
121 description = string.Format("{0}...<span class='identity-inline-collapse-link'>{1}</span>", truncatedDescription, Translate("Product description - show more", "Vis mere"));
122 }
123
124 <div class="@(doTruncate ? "js-identity-product-description-truncated" : string.Empty)" data-full-text="@(doTruncate ? HttpUtility.HtmlAttributeEncode(espressoProduct.DescriptionLong) : string.Empty)" data-partial-text="@(doTruncate ? description : string.Empty)">
125 @description
126 </div>
127 }
128 </div>
129 @RenderingService.Instance.SectionEnd()
130 </div>
131
132 @RenderingService.Instance.PartialView("ecom/product/partials/add-to-cart.cshtml", espressoProduct)
133 @if ( shopContext == ShopType.B2B )
134 {
135 if (replacementProduct != null)
136 {
137 <div class="d-flex flex-column mb-2" style="gap:1em;">
138 <a class="btn btn-replacement btn-lg btn-block position-relative" href="@replacementProduct.Link">
139 @Translate("eCom Product - Replacement Product - Button", "View upgraded style")
140 </a>
141 </div>
142 }
143 <div class="d-flex flex-column mb-2" style="gap:1em;">
144 <a class="btn btn-primary btn-lg btn-block position-relative js-toggle-matrix-modal-btn" href="" data-toggle="modal" data-target=".js-e-product-matrix-modal">
145 @Translate("eCom Product - Open Matrix - Button", "Vælg størrelser")
146 </a>
147 </div>
148
149 } else if (shopContext == ShopType.CustomerShop)
150 {
151 if (replacementProduct != null)
152 {
153 <div class="d-flex flex-column mb-2" style="gap:1em;">
154 <a class="btn btn-replacement btn-lg btn-block position-relative" href="@replacementProduct.Link">
155 @Translate("eCom Product - Replacement Product - Button", "View upgraded style")
156 </a>
157 </div>
158 }
159 <a class="btn btn-primary position-relative mb-2 js-toggle-matrix-modal-btn js-toggle-matrix-modal-btn-customershop" href="#">
160 @Translate("eCom Product - Open Matrix - Button", "Vælg størrelser")
161 </a>
162 }
163 <div class="row d-block d-sm-none">
164 <div class="e-product-text mt-3 mb-4">
165 <div class="col-12">
166 @espressoProduct.DescriptionLong
167 </div>
168 </div>
169 </div>
170 @if (shopContext == ShopType.B2B && isCustomerShop == false)
171 {
172 <div class="e-product-downloads">
173 @RenderingService.Instance.PartialView("ecom/product/partials/part-downloads.cshtml", espressoProduct)
174 </div>
175 }
176 @if ((shopContext != ShopType.B2B && shopContext != ShopType.CustomerShop) && PageView.Current().IsBasketEnabled())
177 {
178 <div class="e-product-delivery font-weight-bold mb-2 text-heading">
179 @RenderingService.Instance.PartialView("ecom/product/partials/delivery-info.cshtml", espressoProduct)
180 </div>
181 }
182
183 </div>
184 </div>
185 <div class="col-12 col-sm-1"></div>
186 <div class="col-12 col-sm-7 order-first">
187 <div class="e-product-image-container js-e-product-images">
188 @RenderingService.Instance.PartialView("ecom/product/partials/images_swiper.cshtml", espressoProduct)
189 </div>
190 </div>
191
192 </div>
193 </div>
194 @RenderingService.Instance.SectionEnd()
195
196 @{
197 int uspPageContentPageId;
198 int.TryParse(PageView.Current().CurrentParagraph.Item["USPPageId"]?.ToString(), out uspPageContentPageId);
199 }
200 @if (uspPageContentPageId > 0 && shopContext == ShopType.B2B)
201 {
202 @RenderingService.Instance.SectionStart(new SectionSettings
203 {
204 Classes = new ClassList("e-section p-section mx-auto py-0"),
205 ContentClasses = new ClassList("col-12 col-lg-8 col-xl-7 mx-auto")
206 })
207 <div class="row">
208 @RenderPageContent(uspPageContentPageId)
209 </div>
210 @RenderingService.Instance.SectionEnd()
211
212 }
213 @RenderingService.Instance.SectionStart(new SectionSettings
214 {
215 Classes = new ClassList("e-section p-section mx-auto py-0"),
216 ContentClasses = new ClassList("col-12 mx-auto"),
217 InnerRowClasses = new ClassList("row js-identity-specifications-container identity-specifications-container"),
218
219
220 })
221
222
223
224 @RenderingService.Instance.SectionEnd()
225 @{
226 int detailsPageContetPageId;
227
228 int.TryParse(PageView.Current().Area.Item["ProductDetailsPage"]?.ToString(), out detailsPageContetPageId);
229 }
230
231
232 @if (detailsPageContetPageId > 0)
233 {
234 @RenderingService.Instance.SectionStart(new SectionSettings
235 {
236 Classes = new ClassList("e-section p-section mx-auto py-0"),
237 ContentClasses = new ClassList("col-12 col-lg-8 col-xl-7 mx-auto")
238 })
239 <div class="row">
240 @RenderPageContent(detailsPageContetPageId)
241 </div>
242 @RenderingService.Instance.SectionEnd()
243 }
244
245
246
247
248 @if (relewiseShowRecommendations == "True" && string.IsNullOrEmpty(relewiseRecommendationsSettings) == false)
249 {
250 @RenderingService.Instance.SectionStart(new SectionSettings
251 {
252 Classes = new ClassList("e-section py-1"),
253 ContentClasses = new ClassList("col-12 mx-auto"),
254 InnerRowClasses = new ClassList("row js-identity-recommendations-container"),
255 })
256
257 @RenderingService.Instance.SectionEnd()
258 }
259
260
261
262 @if (shopContext == ShopType.B2B)
263 {
264 @RenderingService.Instance.PartialView("eCom/Product/partials/part-product-matrix.cshtml", espressoProduct)
265 } else if (shopContext == ShopType.CustomerShop)
266 {
267 <div class="js-identity-customershop-matrix-modal-placeholder" data-product-id="@espressoProduct.Id" data-variant-id="@espressoProduct.VariantId" data-brand-code="@espressoProduct.BrandCode"></div>
268 }
269
270 @RenderingService.Instance.PartialView("ecom/product/partials/identity-part-sizeguide-modal.cshtml", espressoProduct)
271 @RenderingService.Instance.PartialView("ecom/product/partials/identity-part-deliveryinfo-modal.cshtml", espressoProduct)
272
273 @RenderingService.Instance.PartialView("ecom/product/partials/metadata.cshtml", espressoProduct)
274 @RenderingService.Instance.PartialView("ecom/product/partials/gtm-tracking.cshtml", espressoProduct)
275
276 <code class="js-e-breadcrumb-item-append" data-link="@HttpUtility.HtmlAttributeEncode(espressoProduct.Link)" data-text="@HttpUtility.HtmlAttributeEncode(espressoProduct.Name)"></code>
277
278 <script>
279 e4.data.set( '@(espressoProduct.Id)_VariantCombinationTree', JSON.parse('@HttpUtility.JavaScriptStringEncode(Co3.Espresso.Website.Services.JsonService.Instance.ToJson(espressoProduct.VariantCombinationTree))') );
280 e4.data.set( '@(espressoProduct.Id)_VariantCombinationIds', JSON.parse('@HttpUtility.JavaScriptStringEncode(Co3.Espresso.Website.Services.JsonService.Instance.ToJson(espressoProduct.VariantCombinations.Keys))') );
281 e4.data.set( '@(espressoProduct.Id)_PdfData', JSON.parse('@HttpUtility.JavaScriptStringEncode(RenderingService.Instance.PartialView("ecom/product/partials/part-pdf-data.cshtml", espressoProduct))') );
282 </script>
283
284 </div>
285 @RenderingService.Instance.SectionStart(new SectionSettings())
Rapport om företagens sociala ansvar, jfr § 99a i den danska bokföringslagen.
ID® ESG-rapport 2025/2026. Läs här