There are several places in the Ubertcart admin interface where a huge multiple-select list is presented in the tiny default 4-element box. For example, selecting from hundreds of countries which ones you can and can't ship to, or selecting products in a shipping conditions form.

This can easily be fixed *in a few minutes* by adding a #size attribute when generating a form that uses the length of the #options.

For example, changing something like this:

$form['products'] = array(
'#type' => 'select',
'#title' => t('Product models'),
'#options' => $options,
'#default_value' => isset($settings['products']) ? $settings['products'] : NULL,
'#multiple' => TRUE,
);

to this:

$form['products'] = array(
'#type' => 'select',
'#title' => t('Product models'),
'#options' => $options,
'#size' => sizeof($options),
'#default_value' => isset($settings['products']) ? $settings['products'] : NULL,
'#multiple' => TRUE,
);

Or changing something like this (where the #options are calculated):

$form['uc_authnet_duplicate_window'] = array(
'#type' => 'select',
'#title' => t('Duplicate window'),
'#description' => t('Blocks submission of duplicate transactions within the specified window. Defaults to 120 seconds.'),
'#default_value' => variable_get('uc_authnet_duplicate_window', 120),
'#options' => drupal_map_assoc(array(0, 15, 30, 45, 60, 75, 90, 105, 120)),
);

to this:

$form['uc_authnet_duplicate_window'] = array(
'#type' => 'select',
'#title' => t('Duplicate window'),
'#description' => t('Blocks submission of duplicate transactions within the specified window. Defaults to 120 seconds.'),
'#default_value' => variable_get('uc_authnet_duplicate_window', 120),
'#options' => drupal_map_assoc(array(0, 15, 30, 45, 60, 75, 90, 105, 120)),
);
$form['uc_authnet_duplicate_window']['#size'] = sizeof($form['uc_authnet_duplicate_window']['#options']);

There are 120 select form elements in Ubercart 6, of which half are the easy '#options' => $options version, but the ones I've noticed that are most critical are located in:

* uc_country_select() in uc_store.module
* uc_order_condition_has_products_form() in uc_order.ca.inc
* uc_order_condition_billing_zone_form() in uc_order.ca.inc -- this can generate a select list thousands of items long!

All of these three are fixable by adding a '#size' => sizeof($options) line to the array() constructor.

Comments

TR’s picture

Status: Active » Closed (won't fix)

There are many reasons this is a "won't fix". Ubercart 6.x-2.x has been available for 6 years and has reached it's end-of-life - it will become officially unsupported when Drupal 8 is released. That's a matter of months from now. In practice, we don't patch old versions - feature requests are first implemented in the most current version then backported if there is sufficient demand for that feature in older versions. That ensures new features get carried forward put into the newest code, and prevents us from wasting effort on obsolete versions. Conditional Actions is doubly obsolete because it was done away with for D7.

If you have suggestions for the D7 or D8 versions of Ubercart, and can provide a patch, we'd be happy to evaluate it. There are a few awkward select boxes that we know of, and are the subject of other existing issues (search this queue), but the vast majority of the select boxes don't seem to be a problem based on the lack of complaints about them in the 6 years since 6.x-2.x was first released.

CA is not supported past D6, and has been replaced by Rules. For product selections in Rules conditions, please contribute to #1973990: Check an order's products condition - list of products format. A large select box in this case is just as bad, possibly worse, than a small select box - this is a perhaps a place to use autocomplete.

For the uc_authorizenet issue, that's a single-select box which currently shows all 9 available options - I'm not sure what you're concerned about.

For country selections, the multi-select box is 10 elements, which I have found to be quite sufficient. As the person who wrote and tested most of the cif files, I can say with certainty that I've used that select box more than any one else, and I never thought it was too small. Changing it to show all 248 countries would be excessive.