Posted by MMachnik on October 24, 2008 at 3:23pm
Jump to:
| Project: | Node Auto Term [NAT] |
| Version: | 5.x-2.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Zen |
| Status: | closed (fixed) |
Issue Summary
We have found that when doing node_save() on a node that uses NAT, if the node has an associated term with a weight other than 0, the weight gets reset to 0.
_nat_update_terms() defines the weight as 0 when it sets up the edit array and does not use the weight from the terms that are passed in. We solved the problem by taking the term weight and assigning it into $edit before calling taxonomy_save_term():
<?php
$edit['tid'] = $term->tid;
+
+ if (isset($term->weight)) {
+ $edit['weight'] = $term->weight;
+ }
+
taxonomy_save_term($edit);
?>Here is a patch that implements this. Thanks to miche for her help in solving this issue!
| Attachment | Size |
|---|---|
| nat_preserve_term_weight.patch | 377 bytes |
Comments
#1
+1
#2
Looks good for me.
#3
Committed to D6 and D5.
Thanks for the patch and review :)
-K
#4
Automatically closed -- issue fixed for 2 weeks with no activity.