English (United Kingdom)

apply_filters_ref_array( 'vikappointments_fetch_status_save_order', bool $result, string &$status, string &$comment )

Fires after evaluating the default status code.


Description

Trigger hook to manipulate the order status at runtime.

In case you need to determine the correct status depending on the booked services, it is possible to use the following code to access all the services contained within the cart.

// get cart model
$model = JModelVAP::getInstance('cart');
// get cart instance
$cart = $model->getCart();
// iterate items list
foreach ($cart->getItemsList() as $item)
{
    // convert object into an array
    $arr = $item->toArray();
}

Parameters

$result

(bool)  True on success, false otherwise.

&$status

(string)  The status code to use.

&$comment

(string)  An optional status comment.


Example

/**
 * Trigger hook to manipulate the order status at runtime.
 *
 * @param  boolean  $result    True on success, false otherwise.
 * @param  string   &$status   The currently fetched order status.
 * @param  string   &$comment  An optional status comment to be used.
 */
add_filter('vikappointments_fetch_status_save_order', function($result, &$status, &$comment)
{
    // auto-confirm appointment
    $status = 'C';
    // define a custom comment
    $comment = 'Appointment confirmed by a third-party plugin';

    return $result;
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Last Update: 2022-04-11
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.