public function onSetupTakeawayOrderDetails( object &$order, array $list ) : void

Fires while creating the take-away order object according to the details fetched by the query.


Description

External plugins can use this event to manipulate the object holding the details of the order. Useful to inject all the additional data fetched with the manipulation of the query.


Parameters

&$order

(object)  The object holding the details of the order.

$list

(array)  All the records loaded from the database query.

Return Value

None.


Example

The example below can be used to implement a formatted version of the check-in.

/**
 * External plugins can use this event to manipulate the object holding
 * the details of the order. Useful to inject all the additional
 * data fetched with the manipulation of the query.
 *
 * @param   mixed  &$order  The order details object.
 * @param   array  $list    The query resulting array.
 *
 * @return  void
 */
public function onSetupTakeawayOrderDetails(&$order, $list)
{
    // fetch take-away order menu items
    foreach ($list as $row) {
        if ($row->item_id && isset($order->items[$row->item_id])) {
            // assign the image fetched with the query manipulation
            $order->items[$row->item_id]->image = $row->item_image;
        }
    }

    // recover date and time format from configuration
    $config = VREFactory::getConfig();

    $df = $config->get('dateformat');
    $tf = $config->get('timeformat');

    // format check-in date and time
    $order->checkinDateTime = date($df . ' ' . $tf, $order->checkin_ts);
}

Changelog

Version Description
1.8.4 Introduced.
Last Update: 2023-12-29 14:15
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information