This was surprising. Basically when you set the node weight, the shipping weight also changes to that exact same integer value. This in itself is not the end of the world, but if you try to set a negative value, ubercart throws an error because you can't have a negative 'weight'.

It seems like this is a namespace issue. Is it possible to have the node weight form use a different key value to prevent conflicts?

CommentFileSizeAuthor
#3 1539766-weight-namespaces-3.patch771 bytesrickmanelius
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davisben’s picture

Status: Active » Fixed

I changed $node->weight to $node->weight_weight, which should eliminate this problem.

rickmanelius’s picture

@10oclock Thanks!

rickmanelius’s picture

Status: Fixed » Needs review
FileSize
771 bytes

Actually, there were two locations that needed to be fixed. The first is $entity->weight_weight and the second is the form values had to be ['weight']['weight_weight'] because the submit hook ignores the first array key and only uses the second in $form_state['values'].

Attached is a patch.

davisben’s picture

Status: Needs review » Fixed

Thanks for the patch! Applied and committed to 7.x-2.x.

Status: Fixed » Closed (fixed)

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