Error executing template "/Designs/Rapido/Paragraph/SharedFavorites.cshtml"
System.ArgumentNullException: Value cannot be null.
Parameter name: String
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at CompiledRazorTemplates.Dynamic.RazorEngine_82e23fc1b12143f29f1283d152be82ad.Execute() in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\Paragraph\SharedFavorites.cshtml:line 51
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb.Ecommerce.Products; 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Content 5 @using Dynamicweb.Core 6 @using System 7 @using System.Web; 8 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 9 10 11 @* 12 This is a temporary fallback for the DefaultImage. The image pattern MUST be set up like this: 13 14 ImageSmall = /{ProductNumber}.jpg 15 ImageMedium = /{ProductNumber}{VariantOptionLevel1}.jpg 16 ImageLarge = /{ProductNumber}{VariantComboName}.jpg 17 18 In addition to the ImageDefault setting 19 *@ 20 21 @functions { 22 public string GetProductImage(LoopItem productObject = null) 23 { 24 string theImage = ""; 25 string placeholderImg = "/Admin/Public/GetImage.ashx?Format=webp&Image=/Files/Images/placeholder.jpg&Width=225&Height=200&Crop=5&fillcanvas=1"; 26 27 if (productObject == null) { 28 theImage = GetString("Ecom:Product.ImageDefault.Default.Clean"); 29 theImage = String.IsNullOrEmpty(theImage) ? GetString("Ecom:Product.ImageLarge.Clean") : theImage; 30 theImage = String.IsNullOrEmpty(theImage) ? GetString("Ecom:Product.ImageMedium.Clean") : theImage; 31 theImage = String.IsNullOrEmpty(theImage) ? GetString("Ecom:Product.ImageSmall.Clean") : theImage; 32 theImage = String.IsNullOrEmpty(theImage) ? GetString("Ecom:Product.ImageLarge.Default.Clean") : theImage; 33 theImage = String.IsNullOrEmpty(theImage) ? placeholderImg : theImage; 34 } else { 35 theImage = productObject.GetString("Ecom:Product.ImageDefault.Default.Clean"); 36 theImage = String.IsNullOrEmpty(theImage) ? productObject.GetString("Ecom:Product.ImageLarge.Clean") : theImage; 37 theImage = String.IsNullOrEmpty(theImage) ? productObject.GetString("Ecom:Product.ImageMedium.Clean") : theImage; 38 theImage = String.IsNullOrEmpty(theImage) ? productObject.GetString("Ecom:Product.ImageSmall.Clean") : theImage; 39 theImage = String.IsNullOrEmpty(theImage) ? productObject.GetString("Ecom:Product.ImageLarge.Default.Clean") : theImage; 40 theImage = String.IsNullOrEmpty(theImage) ? placeholderImg : theImage; 41 } 42 43 return theImage; 44 } 45 } 46 47 @{ 48 string detailsPageID = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 49 50 var faid = HttpContext.Current.Request.QueryString.Get("FavoriteListID"); 51 var favProds = Dynamicweb.Ecommerce.CustomerCenter.CustomerProductList.GetListById(int.Parse(faid)); 52 var imgService = new Dynamicweb.Ecommerce.Products.ProductImageService(); 53 } 54 55 @* SHOW ALL LISTS *@ 56 57 <div class="grid__col-12 grid__col--bleed"> 58 <div class="grid__cell"> 59 <h2 class="favorites-header">@Translate("Wish list")</h2> 60 </div> 61 </div> 62 63 <div class="favorite-products"> 64 @foreach (var item in favProds.Products) 65 { 66 var product = Dynamicweb.Ecommerce.Services.Products.GetProductById(item.ProductId, item.ProductVariantId, true); 67 var discountMatrixPrice = product.DiscountMatrix(); 68 var link = string.Format("{0}://{1}/Default.aspx?ID={2}&ProductID={3}", Dynamicweb.Context.Current.Request.Url.Scheme, Dynamicweb.Context.Current.Request.Url.Host, detailsPageID, product.Id); 69 var imageLink = "/Admin/Public/GetImage.ashx?Format=webp&Width=230&Height=200&Crop=5&fillcanvas=1&DoNotUpscale=true&Compression=95&image=" + imgService.GetDefaultImageFromShop(product, null); 70 <div class="product"> 71 <div class="top-row"> 72 <p class="productNumber">@product.Number</p> 73 </div> 74 <a href="@link"> 75 <span class="wishList"><i></i></span> 76 <img class="productImage" src="@imageLink" alt="@product.Name" /> 77 <p class="product-name">@product.Name</p> 78 79 @if (@discountMatrixPrice.Price.PriceFormatted == @product.Price.PriceFormatted) 80 { 81 <div class="price-container"> 82 <p class="productPrice">@product.Price.PriceFormatted</p> 83 </div> 84 } 85 else 86 { 87 <div class="price-container"> 88 <p class="productPrice">@discountMatrixPrice.Price</p> 89 <p class="discount-price">@product.Price.PriceFormatted</p> 90 </div> 91 } 92 </a> 93 </div> 94 } 95 </div>