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
Comment #1
5n00py commentedSorry, i found solution at http://drupal.org/node/599806
Comment #2
5n00py commentedbug 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:
After run this code dimensions will be reseted.
Comment #3
5n00py commentedComment #4
5n00py commented#404234: Ajax bug on upload/delete Ubercart images look to this issue too.
Comment #5
longwaveWas this not fixed in #685698-13: Lost product dimensions (length, width, height)?
Comment #6
longwaveTested the code in #2 on latest -dev and the dimensions are no longer reset.
Comment #7
5n00py commentedTY, Longwave )