Aty first i though this was a categories bug; but then removed cats and re-tried just with taxonomy and same result. Possbily i just don't understand what filter is???

============

Description

I have been battling categories for weeks now and thought I would switch gears a bit and try views.

I think what I am trying is about the simplest example I could think of:

Images [container]
---- examples [category]
---- node 1 [category]
---- node 2 [category]

I added the above nodes and they all show up in my menu just fine.

I now try the 20 Steps to Views Happiness tutorial and basically do the following:

- add a view
- give it title, etc
- make a BLOCK view
- add a node:title field
- NO filters, NO args

- go to blocks and enable my new View Block

I now see my new block and sure enough the following titles appear:

• Images
• examples
• node 1
• node 2

BUT!!!

- go back to edit the view
- select to add filter: Tax – Vocab
- select All Of
- Images (my container) shows up in Value listing for the filter
- select Images
- SAVE

Now my block is empty

Seems pretty straight forward. Why does this not work.

Drupal 4.7.3.

Have now tried this both generic taxonomy module as well as cats module - same results (no results).

Peter Lindstrom
www.LiquidCMS.ca

Comments

liquidcms’s picture

Title: why are views blank when filter on taxonomy or category/container » queries gerenated

from the view_view table i pulled out the 2 queries that get stored to try to figure out what is wrong with this.

for the record i have:

NO FILTER:

SELECT node.nid, node.title AS node_title, node.changed AS node_changed FROM node  

WITH TAX-VOCAB FILTER:

SELECT node.nid, node.title AS node_title, node.changed AS node_changed FROM node  LEFT JOIN {term_node} term_node ON node.nid = term_node.nid LEFT JOIN {term_data} term_data ON term_node.tid = term_data.tid WHERE (term_data.vid = '11')  

the 2nd query isnt valid as is; so i will need to go through code to see how it gets converted ({term_data}) into a real query.

liquidcms’s picture

Title: queries gerenated » why does view with term filter not generate any output
liquidcms’s picture

well a little digging into the query that gets stored showed that the wrong query is indeed being built.

NOTE - this example is different that the one above... but similar

examples [category]
image 1
image 2
image 3

the relevant tables have the following data:

node:
                      nid         vid
examples       12          12
image1           6             6
image2           7             7
image3           8             8
term_data:
                       tid          vid
examples         12          11
term_node:
                    nid            tid
                     6               1
                     7               1
                     8               1

and the query that gets generated looks like:

SELECT node.nid, node.title AS node_title, node.changed AS node_changed 
FROM node 
	LEFT JOIN term_node term_node 		ON node.nid = term_node.nid 
	LEFT JOIN term_data term_data 		ON term_node.tid = term_data.tid 
	LEFT JOIN term_node term_node2 	ON node.nid = term_node2.nid 
WHERE ((term_node2.tid = '12'))  

which, will generate no results since there is no tid = 12 in the term_node table.

CAN SOMEONE PLEASE VERIFY THAT I SHOULD BE ABLE TO FILTER ON A CATEGORY/CONTAINER OR TERM/VOCAB?

thanks,

liquidcms’s picture

looking at this a little it would seem that the term_node table is being built incorrectly:

rather than what i have above it should have:

for nid = 6, 7, 8

tid should be 12 to match with term_data[examples].tid = 12

not sure why views module makes tid = 1 rather than 12

liquidcms’s picture

too funny.. ok, i started this as a bug with the category module; but when i saw the problem with the original taxonomy module - i figured the issue must be with the view module

but now, in light of seeingthat the term_node table is wrong - it must again be the cat module or maybe the tax_wrapper - and maybe when i went back to the tax module it simply didnt fix the term_node table.

i iwll try gong back to tax module and re-saving my nodes and then move this BUG back to the category module

liquidcms’s picture

yes, using the original tax module and re-saving the image nodes; the term_node table is now built correctly and my view works as expected.

i have moved this BUG over to the category project: http://drupal.org/node/89171

merlinofchaos’s picture

Status: Active » Closed (works as designed)

So, ah, this isn't a views bug?