Adapt Your Add-ons and Themes to CS-Cart 4.20.1

Core Changes

Changes in fn_get_users() function

Since GROUP BY and the user_profiles table JOIN are not used in most queries, they will now be executed only under certain conditions.

If your add-ons use hooks from fn_get_users() and you perform additional table JOINs that could result in duplicate users in the list, you should now use the new $group_by parameter in the get_users hook.

Example:

fn_my_addon_get_users($params, $fields, $sortings, $condition, &$join, $auth, &$group_by)
{
    $join .= ' LEFT JOIN ?:my_table ON ?:my_table.user_id = ?:users.user_id;

    $group_by[] = '?users.user_id';
}

Otherwise, your add-ons may cause duplicates in the user lists.

Security

There were some controller modes that used allowed GET requests for queries that change the database. We moved them under condition that the request method is POST.

Here is the list of dispatches. If you used them, check that they are requested by POST.

Backend:

storage.clear_cache
storage.clear_thumbnails
tools.remove_quick_menu_item
tools.update_position
custom_menu.update_position

Frontend:

products.product_notifications

Changes in block manager schemas

Structure of grids schema app/schemas/block_manager/grids.php was refactored.

Instead of:

'wrappers' => [
     'wrapper_name' => 'template_name', // the list of "name -> template" pairs that will wrap blocks content inside grid
]

You should now use new structure:

The new structure is more convenient because it can be extended with new parameters.

Schemes using the old structure will continue to work, as the code includes conditions for backward compatibility. However, we recommend switching to the new format.

Hook changes

Changed hooks

- fn_set_hook('get_users', $params, $fields, $sortings, $condition, $join, $auth);

+ fn_set_hook('get_users', $params, $fields, $sortings, $condition, $join, $auth, $group_by);
- fn_set_hook('update_payment_pre', $payment_data, $payment_id, $lang_code, $certificate_file, $certificates_dir, $can_remove_offline_payment_params);

+ fn_set_hook('update_payment_pre', $payment_data, $payment_id, $lang_code, $certificate_file, $certificates_dir, $can_remove_offline_payment_params, $certificate_key_file, $certificate_keys_dir);
- fn_set_hook('update_payment_post', $payment_data, $payment_id, $lang_code, $certificate_file, $certificates_dir, $processor_params, $action);

+ fn_set_hook('update_payment_post', $payment_data, $payment_id, $lang_code, $certificate_file, $certificates_dir, $processor_params, $action, $certificate_key_file, $certificate_keys_dir);