Раздел "Услуги"
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user