Try our conversational search powered by Generative AI!

Commerce with AD user

Vote:
 

Hi Everyone,

How to manage commerce with AD user? when log in with AD user and add cart with this method

 

public static void Add(string entryCode, decimal quantity)
{
var cart = new CartHelper("name");
Entry entry = CatalogContext.Current.GetCatalogEntry(entryCode);
cart.AddEntry(entry, quantity, false); // here i check cart has right item and GetTotalItemCount() is right
}

but when i count item in cart with this code in another page GetTotalItemCount() is 0

var cart = new CartHelper("name"); 
return cart.GetTotalItemCount();

 

Any idea why? i have episerver 7.5 and have AD user in CMS as read only

#109659
Oct 12, 2014 23:37
Vote:
 

Hi,

The cart is identifed by the current contact id. It looks like when you using AD account, the current user is not set correctly all the time, causing the CurrentContactId to be mapped to "anonymous", then causing your problem.

I would suggest you to check if SecurityContext.Current.CurrentUser to see if it returns correct value all the time.

We have an ongoing US to handle this situation more correctly.

Regards.

/Q

#109662
Oct 13, 2014 5:12
Vote:
 

Opps , i just see my post is looks terrible :) but thank you Quan  to reply
Current user is correct all the time but problem is  Episerver creat new cart to AD user evertime when AD user add item to cart. When i log in to Commerce and check order cart. Same AD user many cart created and every cart have just one item. 

401 wt8873 0,00 kr In Progress Today, 10:47 AM
400 wt8873 0,00 kr In Progress Today, 10:47 AM
399 wt8873 0,00 kr In Progress Today, 10:47 AM
398 wt8873 0,00 kr In Progress Today, 10:47 AM
397 wt8873 0,00 kr In Progress Today, 10:47 AM
396 wt8873 0,00 kr In Progress Today, 10:46 AM
395 wt8873 0,00 kr In Progress Today, 10:46 AM
#109687
Oct 13, 2014 11:18
Vote:
 

That's strange. Can you make sure that those carts have same name and same market?

/Q

#109689
Oct 13, 2014 11:46
Vote:
 

I am sure that cart have the same name because  vi config cart name property in start page (multi-site, share database)and all of them have default market.

#109692
Oct 13, 2014 12:10
Vote:
 

I guess i know now what the problem is.  I dont have AD membership provider in Commerce.
Do you know how to make Active Directory Membership Provider for EPiCommerce ? 

#109742
Oct 14, 2014 9:31
Vote:
 

To my knowledge there's no out-of-box support for ActiveDirectoryMembershipProvider for Commerce Manager at the moment.

But we're working on one - should be released in a couple of weeks.

Regards.

/Q

#109778
Oct 14, 2014 17:16
* 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.