Раздел "Услуги"

This commit is contained in:
Konstantin
2026-05-30 10:41:16 +03:00
parent 373c575181
commit fc7ed88ef5
12 changed files with 740 additions and 111 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
class ControllerServiceMenu extends Controller {
public function index() {
$this->load->model('service/category');
$data['categories'] = $this->getCategories();
return $this->load->view('service/menu', $data);
}
private function getCategories($parent_id = 0, $path = '') {
$category_data = array();
$categories = $this->model_service_category->getCategories($parent_id);
foreach ($categories as $category) {
$category_path = $path ? $path . '_' . $category['service_category_id'] : $category['service_category_id'];
$category_data[] = array(
'name' => $category['name'],
'href' => $this->url->link('service/category', 'service_category_id=' . $category_path)
);
$category_data = array_merge($category_data, $this->getCategories($category['service_category_id'], $category_path));
}
return $category_data;
}
}