The order assignment needs to happen *before* the statement that contains the name assignment, not inside the statement.
PHP Code:
//modification for Japanese name order
if ($_SESSION['languages_id'] == '7') {
$customers_name_order = $this->customer['lastname'] . ' ' . $this->customer['firstname'];
} else {
$customers_name_order = $this->customer['firstname'] . ' ' . $this->customer['lastname'];
}
$sql_data_array = array('customers_id' => $_SESSION['customer_id'],
'customers_name' => $customers_name_order,
'customers_company' => $this->customer['company'],
You also need to use the session variable $_SESSION['languages_id'].