Error executing template "Designs/identity_v2/Paragraph/ID Infinite Slider.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_97fd1dd57b6e466693df1001b1cb18f6.Execute() in D:\dynamicweb.net\Solutions\staging-id.espresso4.dk-e5\Files\Templates\Designs\identity_v2\Paragraph\ID Infinite Slider.cshtml:line 65 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.Section 2 @using Co3.Espresso.Website.Models.FrontEnd.Elements 3 @using Co3.Espresso.Website.Models.FrontEnd.Settings 4 @using Co3.Espresso.Website.Services 5 @using Co3.ID.Dw.Models.Frontend.Ecommerce 6 @using Dynamicweb.Ecommerce.Common 7 @using Product = Dynamicweb.Ecommerce.Products.Product 8 @using Co3.ID.Dw.Services 9 @using RenderingService = Co3.Espresso.Website.Services.RenderingService 10 @using ProductService = Co3.Espresso.Website.Services.ProductService 11 12 @{ 13 string backgroundColor = Espresso.Item.BackgroundColor; 14 15 ScriptService.Instance.AddScript("identity.infinity-slider"); 16 } 17 18 19 @RenderingService.Instance.SectionEnd() 20 21 <section class="@Espresso.Container.Classes px-0 e-section js-e-section p-section-bg-@backgroundColor" 22 id="@Espresso.Id"> 23 24 <style> 25 @@media only screen and (max-width: 600px) { 26 --custom-marquee-slider--max-height: 400px; 27 } 28 </style> 29 30 <infinity-slider animation-duration="40" max-height="700px" image-width="100%" aspect-ratio="1/1"> 31 <div class="custom-marquee-slider--container"> 32 <div class="custom-marquee-slider--wrapper"> 33 <div class="custom-marquee-slider--children-wrapper"> 34 @foreach (dynamic InfiniteSlide in Espresso.Item.Slides) 35 { 36 EspressoImage InfiniteSlideImage = new EspressoImage(InfiniteSlide.Item); 37 38 InfiniteSlideImage.Width = 1440; 39 InfiniteSlideImage.Height = 0; 40 InfiniteSlideImage.Cropping = ImageService.Cropping.None; 41 string InfiniteSlideClassList = ""; 42 43 string selectedProductObject = InfiniteSlide.Product as string; 44 45 string hasLink = string.Empty; 46 47 string linkUrl = InfiniteSlide.Link; 48 49 if (!string.IsNullOrEmpty(selectedProductObject) && selectedProductObject.Contains("p_")) 50 { 51 string productId = string.Empty; 52 string variantId = string.Empty; 53 if (selectedProductObject.Contains(":")) 54 { 55 string[] splitIds = selectedProductObject.Split(':'); 56 productId = splitIds[0].Replace("p_", string.Empty); 57 variantId = splitIds[1]; 58 } 59 else 60 { 61 productId = selectedProductObject.Replace("p_", string.Empty); 62 } 63 64 Product dwProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(productId, variantId, Context.LanguageID); 65 IdentityProduct identityProduct = (IdentityProduct)ProductService.Instance.GetEspressoProduct( 66 new ProductSettings() 67 { 68 Id = dwProduct.Id, 69 VariantId = dwProduct.VariantId, 70 PrimaryVariantId = dwProduct.DefaultVariantComboId 71 } 72 ); 73 linkUrl = identityProduct.Link; 74 hasLink = "slider-child--haslink"; 75 } 76 else 77 { 78 if (InfiniteSlide.Link != "") 79 { 80 hasLink = "slider-child--haslink"; 81 } 82 } 83 84 <div class="custom-marquee-slider--child @hasLink"> 85 <img src="@InfiniteSlideImage.URL" alt=""> 86 @if (InfiniteSlide.Eyebrow != "" || InfiniteSlide.Heading != "" || InfiniteSlide.Text != "" || InfiniteSlide.Button != "") 87 { 88 <div class="custom-marquee-slider--child-content"> 89 <div> 90 @if (InfiniteSlide.Eyebrow != "") 91 { 92 <h4 class="mb-0">@InfiniteSlide.Eyebrow</h4> 93 } 94 @if (InfiniteSlide.Heading != "") 95 { 96 <h3 class="h2 mb-1">@InfiniteSlide.Heading</h3> 97 } 98 @if (InfiniteSlide.Text != "") 99 { 100 <p>@InfiniteSlide.Text</p> 101 } 102 @if (InfiniteSlide.Button != "" && !string.IsNullOrEmpty(linkUrl)) 103 { 104 <p> 105 <a href="@linkUrl" class="btn btn-primary">@InfiniteSlide.Button</a> 106 </p> 107 } 108 </div> 109 </div> 110 } 111 @if (!string.IsNullOrEmpty(linkUrl)) 112 { 113 <a class="custom-marquee-slider--full-link" href="@linkUrl"></a> 114 } 115 </div> 116 } 117 </div> 118 </div> 119 <!-- Duplicate images to create the infinite loop effect --> 120 <div class="custom-marquee-slider--wrapper"> 121 <div class="custom-marquee-slider--children-wrapper"> 122 123 @foreach (dynamic InfiniteSlide in Espresso.Item.Slides) 124 { 125 EspressoImage InfiniteSlideImage = new EspressoImage(InfiniteSlide.Item); 126 127 InfiniteSlideImage.Width = 1440; 128 InfiniteSlideImage.Height = 0; 129 InfiniteSlideImage.Cropping = ImageService.Cropping.None; 130 string InfiniteSlideClassList = ""; 131 string selectedProductObject = InfiniteSlide.Product as string; 132 string hasLink = string.Empty; 133 string linkUrl = InfiniteSlide.Link; 134 135 if (!string.IsNullOrEmpty(selectedProductObject) && selectedProductObject.Contains("p_")) 136 { 137 string productId = string.Empty; 138 string variantId = string.Empty; 139 if (selectedProductObject.Contains(":")) 140 { 141 string[] splitIds = selectedProductObject.Split(':'); 142 productId = splitIds[0].Replace("p_", string.Empty); 143 variantId = splitIds[1]; 144 } 145 else 146 { 147 productId = selectedProductObject.Replace("p_", string.Empty); 148 } 149 150 Product dwProduct = Dynamicweb.Ecommerce.Services.Products.GetProductById(productId, variantId, Context.LanguageID); 151 IdentityProduct identityProduct = (IdentityProduct)ProductService.Instance.GetEspressoProduct( 152 new ProductSettings() 153 { 154 Id = dwProduct.Id, 155 VariantId = dwProduct.VariantId, 156 PrimaryVariantId = dwProduct.DefaultVariantComboId 157 } 158 ); 159 linkUrl = identityProduct.Link; 160 hasLink = "slider-child--haslink"; 161 } 162 else 163 { 164 if (InfiniteSlide.Link != "") 165 { 166 hasLink = "slider-child--haslink"; 167 } 168 } 169 170 <div class="custom-marquee-slider--child @hasLink"> 171 <img src="@InfiniteSlideImage.URL" alt=""> 172 @if (InfiniteSlide.Eyebrow != "" || InfiniteSlide.Heading != "" || InfiniteSlide.Text != "" || InfiniteSlide.Button != "") 173 { 174 <div class="custom-marquee-slider--child-content"> 175 <div> 176 @if (InfiniteSlide.Eyebrow != "") 177 { 178 <h4 class="mb-0">@InfiniteSlide.Eyebrow</h4> 179 } 180 @if (InfiniteSlide.Heading != "") 181 { 182 <h3 class="h2 mb-1">@InfiniteSlide.Heading</h3> 183 } 184 @if (InfiniteSlide.Text != "") 185 { 186 <p>@InfiniteSlide.Text</p> 187 } 188 @if (InfiniteSlide.Button != "" && !string.IsNullOrEmpty(linkUrl)) 189 { 190 <p> 191 <a href="@linkUrl" class="btn btn-primary">@InfiniteSlide.Button</a> 192 </p> 193 } 194 </div> 195 </div> 196 } 197 @if (!string.IsNullOrEmpty(linkUrl)) 198 { 199 <a class="custom-marquee-slider--full-link" href="@linkUrl"></a> 200 } 201 </div> 202 } 203 </div> 204 </div> 205 </div> 206 </infinity-slider> 207 </section> 208 209 @RenderingService.Instance.SectionStart(new SectionSettings())
" Mit arbejde giver mig tilfredshed "
- Mathias, 23 år
MATHIAS
Skovhugger, 24 år
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmodtempor incididunt
ut labore et dolore magna aliqua. Lorem ipsum
dolor sit amet, consecteipiscing elit, sed do
eiusmodtempor incididunt ut labore et dolore
magna aliqua.
QUALITY
NEEDS NO
LABEL

SHOP THE LOOK
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec condimentum metus sit amet arcu auctor.
Sed venenatis urna id gravida viverra. Integer ipsum augue, feugiat eget lobortis vitae, ullamcorper eget dui.
No. S85 SEVEN SEAS The Jersey | modern | dame
No. S85 SEVEN SEAS The Jersey | modern | dame
kr. 559,00 (kr. 447,20 ekskl. moms )
+ 2 farver
{"item_name":"SEVEN SEAS The Jersey | modern | dame","item_id":"PROD2222","price":"559.00","item_brand":"SS","item_category":"Skjorter","item_variant":"Grå"}
No. S910 SEVEN SEAS The car coat | dame
No. S910 SEVEN SEAS The car coat | dame
kr. 1.379,00 (kr. 1.103,20 ekskl. moms )
{"item_name":"SEVEN SEAS The car coat | dame","item_id":"PROD2360","price":"1,379.00","item_brand":"SS","item_category":"Overtøj","item_variant":"Navy"}
{"item_name":"T-TIME® T-shirt","item_id":"PROD860","price":"109.00","item_brand":"ID","item_category":"T-shirts","item_variant":"Bordeaux"}
Error executing template "Designs/identity_v2/ecom/productlist/partials/item.cshtml" System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Co3.ID.Dw.Services.ProductService.GetFrontImage(IdentityProduct product) at Co3.ID.Dw.Models.Frontend.Ecommerce.IdentityProduct.get_ListItemHoverImage() at CompiledRazorTemplates.Dynamic.RazorEngine_80889a91c0a34bb0900d610a5b578891.Execute() in D:\dynamicweb.net\Solutions\staging-id.espresso4.dk-e5\Files\Templates\Designs\identity_v2\ecom\productlist\partials\item.cshtml:line 29 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 ViewModelTemplate< Co3.ID.Dw.Models.Frontend.Ecommerce.IdentityProduct > 2 @using Co3.Espresso.Base.Extensions 3 @using Co3.Espresso.Website.Models.FrontEnd.Ecommerce 4 @using Co3.Espresso.Website.Models.FrontEnd.Elements 5 @using Co3.Espresso.Website.Models.FrontEnd.Handlebars 6 @using Co3.Espresso.Website.Models.FrontEnd.Settings 7 @using Co3.Espresso.Website.Services 8 @using Co3.ID.Dw.Helpers 9 @using Co3.ID.Dw.Models.Frontend.Ecommerce 10 @using Co3.ID.Dw.Models.Frontend.Users 11 @using Dynamicweb.Rendering 12 @using Co3.ID.Dw.Services 13 @using Dynamicweb.Frontend 14 @using Dynamicweb.Security.UserManagement 15 @using RenderingService = Co3.Espresso.Website.Services.RenderingService 16 17 @{ 18 string productName = Model.Name; 19 string productNumber = Model.Number; 20 21 User currentUser = PageView.Current().User; 22 ShopType shopContext = SiteContext.CurrentSiteContext(); 23 bool isCustomerShop = (PageView.Current().Area.Item["IsCustomerShop"] != null && (bool)PageView.Current().Area.Item["IsCustomerShop"] == true); 24 string discountGroup = currentUser != null ? currentUser.GetCustomFieldValue< string >( "DiscountGroup" ) : string.Empty; 25 bool showPrices = !isCustomerShop || UserContext.Current.CustomerShop != null && UserContext.Current.CustomerShop.Settings.ShowPrices == true; 26 27 string hoverImage = string.Empty; 28 29 if (!isCustomerShop && Model.ListItemHoverImage != null) 30 { 31 hoverImage = Model.ListItemHoverImage.Medium; 32 } 33 34 bool showBrands = Model.BrandCode == "SS" || Model.BrandCode == "GEYSER" || Model.BrandCode == "PRO WEAR"; 35 } 36 37 <div class="e-block-link e-productlist-item js-e-block-link js-e-productlist-item js-e-productlist-item- p-1" data-product-id="@Model.Id" data-variant-id="@Model.VariantId" data-brand-code="@Model.BrandCode"> 38 @if (showBrands) 39 { 40 <div class="productlist-brand-wrapper"> 41 @if ( Model.BrandCode == "SS" ) 42 { 43 @ImageService.Instance.GetSvgMarkup( "/Files/Images/products/Labels/SevenSeasByID.svg" ) 44 } 45 @if ( Model.BrandCode == "GEYSER" ) 46 { 47 @ImageService.Instance.GetSvgMarkup( "/Files/Images/products/Labels/GEYSER.svg" ) 48 } 49 @if ( Model.BrandCode == "PRO WEAR" ) 50 { 51 @ImageService.Instance.GetSvgMarkup( "/Files/Images/products/Labels/ProWearByID.svg" ) 52 } 53 </div> 54 } 55 56 57 <div class="productlist-label-container"> 58 @if ( Model.ProductLabels != null ) 59 { 60 foreach ( IdentityProductLabel label in Model.ProductLabels ) 61 { 62 <span class="productlist-label label-@label.ClassName ">@label.Text</span> 63 } 64 } 65 66 </div> 67 68 <div class="e-productlist-item-container"> 69 <div class="e-productlist-item-image-container"> 70 <a class="e-productlist-item-image-wrapper" href="@Model.Link"> 71 <img alt="@Model.Name" class="e-productlist-item-image js-e-productlist-item-image" src="@Model.ImagePrimary.Medium" data-base-image="@Model.ImagePrimary.Medium" data-hover-image="@hoverImage"> 72 </a> 73 74 @if (Model.VariantPrimaryImages != null && Model.VariantPrimaryImages.Any() ) 75 { 76 <div class="identity-variant-listitem-select-option-container d-none d-md-block"> 77 <div class="d-flex identity-variant-listitem-select-option-wrapper"> 78 79 @{ 80 int variantCount = Model.VariantPrimaryImages.Count; 81 int variantCountTake = variantCount <= 5 ? 5 : 4; 82 } 83 @foreach ( IdentityProductVariants variantImage in Model.VariantPrimaryImages.Take( variantCountTake ) ) 84 { 85 if (!string.IsNullOrEmpty(variantImage.Link) && variantImage.Image != null) 86 { 87 <span class="select-option-color-wrapper js-select-option-color-wrapper"> 88 <a href="@variantImage.Link"><span class="identity-variant-listitem-select-option-color js-identity-variant-listitem-select-option-color" style="background-image: url(@variantImage.Image.Small);" data-hover-image="@variantImage.Image.Medium"></span></a> 89 </span> 90 } 91 92 } 93 @if ( Model.VariantPrimaryImages.Count > 5 ) 94 { 95 string moreVariantText = string.Format( "+{0}", Model.VariantPrimaryImages.Count - 4 ); 96 <span class="select-option-color-wrapper bg-light variant-option-extra-count"> 97 <span class="identity-variant-listitem-select-option-color">@moreVariantText</span> 98 </span> 99 } 100 </div> 101 </div> 102 103 } 104 105 </div> 106 <div class="e-productlist-item-text-container small"> @* CSS ADD text-truncate *@ 107 <p class="e-productlist-item-name mb-0 list-style-d-none"> 108 <a href="@Model.Link" class="text-ellipsis"> 109 @Translate("eCom Product - Product Number - List - Text", "No.") @Model.Number 110 @productName 111 </a> 112 </p> 113 <p class="e-productlist-item-name mb-1 grid-style-d-none d-none"> 114 <a href="@Model.Link"> 115 <span class="d-block font-weight-bold">@Translate("eCom Product - Product Number - List - Text", "No.") @Model.Number</span> 116 @productName 117 </a> 118 </p> 119 120 <div class="e-productlist-item-text mb-0"> 121 @if (shopContext == ShopType.B2B && string.IsNullOrEmpty(discountGroup) == false && Model.ListPrices != null && Model.ListPrices.Any()) 122 { 123 <p class="e-product-price mb-0 mt-0"> 124 125 @if (SiteContext.ShowPrices()) 126 { 127 <span class="d-block font-weight-bold"> 128 @Translate("Product Netto Price - Text", "Nettopris") 129 <span class="js-e-product-price"> 130 @Model.Price.Formatted 131 </span> 132 </span> 133 } 134 135 136 <span class="d-block text-muted id-product-details-list-price"> 137 @Translate("Product List Price - Text", "Listepris") 138 <span class="js-e-product-listprice"> 139 @Co3.Espresso.Website.Services.PriceService.Instance.GetPrice(new PriceSettings() 140 { 141 Value = Model.ListPrices.FirstOrDefault()?.Amount 142 }) 143 </span> 144 </span> 145 </p> 146 } 147 @if (shopContext == ShopType.B2C || shopContext == ShopType.CustomerShop) 148 { 149 <p class="e-product-price mb-1 mt-0 @(SiteContext.ShowPrices() == false ? "hidden-price" : string.Empty)"> 150 <span class="e-productlist-item-price"> 151 <a href="@Model.Link"> 152 @Model.Price.Formatted 153 </a> 154 </span> 155 <small>(@(Model.PriceWithoutVat.Value > 0 && Model.PriceWithoutVat.Value.Equals(Model.Price.Value) == false ? Model.PriceWithoutVat.Formatted : string.Empty) @Translate("Ecom - Price without VAT - text", "ekskl. moms") )</small> 156 </p> 157 } 158 159 </div> 160 @if ( Model.VariantPrimaryImages != null && Model.VariantPrimaryImages.Any() ) { 161 162 int variantCount = Model.VariantPrimaryImages.Count; 163 164 if ( Model.VariantPrimaryImages.Count > 1 ) { 165 <div class="d-block d-md-none"> 166 <p class="p-0 m-0 font-weight-semibold"><small>+ @variantCount @Translate("Product List Colors - Text", "farver")</small></p> 167 </div> 168 } 169 } 170 </div> 171 @if (shopContext == ShopType.B2B || shopContext == ShopType.CustomerShop) 172 { 173 <form class="e-productlist-item-form-container d-flex justify-content-end"> 174 <a class="btn btn-primary text-white mt-0 position-relative js-identity-productlist-get-variant-matrix-modal identity-productlist-get-variant-matrix-modal-btn"> 175 <span class="identity-productlist-get-variant-matrix-modal-text"> 176 @ImageService.Instance.GetSvgMarkup("/Files/Images/icons/outline/41-shopping/shopping-cart-add-2.svg") 177 </span> 178 </a> 179 </form> 180 181 <div class="e-loading-overlay e-productlist-loading-overlay js-e-matrix-loading-overlay"> 182 @RenderingService.Instance.PartialView( "_partials/loading-spinner.cshtml" ) 183 </div> 184 } 185 </div> 186 <code class="js-identity-product-data" hidden> 187 @{ 188 dynamic productImperssionClick = new 189 { 190 item_name = Model.Name, 191 item_id = Model.Id, 192 price = Model.Price.Value.ToJavaScript(), 193 item_brand = Model.BrandName, 194 item_category = Model.Category, 195 item_variant = Model.ColorVariantText 196 }; 197 @Co3.Espresso.Website.Services.JsonService.Instance.ToJson(productImperssionClick) 198 } 199 </code> 200 </div> 201
{"item_name":"CORE hoodie","item_id":"PROD1291","price":"429.00","item_brand":"ID","item_category":"Sweats","item_variant":"Sort"}