--- sites/all/modules/contributions/ecommerce/ec_customer/ec_customer.checkout.inc.original	2008-12-11 07:11:56.000000000 +0100
+++ sites/all/modules/contributions/ecommerce/ec_customer/ec_customer.checkout.inc	2009-02-06 10:29:41.000000000 +0100
@@ -90,7 +90,7 @@ function ec_customer_checkout_form(&$for
     );
     $form['ec_customer']['address'][$type]['buttons']['select_address'] = array(
       '#type' => 'select',
-      '#title' => t('Select address'),
+      '#title' => t('Select @type address', array('@type' => $type)),
       '#options' => $options,
       '#access' => count($options) > 1,
     );
@@ -122,7 +122,6 @@ function ec_customer_checkout_alter_addr
 function ec_customer_checkout_update_address_js($type = NULL) {
   $cached_form_state = array();
   $files = array();
-
   // Load the form from the Form API cache.
   if (!($cached_form = form_get_cache($_POST['form_build_id'], $cached_form_state)) || !isset($cached_form_state['storage']['txn']) || empty($type)) {
     form_set_error('form_token', t('Validation error, please try again. If this error persists, please contact the site administrator.'));
@@ -137,12 +136,20 @@ function ec_customer_checkout_update_add
 
   $form = array();
 
+  $ba = $form_state['storage']['txn']->billing_address;
+  $sa = $form_state['storage']['txn']->shipping_address;
+  $addresses = $form_state['storage']['addresses'];
+  ($type == 'billing') ? $address = $addresses[$ba] : $address = $addresses[$sa];
+
   ec_customer_checkout_form($form_state, $form);
   $cached_form['ec_customer']['address'][$type] = $form['ec_customer']['address'][$type];
   $cached_form_state['storage'] = $form_state['storage'];
 
   $new_form = array('ec_customer' => array('address' => array('#tree' => TRUE)));
   $new_form['ec_customer']['address'][$type] = $form['ec_customer']['address'][$type];
+
+  $new_form['ec_customer']['address'][$type]['display_address'] = array('#value' => theme('formatted_address', $address));
+
   $form = $new_form;
 
   form_set_cache($_POST['form_build_id'], $cached_form, $cached_form_state);
@@ -154,6 +161,7 @@ function ec_customer_checkout_update_add
     '#tree' => FALSE,
     '#parents' => array(),
   );
+
   drupal_alter('form', $form, array(), 'ec_customer_checkout_form');
   $form_state = array('submitted' => FALSE);
   $form = form_builder('ec_product_form', $form, $form_state);
@@ -283,13 +291,21 @@ function ec_customer_address_form($txn) 
  * Implementation of hook_checkout_submit().
  */
 function ec_customer_checkout_submit(&$form_state, &$form) {
+  // if the address is new add it to the addressbook
   $txn =& $form_state['storage']['txn'];
   if (!$txn->billing_address && !empty($form_state['values']['address']['billing'])) {
     $txn->address['billing'] = (object)$form_state['values']['address']['billing'];
   }
+  elseif ($txn->billing_address) {
+    $txn->address['billing'] = (object)$form_state['storage']['addresses'][$txn->billing_address];
+  }
+
   if (!$txn->shipping_address && !empty($form_state['values']['address']['shipping'])) {
     $txn->address['shipping'] = (object)$form_state['values']['address']['shipping'];
   }
+  elseif ($txn->shipping_address) {
+    $txn->address['shipping'] = (object)$form_state['storage']['addresses'][$txn->shipping_address];
+  }
 }
 
 /**
