Home About Us Developer Blogs Joomla Development Adding Custom Fields to Joomla Categories in Joomla 2.5 and Joomla 3.0
Adding Custom Fields to Joomla Categories in Joomla 2.5 and Joomla 3.0
Wednesday, 17 October 2012 19:43

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) : ?>
						
							
  • label);?>
  • 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 !


    Dipti
    Written on Wednesday, 17 October 2012 19:43 by Dipti

    Viewed 4525 times so far.
    Like this? Tweet it to your followers!

    Rate this article

    (3 votes)

    Latest articles from Dipti

    blog comments powered by Disqus

     

    Newsletter Signup

    Jump on to our Newsletter & stay updated on News on our Extensions, New Releases & Offers !