I am trying to get something that works with my image galleries to order the images.
I am using a view for the galleries which is sorted by "weight in tid."
The gallery is exposing the "weight in tid" field with the image. It is sorting correctly! The numbers associated with the image show up in order starting with 1, 2, 3...and I can drag and drop terms at
nodeorder/term/22/order
and I see that the numbers do change, as does the image order.

However, the drag and drop list at
nodeorder/term/22/order
resets to some other mysterious order every time I hit "save order," and the list of node titles is no longer in the same order that I just created. It also does not match the order that the gallery shows (the gallery is still correct), so all I can figure is that the term order in the drag and drop list is being affected by something else other than weight in tid. Any ideas?

Comments

MBroberg’s picture

Update:
It appears that the list is also being affected by node weight.
I was previously ordering some of the images by hand using weight but that was too tedious. Once I change the node weight back to 0 for an image, that node is ordering correctly in the list - however must I reset all of my node weights to 0 to make the nodeorder list view correctly? It seems that the nodeorder list should be sorted only by weight in tid and not also by nodeweight.

SchwebDesign’s picture

I am experiencing this same problem. Any feedback? MBroberg were you able to fix this? I'm going to continue looking in to this...

MBroberg’s picture

Yes, I found out that if the node weight or any other weight field had a number other than zero it would affect the list. If all nodes have a node weight of zero I can use "weight in tid" to order my images. Nothing further as far as to why that is true.

nsciacca’s picture

This is regarding using a VIEWS implementation only, I'm using an overrided view for taxonomy/term/xxx.

I'm having a similar issue - I've got different sort orders within the same vocabulary on different terms. The problem lies in the way the views query adds tables via left join:

...
 LEFT JOIN `database`.term_node term_node ON node.vid = term_node.vid
....
GROUP BY nid
  ORDER BY term_node_weight_in_tid ASC

Here it joins the term_node table into the results, and then groups by the node id, however, if there is more than 1 entry in the term_node for a node (which is usually the case), it doesn't know which one to pull back, therefore always returning the first found. Note that the core taxonomy sort options only pertain to the term's data, not individual nodes.

If you remove the "GROUP BY nid" in a MySQL editor you'll see that the Left Join in question actually creates duplicate results. I'm looking for a solution now, I'll repost if I figure anything else out - hopefully this will help someone else working on the same issue.

*update*
The solution needs to include a multiple expression for the Left Join of term_node - here's the example modified query with respect to my TID of "2":

 LEFT JOIN `database`.term_node term_node ON (node.vid = term_node.vid AND term_node.tid = 2)

I couldn't figure out how to fix it on the modular level (so it would work with whatever view url & argument configuration you have)--- I tried adding the "extra" array to the field definition but it doesn't allow you to enter variables for the "value". I ended up putting this into my custom module:

function mymodule_views_pre_execute(&$view) {
	if ($view->name == 'taxonomy_term') {
		$find = 'LEFT JOIN {term_node} term_node ON node.vid = term_node.vid';
		$replace = $find . ' AND term_node.tid = '.$view->args[0];
		$view->build_info['query'] = str_replace($find, $replace, $view->build_info['query']);
	}
}

This works specifically for the url path "taxonomy/term/xxx" when the first argument is the TID. I'd really love to figure out a better way to do this so you could have the argument in any location, but I don't have time with my current deadlines. You can modify this to work in your system by changing the $view->name to be your view's name and making sure that $view->args[X] (where X = the argument position relative to views) matches correctly.

vnb’s picture

subscribing

dieuwe’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing as the Drupal 6 branch of this module (and Drupal 6 in general) has been discontinued.