Jump to content

Order domains by expiry date descending in client summary


123host

Recommended Posts

For some odd reason domains in the client summary are listed by domain ID, descending.  It is effectively useless, I can't even imagine why would someone want/need to see a list of domains in order they were registered, especially if there are hundreds of domains.

Ideally each column should be sortable, like most tables on the web and also like some tables in WHMCS, but the developers apparently aren't interested in this basic functionality.

So I have found this item https://smartcoding.wordpress.com/2009/02/24/smarty-sort-array/, the same code is available on a few sites.  But it is dated 2009 and doesn't work as expected.  

I create the plugin script and then in /blend/clientsummary.tpl on line 403 (in 8.0.3) I replace

{foreach key=num from=$domainsummary item=domain}

with

{foreach key=num from=$domainsummary item=domain|@sortby:"domain"}

("domain" was obtained from the smarty {debug} screen) expecting it to be sorted by domain name.

It doesn't work.  I have tried all sorts of variations on this that I can think of without any joy.  Mostly it doesn't output the table, some variations cause a fatal error.

Does anyone have a solution for this so I can make the client summary list of domains more useful?

Link to comment
Share on other sites

7 hours ago, 123host said:

It doesn't work.  I have tried all sorts of variations on this that I can think of without any joy.  Mostly it doesn't output the table, some variations cause a fatal error.

the problem is not so much WHMCS v8 itself, it's the fact that the modifier uses a PHP function that was deprecated back in PHP 7.2... and WHMCS requires PHP 7.2 as a minimum...

8 hours ago, 123host said:

Does anyone have a solution for this so I can make the client summary list of domains more useful?

whilst I think the Smarty modifier could be fixed for PHP 7.2+, if all you want to do is sort the domains on the clientsummary page, you might as well just use a hook to sort the array...

<?php

# Sort Domains In Admin Client Summary Page Hook
# Written by brian!

function admin_client_summary_domain_sort_hook($vars) {

	if ($vars['filename'] == 'clientssummary') {
		$domainsummary = $vars['domainsummary'];
		array_multisort(array_column($domainsummary, 'domain'), SORT_ASC, $domainsummary);
		return array("domainsummary" => $domainsummary);
	}
}
add_hook("AdminAreaPage", 1, "admin_client_summary_domain_sort_hook");
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