Basket - Eventlistener in the standard¶
eZ Commerce offers two standard event listeners.
The basket comes with a standard event listener which provides a logic for standard rules.
The standard listener provides the following checks:
- check if the quantity is valid for a
- check for a minimum quantity
- check for a maximum quantity
- check the packaging unit
- purges the basket cache after changes in the basket
The allowed quantity is stored in
catalogElement as a regex -
$allowedQuantity - and is evaluated by
If the catalog factory did not set the
$allowedQuantity attribute in the catalog element, only
int quantity is valid.
Min and max quantity¶
The min and max values are stored in
EshopBundle/Resources/config/basket.yml as a default, if not set in
1 2 3
The packaging unit is stored in
packagingUnit. If the requested quantity does not correspond to the packaging unit, the quantity is increased to the next possible quantity that will correspond to the packaging unit.
This listener handles discontinued products. It is active when it's enabled in configuration:
How to enable/disable this listener?
1 2 3
When is a catalog element recognized as discontinued?¶
This listener is only active for products that are marked as 'discontinued'
There are three possibilities when a listener checks stock information:
- stock is not available - error message is displayed that there is no information about the availability for product, but it is discontinued.
- stock is 0 - item is removed from the basket and error message is displayed that the item is discontinued and not available anymore.
- ordered quantity is bigger than stock - the quantity is modified in the basket line and notice message is set in the basket.