*** commerce_pdm.admin.inc.orig	2012-02-16 15:59:51.000000000 +0000
--- commerce_pdm.admin.inc	2012-02-16 15:51:20.000000000 +0000
***************
*** 99,104 ****
--- 100,107 ----
                '#type' => 'weight',
                '#title' => t('Delta'),
                '#title_display' => 'invisible',
+               '#delta' => $products_result_count,
+               '#default_value' => $key
              ),
            );
  
***************
*** 159,164 ****
--- 162,169 ----
              '#type' => 'weight',
              '#title' => t('Delta'),
              '#title_display' => 'invisible',
+             '#delta' => $products_result_count,
+             '#default_value' => $key
            ),
          );
        }
***************
*** 261,278 ****
  function theme_commerce_pdm_product_display_manager_table($variables) {
    $form = &$variables['form'];
  
-   drupal_add_tabledrag('commerce_pdm_product_display_manager', 'order', 'sibling', 'delta');
- 
    $header = array (
      t('Product Display Title / Product Title'), t('Edit'), t('Delete'), t('Delta'),
    );
  
    $rows = array();
! 	foreach (element_children($form) as $key) {
      $form_element = &$form[$key];
  
      if (isset($form_element['title'])) {
        if (isset($form_element['nid'])) {  // It's a display node.
          $form_element['nid']['#attributes']['class'] = 'display-nid';
  
          $row = array();
--- 266,285 ----
  function theme_commerce_pdm_product_display_manager_table($variables) {
    $form = &$variables['form'];
  
    $header = array (
      t('Product Display Title / Product Title'), t('Edit'), t('Delete'), t('Delta'),
    );
  
    $rows = array();
!   $group_id = 0;
!   foreach (element_children($form) as $key) {
      $form_element = &$form[$key];
  
      if (isset($form_element['title'])) {
        if (isset($form_element['nid'])) {  // It's a display node.
+  	$group_id++;
+         drupal_add_tabledrag('commerce_pdm_product_display_manager', 'order', 'sibling', 'delta', 'group-' .$group_id);
+ 
          $form_element['nid']['#attributes']['class'] = 'display-nid';
  
          $row = array();
***************
*** 291,296 ****
--- 298,304 ----
          $row[] = theme('indentation', array('size' => 1)) . drupal_render($form_element['title']);
          $row[] = drupal_render($form_element['edit_link']);
          $row[] = drupal_render($form_element['delete_link']);
+ 	$form_element['delta']['#attributes']['class'][] = 'group-' .$group_id;
          $row[] = drupal_render($form_element['delta']);
  
          $rows[] = array('data' => $row, 'class' => array('draggable', 'tabledrag-leaf', 'product'));
***************
*** 306,313 ****
  
          $rows[] = array('data' => $row, 'class' => array('draggable', 'tabledrag-leaf', 'product-orphan'));
        }
! 		}
! 	}
  
    if (!empty($rows)) {
      $rows[0]['class'][] = 'first';
--- 314,321 ----
  
          $rows[] = array('data' => $row, 'class' => array('draggable', 'tabledrag-leaf', 'product-orphan'));
        }
!     }
!   }
  
    if (!empty($rows)) {
      $rows[0]['class'][] = 'first';
***************
*** 384,390 ****
        $out[] = $product_obj->{$field . '_product_id'};
      }
    }
!   return array_values($out);
  }
  
  /**
--- 392,398 ----
        $out[] = $product_obj->{$field . '_product_id'};
      }
    }
!   return $out;
  }
  
  /**
