Skip to main content
Version: 8.1.x

Multi Store Management

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 (Customer Service Representative) 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
  • 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​

  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.

    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.

Orders​

Customers can create orders in different stores. All orders are saved in the same database, so each order has a store property to indicated where is the order been created. The store property is shown on the order receipt and order view pages as well as in the order confirmation email.

In the Commerce Manager Order Search view, a CSR can filter orders by store. CSRs with permission to search for orders in all stores can choose to search in a particular store or in all stores where they have permissions. CSRs without the appropriate permissions can only search in the stores assigned to them.

Key Classes​

  • OrderImpl - Add the store property and persist it
  • CheckoutServiceImpl - Save the store property when create the order
  • checkout\receipt.vm - Show the store property on oder receipt page
  • checkout\orderDetail.vm - Show the store property on order view page
  • email\orderConf.html.vm - Show the store property on order confirmation email
  • OrderSearchCriteria - Holds the search fields in the CM order search form
  • OrderQueryComposer - Composes the query string from the OrderSearchCriteria fields
  • ISearchTab - List the available stores in the search view
  • FulfillmentPermissions - Define the permission whether CSR can search on all the stores
  • OrderSearchResultsView - Show the store property on the search results list view
  • OrderSummaryOverviewSectionPart - Show the store property on the order summary page

How it works​

  1. In CheckoutService, when creating the order, the system keep the store property for the order.
  2. The order property will be shown on the order receipt page, order view page and order confirmation email in the store.
  3. In the CM order search, the search can be filtered by store.
  4. If CSRs have permission to search the orders on all stores, they can choose to search orders either on a particular store or on all the stores. If CSRs don’t have the permission, they can only search by the stores assigned to them.