When a customer registers for an account in a store, the customer is only associated with the that store, but stores can be configured to allow customers from other stores to log in. This allows customer accounts to be shared across multiple stores.
CSRs can be assigned permissions to specific stores to manage its customers.
- CustomerAuthenticationDaoImpl - authentication class to retrieve customer accounts. Modified to filter accounts that were not registered to private stores.
- CustomerImpl - Customer class, updated to include reference to the store where the customer was registered.
- CheckoutServiceImpl - used when creating accounts on checkout.
- CustomerService - Updated for retrieving customers by store.
- CustomeSearchCriteria - Holds the search fields in a customer search from CM
- CustomerQueryComposer - Composes the query string from the CustomerSearchCriteria fields
- CustomerIndexBuildService - Builds the customer index, sets the fields to be indexed. (Modified to include the store code)
- CustomerDetailsProfileRegistrationSection - displays customer registration details. Will show registered store if store is private.
How it works
- When creating/editing a store, the CSR can pick the other stores to allow logins from.
- Customers are attached to store they first registered with by setting the current store to the customer object.
customer.setStore(EpController.getStore());In CheckoutServiceImpl, CheckoutCreateAccountFormController, the current store is set for the new customer accounts.Note:
Customers must always be created within the context of an existing store.
- CustomerService checks for duplicates to ensure that there are no customer records in the database with the same store and UserId/Email
- When logging in to a store, CustomerAuthenticationDaoImpl retrieves all the matching customer usernames in the database for the store and all stores with which it shares customers. The customer is able to log in if a record is found in this list.
- When looking for customers by user ID/email through the CustomerService, we need to pass the store code. The code then filters by the store and the store's associated stores.
- In the CM customer search, the search can be filtered by store. The CM user can only search in the stores where they have permissions.