Jump to content
ozgurerdogan

Any way to sort Products in summary page?

Recommended Posts

I believe this is even not something to vote to add it to whmcs. It is mostly a standart on all table listing things. So whmcs itself should already have had it. Also it is not a hard work to apply is it? It is just a sorting feature...

Share this post


Link to post
Share on other sites

which page are you talking about... and sort in what way??

Share this post


Link to post
Share on other sites

I wasn't sure if you meant the client summary in the admin area, or the product/domain summary page of the client area - but i'm going to assume you mean the admin area as the tables in the client area are sortable.

 

in the absence of WHMCS making these summary tables sortable, what you could do is modify the clientssummary.tpl template using the sortby Smarty plugin.

 

http://forum.whmcs.com/showthread.php?95519-temporarilly-change-sorting-of-items&p=400690#post400690

 

you could then modify the template to either hard code a sort option for each summary section - or even add links to the table column headings to allow sorting by any column.

 

e.g if you wanted to always display a client's domains in alphabetical order, you could do this...

 

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

because it's sorting by string or numerically, it doesn't work well with dates (unless they're in a YYYY/MM/DD format) or currencies - but if you only want to sort by text fields and/or numbers, it should work fine.

 

the idea should work on any of the tables on the summary page - domains, products, addons etc.

 

also, this should continue to work with v6 too (works on beta4).

Share this post


Link to post
Share on other sites
Actually I need to sort by dates mostly. So that would not help me..

you never mentioned sorting by date previously! :)

 

actually, it will help you in one respect - you now know that summary page uses a template.

 

therefore, all you will need to do is replace the current array(s) and generate your own, either in a php block or action hook, by querying the appropriate database tables and ordering by whichever date you want to sort by, and then tweak the foreach loop of the table(s) you want to sort.

Share this post


Link to post
Share on other sites

 

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

 

also, this should continue to work with v6 too (works on beta4).

 

Replacing existing line:

 

 

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

 

with what you suggested breaks the template... Too bad, I would have liked to use that!

Share this post


Link to post
Share on other sites

Hi,

 

in v6.01, using the following code still works for me... :idea:

 

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

 

what you might be doing wrong is where you are putting the Smarty plugin - the above code was written for v5; with v6, a lot of the directories have moved - so for v6, the above plugin now needs to go in...

 

/vendor/smarty/smarty/libs/plugins/

Share this post


Link to post
Share on other sites
thanks, but I am still on last v5

so am I - and it definitely works on v5.3 too! :idea:

 

where did you upload the plugin?

Share this post


Link to post
Share on other sites

per other thread (and in case someone finds THIS thread in the future):

 

I moved the plugin from /public_html/billing/includes/smarty/plugins to /public_html/xxxxx/includes/classes/Smarty/plugins and gee whiz, it works now!

Share this post


Link to post
Share on other sites

So I updated to 6.02, and moved the modifier.sortby.php file to /vendor/smarty/smarty/libs/plugins. I have the following code in clientsummary.tpl which no longer seems to sort correctly:

 

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

 

Any ideas?

Share this post


Link to post
Share on other sites

Hi,

 

as per post #10, the sortby is attached to 'from' and not 'item' - so it should be...

 

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

also, bear in mind what I said in post #6 in that it doesn't work well with dates (unless they're in YYYY/MM/DD format) or currencies.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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