Back to Opencart

File catalog\controller\information\sitemap.php

docs/api/source-catalog.controller.information.sitemap.html

4.1.0.38.5 KB
Original Source

Namespaces

Classes

| 1: | <?php | | 2: | namespace Opencart\Catalog\Controller\Information; | | 3: | /** | | 4: | * Class Sitemap | | 5: | * | | 6: | * @package Opencart\Catalog\Controller\Information | | 7: | */ | | 8: | class Sitemap extends \Opencart\System\Engine\Controller { | | 9: | /** | | 10: | * @return void | | 11: | */ | | 12: | public function index(): void { | | 13: | $this->load->language('information/sitemap'); | | 14: | | | 15: | $this->document->setTitle($this->language->get('heading_title')); | | 16: | | | 17: | $data['breadcrumbs'] = []; | | 18: | | | 19: | $data['breadcrumbs'][] = [ | | 20: | 'text' => $this->language->get('text_home'), | | 21: | 'href' => $this->url->link('common/home', 'language=' . $this->config->get('config_language')) | | 22: | ]; | | 23: | | | 24: | $data['breadcrumbs'][] = [ | | 25: | 'text' => $this->language->get('heading_title'), | | 26: | 'href' => $this->url->link('information/sitemap', 'language=' . $this->config->get('config_language')) | | 27: | ]; | | 28: | | | 29: | $this->load->model('catalog/category'); | | 30: | | | 31: | $data['categories'] = []; | | 32: | | | 33: | $categories_1 = $this->model_catalog_category->getCategories(0); | | 34: | | | 35: | foreach ($categories_1 as $category_1) { | | 36: | $level_2_data = []; | | 37: | | | 38: | $categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']); | | 39: | | | 40: | foreach ($categories_2 as $category_2) { | | 41: | $level_3_data = []; | | 42: | | | 43: | $categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']); | | 44: | | | 45: | foreach ($categories_3 as $category_3) { | | 46: | $level_3_data[] = [ | | 47: | 'name' => $category_3['name'], | | 48: | 'href' => $this->url->link('product/category', 'language=' . $this->config->get('config_language') . '&path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id']) | | 49: | ]; | | 50: | } | | 51: | | | 52: | $level_2_data[] = [ | | 53: | 'name' => $category_2['name'], | | 54: | 'children' => $level_3_data, | | 55: | 'href' => $this->url->link('product/category', 'language=' . $this->config->get('config_language') . '&path=' . $category_1['category_id'] . '_' . $category_2['category_id']) | | 56: | ]; | | 57: | } | | 58: | | | 59: | $data['categories'][] = [ | | 60: | 'name' => $category_1['name'], | | 61: | 'children' => $level_2_data, | | 62: | 'href' => $this->url->link('product/category', 'language=' . $this->config->get('config_language') . '&path=' . $category_1['category_id']) | | 63: | ]; | | 64: | } | | 65: | | | 66: | $data['special'] = $this->url->link('product/special', 'language=' . $this->config->get('config_language')); | | 67: | $data['account'] = $this->url->link('account/account', 'language=' . $this->config->get('config_language')); | | 68: | $data['edit'] = $this->url->link('account/edit', 'language=' . $this->config->get('config_language')); | | 69: | $data['password'] = $this->url->link('account/password', 'language=' . $this->config->get('config_language')); | | 70: | $data['address'] = $this->url->link('account/address', 'language=' . $this->config->get('config_language')); | | 71: | $data['history'] = $this->url->link('account/order', 'language=' . $this->config->get('config_language')); | | 72: | $data['download'] = $this->url->link('account/download', 'language=' . $this->config->get('config_language')); | | 73: | $data['cart'] = $this->url->link('checkout/cart', 'language=' . $this->config->get('config_language')); | | 74: | $data['checkout'] = $this->url->link('checkout/checkout', 'language=' . $this->config->get('config_language')); | | 75: | $data['search'] = $this->url->link('product/search', 'language=' . $this->config->get('config_language')); | | 76: | $data['contact'] = $this->url->link('information/contact', 'language=' . $this->config->get('config_language')); | | 77: | | | 78: | $this->load->model('catalog/information'); | | 79: | | | 80: | $data['informations'] = []; | | 81: | | | 82: | foreach ($this->model_catalog_information->getInformations() as $result) { | | 83: | $data['informations'][] = [ | | 84: | 'title' => $result['title'], | | 85: | 'href' => $this->url->link('information/information', 'language=' . $this->config->get('config_language') . '&information_id=' . $result['information_id']) | | 86: | ]; | | 87: | } | | 88: | | | 89: | $data['column_left'] = $this->load->controller('common/column_left'); | | 90: | $data['column_right'] = $this->load->controller('common/column_right'); | | 91: | $data['content_top'] = $this->load->controller('common/content_top'); | | 92: | $data['content_bottom'] = $this->load->controller('common/content_bottom'); | | 93: | $data['footer'] = $this->load->controller('common/footer'); | | 94: | $data['header'] = $this->load->controller('common/header'); | | 95: | | | 96: | $this->response->setOutput($this->load->view('information/sitemap', $data)); | | 97: | } | | 98: | } | | 99: | |

OpenCart API API documentation generated by ApiGen dev-master