Welcome to Mediachase Community Sign in | Join | Help    
in Search   

OnCartChanged event subscription not firing

Last post Thu, Nov 15 2007, 4:52 PM by kgwood39. 2 replies.
Sort Posts: Previous Next
  •  Wed, Aug 09 2006, 1:52 AM 3427

    OnCartChanged event subscription not firing

    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

  •  Mon, Aug 28 2006, 3:29 PM 3530 in reply to 3427

    Re: OnCartChanged event subscription not firing

    Thank you, Tom, for the info. Any tips are appreciated by the community.
  •  Thu, Nov 15 2007, 4:52 PM 7031 in reply to 3530

    Re: OnCartChanged event subscription not firing

    I was having a similar problem.  Good fix.

    But what is the most appropriate way to obtain the current logged in customer in the ShoppingCart.cs class?
View as RSS news feed in XML
Site Terms | Privacy Policy | About Us | Contact Us
Running on Mediachase eCommerce Framework 4.0.
  Copyright © Mediachase, LTD. 1997-2006. All Rights Reserved

E-commerce, HelpDesk, Service Desk & Project Management Software, alternatives to Microsoft Project Server & Sharepoint Collaboration Server
project management software | microsoft project server | sharepoint collaboration server | issues management, helpdesk & service desk
Powered by Community Server, by Telligent Systems