Style 08-9545-PT

Dress - Let's Party by LILLY kr 2 469,00


Error executing template "Designs/lilly/ecom/product/partials/add-to-cart.cshtml"
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Co3.Espresso.Website.Models.FrontEnd.Ecommerce.EspressoProduct.get_VariantGroups()
at CompiledRazorTemplates.Dynamic.RazorEngine_d7bb68bf1bed4a6e87119d4a2ce130aa.Execute() in E:\dynamicweb.net\SolutionsCustom\lilly.ci.espresso4.dk\Files\Templates\Designs\lilly\ecom\product\partials\add-to-cart.cshtml:line 37
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.Lilly.Website.Models.Frontend.Ecommerce.LillyProduct > 2 @using Co3.Espresso.Base.Extensions 3 @using Co3.Espresso.Website.Models.FrontEnd.Ecommerce 4 @using Co3.Lilly.Website.Services 5 @using Dynamicweb.Ecommerce.Common 6 @using Dynamicweb.Rendering 7 @using Dynamicweb.Security.UserManagement 8 9 @{ 10 bool isUserAuthenticated = User.IsFrontendUserLoggedIn(); 11 double variantStockQuantity = 0; 12 bool hasStock = Model.VariantCombinations.Any(vc => vc.Value.Stock.Quantity > 0); 13 } 14 15 <form action="/system/data/cart" class="e-product-form js-e-product-form js-e-product-form-addtocart py-1 mb-2 js-lilly-stock-in-cart" method="post" data-parent-stock="@Model.Stock.Quantity"> 16 <input name="CartCmd" type="hidden" value="Add"> 17 <input name="ProductID" type="hidden" value="@Model.Id"> 18 @* <input name="VariantID" type="hidden" value="@Model.VariantId"> *@ 19 @*<input class="js-input-stock-change js-lilly-cart-quantity" name="Quantity" type="hidden" value="1" max="@Model.Stock.Quantity">*@ 20 21 <input name="Redirect" type="hidden" value=""> 22 <input name="Name" type="hidden" value="@Model.Name"> 23 <input name="Number" type="hidden" value="@Model.Number"> 24 <input name="Price" type="hidden" value="@Model.Price.Value.ToJavaScript()"> 25 <input name="CurrencyCode" type="hidden" value="@Model.Price.CurrencyCode"> 26 27 @if ( LillyProductService.Instance.IsB2B == true ) 28 { 29 <input name="OrderContext" type="hidden" value="B2B"> 30 } 31 32 @if ( isUserAuthenticated && Model.IsPreorder == true ) 33 { 34 @*<input class="js-product-ispreorder-orderlinefield" type="hidden" name="EcomOrderLineFieldInput_IsPreorder" value="">*@ 35 } 36 37 @if ( Model.VariantGroups.Any() ) 38 { 39 40 <h4 class="small">@Translate( "eCom Product - Choose size - Label", "Vælg størrelse" )</h4> 41 <div class="float-left pl-0"> 42 @foreach ( KeyValuePair<string, EspressoVariantGroup> variantGroup in Model.VariantGroups ) 43 { 44 string variantInputFieldId = string.Format( "{0}_{1}", Model.Id, variantGroup.Value.Id ); 45 46 if ( hasStock == false && Model.IsPreorder == false ) 47 { 48 } else { 49 <div class="form-group mb-0"> 50 @* <label for="@variantInputFieldId" class="font-weight-bold form-control-label h4">@variantGroup.Value.Name</label> *@ 51 52 <select class="form-control js-e-product-form-variant-group-input required selectpicker" data-variant-group-id="@variantGroup.Value.Id" name="VariantID" id="@variantInputFieldId"> 53 @* <option disabled value=""></option> *@ 54 55 @{ 56 57 var options = variantGroup.Value.Options.ToList(); 58 options.Sort((x, y) => string.Compare(x.Value.Name, y.Value.Name)); 59 } 60 @foreach ( var variantOption in options ) 61 { 62 variantStockQuantity = Model.VariantCombinations[variantOption.Key].Stock.Quantity; 63 64 bool isSelected = variantOption.Key == variantGroup.Value.SelectedOptionId; 65 66 if ( Model.VariantCombinations.ContainsKey( variantOption.Key ) ) 67 { 68 69 if ( LillyProductService.Instance.IsB2B ) 70 { 71 if ( Model.IsPreorder == true ) 72 { 73 <option value="@variantOption.Key" @( isSelected ? "selected" : string.Empty )>@variantOption.Value.Name</option> 74 } 75 else 76 { 77 if ( Model.VariantCombinations[variantOption.Key].Stock.Quantity > 0 ) 78 { 79 <option value="@variantOption.Key" @( isSelected ? "selected" : string.Empty )>@variantOption.Value.Name</option> 80 } 81 } 82 } 83 else 84 { 85 if ( Model.VariantCombinations[variantOption.Key].Stock.Quantity > 0 ) 86 { 87 <option value="@variantOption.Key" @( isSelected ? "selected" : string.Empty )>@variantOption.Value.Name</option> 88 } 89 } 90 } 91 92 } 93 </select> 94 95 </div> 96 } 97 } 98 </div> 99100101 } 102103 <div class="d-flex ml-1"> 104105 @if ( Model.VariantId.Any() == false && Model.IsPreorder != true && Model.Stock.Quantity < 1 ) 106 { 107 <p>@Translate( "Not on stock", "Not on stock" )</p> 108 } else if ( Model.VariantId.Any() == true && Model.IsPreorder == false && hasStock == false ) 109 { 110 <p>@Translate( "Not on stock", "Not on stock" )</p> 111 } 112 else 113 { 114115 <input min="1" data-stock="" data-stockMinusWhatsInCart="" style="max-width: 4em;border-radius: 0;" name="Quantity" type="number" value="1" autocomplete="off" class="js-lilly-cart-quantity form-control" data-toggle="popover" data-content="@Translate( "eCom Product - Over in stock quantity - Text", "Varen findes ikke i denne mængde - derfor har vi justeret til den maksimale beholdning." )"> 116117 <button class="btn btn-success" type="submit">@Translate( "eCom Product - Add To Cart - Button", "Add to cart" )</button> 118119 } 120121 </div> 122123 </form> 124
keyboard_arrow_down
keyboard_arrow_up