Elastic Path Commerce Development

Customers

Customers

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.

Key Classes

  • 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.

Customer search

  • 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)

Commerce Manager

  • CustomerDetailsProfileRegistrationSection - displays customer registration details. Will show registered store if store is private.

How it works

  1. When creating/editing a store, the CSR can pick the other stores to allow logins from.
  2. 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.

  3. CustomerService checks for duplicates to ensure that there are no customer records in the database with the same store and UserId/Email
  4. 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.
  5. 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.
  6. 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.