The Techjoomla Blog

Stay updated with all the latest happenings at Techjoomla. From news about the developments in your favourite extensions to Tips & Tricks about the Joomla CMS, Framework & Development.

Posted by on in Joomla Development
  • Font size: Larger Smaller
  • Hits: 66399
  • Comments

Adding Custom Fields to Joomla Categories in Joomla 2.5 and Joomla 3.0

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 wasnt 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 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; ?>

 

Thats it ! Your 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 !

Rate this blog entry:
0
Trackback URL for this blog entry.
A Developer at techjoomla.com , a Foodie, loves to hangout with frendz, adventurous, outspoken.

Believes in 'if you can't avoid it then, enjoy it!'

Besides helping develop the most awesome extensions, she's also in charge of making sure our customers our happy & get the best support & documentation.
blog comments powered by Disqus