=== modified file 'uc_attribute/uc_attribute.admin.inc'
--- uc_attribute/uc_attribute.admin.inc	2010-11-18 16:40:23 +0000
+++ uc_attribute/uc_attribute.admin.inc	2010-11-18 19:08:43 +0000
@@ -1000,47 +1000,50 @@
 function theme_uc_object_options_form($variables) {
   $form = $variables['form'];
 
-  $header = array(array('data' => '&nbsp;&nbsp;' . t('Options')) + theme('table_select_header_cell'), t('Default'), t('Cost'), t('Price'), t('Weight'), t('List position'));
+  drupal_add_js('misc/tableselect.js');
+  $header = array(array('data' => '&nbsp;&nbsp;' . t('Options'), 'class' => array('select-all')), t('Default'), t('Cost'), t('Price'), t('Weight'), t('List position'));
   $table_id_num = $tables = 0;
 
-  foreach (element_children($form['attributes']) as $key) {
-
-    $rows = array();
-
-    if (element_children($form['attributes'][$key]['default'])) {
-
-      foreach (element_children($form['attributes'][$key]['default']) as $oid) {
-        $row = array(
-          drupal_render($form['attributes'][$key]['options'][$oid]['select']),
-          drupal_render($form['attributes'][$key]['default'][$oid]),
-          drupal_render($form['attributes'][$key]['options'][$oid]['cost']),
-          drupal_render($form['attributes'][$key]['options'][$oid]['price']),
-          drupal_render($form['attributes'][$key]['options'][$oid]['weight']),
-          drupal_render($form['attributes'][$key]['options'][$oid]['ordering']),
-        );
-
-        $rows[] = array(
-          'data' => $row,
-          'class' => array('draggable'),
-        );
-      }
-      $table_id = 'uc-attribute-option-table-' . $table_id_num++;
-      drupal_add_tabledrag($table_id, 'order', 'sibling', 'uc-attribute-option-table-ordering');
-    }
-    else {
-      $row = array();
-      $row[] = array('data' => drupal_render($form['attributes'][$key]['default']), 'colspan' => 6);
-      $rows[] = $row;
-    }
-
-    if (!count($rows)) {
-      $rows[] = array(array('data' => t('This !type does not have any attributes.', array('!type' => $form['type']['#value'] == 'product' ? t('product') : t('product class'))), 'colspan' => 6));
-    }
-
-
-    $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('product_attributes'), 'id' => $table_id), 'caption' => '<h2>' . drupal_render($form['attributes'][$key]['name']) . '</h2>'));
-
-    $tables++;
+  if (is_array($form['attributes'])) {
+    foreach (element_children($form['attributes']) as $key) {
+
+      $rows = array();
+
+      if (element_children($form['attributes'][$key]['default'])) {
+
+        foreach (element_children($form['attributes'][$key]['default']) as $oid) {
+          $row = array(
+            drupal_render($form['attributes'][$key]['options'][$oid]['select']),
+            drupal_render($form['attributes'][$key]['default'][$oid]),
+            drupal_render($form['attributes'][$key]['options'][$oid]['cost']),
+            drupal_render($form['attributes'][$key]['options'][$oid]['price']),
+            drupal_render($form['attributes'][$key]['options'][$oid]['weight']),
+            drupal_render($form['attributes'][$key]['options'][$oid]['ordering']),
+          );
+
+          $rows[] = array(
+            'data' => $row,
+            'class' => array('draggable'),
+          );
+        }
+        $table_id = 'uc-attribute-option-table-' . $table_id_num++;
+        drupal_add_tabledrag($table_id, 'order', 'sibling', 'uc-attribute-option-table-ordering');
+      }
+      else {
+        $row = array();
+        $row[] = array('data' => drupal_render($form['attributes'][$key]['default']), 'colspan' => 6);
+        $rows[] = $row;
+      }
+
+      if (!count($rows)) {
+        $rows[] = array(array('data' => t('This !type does not have any attributes.', array('!type' => $form['type']['#value'] == 'product' ? t('product') : t('product class'))), 'colspan' => 6));
+      }
+
+
+      $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('product_attributes'), 'id' => $table_id), 'caption' => '<h2>' . drupal_render($form['attributes'][$key]['name']) . '</h2>'));
+
+      $tables++;
+    }
   }
 
   if (!$tables) {

=== modified file 'uc_attribute/uc_attribute.module'
--- uc_attribute/uc_attribute.module	2010-11-02 20:40:16 +0000
+++ uc_attribute/uc_attribute.module	2010-11-18 19:11:43 +0000
@@ -684,7 +684,7 @@
       // Read attribute data.
       $query = db_select('uc_attributes', 'a')
         ->fields('a', array('aid', 'name', 'description'))
-        ->condition('aid', $aid);
+        ->condition('a.aid', $aid);
 
       $query->leftJoin($sql['attr_table'], 'pa', "a.aid = pa.aid AND pa.{$sql['id']} = :id", array(':id' => $id));
       $query->fields('pa', array('label', 'default_option', 'required', 'ordering', 'display', $sql['id']));

