changing admin -> orders

Open to all! Ask other shopowners for help.
Post Reply
User avatar
Portman
Contributor
Posts: 158
Joined: Mon Mar 08, 2021 1:04 am
Phoenix Version: v1.0.8.20
Has thanked: 29 times
Been thanked: 4 times

changing admin -> orders

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: changing admin -> orders

Post 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
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: changing admin -> orders

Post 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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
User avatar
Portman
Contributor
Posts: 158
Joined: Mon Mar 08, 2021 1:04 am
Phoenix Version: v1.0.8.20
Has thanked: 29 times
Been thanked: 4 times

Re: changing admin -> orders

Post 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.
Omar_one
Senior Contributor
Posts: 679
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Has thanked: 100 times
Been thanked: 56 times

Re: changing admin -> orders

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply