<?php
class ControllerErrorNotFound extends Controller {
	public function index() {
		$this->load->language('error/not_found');

		$this->document->setTitle($this->language->get('heading_title'));

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/home')
		);

		if (isset($this->request->get['route'])) {
			$url_data = $this->request->get;

			unset($url_data['_route_']);

			$route = $url_data['route'];

			unset($url_data['route']);

			$url = '';

			if ($url_data) {
				$url = '&' . urldecode(http_build_query($url_data, '', '&'));
			}

			$data['breadcrumbs'][] = array(
				'text' => $this->language->get('heading_title'),
				'href' => $this->url->link($route, $url, $this->request->server['HTTPS'])
			);
		}

		$data['heading_title'] = $this->language->get('heading_title');
		$data['text_error'] = $this->language->get('text_error');
		$data['text_eyebrow'] = $this->language->get('text_eyebrow');
		$data['text_hint'] = $this->language->get('text_hint');
		$data['button_home'] = $this->language->get('button_home');
		$data['button_catalog'] = $this->language->get('button_catalog');
		$data['button_contact'] = $this->language->get('button_contact');
		$data['button_continue'] = $this->language->get('button_home');

		$data['continue'] = $this->url->link('common/home');
		$data['contact'] = $this->url->link('information/contact');

		$this->load->model('catalog/category');

		$categories = $this->model_catalog_category->getCategories(0);

		$data['catalog'] = $this->url->link('common/home');

		if ($categories) {
			$data['catalog'] = $this->url->link('product/category', 'path=' . $categories[0]['category_id']);
			$data['button_catalog'] = $categories[0]['name'];
		}

		$data['column_left'] = $this->load->controller('common/column_left');
		$data['column_right'] = $this->load->controller('common/column_right');
		$data['content_top'] = $this->load->controller('common/content_top');
		$data['content_bottom'] = $this->load->controller('common/content_bottom');
		$data['footer'] = $this->load->controller('common/footer');
		$data['header'] = $this->load->controller('common/header');

		$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');

		$this->response->setOutput($this->load->view('error/not_found', $data));
	}
}
