Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Subcategories box in new issue #76

Open
kaiser36 opened this issue May 10, 2019 · 1 comment
Open

Add a Subcategories box in new issue #76

kaiser36 opened this issue May 10, 2019 · 1 comment

Comments

@kaiser36
Copy link

Hi
How can I add the subcategories field when you are entering a new issue. I need to have categories and subcategories available in a box to choose from.

@itsam
Copy link
Owner

itsam commented May 21, 2019

Subcategories are included by default normally... Probably you are creating your own form so you can embed smt like this

function createCategoriesOptions()
{
	$options = array();
	$db = JFactory::getDbo();
	$query = $db->getQuery(true)
			->select('a.id AS value')
			->select('a.title AS text')
			->select('a.path AS path')
			->select('COUNT(DISTINCT b.id) AS level')
			->from('#__categories as a')
			->where('a.extension = "com_imc"')
			->where('a.published = 1')
			->join('LEFT', '#__categories AS b ON a.lft > b.lft AND a.rgt < b.rgt')
			->group('a.id, a.title, a.lft, a.rgt')
			->order('a.lft ASC');
	$db->setQuery($query);
	$categories = $db->loadObjectList();
	return $categories;
}
$categoriesOptions = createCategoriesOptions();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants