“No Parent” Is Missing from the “Parent” Dropdown When Trying to Add a New Category in Joomla

A new client of ours called us today and told us that he’s facing a major challenge after migrating his Joomla website from 1.5.26 to 3.4.1. He told us that the No Parent option seems to be missing from the Parent dropdown in Edit Category mode, which meant that whenever he tries to add a new category anywhere on the Joomla website, that category must be the child of another category. In other words, he can’t have new top level categories on his website.

Of course, the first thing that we tried to do was to rebuild the categories by clicking on the Rebuild button in the Category Manager page. But, instead of fixing the problem, it threw the following error (by the way, the error was in green [which typically means success], instead of red – weird):

Failed rebuilding Categories tree data.

Hmmm! That error meant that there was corruption at the database level in the #__categories table. So, we logged in to phpMyAdmin, selected the database that powers the website, and checked the table #__categories. Unsurprisingly, we noticed that the ROOT item is missing.

So, what is the ROOT item?

The ROOT item (or the ROOT row, or the ROOT entry) is a row that must exist in all the tables where parenting is available (e.g. an item can be the child of another item – there are two core tables that must have a ROOT entry: the #__assets table and the #__categories table). That row must have the following characteristics:

  • It must have an ID of 1.
  • Its parent must be 0 (e.g. it doesn’t have any parent).

  • Its lft (left) value is 0, and its rgt (right) value is the maximum ID in the table + 1.

So, in order to fix the problem, we executed the following query to re-create the ROOT item:

INSERT INTO `#__categories` (`id`, `asset_id`, `parent_id`, `lft`, `rgt`, `level`, `path`, `extension`, `title`, `alias`, `note`, `description`, `published`, `checked_out`, `checked_out_time`, `access`, `params`, `metadesc`, `metakey`, `metadata`, `created_user_id`, `created_time`, `modified_user_id`, `modified_time`, `hits`, `language`, `version`) VALUES
(1, 0, 0, 0, 10000, 0, '', 'system', 'ROOT', 'ROOT', '', '', 1, 0, '0000-00-00 00:00:00', 1, '{}', '', '', '{}', 42, '2011-01-01 00:00:01', 0, '0000-00-00 00:00:00', 0, '*', 1);

The maximum ID, which is in bold red in the above query, is the result returned by executing the following query:

SELECT MAX(id) + 1 FROM `#__categories` WHERE 1

After doing the above, we tried clicking on the Rebuild button again, and, to our joy, we saw the following (success) message:

Categories tree data successfully rebuilt.

Yey!

We then tried to add a new category and, unsurprisingly, the No Parent option was available once again! The problem is officially solved!

But, what caused the problem in the first place?

We think that the problem was caused by the migration tool that our client used to migrate the data. We don’t want to disclose the name of that tool, but that’s one of the reasons why we have our own scripts for migrating Joomla websites.

In closing, if you have the same problem on your Joomla website, then check if the ROOT entry exists in the #__categories table. If it doesn’t, then you should re-add it using the above query. If it does, then the problem might be elsewhere – in that case, go ahead and contact us and we’ll try our absolute best to solve the problem for you quickly and cheaply!

5 Responses to ““No Parent” Is Missing from the “Parent” Dropdown When Trying to Add a New Category in Joomla”
  1. Comment by Marc-Antoine Minville — June 10, 2015 @ 5:12 pm

    I want to thank you for your solution, it did solve my problem. I can tell that the migration tool that breaks the categories structure is the one that begins by “JUp”…

  2. Comment by Fadi — June 12, 2015 @ 10:10 am

    Hi Marc-Antoine,

    Glad we were able to help! There are several Joomla migration tools that cause this same issue. In fact, the one that our client used is different from the one that you have mentioned above. Not sure exactly why this is such a common problem.

  3. Comment by Rowby — September 19, 2015 @ 11:32 am

    Thanks!

    I went into phpmyadmin, selected the database, selected Mysql panel and ran your query replacing #__ with the prefix of my mysql file. Selected “GO” and it updated the categories table.

    Then I went back to my Joomla (3.x) installation, selected Categories, made sure I selected “All” of them and clicked on the Rebuild button.

    Then I went into my categories, and selected one of them and then indeed had the choice, once again, to select “No parent”.

    Appreciate your posting this!

    BTW I did a backup of the site first, using akeeba backup — just in case, but didn’t need to use it — since your solution worked perfectly.

    Rowby

  4. Comment by Sonsoles — October 25, 2015 @ 5:28 pm

    Finally found the solution in your site! I’ve had the same situation migrating from Joomla 1.0.12 to 3.4.3. I suspected this was because of the missing ROOT record, but had no idea of how to create it.

    Thanks a lot!

    (By the way I also had to rebuild the categories structure.)

  5. Comment by Alexandros — December 9, 2015 @ 1:23 pm

    Thank you so much!

    I have managed to rebuild the my categories with this guide.

Leave a comment