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 storesCustomerImpl
- Customer class, updated to include reference to the store where the customer was registeredCheckoutServiceImpl
- used when creating accounts on checkoutCustomerService
- Updated for retrieving customers by storeCustomeSearchCriteria
- Holds the search fields in a customer search from CMCustomerQueryComposer
- Composes the query string from the CustomerSearchCriteria fieldsCustomerIndexBuildService
- 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.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.
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 itCheckoutServiceImpl
- Save the store property when create the ordercheckout\receipt.vm
- Show the store property on oder receipt pagecheckout\orderDetail.vm
- Show the store property on order view pageemail\orderConf.html.vm
- Show the store property on order confirmation emailOrderSearchCriteria
- Holds the search fields in the CM order search formOrderQueryComposer
- Composes the query string from the OrderSearchCriteria fieldsISearchTab
- List the available stores in the search viewFulfillmentPermissions
- Define the permission whether CSR can search on all the storesOrderSearchResultsView
- Show the store property on the search results list viewOrderSummaryOverviewSectionPart
- Show the store property on the order summary page
How it works
- In
CheckoutService
, when creating the order, the system keep the store property for the order. - The order property will be shown on the order receipt page, order view page and order confirmation email in the store.
- In the CM order search, the search can be filtered by store.
- 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.