OpenCart 🇺🇦

Схема

public mixed autocomplete ( )

Аргументы

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

Описание

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

Исходный код

$json = array();

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

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

	$results = $this->model_catalog_product->getProducts($data);

	foreach ($results as $result) {
		$json[] = array(
			'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')),
			'link' => str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $result['product_id'] . '&tracking=' . $this->affiliate->getCode()))			
		);	
	}
}

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