Your cart is empty!
Fetch Available
public function onFetchAvailablePaymentMethods(mixed &$query, string $group, array $options) : void
Fires while loading all the available methods of payment.
Description
Trigger hook to allow the plugins to manipulate the query used to retrieve the available payment gateways.
It is possible to apply further restrictions or to select additional columns from external database tables.
Parameters
- &$query
-
(mixed) Either a query builder object or a plain string.
- $group
-
(string) The group to which the payments belong (appointments, packages or subscriptions).
- $options
-
(array) An array of options to filter the payments.
id_employee
- takes only the payments assigned to the specified employee (for appointments group only);strict
- validates the publishing options of the payment (by default it relies on the current client section).
Return Value
None.
Example
The example below excludes the payment with ID 5 for guest users.
/**
* Trigger event to allow the plugins to manipulate the query used to retrieve
* the available payment gateways.
*
* @param mixed &$query The query string or a query builder object.
* @param string $group The group to which the payments belong.
* @param array $options An array of options to filter the payments.
*
* @return void
*/
public function onFetchAvailablePaymentMethods(&$query, $group, $options)
{
if (VikAppointments::isUserLogged())
{
// always exclude the payment method with ID 5 in case of guest user
$query->where('id <> 5');
}
}
Changelog
Version | Description |
---|---|
1.7 | Introduced. |
Last Update: 2021-10-08 14:42
Helpful?