Maybe this could be considered an Ubercart bug, but it seems to me something more appropriately fixed in nodeorder.

When using Nodeorder 7.x-1.2 and Ubercart 7.x-3.4 (though probably any version of Ubercart would suffer), the "weights" conflict. uc_product sets $node->weight in order to store the physical weight of an item, while nodeorder sets $node->weight based on the weight column it adds to taxonomy_index.

Reproduction steps:

* Create a product. Set its weight to 0 or any positive number, and assign it to a category so you can use nodeorder with it.
* Use nodeorder to set that category to the top... giving it a negative number.
* Now edit the product. You'll see that its physical weight is negative... which is invalid. You'll have to set it to 0 or something positive to save the product... but that'll screw with the nodeorder!

I think the solution is for nodeorder to not set/use $node->weight, but rather something safer that's namespaced by nodeorder.

I think the nodeorder_node_load() function is one place that needs to be changed, but there may be other places too.

Comments

manicato’s picture

I have the same problem.

stealthtech1’s picture

Node order messes with ubercart's gram/kg weight field.

My suggestion is to give the weight schema field a more unique name like 'nodeorder_weight'

marcp’s picture

I agree with everyone on this that nodeorder's weight field should get renamed. There ought to be a 7.x-2.x branch where this happens.

I'm out of the loop and haven't been using Drupal lately. Anyone interested in co-maintaining?

Thanks!

Marc

valthebald’s picture

while I helped to port nodeorder to 7.x initially, I think most of its features can be achieved by nodequeue, so I'm not sure if 7.x version is really needed at all.

stealthtech1’s picture

DraggableViewsis also a great module alternative

ninjacoderz’s picture

A simple fix

remove nodeorder_node_load and it will ok!

behindthepage’s picture

The problem can be solved by changing the last line of nodeorder_node_load and adding "nodeorder" in

<?php
/**
 * Implements hook_node_load().
 */
function nodeorder_node_load($nodes, $types) {
  $result = db_query('SELECT weight, nid FROM {taxonomy_index} WHERE nid IN(:nids)', array(':nids' => array_keys($nodes)));
  foreach ($result as $record) {
    $nodes[$record->nid]->nodeorder['weight'] = $record->weight;
  }
}
?>

  • dieuwe committed c8b05bd on 7.x-1.x authored by scotthorn
    Issues #1780576 and #1936454. Use 'nodeorder' instead of 'weight' when...
dieuwe’s picture

Issue summary: View changes
Status: Active » Fixed
dieuwe’s picture

See: https://www.drupal.org/node/1780576#comment-9005707 comments #30 through to #34.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.