I'm getting a bug when trying to use Taxonomy vocabulary contexts. When I pick a single vocabulary for a context, and then display that context in a panel, EVERY term from EVERY category on my site is displayed in the panel. Any idea why every single term is being queried to show up in the panel (when the context is explicitly set to a single category)?

Any help/info about this would be much appreciated.

Thanks,
DSC

CommentFileSizeAuthor
#7 vocabulary_terms.patch2.71 KBpancho

Comments

dawansv’s picture

Version: 5.x-2.0-beta2 » 5.x-2.0-beta3

Same issue here. I have 4 different vocabularies, and when selecting any vocabulary, the title changes, but the term list is always the same: all terms from all vocabularies.

Also:
- terms seem to be sorted in database order instead of using the weight factor.
- only first-level terms show up, whether I leave max depth to blank (supposed to mean unlimited) or specify a depth of 2 or 3 (I have 2 levels in my case).

Cheers,

Vincent

nath’s picture

Same problem here. Any ideas?

nath’s picture

It seems to me that the problem is in this function in vocabulary_terms.inc. There is no limitation to a single vocabulary in that function.
If one wants to show all terms in a vocabulary, $tid will be 0 and so the result of thee query is a list of all top-level terms in all vocabularies.

function _panels_content_vocabulary_terms($tid, $max_depth, $depth = -1) {
  $depth++;
  if ($max_depth != NULL && $depth == $max_depth) {
    return array();
  }
  $return = array();
  $query = db_query('SELECT t.name, t.tid FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE h.parent = %d', $tid);
  while ($result = db_fetch_object($query)) {
    $return[] = array(
      'data' => l($result->name, 'taxonomy/term/'. $result->tid),
      'children' => _panels_content_vocabulary_terms($result->tid, $max_depth + 1, $depth),
    );
  }
  return $return;
}
summit’s picture

Hi,

Did somebody already solve this one? Please post your solution code!
Thanks a lot in advance!
greetings, Martijn

nath’s picture

Version: 5.x-2.0-beta3 » 5.x-2.0-beta4b

Still happens with beta4b.

pancho’s picture

Version: 5.x-2.0-beta4b » 5.x-2.x-dev
Component: Code » Plugins - contexts
Assigned: Unassigned » pancho

Confirmed. There's indeed about everything wrong with this code, it definitely needs to be rewritten.
I'll take a look at it next week.

pancho’s picture

Status: Active » Needs review
StatusFileSize
new2.71 KB

Here's a list with all bugs:

1. 'max_depth' field is generally not saved.

2. If 'tree' is set to true:
- output is not restricted to a certain vid
- 'max_depth' == 0/empty shows only top level (instead of all levels)
- 'max_depth' > 0 shows all levels (no restriction)
- terms are not ordered, term weight is ignored
(If 'tree' is set to false, everything is fine.)

Enclosed patch fixes all of this, and renders 'max_depth' as a select instead of a textfield to improve usability.

pancho’s picture

Title: Taxonomy vocabulary contexts not displaying properly » CT vocabulary terms not displaying properly
Component: Plugins - contexts » Plugins - content types
Fayna’s picture

This patch fixed it for me! Awesome Pancho!

merlinofchaos’s picture

Status: Needs review » Fixed

Applied. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.