Closed BrockleyJohn closed 3 years ago
function listen_insertOrder(&$params) {
This is incorrect and unnecessary. Just remove the & and it should work with no other changes. If not, please post the actual code. Because you should not need $parameters to be a reference there, just sql_data.
Ok - as you were - it works fine on a clean install; there must be something squiffy in that dev store. Back to the code I had 5 hours ago!
The insert order hook lets you manipulate the sql_data before an order is inserted.
In order to do this I receive the parameter into my hook method by reference.
function listen_insertOrder(&$params) {
This works but generates a warning
Suggested fix is a change in the call method of the hooks class, from
$result .= call_user_func($callback, $parameters);
to$result .= call_user_func_array($callback, [&$parameters]);
This disappears the problem and doesn't obviously break anything - I assume screwing up this method should be in-your-face!