You can delegate you operations in the shop to another user. This user can then take over as if they had a different customer number.
The user must have the
siso_policy/delegate Policy which gives them access to special delegate functions.
They can access these functions in the site header.
On the delegate page the user can enter a customer number of a known customer and click Delegate.
User data for the provided customer number is then fetched from ERP. If the customer number is valid the number is assigned to the current user. The delegate user then takes over as a different customer with a different customer number and can even create an order with the given customer number. They only get the ERP profile data from the different customer, but not other things, such as the basket. The user always uses their own basket.
The user stays in the delegate role until they click Undelegate.
The delegate function is disabled by default. To enable it, add the following configuration in your Ibexa Platform project folder, the
config\packages\ezplatform.yaml file, under the
When a user enters a customer number in the Delegate screen, the delegate function is called directly.
If no user is found with provided customer number, an error message is displayed.
If the delegation is successful, new user data is displayed. In the top right corner in the header you can see the new customer number.
The user can return to their own profile by clicking the Undelegate button.
Access the delegation from the menu:
Routing / Controller (New actions) and logic¶
EshopBundle/Controller/DelegateCustomerController.php controller handles delegating and undelegating actions.
The function adds two routes:
1 2 3 4 5 6 7
Delegating is not always allowed, you can use the
DelegateCustomerController::isDelegateAllowed method to check that.
The method returns true if delegation is allowed.
Form and entity¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
For the form implementation you must have a new entity:
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
There are also two new templates to show the delegate forms and information.
Customer profile data¶
The information whether the user is a delegate or not is stored in the customer profile data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14