I have filled in the fields that are missing from the array for each respective call (see below).
The two function calls outputs are merged as data['messages'] and display correctly on the front end. However what I want to do is sort the comments from the two functions by the field 'created' so that they appear in order.
Any help? I got to this point and an evenings playing has go me knowwhere.
Code: Select all
$results = $this->model_ticket_message->getOrderHistories(1, 1, 10);
foreach ($results as $result) {
$this->data['messages'][] = array(
'status' => $result['status'],
'content' => nl2br($result['comment']),
'created' => $result['date_added'],
'is_user' => 0,
'order_history' => 1
);
}
$results = $this->model_ticket_message->getMessages( array('filter_ticket' => $ticket_id) );
foreach ($results as $result) {
$this->data['messages'][] = array(
'status' => '',
'content' => nl2br($result['content']),
'created' => $result['created'],
'is_user' => $result['is_user'],
'order_history' => 0
);
}