8/21/2008 8:50:31 AM
RE:Access to shopping cart from ASHX handler
Ok, i've been working on this for over a day now and tried nearly everything i can find in the API and still seem to be missing something.
I was able to get access to the CMSContext.CurrentShoppingCart from the .ashx handler by including the SessionState namespace. However, the same issues persist. Changes i make to the cart from the Handler are not reflected in the CMSContext.CurrentShoppingCart on other pages.
Through debugging, i can tell that the CMSContext.CurrentShoppingCart has one less CartItem after i remove an SKU (which i've tried doing several different ways). I've tried ShoppingCartInfoProvider.SetShoppingCartItems(CMSContext.CurrentShoppingCart.ShoppingCartID, CMSContext.CurrentShoppingCart.CartItems); thinking it would force the DB updates, as well as resetting CMSContext.CurrentShoppingCart w/ CMSContext.CurrentShoppingCart = ShoppingCartInfoProvider.GetShoppingCartInfo(CMSContext.CurrentShoppingCart.ShoppingCartGUID); in an attempt to make sure CurrentShoppingCart reflects the changes, but nothing seems to take.
When i go back to the page w/ the ShoppingCart web part, all the items remain, even after refreshing.
What's more frustrating, is that if i try running the handler to remove another item, the handler shows that the previous item has been removed! So it seeeeeems like it's working, but there must be something i'm not doing to get these changes reflected in the Kentico shopping cart code.
Thanks in advance,