November Happy Hour will be moved to Thursday December 5th.

guest order reassigned to logged in user v13

Vote:
 

I have a weird issue.

chrome: I purchase an item  as a guest(anonymous)

firefox: logged in to see orders in episerver.  I see the order with anonymous info.

chrome: click login and login as a registered user

firefox: refresh orders page and see that last order gets assigned to the account I just logged in with on chrome

I'm not sure how I go about deleting whatever is in memory so that the last guest order doesn't get reassigned to the next logged in user.  I do have _orderRepository.Delete(cart.OrderLink) on finishing a checkout but it looks like I need to do something else to clear out the order session info.

  Any help would be appreciated. thank you

#251338
Mar 25, 2021 0:02
Vote:
 

Hi Peter,

The issue look like related to state management, so you can try SessionState(SessionStateBehavior.Disabled)] on action/controller level and the _orderRepository.Delete(cart.OrderLink) is the correct way to delete a cat.

#251340
Mar 25, 2021 7:47
Vote:
 

I assume you log in on Firefox with admin account?

The order will be assigned to the next user login (on same browse/session) as a default behavior of IProfileMigrator. If you want to disable that, you can implement your own MigrateOrders method, then register the class yourself.

#251342
Mar 25, 2021 8:31
Vote:
 

As Sunjay mentioned it looks like the issue is related to the session state. it seems the session not expired and you tried to log in on chrome. 

you can reduce session timeout or as Quan mentioned, implement your own IProfileMigrator

#251428
Mar 25, 2021 20:44
Vote:
 

Hi Everyone sorry for the late reply

I'm finally able to get to this.  I've been able to inherit a new ProfileMigrator from ProfileMigrator so I can keep the stock MigrateCarts and wishlists.

I have created orders as a guest and then logged in and the orders don't migrate over to the new logged in user but I have a special case and I'm hoping you guys can help.

Special case to move order from anonymous.

On the thank you page after submitting an order.  There is an option for the customer to create an account by putting in a password. After I create the account for the customer I need to move that order over to the newly created customer.  Is that possible?  It seems that it's still looking at MyProfileManager which overrides the MigrateOrders with nothing. class below

    public class MyProfileMigrator  : ProfileMigrator
    {
        public MyProfileMigrator(IOrderRepository orderRepository, ICurrentMarket currentMarket, CartMigrator cartMigrator) 
         : base(orderRepository, currentMarket, cartMigrator)   {        }
        
        public override void MigrateOrders(Guid anonymousId)  {        }
       //MigrateCarts and MigrateWishLists will be the base logic
   }
#254768
May 13, 2021 9:40
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.