Hook to add details into admin customers
Posted: Sun Apr 07, 2024 5:46 pm
Phoenix 1.0.9.0 PHP8.1
I have created a hook which adds additional information on the customers page. I can get it to show the customers phone number, mobile and business name if there is one, but I cannot get it to show the customers ID. The hook is based on a adjusted copy of another that adds information into the orders table, and that works.
The code below shows the heading but the data next to each customer is empty.
This is the code that I have used.
Why would some work and not the customers ID. Is it a case that the code as changed in a newer version.
I have created a hook which adds additional information on the customers page. I can get it to show the customers phone number, mobile and business name if there is one, but I cannot get it to show the customers ID. The hook is based on a adjusted copy of another that adds information into the orders table, and that works.
The code below shows the heading but the data next to each customer is empty.
This is the code that I have used.
Code: Select all
class hook_admin_customers_extra_details {
public function listen_constructPaginator() {
$pos = 2;
array_splice($GLOBALS['table_definition']['columns'], $pos, 0, [
[
'name' => 'Mobile',
'function' => function (&$row) {
return strip_tags($row['customers_fax']);
},
],
]);
array_splice($GLOBALS['table_definition']['columns'], $pos, 0, [
[
'name' => 'Phone',
'function' => function (&$row) {
return strip_tags($row['customers_telephone']);
},
],
]);
array_splice($GLOBALS['table_definition']['columns'], $pos, 0, [
[
'name' => 'Company name',
'function' => function (&$row) {
return strip_tags($row['entry_company']);
},
],
]);
array_splice($GLOBALS['table_definition']['columns'], $pos, 0, [
[
'name' => 'Cust No',
'function' => function (&$row) {
return strip_tags($row['customers_id ']);
},
],
]);
}
}