I'm having a problem with a view presenting nodes grouped by taxonomy term, and then filtered
(by term, via a form). Multiple terms can be applied to the same node.

The issue is that the results, when filtered, also get listed under the additional terms.
I've found many related issues, but no solutions to this exact problem.

-----------------------------------------------------------------------------------
Example to illustrate: using 3 nodes (article titles) and 2 taxonomy terms (categories = sugar, saccharine):

Node 1 'Sugar is good' (term: sugar)
Node 2 'Saccharine is good' (term: saccharine)
Node 3 'Sugar and saccharine are maybe bad' (terms: sugar, saccharine)

View type nodes with:
Fields: title, term(not displayed),
Format: list/grouped on term,
Relationship: Taxonomy terms on node/ 'required'

Result:
-----------------------------------------------------------------------
Saccharine
Saccharine is good
Sugar and saccharine are maybe bad

Sugar
Sugar and saccharine are maybe bad
Sugar is good
-----------------------------------------------------------------------
This is OK.

But the issue arises when introducing a filter -- exposed to the visitor -- on the taxonomy term:

Filter on taxonomy term:
single filter
is one of

Choosing 'sugar' the result is:
-----------------------------------------------------------------------
Saccharine
Sugar and saccharine are maybe bad

Sugar
Sugar and saccharine are maybe bad
Sugar is good
-----------------------------------------------------------------------
The correct nodes are displayed; but one node is also displayed under its additional term.

I require the following result:
-----------------------------------------------------------------------
Sugar
Sugar and saccharine are maybe bad
Sugar is good
-----------------------------------------------------------------------

Is there a way to achieve this within the same page/view?

Comments

DropInTheOcean’s picture

Priority: Normal » Minor
Issue summary: View changes

Was able to achieve this by tweaking the contextual filter settings.
- When the filter value is NOT in the URL
- Type PHP code...
if (isset($_GET['taxonomy_vocabulary_2_tid'])) { $query=(int)$_GET['taxonomy_vocabulary_2_tid']; }
else { $query=NULL; }
return $query;

DropInTheOcean’s picture

Status: Active » Closed (fixed)