Notifications in Venddor IO

Handling Notifications

Notifications in Venddor IO serve as an integral feedback mechanism, displayed as pop-up rectangles at the screen's top-right corner. They provide users with instant updates, alerts, or confirmations based on their actions or system responses.

Diverse Notification Categories

Venddor IO classifies notifications into five distinct categories:

The visual representation of these notifications is controlled by the CSS specific to the area where the notification is triggered.

Initiating Notifications

Notifications in Venddor IO are generated using the fn_set_notification function. Typically, an empty container is embedded within every Venddor IO page's HTML code, where the notification block materializes if a notification is triggered. This container is set up via templates found in:

Mechanisms to Trigger Notifications

1. Standard Page Load

This is initiated when a page is loaded. For example, in an 'add_to_cart' mode, the notification function might be invoked to display a warning:

if ($mode == 'add_to_cart') {
    fn_set_notification('E', fn_get_lang_var('warning'), $msg, true, 'insecure_password');
}

After invoking, the notification details are added to a specific array. When processed, this array determines which notification type gets displayed.

2. Through AJAX

AJAX-based notifications cater to dynamic updates without needing to reload the entire page. Here's how it works:

if (defined('AJAX_REQUEST')) {
    fn_set_notification('E', fn_get_lang_var('warning'), $msg, true, 'insecure_password');
}

On script completion or an explicit exit(), the Ajax class's destructor is triggered. It subsequently processes the notification details, presenting them via JavaScript functions.

3. JavaScript-based Notifications

Notifications can also be manually set using JavaScript. For example:

$.ceNotification('show', {
    type: 'E',
    title: _.error,
    message: error_msg
});