Add customer ID above phone and email on admin - orders page

Open to all! Ask other shopowners for help.
Post Reply
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Add customer ID above phone and email on admin - orders page

Post by 14Steve14 »

Whilst I have a bit of time |I am trying to update a copy of 1.0.8.20 so that it matches my current site. This will probably be one of many questions that I need answering as things have changed since my version 1.0.7.11.

Is there a way to add the customers ID above the email and phone number on the admin/orders page without changing core?

I have found the relevant code in admin/includes/actions/orders/views/edit.php

Code: Select all

<td>
                <p><?= $address->format($order->customer, 1, '', '<br>') ?></p>
                <p><?= $customer_data->get('telephone', $order->customer) . '<br><a href="mailto:' . $email_address . '"><u>' . $email_address . '</u></a>' ?></p>
              </td>
I believe what I need to add is

Code: Select all

                <?= $customer_data->get('id', $order->customer)  ?>
which I can do manually and get the ID to show but that alters core.

Any help appreciated.


Join The Code Co-op to get access to your library in the Code Co-op Forum
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Add customer ID above phone and email on admin - orders page

Post by raiwa »

I did it with an admin orders hook injecting the ID below the Page Title:

Code: Select all

  function listen_injectSiteEnd() {
    global $order, $customer_data;

    if ( isset($_GET['action']) && 'edit' === $_GET['action'] ) {

      $customer_id = '<h2 class="display-4 mb-2">' . TEXT_CUSTOMER_ID . $customer_data->get('id', $order->customer) . '</h2>';


      $output = <<<EOD
<script>
$(function() {
  $('h1:first').after('{$customer_id}');
});
</script>
EOD;

      return $output;
    }
  }
If you wish to show it elsewhere, you'll need to modify the 'h1:first' selector for your needs.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Add customer ID above phone and email on admin - orders page

Post by 14Steve14 »

Thanks @raiwa I will give it a go and may be back for a bit more help if needed.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Add customer ID above phone and email on admin - orders page

Post by burt »

Haven't tested but this target should get it;

Code: Select all

tbody:first > tr:first > td:first > p:first
I am not here to build for you.
I am here to build with you. Let's help each other.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Add customer ID above phone and email on admin - orders page

Post by ecartz »

I would think that TBODY should be enough on its own, without the :first. I agree that :first makes sense for the other elements.
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Add customer ID above phone and email on admin - orders page

Post by 14Steve14 »

Thanks to both @burt and @ecartz . When I have time next weekend I will give it a go and see what happens. I spent all this weekend adding in the supporters code stuff that I use to a blank 1.0.8.20, and there will be more to add once I decide on the final options I want on the new site. It took a long time what with all the testing so didn't get to do much else. There were a few problems along the way, but nothing serious.

I did think about adding a post to the main area so that non supporters could see what is available if they wanted to go pro but so far only have notes.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Add customer ID above phone and email on admin - orders page

Post by heatherbell »

14Steve14 wrote: Tue Apr 11, 2023 9:00 am I did think about adding a post to the main area so that non supporters could see what is available if they wanted to go pro but so far only have notes.
That already exists here as a pinned topic - viewtopic.php?p=9223#p9223
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Add customer ID above phone and email on admin - orders page

Post by 14Steve14 »

heatherbell wrote: Tue Apr 11, 2023 11:35 am
14Steve14 wrote: Tue Apr 11, 2023 9:00 am I did think about adding a post to the main area so that non supporters could see what is available if they wanted to go pro but so far only have notes.
That already exists here as a pinned topic - viewtopic.php?p=9223#p9223
Fair enough. I will leave it then.


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