Symptoms :

I have a very long vocabulary with hierarchies (for regions/countries). When displaying in the admin page (admin/content/taxonomy/xxx) only the first page shows any items - subsequent pages (eg. admin/content/taxonomy/xxx?page=2) show no items (even though there should be some).

Supposition :

I have looked at the code, and from what I can tell this will happen if :
1. The very first item is a root of a hierarchy
2. That hierarchy has more than one page's worth of elements

Patch :

Here is a patch I made for this. It fixes my problem.

Index: taxonomy.admin.inc
===================================================================
--- taxonomy.admin.inc  (drupal 6.3)
+++ taxonomy.admin.inc  (patched)
@@ -299,11 +299,13 @@
       // Count entries before the current page.
       if ($page && ($page * $page_increment) > $before_entries && !isset($back_peddle)) {
         $before_entries++;
+        $term = next($tree);
         continue;
       }
       // Count entries after the current page.
       elseif ($page_entries > $page_increment && isset($complete_tree)) {
         $after_entries++;
+        $term = next($tree);
         continue;
       }

@@ -314,18 +316,19 @@
           $before_entries--;
           $back_peddle++;
           if ($pterm->depth == 0) {
-            prev($tree);
+            $term = $pterm;
             continue 2; // Jump back to the start of the root level parent.
           }
         }
       }
       $back_peddle = isset($back_peddle) ? $back_peddle : 0;
-
+
       // Continue rendering the tree until we reach the a new root item.
       if ($page_entries >= $page_increment + $back_peddle + 1 && $term->depth == 0 && $root_entries > 1) {
         $complete_tree = TRUE;
         // This new item at the root level is the first item on the next page.
         $after_entries++;
+        $term = next($tree);
         continue;
       }
       if ($page_entries >= $page_increment + $back_peddle) {
@@ -346,7 +349,9 @@
         $root_entries++;
       }
       $current_page[$key] = $term;
-    } while ($term = next($tree));
+
+      $term = next($tree);
+    } while ($term);

     // Because we didn't use a pager query, set the necessary pager variables.
     $total_entries = $before_entries + $page_entries + $after_entries;

(the problem is when it does the 'continue 2'. Just before that it does a prev($tree), knowing that the while test will do a next($tree) and thus get the element back. However, as this is the begining of $tree, prev($tree) tries to set a negative index and the subsequent call to next($tree) does not work.)

Thank you :)

CommentFileSizeAuthor
#9 patch_292073.diff1.69 KBAlice Heaton
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alice Heaton’s picture

Title: long hierarchies not displayed on admin page » long hierarchies not displayed on admin page (taxonomy)

Sorry, maybe I should have mentioned taxonomy on the issue title.

meba’s picture

Status: Active » Closed (duplicate)

This is a duplicate of: http://drupal.org/node/23687

I have posted your patch there.

Alice Heaton’s picture

Hi Meba, thanks for you interest !

I'm wondering why you made my bug report a duplicate though ?

My report :

  • Describes a specific problem
  • Explains what the symptoms are
  • Explains how to re-create the problem
  • Provides a patch to fix that particular problem

All this in accordance with the best practice bug reporting of Drupal, as per http://drupal.org/node/19279

Instead, you've made this issue a duplicate of an issue which :

  • Does not describe any symptoms
  • Does not describe how to recreate the problem
  • Is unclear about what component are actually affected
  • Has been open since 2005

Somehow, I feel the particular issue I'm reporting is more likely to be resolved on it's own... But maybe you know something I don't ? Could you let me know why you made this bug report a duplicate ? Thanks :)

damiancugley’s picture

Version: 6.3 » 6.4
Status: Closed (duplicate) » Needs review

This also affects the administration page for forums (since the forum hierarchy is represented with a vocabulary). In the case of our site, each container had exactly ten forums, just enough to make the pager go wrong :-)

I am changing the status back to 'patch (code needs review)' because I think this bug is unrelated to the new pager code mentioned in #23687: New pager code broken taxonomy pagers

Damien Tournoud’s picture

catch’s picture

Anselm - could you apply the 6.x patch from that issue and confirm whether it fixes your bug?

Alice Heaton’s picture

@catch : Thanks for asking - but no, it doesn't fix my problem. I've reverted my own patch, checked the issue was back (it was), and then applied the patch from #302440 (the one given in comment #17) ; I cleared the cache and checked again and it did not fix the issue.

The patch I've given, however, does fix my issue. I've spent a while analysing that problem when it occurred, and I am certain there is a logical error in the code of taxonomy_overview_terms ; which is fixed with my patch. I'm not sure why no-one is looking at that ; maybe I'm not expressing myself clearly ? I did give a test case, an analysis of the problem and a patch, not sure what else is needed...

catch’s picture

Version: 6.4 » 7.x-dev
Status: Needs review » Needs work

Thanks Anselm. I'm moving this to 7.x since it's likely the same issue is present there - and we usually fix in the development version then backport. You'll need to roll your patch into a proper patch file to get it reviewed properly - cvs diff -up > foo.patch will do it, or see http://drupal.org/patch/create

Alice Heaton’s picture

FileSize
1.69 KB

Thanks catch :)

Here is the patch as a patch file ; unified format and with function name :)

meba’s picture

I don't think this patch solves the problem, maybe partially. I applied to 6.x and after clicking page 2, terms from page 1 are still displayed, however - together with terms from page 2. then, page 3 displays only terms from page 3.

catch’s picture

meba - that's by design - are some of the terms greyed out?

meba’s picture

No...

Alice Heaton’s picture

@meba : I agree with catch - I think what you are seeing is by design. The taxonomy admin page never splits hierarchies, so when an item has sub items you always see them all together. It might depend on the template you're using, but with the default one the items that are not of the current page are slightly greyed out.

For instance if your first item has, say, 50 sub items then :

  • The 1st page will show all 50 items ; the first 10 normal and the rest slightly greyed out
  • The 2nd page will show all 50 items ; number 11 to 20 normal, the rest slighlt greyed out
  • The 3rd page will show all 50 items ; number 21 to 30 normal, the rest slightly greyed out
  • etc.

Only when you get to the sixth page does this term and all it's sub-items go away.

It may or may not be the right approach in terms of UI, but it's what it's supposed to do. For dealing with large taxonomies, you might find Taxonomy Manager to be helpful.

meba’s picture

i understand and agree...

Is it possible to page the list by term? I mean that not depending on number of terms, one term always displays its children - all of them. I am aware that this may require some extensive algorithm, but its an idea which may male the interface more undersandable.

If its not, this patch looks good to me.

Alan D.’s picture

I just ran into this issue with a moderately large vocab of 50,000 items. The patch worked on the pagination issue, but 20,000 or so items on a page makes the jscript unusable / crashes the browser even on a fairly powerful computer. The current admin interface is not really up to this sort of taxonomy.

natuk’s picture

Subscribing

xmacinfo’s picture

While it will be great to have this fixed for D7.x (which I shall test when I'll have some free time), I do expect a backport later for D6.x.

As for D6.17, currently, with a large taxonomy list, we cannot go to page 2 (admin/content/taxonomy/xxx?page=1).

But we can display any other pages:
For example, going to page 1(admin/content/taxonomy/xxx) or page 3 (admin/content/taxonomy/xxx?page=2) or page 4 (admin/content/taxonomy/xxx?page=3) and so on..., the content is displayed properly.

@Anselm Heaton: thanks for the Taxonomy Manager suggestion. I will try it as well.

nicholas.alipaz’s picture

I have too suffered through this. Would be great to see a d6 solution at some point. IMO, this is a very big deal and it breaks the normal functionality of the taxonomy module. I think it should be marked critical since it renders taxonomy module broken for some use cases.

Alan D.’s picture

Priority: Normal » Major

Not critcal, but fairly major in relation to most existing bugs that exist in Drupal 6/7

sun’s picture

Title: long hierarchies not displayed on admin page (taxonomy) » Long hierarchies not displayed on Taxonomy admin page
Version: 7.x-dev » 8.x-dev
Priority: Major » Normal
Issue tags: +Needs backport to D7

Not major.

ytsurk’s picture

this is still encountering ..
see also #1217046: Clean up the CSS for Taxonomy module

nicholas.alipaz’s picture

I don't really see how this is not minimally major and more likely critical since it breaks the normal expected functionality of taxonomy administration in Drupal core.

xmacinfo’s picture

For very large Taxonomy lists, is recommended to use this module :

http://drupalmodules.com/module/taxonomy-manager

I agree that this bug should be fixed in core. But for now, using Taxonomy Manager save us a lot of performance problems.

docans’s picture

Hi. I am experiencing this issue in Drupal 7.24. when i go to the next taxonomy page(second page) i.e. http://mysite/admin/structure/taxonomy/catalog?page=1 nothing shows up. And this has also affected my ubercat catalog functionality as well. Is ther a patch for drupal 7.24 as at now

docans’s picture

Version: 8.x-dev » 7.24
Priority: Normal » Critical
Issue summary: View changes
Alan D.’s picture

Version: 7.24 » 8.x-dev
Priority: Critical » Normal

Needs to be fixed in Drupal 8.x before it has ANY chances of making it into Drupal 7.x :(

docans’s picture

Thanks very much for your reply

Anonymous’s picture

gambry’s picture

Status: Needs work » Closed (duplicate)