OpenCart 🇺🇦

Схема

public mixed history ( )

Аргументы

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

Описание

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

Исходный код

$this->language->load('sale/order');

$this->data['error'] = '';
$this->data['success'] = '';

$this->load->model('sale/order');

if ($this->request->server['REQUEST_METHOD'] == 'POST') {
	if (!$this->user->hasPermission('modify', 'sale/order')) {
		$this->data['error'] = $this->language->get('error_permission');
	}

	if (!$this->data['error']) {
		$this->model_sale_order->addOrderHistory($this->request->get['order_id'], $this->request->post);

		$this->data['success'] = $this->language->get('text_success');
	}
}

$this->data['text_no_results'] = $this->language->get('text_no_results');

$this->data['column_date_added'] = $this->language->get('column_date_added');
$this->data['column_status'] = $this->language->get('column_status');
$this->data['column_notify'] = $this->language->get('column_notify');
$this->data['column_comment'] = $this->language->get('column_comment');

if (isset($this->request->get['page'])) {
	$page = $this->request->get['page'];
} else {
	$page = 1;
}

$this->data['histories'] = array();

$results = $this->model_sale_order->getOrderHistories($this->request->get['order_id'], ($page - 1) * 10, 10);

foreach ($results as $result) {
	$this->data['histories'][] = array(
		'notify'     => $result['notify'] ? $this->language->get('text_yes') : $this->language->get('text_no'),
		'status'     => $result['status'],
		'comment'    => nl2br($result['comment']),
		'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added']))
	);
}

$history_total = $this->model_sale_order->getTotalOrderHistories($this->request->get['order_id']);

$pagination = new Pagination();
$pagination->total = $history_total;
$pagination->page = $page;
$pagination->limit = 10;
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->url->link('sale/order/history', 'token=' . $this->session->data['token'] . '&order_id=' . $this->request->get['order_id'] . '&page={page}', 'SSL');

$this->data['pagination'] = $pagination->render();

$this->template = 'sale/order_history.tpl';

$this->response->setOutput($this->render());