Posted by 5n00py on March 30, 2010 at 8:58pm
2 followers
Jump to:
| Project: | Ubercart |
| Version: | 6.x-2.4 |
| Component: | Products |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hello, i found this bug.
I have problem when I try to modify node in my module.
When i run this code dimensions is set to 0.
$node=node_load($nid);
node_save($node);I look to api.ubercart.org and found this:
function uc_product_load(&$node) {
return db_fetch_object(db_query('SELECT model, list_price, cost, sell_price, weight, weight_units, length, width, height, length_units, pkg_qty, default_qty, unique_hash, ordering, shippable FROM {uc_products} WHERE vid = %d', $node->vid));
}and this:
function uc_product_update($node) {
if ($node->revision) {
db_query("INSERT INTO {uc_products} (vid, nid, model, list_price, cost, sell_price, weight, weight_units, length, width, height, length_units, pkg_qty, default_qty, unique_hash, ordering, shippable) VALUES (%d, %d, '%s', %f, %f, %f, %f, '%s', %f, %f, %f, '%s', %d, %d, '%s', %d, %d)",
$node->vid, $node->nid, $node->model, $node->list_price, $node->cost, $node->sell_price, $node->weight, $node->weight_units, $node->dim_length, $node->dim_width, $node->dim_height, $node->length_units, $node->pkg_qty, $node->default_qty, $node->unique_hash, $node->ordering, $node->shippable
);
}
else {
//drupal_set_message('<pre>'. print_r($node, TRUE) .'</pre>');drupal_set_message('<pre>'. print_r($node, TRUE) .'</pre>');
db_query("UPDATE {uc_products} SET model = '%s', list_price = %f, cost = %f, sell_price = %f, weight = %f, weight_units = '%s', length = %f, width = %f, height = %f, length_units = '%s', pkg_qty = %d, default_qty = %d, ordering = %d, shippable = %d WHERE vid = %d",
$node->model, $node->list_price, $node->cost, $node->sell_price, $node->weight, $node->weight_units, $node->dim_length, $node->dim_width, $node->dim_height, $node->length_units, $node->pkg_qty, $node->default_qty, $node->ordering, $node->shippable, $node->vid);
}
}In uc_product_load ubercart set $node->length for length, but in uc_product_update ubercart get this value from $node->dim_length.
By default ubercart works normaly if node editing with forms, but if ANY module wants modify node like me ( ndoe_load and node_save ) is set to 0.
Comments
#1
Sorry, i found solution at http://drupal.org/node/599806
#2
bug not fixed.
I test this bug on lastest ubercart release.
For reproduce this bug simply add dimensions to any product then use code like this:
$node = node_load(1350); //Use nid of edited node.node_save($node);
After run this code dimensions will be reseted.
#3
#4
#404234: Ajax bug on upload/delete Ubercart images look to this issue too.
#5
Was this not fixed in #685698-13: Lost product dimensions (length, width, height)?
#6
Tested the code in #2 on latest -dev and the dimensions are no longer reset.
#7
TY, Longwave )
#8
Automatically closed -- issue fixed for 2 weeks with no activity.