protected function getListQuery() { $id = JRequest::getUInt('id'); jimport('joomla.application.categories'); $catObj = JCategories::getInstance('JNT_Hanhphuc', array('extension' => 'com_jnt_hanhphuc', 'table' => '')); $category = $catObj->get($id); $query = FrontJntHanhphucHelper::getUsers($category->id, true); return $query; }
public function getCategories() { jimport('joomla.application.categories'); $catObj = JCategories::getInstance('JNT_Hanhphuc', array('extension' => 'com_jnt_hanhphuc', 'table' => '')); $categories = $catObj->get()->getChildren(); // var_dump($categories); $arrCat = array(); foreach ($categories as $key => $cat) { $sub = $cat->getChildren(); foreach ($sub as &$c) { $users = FrontJntHanhphucHelper::getUsers($c->id); if (!empty($users)) { $c->users = $users; $arrCat[] = $c; } } } return $arrCat; }