Jump to content

Displaying active products first in the ticket list


jerry_afr

Recommended Posts

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

Link to comment
Share on other sites

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. :!:

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