Hi all,
I was having some trouble working out why, for a customer "Small Shopping Basket", subscribing to this event using:
CurrentShoppingCart.CartChanged += new CartChangedEventHandler(OnCartChanged);
... was not firing. After some brain time, I realised that the CurrentShoppingCart was always returning a new shopping cart. So, with one simple changed, all is good in the small shopping cart world.
In Mediachase.Store.Business.ShoppingCart, change:
public static ShoppingCart Instance
{
get
{
if(HttpContext.Current.Items["StoreShoppingCart"] == null)
{
return new ShoppingCart();
}
return (ShoppingCart)HttpContext.Current.Items["StoreShoppingCart"];
}
}
to
public static ShoppingCart Instance
{
get
{
if(HttpContext.Current.Items["StoreShoppingCart"] == null)
{
HttpContext.Current.Items["StoreShoppingCart"] = new ShoppingCart();
}
return (ShoppingCart)HttpContext.Current.Items["StoreShoppingCart"];
}
}
Hope this helps some of you.
Cheers,
________________________________
Tom Witherington
Technical Lead
Webreality
+44 (0)1534 488888
www.webreality.co.uk