Jump to content

Display customers ID in six template


Recommended Posts

if you want to show it by editing a template, you could use...

 

{$clientsdetails.id}

if you want to show it in the navbar/sidebar/panel, then you'd need to use an action hook - which one will depend on where you want to display the customer ID.

Link to comment
Share on other sites

I want it to show it in "My details" at the left in the sidebar. Is it possible to integrate it simply via a template file?

i'm afraid not - you're going to need an action hook.

 

i've posted one very similar previously...

 

http://forum.whmcs.com/showthread.php?111614-how-can-i-hide-some-fields&p=457799#post457799

 

i've modified the code for you to show the customer ID...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
   $client = Menu::context('client');

   if($client->companyname != ""){
       $name = '<strong>'.$client->companyname.'</strong>';
   } else {
   $name = '<strong>'.$client->fullname.'</strong>';
   }
   $address1 = $client->address1;
   if($client->address2 != ""){
       $address2 = '<br>'.$client->address2;
   } else {
       $address2='';
   }
   $city = ' '.$client->city;
   $state = '<br>'.$client->state;
   $postcode = '<br>'.$client->postcode;
   $country = '<br>'.$client->countryname;
   $clientid = '<br><br>Customer ID: '.$client->id;
   $address_new = $name.'<p>'.$address1.$address2.$postcode.$city.$state.$country.$clientid.'</p>';

   if (!is_null($primarySidebar->getChild('Client Details'))) {
                    $primarySidebar->getChild('Client Details')
                                              ->setBodyHtml($address_new);
   }
}); 

to use it, just create a file within /includes/hooks, call it customeridsidebar.php and paste the above code into it.

Link to comment
Share on other sites

  • 6 years later...
On 6/14/2016 at 6:39 PM, brian! said:

i'm afraid not - you're going to need an action hook.

 

i've posted one very similar previously...

 

http://community.whmcs.com/showthread.php?111614-how-can-i-hide-some-fields&p=457799#post457799

 

i've modified the code for you to show the customer ID...

 

 


<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
   $client = Menu::context('client');

   if($client->companyname != ""){
       $name = '<strong>'.$client->companyname.'</strong>';
   } else {
   $name = '<strong>'.$client->fullname.'</strong>';
   }
   $address1 = $client->address1;
   if($client->address2 != ""){
       $address2 = '<br>'.$client->address2;
   } else {
       $address2='';
   }
   $city = ' '.$client->city;
   $state = '<br>'.$client->state;
   $postcode = '<br>'.$client->postcode;
   $country = '<br>'.$client->countryname;
   $clientid = '<br><br>Customer ID: '.$client->id;
   $address_new = $name.'<p>'.$address1.$address2.$postcode.$city.$state.$country.$clientid.'</p>';

   if (!is_null($primarySidebar->getChild('Client Details'))) {
                    $primarySidebar->getChild('Client Details')
                                              ->setBodyHtml($address_new);
   }
}); 
 

 

to use it, just create a file within /includes/hooks, call it customeridsidebar.php and paste the above code into it.

 

Hi there, I know this is an old thread but i like the idea I just have one question.

How can I make something  with the same idea but instead of a customer id like a number. It says the clients name like "Welcome back John" and then also like a breadcrumb trail below that, that then shows the Customer Code like JHN310 basically an abstract of the clients name and a randomly generated number?  Theme I am using is the control theme, the default order form template is Control Alternative Compare (Default). (Not sure if this helps)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated