public function onBuildServiceSearchOptionsQuery(mixed &$queryint $id) : void

Fires while fetching the list of available options.


Description

Trigger hook to manipulate at runtime the query used to load the available options to display under the Service Details page in the front-end.

Third party plugins can extend the query by applying further conditions or selecting additional data.


Parameters

&$query

(mixed)  Either a query builder object or a plain string.

$id

(int)  The ID of the service to which the options should be attached.

Return Value

None.


Example

The example below makes the options with ID 1, 2 and 3 always available for all the services.

/**
 * Trigger hook to manipulate the query at runtime. Third party plugins
 * can extend the query by applying further conditions or selecting
 * additional data.
 *
 * @param   mixed    &$query  Either a query builder or a query string.
 * @param   integer  $id      The service ID.
 *
 * @return  void
 */
public function onBuildServiceSearchOptionsQuery(&$query, $id)
{
   $query->orWhere('`id` IN (1,2,3)');
}

Changelog

Version Description
1.7.3 Introduced.
Last Update: 2022-01-28 16:29
Helpful?