Quote Originally Posted by wsworx View Post
1.5.7c
PHP 7.5

I am working with "add_customers_from_admin-2.0.10" plugin.

On the backend page "Add Customers" I need the "Choose A Customer" dialog to be sorted so I can actually find a customer easily.
In the file "add_customers_backend.php", at line 642, I added "ORDER BY customers_lastname" but it is not working.
Can someone tell me how to get this sort to work?

Code:
function create_customer_drop_down() {
  global $db;
  $customers = array();
  $customers[] = array ( 'id' => '0', 'text' => TEXT_PLEASE_CHOOSE );
  
  $sql = "SELECT customers_id, customers_firstname, customers_lastname, customers_email_address FROM " . TABLE_CUSTOMERS . " ORDER BY customers_lastname";
  $customersRecords = $db->Execute($sql);
  
  while (!$customersRecords->EOF) {
    $customers[] = array('id' => $customersRecords->fields['customers_id'], 'text' => $customersRecords->fields['customers_firstname'] . ' ' . $customersRecords->fields['customers_lastname'] . ' (' . $customersRecords->fields['customers_email_address'] . ')');
    $customersRecords->MoveNext();
  }
  
  return $customers;
}
Thank You for your assistance with this.
Never mind folks.
I now see that is actually sorting by last name.
If I want the last name to show first I have to rearrange the code accordingly.