Closed (works as designed)
Project:
Ubercart
Version:
6.x-2.0-rc7
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Oct 2009 at 04:44 UTC
Updated:
30 Jan 2011 at 18:33 UTC
While trying to import a number of products (using node_import), I found that length, width and height were not being processed by uc_products.module. Attached is a patch to fix the error.
--- uc_product.module.orig 2009-10-09 14:30:34.000000000 +1100
+++ uc_product.module 2009-10-09 15:09:32.000000000 +1100
@@ -527,17 +527,17 @@
),
'#default_value' => isset($node->length_units) ? $node->length_units : variable_get('uc_length_unit', 'in'),
);
- $form['base']['dimensions']['dim_length'] = array('#type' => 'textfield',
+ $form['base']['dimensions']['length'] = array('#type' => 'textfield',
'#title' => t('Length'),
'#default_value' => isset($node->length) ? $node->length : '',
'#size' => 10,
);
- $form['base']['dimensions']['dim_width'] = array('#type' => 'textfield',
+ $form['base']['dimensions']['width'] = array('#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => isset($node->width) ? $node->width : '',
'#size' => 10,
);
- $form['base']['dimensions']['dim_height'] = array('#type' => 'textfield',
+ $form['base']['dimensions']['height'] = array('#type' => 'textfield',
'#title' => t('Height'),
'#default_value' => isset($node->height) ? $node->height : '',
'#size' => 10,
@@ -637,10 +637,10 @@
*/
function uc_product_insert($node) {
if (!isset($node->unique_hash)) {
- $node->unique_hash = md5($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->shippable . time());
+ $node->unique_hash = md5($node->vid . $node->nid . $node->model . $node->list_price . $node->cost . $node->sell_price . $node->weight . $node->weight_units . $node->length . $node->width . $node->height . $node->length_units . $node->pkg_qty . $node->default_qty . $node->shippable . time());
}
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
+ $node->vid, $node->nid, $node->model, $node->list_price, $node->cost, $node->sell_price, $node->weight, $node->weight_units, $node->length, $node->width, $node->height, $node->length_units, $node->pkg_qty, $node->default_qty, $node->unique_hash, $node->ordering, $node->shippable
);
}
@@ -650,13 +650,13 @@
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
+ $node->vid, $node->nid, $node->model, $node->list_price, $node->cost, $node->sell_price, $node->weight, $node->weight_units, $node->length, $node->width, $node->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);
+ $node->model, $node->list_price, $node->cost, $node->sell_price, $node->weight, $node->weight_units, $node->length, $node->width, $node->height, $node->length_units, $node->pkg_qty, $node->default_qty, $node->ordering, $node->shippable, $node->vid);
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| uc_product.module.patch | 4.54 KB | scholar |
Comments
Comment #1
Island Usurper commentedIE and jQuery don't play well together when there is a form field named "length" on the page. See #404234: Ajax bug on upload/delete Ubercart images. The node_import integration will need to be fixed somehow to make this work again.
Comment #2
Dimm commented+1
Comment #3
Dimm commentedhttp://drupal.org/node/685698#comment-4024112