Developer forum

Forum » Ecommerce - Standard features » Getting an error when rebuilding cart after being idle

Getting an error when rebuilding cart after being idle

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I get the following error when I restart a session on a site for a user that has an existing cart. Upon loading it, Dynamicweb crashes with the following: An item with the same key has already been added.

The stack trace points to this:

System.Linq.Enumerable.ToDictionary(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) +292
   Dynamicweb.eCommerce.Orders.Discounts.DiscountProvider.GetDiscountOrderLine(Order order, Discount od, OrderLine orderline) +526
   Dynamicweb.eCommerce.Orders.Discounts.DiscountProvider.ProcessInclusiveDiscounts(Order order) +293
   Dynamicweb.eCommerce.Frontend.Cart.CartCatch.FindDiscount(Order ecomCart) +3815
   Dynamicweb.eCommerce.Cart.Frontend.HandleDiscountAndTaxes(Order cart, Boolean fromBackend) +48
   Dynamicweb.eCommerce.Frontend.Cart.CartPageTemplateExtender.ExtendTemplate(Template Template) +94
   Dynamicweb.Frontend.PageView.RenderPageTemplateExtenders(Template Template) +717
   Dynamicweb.Frontend.PageView.SetPageTemplateValues() +19538

 

I think this is happening because I have two products in the cart with an identical OrderLineProductID and two discounts that apply to these lines.

Note: it works fine when adding the products to the cart initially. However, it breaks when I return to the site after my session has expired and I log in again.

I have attached the order lines for this order. Is there any other info I can provide? Can't give a URL as this is in a local development environment but I can provide a full backup.

Thanks,

Imar


Replies

 

You must be logged in to post in the forum