Jump to content

Any way to sort Products in summary page?


Recommended Posts

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).

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

 

{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!

Link to comment
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/

Link to comment
Share on other sites

  • 1 month later...

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?

Link to comment
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.

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