Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nguyen Hien 52 posts 133 karma points
    Jan 13, 2016 @ 08:18
    Nguyen Hien
    0

    How to clear customerkey for CurrentCustomer?

    Currently, when I logged out from website. When I logged in with another account, the customerkey for CurrentCustomer still keep old value? How to clear customerkey for CurrentCustomer?

  • Tarek 9 posts 29 karma points
    Jan 13, 2016 @ 10:22
    Tarek
    0

    Hi Hien,

    I seem to be having the same issue.

    Please let me know if you find a solution to this problem.

    Regards, Tarek

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 13, 2016 @ 16:38
    Rusty Swayne
    0

    Are you using Umbraco membership for your customer logins? By default the CustomerContext (which is responsible for the CurrentCustomer) uses Umbraco's MembershipHelper to determine if the customer is logged in.

    https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Web/CustomerContext.cs#L77

    If your implementation is managing authentication directly through .NET or via a custom membership provider, you may need to create a customer CustomerContext.

    This process is pretty straight forward:

    1) Create a sub class of CustomerContextBase and implement the 3 abstract methods

        /// <summary>
        /// Returns true or false indicating whether or not the current user is logged in.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/> indicating whether the current user is logged in.
        /// </returns>
     bool GetIsCurrentlyLoggedIn();
    
    
        /// <summary>
        /// The get user's provider user name.
        /// </summary>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        string GetMembershipProviderUserName();
    
       /// <summary>
        /// The get membership provider key.
        /// </summary>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        string GetMembershipProviderKey();
    

    Then, in the merchello.config file, change the CustomerContext reference to reference the new class.

         <pluggable>
           <object alias="CustomerContext" type="Merchello.Web.CustomerContext, Merchello.Web" />
        </pluggable>
    
  • Nguyen Hien 52 posts 133 karma points
    Jan 14, 2016 @ 00:07
    Nguyen Hien
    0

    Rusty, how can I force reset CurrentCustomer to Current Umbraco Logged In? We use Umbraco membership for creating new login. Currently, I need create some code to Create Merchello Customer manual. Because, if don't create Merchello Customer, all invoice has null CustomerKey. Can you suggest for this case?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jan 14, 2016 @ 15:02
    Rusty Swayne
    1

    Nguyen, the customer should be automatically created by Merchello when the new member is created in Umbraco (as long as your member type is listed in the merchello.config).

       <!-- A comma delimited list of Umbraco MemberTypes to be considered as Merchello Customers -->
       <customer memberTypes="Customer,MerchelloCustomer" />
    

    Merchello is designed to allow for both customer and anonymous customer checkout out - so it sounds like you may be creating a customer for what Merchello things is an anonymous checkout.

    I'd check to see if your member type is listed in the merchello.config.

    FYI

    Customers records are tied to Umbraco (or membership providers) via the login name - so most commonly email address.

Please Sign in or register to post replies

Write your reply to:

Draft