OpenCart 🇺🇦

Схема

public mixed autocomplete ( )

Аргументы

Аргумент Возможный тип Описание
У метода нет аргументов

Описание

Метод пока еще не документирован.

Исходный код

$json = array();

if (isset($this->request->get['filter_name'])) {
	$this->load->model('sale/customer');

	$data = array(
		'filter_name' => $this->request->get['filter_name'],
		'start'       => 0,
		'limit'       => 20
	);

	$results = $this->model_sale_customer->getCustomers($data);

	foreach ($results as $result) {
		$json[] = array(
			'customer_id'       => $result['customer_id'], 
			'customer_group_id' => $result['customer_group_id'],
			'name'              => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')),
			'customer_group'    => $result['customer_group'],
			'firstname'         => $result['firstname'],
			'lastname'          => $result['lastname'],
			'email'             => $result['email'],
			'telephone'         => $result['telephone'],
			'fax'               => $result['fax'],
			'address'           => $this->model_sale_customer->getAddresses($result['customer_id'])
		);					
	}
}

$sort_order = array();

foreach ($json as $key => $value) {
	$sort_order[$key] = $value['name'];
}

array_multisort($sort_order, SORT_ASC, $json);

$this->response->setOutput(json_encode($json));