English (United Kingdom)

apply_filters_ref_array( 'vikrestaurants_setup_takeaway_order_details', bool $status, object &$order, array $list )

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

$status

(bool)  True on success, false otherwise.

&$order

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

$list

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


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   boolean  $status  True on success, false otherwise.
 * @param   mixed    &$order  The order details object.
 * @param   array    $list    The query resulting array.
 */
add_filter('vikrestaurants_setup_takeaway_order_details', function($status, &$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);

    return true;
}, 10, 3);

Changelog

Version Description
1.2.1 Introduced.
Last Update: 2021-03-03
Helpful?

This website uses cookies

This website uses cookies and similar technologies. Some of these technologies are necessary for the proper functioning of the website (Essential). Other technologies are used to evaluate user behavior (Analysis), to integrate external media or for advertising purposes. If you agree, these technologies are activated. For details, please refer to the privacy policy. From this same page you can also update/revoke your consent. If you do not give your consent, only cookies with essential functions will be activated.

We use technologies from the USA on our website. If you give your consent, you therefore consent at the same time to your data being transferred to the USA. We would like to point out that the USA does not have a level of data protection comparable to that of the EU and that any US company can be obliged by state authorities to hand over your data without you having any effective legal protection against this.