save session variable to orders table with a Hook
Posted: Sat Jul 23, 2022 6:03 pm
Hi all
i made a hook for saving the referer to the orders table and i copied the code from a other module and it worked
the only thing is, i'm not sure if every 3 functions are needed to only save the parameter to the DB or is one of them to use it from the DB. Thank you for clarifying:
Maybe be first not?
thank in advance for helping / telling me
i made a hook for saving the referer to the orders table and i copied the code from a other module and it worked
the only thing is, i'm not sure if every 3 functions are needed to only save the parameter to the DB or is one of them to use it from the DB. Thank you for clarifying:
Code: Select all
function listen_databaseOrderBuild($parameters) {
if (!empty($parameters['builder']->get('orders_advertiser'))) {
$order_info = &$parameters['order']->info;
$order_info['orders_advertiser'] = $parameters['builder']->get('orders_advertiser');
}
}
function listen_constructOrder($parameters) {
if (!empty($_SESSION['orders_advertiser'])) {
$order_info = &$parameters->info;
$order_info['orders_advertiser'] = ($_SESSION['orders_advertiser']);
}
}
function listen_insertOrder($parameters) {
$orders = &$parameters['sql_data']['orders'];
$orders['orders_advertiser'] = ($GLOBALS['order']->info['orders_advertiser'] ?? '');
}thank in advance for helping / telling me