jerry_afr Posted July 16, 2018 Share Posted July 16, 2018 Hi, When user tries to open a new ticket, there is a drop down list where he selects the service related to the ticket. In this list, all of user's services are displayed (terminated and active). Is there a way to make this list ordered by status? (for example, active products first, then terminated ones). Thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 18, 2018 Share Posted July 18, 2018 On 16/07/2018 at 08:16, jerry_afr said: Is there a way to make this list ordered by status? (for example, active products first, then terminated ones). the quick way would be to use an action hook - so create a .php file in /includes/hooks and paste the code below into it. <?php /** * Sort RelatedServices To Show Active Domains/Services First * @author brian! */ function sort_ticket_relatedservices_hook($vars) { if ($vars['templatefile']=='supportticketsubmit-steptwo'){ $relatedservices = $vars['relatedservices']; array_multisort(array_column($relatedservices, 'status'), SORT_ASC, array_column($relatedservices, 'name'), SORT_ASC, $relatedservices); return array("relatedservices" => $relatedservices); } } add_hook("ClientAreaPageSubmitTicket", 1, "sort_ticket_relatedservices_hook"); that should sort the $relatedservices array first by "status" (in alphabetical order - so "Active" first), and then by the service name. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.