Copied to clipboard

Flag this post as spam?

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


  • Frans Lammers 57 posts 400 karma points c-trib
    Oct 19, 2017 @ 14:53
    Frans Lammers
    0

    Merchello - Basket shared among users

    Hi,

    I have a problem in Merchello. When there is a switch of members on the same machine - the first member logs out and another logs in - the second one gets the same basket as the first one. And also the CurrentCustomer is still the first one.

    I understood that Merchello is supposed to notice when a member logs in to Umbraco and in my login I use the standard Members.Login(email, password) method:

    if (Members.Login(model.Email, model.Password))
    {
        var ticket = new FormsAuthenticationTicket(model.Email, model.RememberMe, timeout);
        string encrypted = FormsAuthentication.Encrypt(ticket);
        HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted)
        {
            Expires = DateTime.Now.AddMinutes(timeout),
            HttpOnly = true // cookie not available in javascript
        };
        Response.Cookies.Add(cookie);
    
        return RedirectToUmbracoPage(storeRoot.Id);
    
    }
    

    Am I forgetting something?

  • Frans Lammers 57 posts 400 karma points c-trib
    Oct 24, 2017 @ 13:34
    Frans Lammers
    100

    Thinking it had to be something concerning the CustomerContext I tried to put a Reinitialize right after the login:

    if (Members.Login(model.Email, model.Password))
        {
            CustomerContext.Reinitialize(CurrentCustomer);
    

    And now it works: the basket gets updated to the one the user had left last time. I only wonder if this is the way it is supposed to be?

Please Sign in or register to post replies

Write your reply to:

Draft