imc icon indicating copy to clipboard operation
imc copied to clipboard

Add a Subcategories box in new issue

Open kaiser36 opened this issue 6 years ago • 1 comments

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.

kaiser36 avatar May 10 '19 07:05 kaiser36

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();

itsam avatar May 21 '19 21:05 itsam