OpenCart 🇺🇦

Схема

public mixed bestPrice ( )

Аргументы

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

Описание

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

Исходный код

$this->load->model('openbay/amazon_listing');
$this->load->language('openbay/amazon_listing');

$error = '';

if (empty($this->request->post['asin'])) {
	$error = $this->language->get('error_missing_asin');
}

if (empty($this->request->post['marketplace'])) {
	$error = $this->language->get('error_marketplace_missing');
}

if (empty($this->request->post['condition'])) {
	$error = $this->language->get('error_condition_missing');
}

if ($error) {
	$json = array(
		'data' => '',
		'error' => $error,
	);
} else {
	$bestPrice = $this->model_openbay_amazon_listing->getBestPrice($this->request->post['asin'], $this->request->post['condition'], $this->request->post['marketplace']);

	if ($bestPrice) {
		$json = array(
			'data' => $bestPrice,
			'error' => '',
		);
	} else {
		$json = array(
			'data' => '',
			'error' => $this->language->get('error_amazon_price'),
		);
	}
}

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