Error executing template "Designs/DLF/eCom/ProductCatalog/basic_View.cshtml"
System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at Dynamicweb.Data.Database.CreateDataReader(IDbCommand command, CommandBehavior behavior)
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, CommandBehavior behavior, Int32 commandTimeout)
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
   at Dynamicweb.Ecommerce.Variants.VariantCombinationRepository.GetAll()
   at Dynamicweb.Ecommerce.Variants.VariantCombinationService.InitializeVariantCombinations()
   at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Ecommerce.Variants.VariantCombinationService.GetVariantCombinations(String productId)
   at Dynamicweb.Ecommerce.Products.ProductService.IsVariantMaster(Product product)
   at DLF.MyDLF.Webshop.Web.CustomCode.Products.ProductVariantService.<>c__DisplayClass4_0.b__1(Product s)
   at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.d__1.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at DLF.MyDLF.Webshop.Web.CustomCode.Products.ProductVariantService.<>c__DisplayClass5_0.b__0()
   at NORRIQ.Common8.Caching.CacheItemContainer.BuildItem[T](Func`1 buildmethod, Type dependencyType)
   at NORRIQ.Common8.Caching.HttpCache.GetOrInsert[T](String cacheKey, Func`1 buildCacheDependency, Func`1 buildNewItem)
   at NORRIQ.Common8.Caching.HttpCache`1.GetOrInsert[T](String cacheKey, Func`1 buildNewItem)
   at DLF.MyDLF.Webshop.Web.CustomCode.Products.ProductVariantService.GetMostExpensiveActiveVariant(String productId, String languageId)
   at CompiledRazorTemplates.Dynamic.RazorEngine_0b143c08a60141d6b5f8839fe16421f0.Execute() in C:\inetpub\solutions\DLF.MyDLF.Webshop\Live\Files\Templates\Designs\DLF\eCom\ProductCatalog\basic_View.cshtml:line 31
   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()
ClientConnectionId:67699cdd-31ff-49f3-a0b7-848eccd34745
Error Number:-2,State:0,Class:11
ClientConnectionId before routing:8efb7572-9a5a-48ec-81f7-f20fab9c79ff
Routing Destination:f4a89a657752.tr30954.westeurope1-a.worker.database.windows.net,11029

1 @using System.Linq 2 @using DLF.MyDLF.Webshop.Web.CustomCode.Products 3 @using NORRIQ.Common8.Ecom 4 @using Dynamicweb.Rendering 5 @using Dynamicweb.Ecommerce.ProductCatalog 6 @using Dynamicweb.Ecommerce.Products 7 @using Dynamicweb.Ecommerce.Variants 8 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 9 @using NORRIQ.Common8.Factory 10 @using NORRIQ.Seo.Canonical 11 @using ProductKey = NORRIQ.Common8.Ecom.ProductKey; 12 13 @inherits ViewModelTemplate<ProductViewModel> 14 @{ 15 // EcomMedia settings 16 var productKey = new ProductKey(Model.Id, Model.VariantId, Model.LanguageId); 17 var images = NORRIQ.EcomMedia.Frontend.GetProductMedia(productKey); 18 19 20 //scores 21 var ratings = Model.ProductCategories.FirstOrDefault(cat => cat.Value.Fields.Where(field => field.Value.Value != null).All(field => field.Value.Value is int)).Value; 22 var maxScore = 9; 23 24 var productService = ObjectFactory.GetInstance<ProductService>(); 25 26 var variantService = ObjectFactory.GetInstance<ProductVariantService>(); 27 var activeVariants = variantService.GetActiveVariants(Model.Id, Model.LanguageId); 28 29 30 var urlService = ObjectFactory.GetInstance<IProductUrlService>(); 31 var defaultVariant = variantService.GetMostExpensiveActiveVariant(Model.Id, Model.LanguageId); 32 var price = defaultVariant != null ? defaultVariant.PriceWithoutVat : Model.Price.PriceWithoutVat; 33 var mainProduct = Model.GetMainProduct(); 34 var shortDesc = string.IsNullOrEmpty(Model.ShortDescription) && mainProduct != null ? mainProduct.ShortDescription : Model.ShortDescription; 35 var longDescription = string.IsNullOrEmpty(Model.LongDescription) && mainProduct != null ? mainProduct.LongDescription : Model.LongDescription; 36 var additionalText = Model.GetAdditionalText(); 37 38 39 } 40 <product-details-basic-view default-variant="@Model.VariantId" inline-template has-variants="@activeVariants.Any()" default-price-without-vat="@price"> 41 <div class="basic_view"> 42 <section class="basic_view-pdp" itemscope="" itemtype="https://schema.org/Product"> 43 <div class="basic_view-media"> 44 @if (images.GetImages().Any()) 45 { 46 if (images.GetImages().Count() > 1) 47 { 48 <slick ref="slick" class="basic_view-thumbs" id="pdp-thumbs" :options="slickOptionsThumbs"> 49 @foreach (var img in images.GetImages()) 50 { 51 <div class="basic_view-thumb"> 52 <img src="/Admin/Public/GetImage.ashx?Width=60&amp;Height=60&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(img.Url)" 53 alt="@Model.Name" 54 class="img-fluid" /> 55 </div> 56 } 57 </slick> 58 <slick ref="slick" 59 class="basic_view-images basic_view-slick-images" 60 id="pdp-images" 61 :options="slickOptionsImages"> 62 @foreach (var img in images.GetImages()) 63 { 64 <picture class="basic_view-image"> 65 @*<source media="(max-width:1199.98px)" srcset="/Admin/Public/GetImage.ashx?Width=630&amp;Height=630&amp;Compression=85&amp;Crop=5&amp;Image=@(img.Url)">*@ 66 <source media="(max-width:991.98px)" srcset="/Admin/Public/GetImage.ashx?Width=530&amp;Height=530&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(img.Url)"> 67 <source media="(max-width:767.98px)" srcset="/Admin/Public/GetImage.ashx?Width=400&amp;Height=400&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(img.Url)"> 68 <img src="/Admin/Public/GetImage.ashx?Width=630&amp;Height=630&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(img.Url)" 69 alt="@Model.Name" 70 class="img-fluid" 71 itemprop="image" /> 72 </picture> 73 } 74 </slick> 75 } 76 else if (images.GetImages().Any()) 77 { 78 var pdpImage = images.GetFirstImage().Url; 79 <div class="basic_view-images first"> 80 <picture class="basic_view-image"> 81 @*<source media="(max-width:1199.98px)" srcset="/Admin/Public/GetImage.ashx?Width=630&amp;Height=630&amp;Compression=85&amp;Crop=5&amp;Image=@(pdpImage)">*@ 82 <source media="(max-width:991.98px)" srcset="/Admin/Public/GetImage.ashx?Width=530&amp;Height=530&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(pdpImage)"> 83 <source media="(max-width:767.98px)" srcset="/Admin/Public/GetImage.ashx?Width=400&amp;Height=400&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(pdpImage)"> 84 <img src="/Admin/Public/GetImage.ashx?Width=630&amp;Height=630&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(pdpImage)" 85 alt="@Model.Name" 86 class="img-fluid" 87 itemprop="image"> 88 </picture> 89 </div> 90 } 91 } 92 else 93 { 94 var pdpImage = "/Files/Images/default.jpg"; 95 <div class="basic_view-image default"> 96 <picture class="basic_view-image"> 97 <source media="(max-width:1199.98px)" srcset="/Admin/Public/GetImage.ashx?Width=630&amp;Height=630&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(pdpImage)"> 98 <source media="(max-width:991.98px)" srcset="/Admin/Public/GetImage.ashx?Width=530&amp;Height=530&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(pdpImage)"> 99 <source media="(max-width:767.98px)" srcset="/Admin/Public/GetImage.ashx?Width=400&amp;Height=400&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(pdpImage)"> 100 <img src="/Admin/Public/GetImage.ashx?Width=870&amp;Height=870&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(pdpImage)" 101 alt="@Translate(" No product picture")" 102 class="img-fluid" 103 itemprop="image"> 104 </picture> 105 </div> 106 } 107 </div> 108 <div class="basic_view-content"> 109 <h1 itemprop="name"> 110 @Model.Name 111 </h1> 112 @if (!string.IsNullOrEmpty(additionalText)) 113 { 114 <p>@additionalText</p> 115 } 116 <p class="basic_view-sku" data-caption="Varenummer" itemprop="sku"> 117 @Translate("Product number"): @Model.Number 118 </p> 119 120 @if (Pageview.User == null) 121 { 122 var priceExplanation = Model.HasKgBaseUnit() ? Translate("Price/unit", " / KG") : Translate("Price per variant", ""); 123 <template v-if="!noVariantPicked"> 124 <div class="basic_view-async"> 125 <p class="basic_view-list-price"> 126 <span itemprop="priceCurrency" content=""></span> 127 <span itemprop="price">@Translate("From") {{ price | currency }} @priceExplanation</span> 128 </p> 129 </div> 130 </template> 131 } 132 else 133 { 134 135 <async-price class-type="basic_view" default-price-without-vat="@Model.Price.PriceWithoutVat" has-variants="@activeVariants.Any()" product-id="@Model.Id" :variant-id="variantId" unit-of-measure="" has-kg-base-unit="@Model.HasKgBaseUnit()"></async-price> 136 } 137 @if (activeVariants.Any()) 138 { 139 <div class="basic_view-variants"> 140 <div class="basic_view-variant"> 141 <label for="variant-1"> 142 @Translate("Variants") 143 </label> 144 <select id="variant-1" name="variant-1" class="form-control" v-model="variantId" @@change="variantSelected"> 145 <option value="" selected disabled hidden>@Translate("Choose Variant")</option> 146 @foreach (var variant in activeVariants) 147 { 148 <option data-variant-price="@variant.Price.PriceWithoutVAT" value="@variant.VariantId">@variant.CleanVariantId()</option> 149 } 150 </select> 151 </div> 152 <template v-if="!noVariantPicked"> 153 <p>@Translate("Buy variants text")</p> 154 </template> 155 </div> 156 } 157 158 <add-to-basket-simple v-if="!noVariantPicked" class="basic_view-form" product-id="@Model.Id" :variant-id="variantId" unit-of-measure="STK"></add-to-basket-simple> 159 @if (!string.IsNullOrEmpty(shortDesc)) 160 { 161 <div class="basic_view-short-description"> 162 @shortDesc 163 </div> 164 } 165 </div> 166 </section> 167 168 <section class="basic_view-tabs"> 169 <h2 class="text-center">@Translate("Product Details")</h2> 170 171 <b-tabs nav-class="basic_view-tabs-nav" nav-wrapper-class="basic_view-tabs-navbar" content-class="basic_view-tabs-content"> 172 @if (ratings != null) 173 { 174 <b-tab title="@Translate("Ratings")" active> 175 <div class="basic_view-ratings"> 176 @foreach (var rating in ratings.Fields) 177 { 178 int score = -1; 179 if (!int.TryParse(rating.Value?.Value?.ToString(), out score) || score < 1) 180 { 181 continue; 182 } 183 <div class="seeds_rating"> 184 <span class="seeds_rating-label">@rating.Value.Name</span> 185 <span class="seeds_rating-items"> 186 @for (int counter = 1; counter <= maxScore; counter++) 187 { 188 if (counter <= score) 189 { 190 <span class="active"></span> 191 } 192 else 193 { 194 <span></span> 195 } 196 197 } 198 199 </span> 200 </div> 201 } 202 </div> 203 </b-tab> 204 } 205 @if (!string.IsNullOrEmpty(longDescription)) 206 { 207 <b-tab title="@Translate(" Description")"> 208 <div class="basic_view-long-description">@longDescription</div> 209 </b-tab> 210 } 211 </b-tabs> 212 </section> 213 214 @{ 215 var relatedProducts = Model.GetRelatedProducts(); 216 } 217 218 219 @if (relatedProducts.Count > 0) 220 { 221 <section class="basic_view-related"> 222 <template> 223 <h2 class="text-center"> 224 @Translate("Related Products") 225 </h2> 226 <div class="basic_view-related--grid"> 227 <!-- Add id="plp-related", to show related products in a carousel --> 228 @foreach (var rel in relatedProducts) 229 { 230 var leastExpensiveVariant = variantService.GetLeastExpensiveActiveVariant(rel.Id, rel.LanguageId); 231 if (leastExpensiveVariant != null) 232 { 233 var url = urlService.GetProductUri(rel); 234 var relProductKey = new ProductKey(rel.Id, leastExpensiveVariant != null ? leastExpensiveVariant.VariantId : rel.VariantId, Model.LanguageId); 235 var relImage = NORRIQ.EcomMedia.Frontend.GetProductMedia(relProductKey).GetFirstImage(); 236 var hasKgBaseUnit = (leastExpensiveVariant.HasKgBaseUnit) ? 1 : 0; 237 238 <div class="basic_view-related--item"> 239 <article class="basic_view-related--product"> 240 <a href="@url.PathAndQuery" class="basic_view-related--link"> 241 <picture class="basic_view-related--image"> 242 <source media="(max-width:767.98px)" 243 srcset="/Admin/Public/GetImage.ashx?Width=360&amp;Height=360&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(relImage.Url)" /> 244 <source media="(max-width:991.98px)" 245 srcset="/Admin/Public/GetImage.ashx?Width=300&amp;Height=300&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(relImage.Url)" /> 246 <img src="/Admin/Public/GetImage.ashx?Width=260&amp;Height=260&amp;Compression=85&amp;Crop=5&amp;fillcanvas=true&amp;Image=@(relImage.Url)" alt="Product Name" itemprop="image" class="img-fluid" /> 247 </picture> 248 <header class="basic_view-related--specs"> 249 <h1>@rel.Name</h1> 250 <p class="basic_view-related--sku" data-caption="@Translate("Product Number")">@leastExpensiveVariant.Number</p> 251 </header> 252 </a> 253 <footer class="basic_view-related--foot"> 254 <div class="basic_view-related--async"> 255 <async-price class-type="basic_view-related--price" 256 default-price-without-vat="@leastExpensiveVariant.PriceWithoutVat" 257 product-id="@rel.Id" 258 variant-id="@leastExpensiveVariant.VariantId" 259 :has-kg-base-unit="@hasKgBaseUnit" 260 unit-of-measure=""></async-price> 261 </div> 262 @*@if (relProduct.VariantCount == 0) 263 { 264 <add-to-basket-button-only product-id="@rel.ProductId" variant-id="@rel.VariantId" unit-of-measure="" button-class="btn btn-primary" class="basic_view-related--form"></add-to-basket-button-only> 265 } 266 else 267 { 268 <a class="btn btn-primary" href="@url.PathAndQuery"> 269 @Translate("See product") 270 </a> 271 }*@ 272 </footer> 273 </article> 274 </div> 275 } 276 277 278 279 } 280 </div> 281 </template> 282 </section> 283 } 284 </div> 285 </product-details-basic-view> 286 287 288