If there is a depth parameter in the URL (e.g. taxonomy/term/tids/depth), then the content display is off.

This module overrides the entire nested select query instead of adding joins to produce the AND of terms. The current code works when there is no depth parameter.

See #1313424: Problem with filtering and page title translation.

Comments

solotandem’s picture

Status: Active » Patch (to be ported)

Fixed by commit 90f1be4.

Needs to be ported to 6.x branch.

glenshewchuck’s picture

Stoked - perfect timing for us. Thank you - looking forward to the 6.x patch. I can do testing for you on it.

czaku’s picture

For me version for D7 is still not working correctly (even on clean install)

czaku’s picture

I made a temporary fix which depends on number of currently selected terms, I noticed it was working for 2 and more terms (AND filtering) but there was no depth the single term (I needed that) so that I compared SQL queries for all cases and produced result:

in tf_views.module instead of lines:

foreach ($tids as $index => $tid) {
// Add a join producing an AND of the terms.
$alias = 'tn' . $index;
$select->join('taxonomy_index', $alias, 'tn.nid = ' . $alias . '.nid AND ' . $alias . '.tid = ' . $tid);
}

i did put:

if(count($tids) <= 1) {
            foreach ($tids as $index => $tid) {
              // Add a left join producing the nids for the term with the nids from its child terms (depth).
              $alias = 'tn' . $index;
              $select->leftJoin('taxonomy_index', $alias, 'tn.nid = ' . $alias . '.nid AND ' . $alias . '.tid = ' . $tid);
            }
            break;
        } else {
            foreach ($tids as $index => $tid) {
              // Add a join producing an AND of few terms.
              $alias = 'tn' . $index;
              $select->join('taxonomy_index', $alias, 'tn.nid = ' . $alias . '.nid AND ' . $alias . '.tid = ' . $tid);
            }
            break;
        }

doesn't seem unsafe or unstable, solotandem please have a look, I really urgently need it working, and you don't respond to my messages anymore... :/ this is my first experience in modyfing some api queries...

glenshewchuck’s picture

Thankx for the patch czaku. Is this still working good for you in D6? Just wondering because I'm going to apply to my site :)

czaku’s picture

Sorry I use D7, have no idea about D6 :/

alexbk66-’s picture

I have the same issue with D6, I wonder which fix will work for D6?

alexbk66-’s picture

Note: I'm still D6

I simply don't let tf_views_views_query_alter() modify the query if there's no comma separated list of tids, i.e. single term or terms separated by space. So I changed

    if (strpos($view->args[0], ' ') !== FALSE) {
      // Retain default view functionality of OR-ing the tids. (Views removes the '+')
      return;
    }

to:

    if (strpos($view->args[0], ',') === FALSE) {
      // Retain default view functionality if there's no multi terms,
      // Otherwise breaks depth modifier
      return;
    }

My understanding is that tf_views_views_query_alter() makes sense only for multiple terms separated by ',' anyway. Correct me if I'm wrong, but it did work for me.

nicholas.alipaz’s picture

#8 works beautifully

Leeteq’s picture

Leeteq’s picture