--- uc_cart.module 2009-09-29 19:20:45.000000000 -0500 +++ uc_cart.module 2009-09-30 01:14:19.000000000 -0500 @@ -1336,7 +1336,8 @@ function uc_cart_get_contents($cid = NUL if (!isset($items[$cid])) { $items[$cid] = array(); - $result = db_query("SELECT c.*, n.title, n.vid FROM {node} n INNER JOIN {uc_cart_products} c ON n.nid = c.nid WHERE c.cart_id = '%s' ORDER BY c.cart_item_id", $cid); + $cart_order_preference = variable_get('uc_cart_contents_order_preference', ''); + $result = db_query("SELECT c.*, n.title, n.vid FROM {node} n INNER JOIN {uc_cart_products} c ON n.nid = c.nid WHERE c.cart_id = '%s' %s", $cid, $cart_order_preference); while ($item = db_fetch_object($result)) { for ($i = 0; $i < count($items[$cid]); $i++) { --- uc_cart.admin.inc 2009-09-23 10:45:56.000000000 -0500 +++ uc_cart.admin.inc 2009-09-30 01:16:10.000000000 -0500 @@ -209,7 +209,23 @@ function uc_cart_cart_settings_form() { '#size' => 32, '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), ); - + $form['contents_order_preference'] = array( + '#type' => 'fieldset', + '#title' => t('Cart contents sort order preference'), + '#description' => t('Select the preferred sort order for cart contents to be displayed.'), + ); + $form['contents_order_preference']['uc_cart_contents_order_preference'] = array( + '#type' => 'radios', + '#title' => t('Sort order'), + '#options' => array( + '' => t('Unsorted'), + 'ORDER BY cart_item_id ASC' => t('Oldest added items first'), + 'ORDER BY cart_item_id DESC' => t('Newest added items first'), + 'ORDER BY changed ASC' => t('Oldest added or changed items first'), + 'ORDER BY changed DESC' => t('Newest added or changed items first'), + ), + '#default_value' => variable_get('uc_cart_contents_order_preference', ''), + ); return system_settings_form($form); }