Customer is b2b or b2cvar shopContext = ShopContext.GetCurrent(); shopContext.IsB2cCustomer#region Get Customer |
| var accountId = CommerceFrameworkBase.Context.AccountId; |
| var accountType = ShopContext.GetCurrent().ShopAccount.Type; |
| ICustomerProfile customer = null; |
| if (accountType == ShopAccountType.Contact) |
| customer = CommerceFrameworkBase.Customers.GetCustomerByContact(accountId); |
| else if (!String.IsNullOrEmpty(accountId) && ((accountType == ShopAccountType.Customer) || (accountType == ShopAccountType.SalesAgent && ShopContext.GetCurrent().IsImpersonating))) |
| customer = CommerceFrameworkBase.Customers.GetCustomer(accountId); |
#endregion#region Get Customer var accountId = CommerceFrameworkBase.Context.AccountId; var accountType = ShopContext.GetCurrent().ShopAccount.Type; ICustomerProfile customer = null; if (accountType == ShopAccountType.Contact) customer = CommerceFrameworkBase.Customers.GetCustomerByContact(accountId); else if (!String.IsNullOrEmpty(accountId) && ((accountType == ShopAccountType.Customer) || (accountType == ShopAccountType.SalesAgent && ShopContext.GetCurrent().IsImpersonating))) customer = CommerceFrameworkBase.Customers.GetCustomer(accountId); #endregionvar name = Shop.ShopAccount.Name; Get Customer by ERP Call // Sana should retrieve from NAV per customer (in real-time): var options = ObjectFactory.Create<ICustomerLoadOptions>(); options.LoadShippingAddresses = false; customer = Providers.Customers.GetCustomer(accountId, options); var shopContext = ShopContext.GetCurrent(); if (shopContext.ShopAccount != null) return shopContext.ShopAccount.Id.ToString(); else return "guest-" + CommerceFrameworkBase.Context.AccountId; |