Error executing template "/Designs/elsalg/frontpage/Paragraph/WidgetRaptorProductsNative.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at eela.custom.Raptor.GetRaptorItems(String apiName, Int32 productsCount) in D:\Inet\Eela\eela\custom\Raptor\Raptor.cs:line 20
   at CompiledRazorTemplates.Dynamic.RazorEngine_d74c05f1daaf49508d8f758e27eac7bd.Execute() in D:\websites\elsalg.dk\application(9.12.1)\Files\Templates\Designs\elsalg\frontpage\Paragraph\WidgetRaptorProductsNative.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 @using System.Net; 2 @using System.Web; 3 @using eela.custom; 4 @using eela.custom.Providers; 5 @using Newtonsoft.Json; 6 @using Newtonsoft.Json.Linq; 7 @using System.Text.RegularExpressions 8 @{ 9 var parameterName = GetValue("Item.SectionName") != null && !string.IsNullOrWhiteSpace(GetValue("Item.SectionName").ToString()) ? GetValue("Item.SectionName").ToString() : String.Empty; 10 var parameterValue = GetValue("Item.SectionValue") != null && !string.IsNullOrWhiteSpace(GetValue("Item.SectionValue").ToString()) ? GetValue("Item.SectionValue").ToString() : String.Empty; 11 var raptorIntegrationType = GetValue("Item.RaptorIntegrationType") != null && !string.IsNullOrWhiteSpace(GetValue("Item.RaptorIntegrationType").ToString()) ? GetValue("Item.RaptorIntegrationType").ToString() : "GetOverallTopVisits"; 12 13 var productCount = GetValue("Item.NoOf_Products") != null && !string.IsNullOrWhiteSpace(GetValue("Item.NoOf_Products").ToString()) ? int.Parse(GetValue("Item.NoOf_Products").ToString()) : 10; 14 15 if (productCount < 1) 16 { 17 productCount = 10; 18 19 } 20 21 List<Dynamicweb.Ecommerce.Products.Product> products = new List<Dynamicweb.Ecommerce.Products.Product>(); 22 23 if (raptorIntegrationType == "GetTopSellingInCagegory") { raptorIntegrationType = "GetTopSellingInCategory"; } 24 if (!string.IsNullOrWhiteSpace(parameterName) && !string.IsNullOrWhiteSpace(parameterValue)) 25 { 26 products = eela.custom.Raptor.GetRaptorItems(raptorIntegrationType, parameterName, parameterValue, productCount); 27 } 28 else 29 { 30 products = eela.custom.Raptor.GetRaptorItems(raptorIntegrationType, productCount); 31 } 32 33 if (products.Count < 1) { return; } 34 } 35 36 37 <script> 38 function formatPrice(fPrice) { 39 document.write(fPrice.replace(/,00$/, ',-')); 40 } 41 $(document).ready(function () { 42 var $owlProducts = $('.owl-products'); 43 44 function checkWidth() { 45 var windowSize = $(window).width(); 46 if (windowSize > 1199) { 47 $owlProducts.owlCarousel({ 48 margin: 24, 49 dots: false, 50 responsiveClass: true, 51 slideBy: "page", 52 responsive: { 53 0: { 54 items: 1, 55 nav: true 56 }, 57 600: { 58 items: 3, 59 nav: true 60 }, 61 1000: { 62 items: 4, 63 nav: true, 64 loop: false 65 } 66 } 67 }); 68 $owlProducts.removeClass('scroll-mobile'); 69 } else { 70 $owlProducts.addClass('scroll-mobile'); 71 $owlProducts.owlCarousel('destroy'); 72 } 73 } 74 75 checkWidth(); 76 77 $(window).on("resize", checkWidth); 78 79 $(".item-assortment-link").on('click', function (event) { 80 event.preventDefault(); 81 var newURl = $(this).attr('data-url'); 82 location.href = newURl; 83 //window.open(newURl,'_blank'); 84 }); 85 }); 86 87 </script> 88 89 90 91 <div class="widget-products"> 92 <div class="container_4 clearfix"> 93 94 <div class="title"> 95 <div class="container_4 clearfix"> 96 <div class="grid_4"> 97 <h1>@GetString("Item.Title")</h1> 98 </div> 99 </div> 100 </div> 101 102 <div class="product-grid"> 103 <div class="tabs-items tab-items-product"> 104 105 <section class="tab-item current clearfix"> 106 107 <div class="owl-wrapp"> 108 <div id="raptor-recomendations-@raptorIntegrationType" class="owl-products owl-carousel owl-theme @(products.Count() < 4 ? "owl-center" : null)"> 109 @foreach (Dynamicweb.Ecommerce.Products.Product product in products) 110 { 111 if (string.IsNullOrWhiteSpace(product.Name)) { continue; } 112 113 bool hasDiscount = false; 114 115 if (Convert.ToDecimal(product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value.ToString()) != 0) 116 { 117 hasDiscount = true; 118 } 119 120 string baseUrl = String.Format("Default.aspx?ID={0}&ProductID={1}", "9", product.Id); 121 string url = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(baseUrl).ToString(); 122 string buyURL = String.Format("{0}?cartcmd=add", url); 123 124 var primaryGroup = ProductProvider.GetPrimaryParentGroup(product.Id); 125 var elsEnergy = product.ProductFieldValues.GetProductFieldValue("ELSEnergy").Value.ToString(); 126 var energyImgPath = ProductProvider.GetEnergyImagePath(product.ProductFieldValues.GetProductFieldValue("ELSEan").Value.ToString(), elsEnergy, primaryGroup.Id.Replace("-at-SHOP1", "")); 127 128 <div id="recomendation-@product.Id"> 129 <article class="product @(hasDiscount ? "has-discount" : "")" title="@product.Name"> 130 <div class="product-content"> 131 132 <a class="clearfix product-link-box" href="@url" data-raptorrecommendation="productId:@product.Id"> 133 <div class="image"> 134 <div> 135 @if (!ProductProvider.ElectraImgExists(product.ProductFieldValues.GetProductFieldValue("ELSEan").Value.ToString(), product.Number)) 136 { 137 <img src="https://cdn1.elsalg.dk/inetimagegen.ashx?altFmImage_path=/Files/ELSALG/eCom/Pictures/@(product.ProductFieldValues.GetProductFieldValue("ELSAlternatePictureID").Value.ToString() == "" ? "0000000000001" : product.ProductFieldValues.GetProductFieldValue("ELSAlternatePictureID").Value.ToString()).png&amp;image=/files/ELSALG/eCom/Pictures/@(product.ProductFieldValues.GetProductFieldValue("ELSEan").Value.ToString()).png&amp;width=255&amp;height=255&amp;crop=5" alt="@product.Name" /> 138 } 139 else 140 { 141 var electraImgUrl = ProductProvider.GetElectraImgUrl(product.Number); 142 143 <img src="@electraImgUrl" alt="@product.Name" /> 144 } 145 </div> 146 147 @*----- Render all labels related to the product notes. ----- *@ 148 149 @{ 150 151 var productSymbolsValue = product.ProductFieldValues.GetProductFieldValue("ELSProductSymbols").Value.ToString(); 152 var elsAssortmentId = product.ProductFieldValues.GetProductFieldValue("ELSAssortmentID").Value.ToString().ToLower(); 153 154 155 <div class="label-info"> 156 157 @if (product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value.ToString() != "0") 158 { 159 <div class="item save">@(Convert.ToDecimal(product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value.ToString()) != 0 ? "Spar " + Convert.ToDouble(product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value.ToString()).ToString("0,0.00").Replace(",00", ",-") : "")</div> 160 } 161 162 @if (!string.IsNullOrWhiteSpace(productSymbolsValue.Trim())) 163 { 164 var productSymbols = JArray.Parse(productSymbolsValue) as JArray; 165 166 foreach (var productSymbol in productSymbols) 167 { 168 <div class="item online">@productSymbol["description"]</div> 169 } 170 } 171 172 @if (elsAssortmentId == "5ps") 173 { 174 <div class="item rate"> 175 Rente-og gebyrfrit 176 <span class="link item-assortment-link" data-url="/meddethele"> 177 Læs mere her! 178 </span> 179 </div> 180 } 181 </div> 182 183 <div class="label-marks"> 184 @if (!string.IsNullOrWhiteSpace(productSymbolsValue.Trim())) 185 { 186 var productSymbols = JArray.Parse(productSymbolsValue) as JArray; 187 188 foreach (var productSymbol in productSymbols) 189 { 190 <div class="item"> 191 <img src="/files/images/symbols/@(productSymbol["value"])" alt="" /> 192 </div> 193 } 194 } 195 </div> 196 } 197 </div> 198 199 <div class="text"> 200 <div class="description"> 201 <div class="title-content"> 202 <div class="title"> 203 @TruncateAtWords(product.Name.ToString(), 56) 204 </div> 205 <p class="productsubheader"> 206 @product.ProductFieldValues.GetProductFieldValue("ELSProductSubHeader").Value 207 </p> 208 </div> 209 @product.ProductFieldValues.GetProductFieldValue("ELSProductShortText").Value 210 211 </div> 212 <div class="pricing clearfix"> 213 <div class="prod-spec-tab d-flex justify-content-between"><a href="@string.Format("{0}?tab=specifications", url)">Datablad</a></div> 214 215 <div class="clearfix"> 216 <span class="discount">@(Convert.ToDecimal(product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value.ToString()) != 0 ? "Spar " + Convert.ToDouble(product.ProductFieldValues.GetProductFieldValue("ELSUnitSavings").Value.ToString()).ToString("0,0.00").Replace(",00", ",-") : "")</span> 217 <span class="price"> 218 <script>formatPrice('@ProductExtensions.GetCustomPrice(product)')</script> 219 @if (elsAssortmentId == "5ps") 220 { 221 <span class="month-price-text">Rentefrit pr. md.</span> 222 } 223 </span> 224 @if (!string.IsNullOrEmpty(energyImgPath)) 225 { 226 <span class="energy-pg"> 227 <a href="@string.Format("{0}?tab=specifications", url)"> 228 <img src="@energyImgPath" alt="" /> 229 </a> 230 </span> 231 } 232 <div class="buy"> 233 <div onclick="AddToCartWithSupplemental('@buyURL', '@product.Number', '@product.Id', '@HttpUtility.JavaScriptStringEncode(product.Name.Replace("''", ""))');return false;" class="button skipSwipable"> 234 Køb 235 </div> 236 </div> 237 </div> 238 <div class="delivery-text">@product.ProductFieldValues.GetProductFieldValue("ELSDeliveryText").Value.ToString()</div> 239 </div> 240 </div> 241 </a> 242 </div> 243 </article> 244 </div> 245 } 246 </div> 247 </div> 248 </section> 249 </div> 250 </div> 251 </div> 252 </div> 253 254 @functions 255 { 256 string TruncateAtWords(string html, int maxCharacters) 257 { 258 if (html == null || (html = html.Trim()).Length <= maxCharacters || string.IsNullOrEmpty(html)) 259 return html; 260 261 int index = html.Trim().LastIndexOf(" "); 262 while ((index + 3) > maxCharacters) 263 index = html.Substring(0, index).Trim().LastIndexOf(" "); 264 265 if (index > 0) 266 return html.Substring(0, index) + " &hellip;"; 267 268 return html.Substring(0, maxCharacters - 3) + " &hellip;"; 269 } 270 }

Mest solgte TV

Mest solgte produkter

Populære hvidevarer

Eltons butik - Det´sgu service

Besøg Eltons butik og læs mere om vores nye reklamekoncept.

Error parsing template "/Designs/elsalg/frontpage/Paragraph/WidgetBrands.cshtml"
Line 54: (53:4) - Encountered end tag "div" with no matching start tag.  Are your start/end tags properly balanced?

1 <!-- ------------- widget brands ------------- --> 2 <script type="text/javascript"> 3 $(function() { 4 $('.owl-brands').owlCarousel({ 5 loop: false, 6 dots: false, 7 margin: 15, 8 nav: true, 9 items: 6, 10 slideBy: "page", 11 responsive: { 12 0: { 13 items: 3, 14 margin: 10 15 }, 16 600: { 17 items: 4, 18 margin: 10 19 }, 20 1000: { 21 items: 6 22 } 23 } 24 }); 25 }); 26 </script> 27 @{ 28 var checkOwl = GetString("Item.Template"); 29 var newClass = ""; 30 31 if (checkOwl.Contains("owl-brands")) { 32 newClass = "row-owl"; 33 } 34 35 36 <div class="container_4 clearfix"> 37 <div class="row @newClass clearfix"> 38 <div class="@GetString("Item.Template")"> 39 @foreach (var brand in GetLoop("Item.Collection")) 40 { 41 var url = brand.GetString("Item.Collection.Link"); 42 43 <div class="item"> 44 <div class="image"> 45 <a @(!string.IsNullOrEmpty(url) ? " href=\"" + url + "\"" : string.Empty)> 46 <img src="@brand.GetString("Item.Collection.Image")" alt="" /> 47 </a> 48 </div> 49 </div> 50 } 51 </div> 52 </div> 53 </div> 54 </div> 55 } 56
Fagmandens tips & fif..
Hvordan slipper man af med lugten i køleskabet eller glaspest?
Og hvad er det nu lige at vaskesymbolerne i tøjet betyder?