Configuring Purchase Requirements¶
The extension has no global settings. Its settings page shows an information block and nothing else. Everything is configured per requirement under Purchase Requirements in the Extensions navigation group of the admin area.
The extension does not add a permission of its own to Paymenter's roles.
Fields of a requirement¶
| Setting | Type | Default | What it does |
|---|---|---|---|
| Product | Select, required | None | The product this requirement applies to. The list contains all products, sorted by name, and is searchable. |
| Requirement type | Select, required | Requires an active service of another product | Chooses the kind of rule: Requires an active service of another product or Maximum quantity per customer. The field below it changes with the type. |
| Required product | Select, required | None | Only shown for Requires an active service of another product. The customer must own an active service of this product. |
| Maximum quantity per customer | Whole number, required | None | Only shown for the type Maximum quantity per customer. How many services of the product one customer may hold. The form accepts 1 to 100000. |
| Custom error message | Text, optional | Empty | Shown to the customer when the requirement is not met. At most 255 characters. Leave it empty to use the default message. |
| Enabled | Toggle | On | A disabled requirement never blocks a purchase. |
When you save, the extension clears the field that does not belong to the chosen type. If you switch a requirement from one type to the other, the old required product or the old maximum is removed.
Default messages¶
If Custom error message is empty, the customer sees one of these texts. The product names are filled in from your products.
| Requirement type | Message |
|---|---|
| Requires an active service of another product | You need an active <required product> service before purchasing <product>. |
| Maximum quantity per customer | You can purchase at most <limit> <product> per customer. |
A custom message is shown as you typed it. It has no placeholders.
How services are counted¶
Only the customer's own services are looked at.
| Requirement type | Pending | Active | Suspended | Cancelled |
|---|---|---|---|---|
| Requires an active service of another product | Does not count | Counts | Does not count | Does not count |
| Maximum quantity per customer | Counts | Counts | Counts | Does not count |
For Maximum quantity per customer the purchase is allowed when the services the customer already holds plus the quantity in the cart do not exceed the maximum.
- Existing services are counted one per service. The quantity stored on a service is not used. If a product allows a combined quantity and a customer orders it with quantity 3 on one cart line, that purchase counts as 3 while it is in the cart and as 1 held service afterwards.
- A product in the cart never fulfils a Required product rule. The customer needs a service of the required product that is already active.
Several requirements for one product¶
You can create any number of requirements for the same product. All enabled requirements of a product must be met. They are checked in the order they were created, and the customer sees the message of the first one that is not met.
Deleted products¶
- If the product in Product is deleted, its requirements are deleted with it.
- If the product in Required product is deleted, the requirement stays but no longer blocks anything. In the list its condition reads
Requires an active service (no product selected). Edit it and pick a new product, or delete it.
Database¶
The extension stores its data in one table, ext_purchase_requirements, with one row per requirement.