Hello, there is no field NOTE in table ORDERS in early prestashop 1.7 versions. The NOTE field have appeared in later prestashop 1.7 versions. Then, you can try this code:
if (!empty($message) && Validate::isCleanHtml($message)) {
// Retrieve the last created order for the current cart
$order = Order::getByCartId((int)$id_cart);
if ($order) {
// Sanitize the message
$cleanMessage = strip_tags($message, '<br>');
// Update the note field in the orders table
Db::getInstance()->update(
'orders',
['note' => pSQL($cleanMessage)],
'id_order = ' . (int)$order->id
);
}
}