Page 1 of 1

changing admin -> orders

Posted: Tue Aug 13, 2024 4:43 am
by Portman
Hi,

Just a quick question...

where is the file that displays the contents found in Admin -> Orders.

I want to change the customer names on the list to company names

thanks

Re: changing admin -> orders

Posted: Tue Aug 13, 2024 5:04 am
by heatherbell
Portman wrote: Tue Aug 13, 2024 4:43 am where is the file that displays the contents found in Admin -> Orders.
The pages get their content according to Action on the page from files in admin/includes/actions/
For this page, admin/includes/actions/orders with the default view coming from admin/includes/actions/orders/views/default.php

Re: changing admin -> orders

Posted: Tue Aug 13, 2024 5:56 am
by Kofod95
Note that you could use something like:

Code: Select all

class hook_admin_orders_showCompany{
  listen constructPaginator($params){
    global $table_definition;
  
  ...
  
  }
}
To insert the company name beside the name, or instead of on the order-listing. I can't remember the rest of the code, but if you need/want I can find more.

If you are talking about the order edit screen, you could probably just change the address format.

//Daniel

Re: changing admin -> orders

Posted: Thu Aug 15, 2024 12:19 am
by Portman
Thanks @Kofod95 & @heatherbell,

I had it stuck in my head for some reasons that hooks only worked in Front of House, not Admin. so with the info you have both given me I'll give creating a hook for this a go (I'll probably have to undo some other changes I made to the core code in admin too now that I realise this is the case)

If I have no luck I may call on you again @Kofod95 for some help.

Re: changing admin -> orders

Posted: Thu Aug 15, 2024 7:53 pm
by Omar_one
@Portman
try this (save it includes/hooks/admin/orders/xxxx.php) change xxxx as you want

Code: Select all

class hook_admin_orders_xxxx {
  public function listen_constructPaginator($paginator) {	   
    $GLOBALS['table_definition']['columns'][] = [
      'name' => "Company",
      'class' => 'text-right',
      'function' => function ($row) {
       return $row['customers_company'];
      },
    ];
  }  
 }
this will add a new column(customers_company) in orders.php