Page 1 of 1
Add customer ID above phone and email on admin - orders page
Posted: Fri Apr 07, 2023 12:10 pm
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.
Re: Add customer ID above phone and email on admin - orders page
Posted: Fri Apr 07, 2023 12:42 pm
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.
Re: Add customer ID above phone and email on admin - orders page
Posted: Sat Apr 08, 2023 9:34 am
by 14Steve14
Thanks @raiwa I will give it a go and may be back for a bit more help if needed.
Re: Add customer ID above phone and email on admin - orders page
Posted: Mon Apr 10, 2023 2:15 pm
by burt
Haven't tested but this target should get it;
Code: Select all
tbody:first > tr:first > td:first > p:first
Re: Add customer ID above phone and email on admin - orders page
Posted: Mon Apr 10, 2023 9:57 pm
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.
Re: Add customer ID above phone and email on admin - orders page
Posted: Tue Apr 11, 2023 9:00 am
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.
Re: Add customer ID above phone and email on admin - orders page
Posted: Tue Apr 11, 2023 11:35 am
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
Re: Add customer ID above phone and email on admin - orders page
Posted: Tue Apr 11, 2023 12:05 pm
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.