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);
   }
 }

CommentFileSizeAuthor
uc_product.module.patch4.54 KBscholar

Comments

Island Usurper’s picture

Status: Needs review » Closed (works as designed)

IE 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.

Dimm’s picture

+1

Dimm’s picture