Customers are stored as User Content items in the database. eZ Commerce uses the following features that are connected to users:
- Roles and Policies
- extensible User model
- User Groups
- password management
- activation of accounts
- session handling
In addition, eZ Commerce supports multiple user accounts with the same email address (e.g. for a multi-shop setup).
eZ Commerce adds the following new Fields to the User Content Type that are required for the shop:
- first name, last name
- customer profile data
- customer number, contact number
- budget per order and per month (used by the Customer Center plugin)
Each shop stores private and business customers in different User Groups. If required, shops can also share one common User Group.
ERP system as the master¶
The customers are directly connected to the ERP system if they have a customer number or/and a contact number.
The ERP system usually identifies customers by their customer numbers. The customer number is stored as a read-only Field in the User Content item.
The shop gets the information from the ERP automatically when user information (customer profile data) is requested for the first time.
The information is stored in the session to reduce the number of calls to ERP.
The ERP system provides:
- invoice address
- buyer address
- a list of delivery addresses
- contact information if the user has a contact number
- further information depending on the ERP system
Accessing customer data in a template¶
The template offers a global Twig variable that contains the main information about the current user, their addresses and data from the ERP.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Do not use methods of the customer service inside a constructor of a service. The constructor is built at a very early stage of the process and the system may not have the information that a user is already logged in.
Do not use the customer service in any place that cannot access the session. An example would be a CLI tool, or processes that happen in background, like sending out the order if a customer paid via a payment service provider.
eZ Commerce uses the UBL standard to model customer data. The most important type is the Party which describes an address.
For each user, the following information is stored. If the user has a customer number, the following information is updated from the ERP after login:
- Buyer Party
- Invoice Party
- DeliveryParties - a list of addresses in the Party format
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47