Error executing template "Designs/juuls/ecom/productlist/partials/item.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_4f93dc51cc7346f9b74068b264025c64.Execute() in D:\dynamicweb.net\Solutions\twodayco3\juulsvin.cloud.dynamicweb-cms.com\Files\Templates\Designs\juuls\ecom\productlist\partials\item.cshtml:line 40 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< EspressoProduct > 2 @using System.Drawing 3 @using System.Globalization 4 @using Co3.Espresso.Website.Models 5 @using Co3.Espresso.Website.Models.FrontEnd.Ecommerce 6 @using Co3.Espresso.Website.Models.FrontEnd.Elements 7 @using Co3.Espresso.Website.Models.FrontEnd.Handlebars 8 @using Co3.Espresso.Website.Models.FrontEnd.Settings 9 @using Co3.Espresso.Website.Services 10 @using Co3.Juuls.Frontend.Models.Frontend.Ecommerce 11 @using Co3.Juuls.Website.Frontend.Helpers 12 @using Co3.Juuls.Website.Frontend.Models.Frontend.Ecommerce 13 @using Co3.Juuls.Website.Frontend.Services 14 @using Dynamicweb.Ecommerce 15 @using Dynamicweb.Ecommerce.Common 16 @using Dynamicweb.Ecommerce.CustomerExperienceCenter.Favorites 17 @using Dynamicweb.Ecommerce.Orders.Discounts 18 @using Dynamicweb.Ecommerce.Products 19 @using Dynamicweb.Ecommerce.Stocks 20 @using Dynamicweb.Frontend 21 @using Dynamicweb.Rendering 22 @using Dynamicweb.Security.UserManagement 23 @using EspressoProduct = Co3.Juuls.Website.Models.Frontend.Ecommerce.JuulsProduct 24 @using ShopType = Co3.Juuls.Website.Frontend.Helpers.ShopType 25 @using StockService = Dynamicweb.Ecommerce.Stocks.StockService 26 27 @{ 28 string quantityDiscountText = Model.QuantityDiscountText; 29 ShopType siteContext = SiteContext.CurrentSiteContext(); 30 31 EspressoPrice priceSavedAmount = JuulsDiscountService.Instance.GetSavedAmount(Model.Discount, Model.Price); 32 EspressoPrice priceWhenDiscounted = JuulsDiscountService.Instance.GetDiscountCalculated(Model.Discount, Model.Price); 33 34 bool hasB2cAmoutnDiscount = Model.Discount != null && Model.Discount.ProductQuantity > 1; 35 36 CultureInfo currencyCulture = new CultureInfo( Context.Currency.CultureInfo ); 37 string ga4Price = Double.Parse(Model.Price.Value.ToString(), NumberStyles.Currency, currencyCulture).ToString("f", CultureInfo.InvariantCulture); 38 } 39 40 <div class="bg-white mb-2 w-100 py-2 e-block-link e-productlist-item js-e-block-link js-e-productlist-item js-e-productlist-item-@Model.Id" data-product-id="@Model.Id" data-variant-id="@Model.VariantId" data-product-name="@Model.Name" data-product-number="@Model.Number" data-product-price="@ga4Price" data-currency="@Context.Currency.Code" data-product-category="@Model.PrimaryGroup.ParentGroups.FirstOrDefault().Name" data-product-category2="@Model.PrimaryGroup.Name" data-product-list-name="@Model.PrimaryGroup.Name - @JuulsProductService.Instance.GetProductFieldValue( Product.GetProductById( Model.Id ),"NavWineRegion")"> 41 42 <div class="e-productlist-item-container position-relative"> 43 <div class="e-productlist-item-image-container"> 44 45 <a class="e-productlist-item-image-wrapper" href="@Model.Link"> 46 <img class="e-productlist-item-image" src="@($"{Model.ImagePrimary.Small}&filename={Model.Number}-{Model.Name.Trim().Replace(" ","-")}.jpg")" alt="@Model.Name - @Model.ProductType" title="@Model.Name - @Model.ProductType"> 47 </a> 48 </div> 49 50 <div class="juuls-product-badges-wrapper"> 51 @RenderingService.Instance.PartialView("ecom/product/partials/awards.cshtml", Model) 52 @RenderingService.Instance.PartialView("ecom/product/partials/part-discount-badge.cshtml", Model) 53 </div> 54 55 56 <div class="e-productlist-item-text-container small px-2"> 57 <span class="e-productlist-item-text-container-header"> 58 <h3 class="e-productlist-item-name mb-1"> 59 <a href="@Model.Link">@Model.Name</a> 60 </h3> 61 @RenderingService.Instance.PartialView("ecom/product/partials/add-to-favorites.cshtml", Model) 62 63 </span> 64 @if (SiteContext.CurrentSiteContext() != ShopType.B2B) 65 { 66 if (Model.HasBeforePrice) 67 { 68 <p class="juuls-before-price-block small m-0 mb-2 px-1 d-flex justify-content-between"> 69 <span class="text-success"> 70 @Translate("eCom - Product - Discount - Saved - Text", "Spar") @Model.SavedAmount.Formatted 71 </span> 72 <span class="mr-1 text-dark"> 73 @Translate("eCom - Product - Discount - Before Price - Text", "Før pris") @Model.BeforePrice.Formatted 74 </span> 75 </p> 76 } 77 else if (hasB2cAmoutnDiscount) 78 { 79 <p class="juuls-before-price-block small m-0 mb-2 px-1 d-flex justify-content-between"> 80 <span class="mr-1"> 81 Spar @priceSavedAmount.Format() 82 </span> 83 <a href="@Model.Link" class="e-product-price text-dark mb-0 mt-0"> 84 @Model.Price.Formatted <span>v/ 1 stk.</span> 85 </a> 86 </p> 87 } 88 } 89 else 90 { 91 if (Model.SalesDiscount != null && string.IsNullOrEmpty(Model.SalesDiscount.CampaignName) == false) 92 { 93 <p class="mb-2 juuls-before-price-block small m-0 d-flex justify-content-center"> 94 @Model.SalesDiscount.CampaignName 95 </p> 96 } 97 } 98 99 <div class="d-flex flex-wrap flex-column flex-md-row flex-md-nowrap"> 100 <div class="d-flex flex-column text-left mb-md-1"> 101 <div> 102 @Model.RenderDisplayGroup("Frontend_Topinfo") 103 </div> 104 <div class="d-flex align-items-center flex-wrap"> 105106 @if (Model.Stock.Quantity > 0) 107 { 108 if (Model.Stock.State != null) 109 { 110 <span class="@(Model.Stock.State.Contains("Få på lager") || Model.Stock.State.Contains("Ukendt tilgængelighed") ? "bg-warning" : "bg-success") product-stock-status"> </span> 111 @Model.Stock.State 112 } 113 } 114115 </div> 116 </div> 117118 <div class="d-flex flex-column ml-md-auto"> 119 <p class="e-productlist-item-text mb-0 text-md-right justify-content-between"> 120 <span class="e-productlist-item-price"> 121122 @if (siteContext == ShopType.B2B) 123 { 124 EspressoPrice userDiscountedPrice = JuulsProductService.Instance.GetUserDiscountedPrice(Model); 125126 if ( userDiscountedPrice.Value > 0) 127 { 128 <span class="mb-1 d-flex justify-content-between"> 129 <span class="mr-1 text-line-through small text-muted"> 130 @Translate("eCom - Product - Discount - Before Price - Text", "Før pris") @Model.Price.Formatted 131 </span> 132 </span> 133 <a href="@Model.Link" class="e-product-price h3 mb-0 mt-0"> 134 @userDiscountedPrice.Formatted 135 </a> 136137 } 138 else 139 { 140 <a href="@Model.Link" class="e-product-price h3 mb-0 mt-0"> 141 @Model.Price.Formatted 142 </a> 143 } 144 <small class="d-block text-muted">@Translate("eCom - Product - Ex VAT - Text", "ex. moms")</small> 145 } 146 else 147 { 148 if (hasB2cAmoutnDiscount) 149 { 150 <span class="text-dark h3"> 151 @priceWhenDiscounted.Format() <span>v/ @Model.Discount.ProductQuantity stk.</span> 152 </span> 153 } 154 else 155 { 156 <a href="@Model.Link" class="e-product-price text-dark h3 mb-0 mt-0"> 157 @Model.Price.Formatted 158 </a> 159 } 160 } 161 </span> 162 </p> 163 @if (Model.IsStoreOnly == false && Model.CanPurchaseByContext) 164 { 165 if (Model.Stock.Quantity > 0) 166 { 167 @RenderingService.Instance.PartialView("ecom/product/partials/add-to-cart.cshtml", Model) 168 } 169 else 170 { 171 if (Model.Stock.State != null) 172 { 173 <div class="d-flex align-items-center"> 174 <span class="bg-danger product-stock-status"> </span> 175 @Model.Stock.State 176 </div> 177 } 178 } 179 } 180 </div> 181 </div> 182 </div> 183 </div> 184 </div> 185
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
Alle priser er inkl. moms