My current settings …
In Drupal 6, I currently have a view that filters and sorts nodes by the following criteria:
The taxonomy term is very general, and nodes can either be assigned to "Referenzen" only, or any of its sub-nodes. This is done for the basic structuring of the site. Here, in this view though, I only want to "load all nodes with 'Referenzen' assigned", regardless of their sub-term.
The problem …
"Wichtig" ("important") is an integer value that defines the primary sort criteria for me. I do not care whether a reference is filed under "Media" or "Consulting", or any other sub-term.
However, the nodes are finally displayed like this:
Node 1 Important: 100 Taxonomy: Referenzen
Node 2 Important: 0 Taxonomy: Referenzen
Node 3 Important: -100 Taxonomy: Referenzen
Node 4 Important: 100 Taxonomy: Referenzen – Media
Node 5 Important: 80 Taxonomy: Referenzen – Media
As you can see, the "Important" factor comes second when sorting the nodes, and the taxonomy grouping comes first.
How can I change this behavior, so the following is achieved:
Node 1 Important: 100 Taxonomy: Referenzen
Node 4 Important: 100 Taxonomy: Referenzen – Media
Node 5 Important: 80 Taxonomy: Referenzen – Media
Node 2 Important: 0 Taxonomy: Referenzen
Node 3 Important: -100 Taxonomy: Referenzen
The executed query
SELECT node.nid AS nid, node.title AS node_title, node.language AS node_language, node_data_field_image.field_image_fid AS node_data_field_image_field_image_fid, node_data_field_image.field_image_list AS node_data_field_image_field_image_list, node_data_field_image.field_image_data AS node_data_field_image_field_image_data, node.type AS node_type, node.vid AS node_vid, node_revisions.teaser AS node_revisions_teaser, node_revisions.format AS node_revisions_format, node_data_field_important.field_important_value AS node_data_field_important_field_important_value, node_data_field_date.field_date_value AS node_data_field_date_field_date_value
FROM node node
INNER JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN content_field_image node_data_field_image ON node.vid = node_data_field_image.vid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
LEFT JOIN content_field_important node_data_field_important ON node.vid = node_data_field_important.vid
LEFT JOIN content_type_story node_data_field_date ON node.vid = node_data_field_date.vid
WHERE (term_node.tid = 2) AND (node.language in ('***CURRENT_LANGUAGE***')) AND (node.status <> 0)
ORDER BY node_data_field_important_field_important_value DESC, node_data_field_date_field_date_value DESC
The exported view
… can be downloaded here:
MySQL Query Browser
… however tells me that those that have the "Wichtig" field not set have the value NULL
and therefore are sorted last. All newly created nodes get "Wichtig" set as 0
, however all old ones still have NULL
.
So what can I do to make those with NULL have the value 0
instead and how can I prevent this for new articles in the future?