public function get_children($parent_id = 0, $type = false, $visible_on_frontend = false)
{
$categories_id = $parent_id = intval($parent_id);
$cache_group = 'categories/' . $categories_id;
$table = $this->tables['categories'];
$db_t_content = $this->tables['content'];
if (isset($orderby) == false) {
$orderby = array();
//$orderby[0] = 'updated_at';
//$orderby[1] = 'DESC';
$orderby[0] = 'position';
$orderby[1] = 'asc';
}
if ($parent_id == 0) {
return false;
}
$data = array();
$data['parent_id'] = $parent_id;
if ($type != false) {
$data['data_type'] = $type;
} else {
$type = 'category_item';
$data['data_type'] = $type;
}
$cache_group = 'categories/' . $parent_id;
$q = " SELECT id, parent_id FROM {$table} WHERE parent_id={$parent_id} ";
$params = array();
$params['table'] = $table;
$params['no_limit'] = true;
$params['parent_id'] = $parent_id;
$save = $this->app->database_manager->get($params);
$q_cache_id = __FUNCTION__ . crc32($q);
// $save = $this->app->database_manager->query($q, $q_cache_id, $cache_group);
if (empty($save)) {
return false;
}
$to_return = array();
if (is_array($save) and !empty($save)) {
foreach ($save as $item) {
$to_return[] = $item['id'];
}
}
$to_return = array_unique($to_return);
return $to_return;
}