Customize customer list

  • Posts: 102
  • Thank you received: 12
  • Hikashop Business
2 years 6 months ago #341793

Hello,

How can an additional column be inserted in the customer overview (list) in which the data from a user-defined field are listed (isis Listing.php?)? We have stored customer numbers with the customers, which we use externally. Displaying this customer number in this list would be very helpful when searching for customers.

Christian sends greetings

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 6 months ago #341795

Hi,

If you're using a normal custom field of the table "user" to store that data in a column of the hikashop_user table, you can just edit the settings of the custom field in the menu Display>custom fields and turn on the "backend listing" setting.
If that's not the case and you just want to add your custom PHP code to the customers listing, you can edit the file user / listing via the menu Display>views
Note that to easy find which view file to edit for which area of HikaShop, you can activate the "Display view files" setting of the HikaShop configuration.

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

  • Posts: 102
  • Thank you received: 12
  • Hikashop Business
2 years 5 months ago #341851

Hello,

it is an address field.

Changes only take effect in isis listing.php. My customer number is stored in the "kdnr" address column. For the display in the customer list (isis listing.php) I found the following areas for the e-mail address, for example:

1.
<th class="title"><?php
echo JHTML::_('grid.sort', JText::_('HIKA_EMAIL'), 'huser.user_email', $this->pageInfo->filter->order->dir, $this->pageInfo->filter->order->value);
?></th>

2.
<td><?php
echo $row->user_email;
?></td>

What has to be changed here so that the column "kdnr" from the address area is displayed?

Greetings from Christian

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 5 months ago #341854

Hi,

The addresses of the users are not loaded there. So before displaying something of the addresses you first need to load it from the database.
Also, a user can have several billing addresses and several shipping addresses, with a default address for each.

For example, you could add:

<th class="title">kdnr</th>
and
<td><?php
$class = hikashop_get('class.address');
$billing_addresses = $class->loadUserAddresses($row->user_id, 'billing');
$main_billing_address = reset($billing_addresses);
echo $main_billing_address->kdnr;
?></td>

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

  • Posts: 102
  • Thank you received: 12
  • Hikashop Business
2 years 5 months ago #341865

Hello,

this works very well, thanks for the help.

What is somewhat unfavorable: On the one hand, there is for the column

<th class="title">kdnr</th>

no sorting function. Columns included in this way are also not included in the search. However, the search can alternatively be carried out with the browser search.

Greetings from Christian

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 5 months ago #341866

Hi,

There is indeed no way to add that unless you also modify the file administrator/components/com_hikashop/views/user/view.html.php (which is a core hack, and thus you'll loose the customization on each update), or with the development of a system plugin to override the view which is kind of complex unless you know what you're doing.

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

Time to create page: 0.063 seconds
Powered by Kunena Forum