var customerContext = new CustomerContext(UmbracoContext);
var customer = MerchelloContext.Current.Services.CustomerService.GetByLoginName(login.LoginUsername);
customerContext.Reinitialize(customer);
I expect customerContext.CurrentCustomer will return the customer i just pasted in, but it always return anonymous customer? Am i doing wrong?
You should not need to get the customer via the CustomerService.
var customerContext = new CustomerContext(UmbracoContext);
var currenctCustomer = customerContext.CurrentCustomer;
Just FYI, in 1.8.2 there are now two abstract controller classes that have wrapped the RenderMvcController and SurfaceController - named
MerchelloRenderMvcController and MerchelloSurfaceController. These will give you direct access to the CustomerContext and CurrentCustomer without having to instantiate them yourself.
CustomerContext.CurrentCustomer always return anonymous customer - 1.8.2
I expect customerContext.CurrentCustomer will return the customer i just pasted in, but it always return anonymous customer? Am i doing wrong?
What i need is allow user to add the product to shopping cart without login first, but customer need to login/register before he checkout.
Thanks
You should not need to get the customer via the CustomerService.
Just FYI, in 1.8.2 there are now two abstract controller classes that have wrapped the RenderMvcController and SurfaceController - named MerchelloRenderMvcController and MerchelloSurfaceController. These will give you direct access to the CustomerContext and CurrentCustomer without having to instantiate them yourself.
Hi Rusty,
I am also trying to get CurrentCustomer.IsAnonymous... It is always true
I have .Net 4.7.2
Umbraco Version 7.12.0
Merchello Version 2.7.0
I am using custom Controller, ViewModels
My Controller has
and View also has
I have the same problem, in merhcello.
How do you get it solved?
is working on a reply...