Index: uc_aac.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_aac/uc_aac.module,v
retrieving revision 1.10.2.4
diff -u -p -r1.10.2.4 uc_aac.module
--- uc_aac.module	13 Nov 2009 01:02:57 -0000	1.10.2.4
+++ uc_aac.module	17 Nov 2009 02:47:24 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: uc_aac.module,v 1.10.2.4 2009/11/13 01:02:57 antoinesolutions Exp $
+// $Id: uc_aac.module,v 1.10.2.1 2009/11/10 17:25:00 antoinesolutions Exp $
 
 /**
  * @file
@@ -70,7 +70,12 @@ function uc_aac_form_alter(&$form, $form
           $options = array();
 
           if ($form['attributes'][$aid]['#type'] == 'select' || $form['attributes'][$aid]['#type'] == 'radios') {
-            $selected_oid = $product->attributes[$aid]->default_option;
+            if (isset($_POST['attributes'][$aid])) {
+              $selected_oid = $_POST['attributes'][$aid];
+            }
+            else {
+              $selected_oid = $product->attributes[$aid]->default_option;
+            }
             $form['attributes'][$aid]['#default_value'] = $selected_oid;
 
             // Rebuild option text
@@ -80,8 +85,13 @@ function uc_aac_form_alter(&$form, $form
             }
           }
           elseif ($form['attributes'][$aid]['#type'] == 'checkboxes') {
+            if (isset($_POST['attributes'][$aid])) {
+              $selected_oid = $_POST['attributes'][$aid];
+            }
+            else {
+              $selected_oid = $product->attributes[$aid]->default_option;
+            }
             // TODO: Find out why the default option is not always an array.
-            $selected_oid = $product->attributes[$aid]->default_option;
             if (!is_array($selected_oid)) {
               $selected_oid = array();
             }
@@ -201,12 +211,15 @@ function _uc_aac_calculate() {
   // Render the updated weight
   $output['replacements']['weight'] = theme('uc_product_weight', $item->weight, $product->weight_units, 0, 0);
 
-  // Unset the form id to ensure Drupal doesn't attempt to process it.
-  unset($_POST['form_id']);
-  // Render the updated form
-  $output['form'] = drupal_get_form('uc_product_add_to_cart_form_'. $nid, $product);
-  // TODO: Fix bug where multiple add_to_cart forms on a single page have
-  // elements with identical css id's after regenerating the forms
+  // If reprice is enabled and price adjustments are to be displayed
+  if (variable_get('uc_aac_reprice', 1) == 1 && variable_get('uc_attribute_option_price_format', 'adjustment') == 'adjustment') {
+    // Unset the form id to ensure Drupal doesn't attempt to process it.
+    unset($_POST['form_id']);
+    // Render the updated form
+    $output['form'] = drupal_get_form('uc_product_add_to_cart_form_'. $nid, $product);
+    // TODO: Fix bug where multiple add_to_cart forms on a single page have
+    // elements with identical css id's after regenerating the forms
+  }
 
   drupal_set_header("Content-Type: text/javascript; charset=utf-8");
   print drupal_to_js($output);
