We recently had a special case scenario where we had to develop a Quick2Cart plugin to sell Joomla Categories.  We were consistently hitting a wall trying to show our custom fieldset for Quick2Cart in the Joomla Category Add/Edit view. We already have a content plugin for this which shows Quick2Cart in Joomla content items. But it simply wasn't working in case of the category view in Joomla 2.5 as well as Joomla 3.0.

Techjoomla Patch/Hack to Joomla 2.5 to add custom fields to Joomla Categories in Joomla 2.5

After digging around, we discovered that there is a bug in Joomla & the code needed to render custom fields is missing in the edit template file.

Here is a patch that will help you add this fix to help you create additional category fields using Plugins.

Open the file /administrator/components/com_categories/views/category/tmpl/edit.php

For Joomla 3.0 look out for the following code change,

Around line 43, look for

 

Just after this line, add the following code for tabs

				form->getFieldsets('attribs'); ?>
					 $fieldSet) : ?>

Now just after following code,

loadTemplate('options'); ?>

 

Add the following code for tab content,

				form->getFieldsets('attribs'); ?>
					 $fieldSet) : ?>
description) && trim($fieldSet->description)) : ?>

escape(JText::_($fieldSet->description));?>

form->getFieldset($name) as $field) : ?>
label; ?>
input; ?>

 

And for Joomla 2.5 look out for the following code change,

Around line 89, look for

 

 

Just above this line, add the following code

 

		form->getFieldsets('attribs'); ?>
			 $fieldSet) : ?>
						
						label), $name.'-options'); ?>
						description) && trim($fieldSet->description)) : ?>

escape(JText::_($fieldSet->description));?>

    form->getFieldset($name) as $field) : ?>
  • label; ?> input; ?>

 

That's it! You are Done.

Now your custom plugin to add fields should work just like it will work for other forms like Joomla Content Articles. We hope this blog is useful to any developers who might be stumped!