Italian (Italy)

do_action_ref_array( 'vikrestaurants_build_all_orders_query', mixed &$querystring $group, array &$options )

Fires while loading the restaurants reservations or the take-away orders to display.


Description

Trigger hook to manipulate at runtime the query used to load the restaurants reservations or the take-away orders to display under the All Orders 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.

$group

(string)  The current group ("restaurant" or "takeaway").

&$options

(array)  An array of options.

  • start - the query offset to handle the pagination;
  • limit - the maximum number of reservations/orders to display per page.

Example

The example below joins the reservations table to a third-party table to access further data.

/**
 * 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  string  $group     The group to use ("restaurant" or "takeaway").
 * @param  array   &$options  An array of options.
 */
add_action('vikrestaurants_build_all_orders_query', function(&$query, $group, &$options) {
    $db = JFactory::getDbo();

    // select some columns
    $query->select($db->qn(['tpt.column1', 'tpt.column2']));
    // join restaurant reservations to a third-party table
    $query->leftjoin($db->qn('#__myplugin_third_party_table', 'tpt') . ' ON ' . $db->qn('tpt.id_reservation') . ' = ' . $db->qn('r.id'));
    // avoid duplicates
    $query->group($db->qn('r.id'));
}, 10, 3);

Changelog

Version Description
1.3 Introduced.
Ultimo aggiornamento: 2023-12-21
Utile?
Potrebbe interessarti:

Questo sito web utilizza i cookie

Questo sito web utilizza cookie e tecnologie simili. Alcune di queste tecnologie sono necessarie per il corretto funzionamento del sito web (essenziali). Altre tecnologie sono utilizzate per valutare il comportamento degli utenti (analisi), per integrare media esterni o per scopi pubblicitari. Se l'utente accetta, queste tecnologie vengono attivate. I dettagli sono riportati nella Privacy Policy. Da questa stessa pagina è inoltre possibile aggiornare/revocare il consenso. Se non si fornisce il consenso, verranno attivati solo i cookie con funzioni essenziali.

Sul nostro sito web utilizziamo tecnologie provenienti dagli Stati Uniti. Pertanto, se acconsentite, acconsentite anche al trasferimento dei vostri dati negli Stati Uniti. Desideriamo sottolineare che gli Stati Uniti non hanno un livello di protezione dei dati paragonabile a quello dell'Unione Europea e che qualsiasi azienda statunitense può essere obbligata dalle autorità statali a consegnare i vostri dati senza che voi abbiate alcuno strumento efficace di protezione legale contro questo.