Show Joomla Username and ID on customer details

  • Posts: 4
  • Thank you received: 0
8 years 7 months ago #235679

On the Order details page of the backend of HikaShop, it has the boxes Main Information, Additional Information, Customer, Billing address, shipping address. In the customer box it shows name, email and Id (this is the customerID in Hikashop).

I want to also see the Joomla username and Joomla ID. Is this possible? If so how? I can't work out which file in Display>View relates to that customer display box.

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 7 months ago #235691

Hi,

It's the file "show" of the view "order" that you can edit for your backend template via the menu Display>views.
It's that code you're looking for in there:
take.ms/T8OU9

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
8 years 7 months ago #235803

That's great thank Nicholas.... but what code do I need to add? to show Joomla username and Joomla ID

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
8 years 7 months ago #235829

x

Last edit: 8 years 7 months ago by KarenJohnson.

Please Log in or Create an account to join the conversation.

  • Posts: 193
  • Thank you received: 76
8 years 7 months ago #235893

Here is code from my modification. It was done for Hikashop 2.6.1 but I think it should work also in Hikashop 2.6.2.
Add it at the very top of the file, right after defined('_JEXEC') or die('Restricted access');

if (!empty($this->order->customer->user_cms_id)) {

    $u = new JUser((int)$this->order->customer->user_cms_id);
    $this->extra_data['user'][] = array(
        'title' => 'Username',
        'data' => $u->username
    );
    $this->extra_data['user'][] = array(
        'title' => 'Joomla user ID',
        'data' => '<a href="index.php?option=com_users&view=user&layout=edit&id='.$u->id.'">'.$u->id.'</a>'
    );
}

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
8 years 7 months ago #235804

Hi,

Well, it's quite simple.
As you can see there, this displays the name of the user:

<?php echo @$this->order->customer->name; ?>
So to display the username it's:
<?php echo @$this->order->customer->username; ?>
And for the id:
<?php echo @$this->order->customer->id; ?>

The following user(s) said Thank You: KarenJohnson

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
8 years 7 months ago #237692

It worked! Thanks so much

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum