Tell me how to pull out the list of category items (menu) from the database bypassing all controllers and other modules? He did not try to find the table and keys, but he did not find the paths leading to the data output.

In the template, just from somewhere, $ categories appears, which contains everything in it. Where it is determined I can not find.

And you need to pull the menu generation into a separate file that is not connected to the main opencartʻa system.

    1 answer 1

    In the template, they appear from the controller, but the data in it is taken from the catalog/model/catalog/category.php

     $this->load->model('catalog/category'); $data['categories'] = array(); $categories = $this->model_catalog_category->getCategories(0); 

    Well, in the model:

     public function getCategories($parent_id = 0) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id) LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND c.status = '1' ORDER BY c.sort_order, LCASE(cd.name)"); return $query->rows; }