Here is a code to remove the unwanted "Please select" option and set up the default attribute.
This is made for attributes that are user as select boxes:
<?php
function yourmodule_form_alter($form_id, &$form) {
// override product form
if (strpos($form_id, 'add_to_cart_form')) {
// setup default attributes
foreach ($form['attributes'] as $key=>$atr) {
if (is_array($atr)) {
// remove unwanted t('Please select')
$opt=array();
foreach($atr['#options'] as $opt_key=>$opt_val) {
if ($opt_val != t('Please select')) {
$opt[$opt_key] = $opt_val;
}
}
$form['attributes'][$key]['#options'] = $opt;
// setup default attribute
$attribute = db_fetch_object(db_query("SELECT a.aid, a.name, a.ordering AS default_ordering, a.required AS default_required, a.display AS default_display, a.description, pa.default_option, pa.required, pa.ordering, pa.display FROM {uc_attributes} AS a LEFT JOIN {uc_product_attributes} AS pa ON a.aid = pa.aid AND pa.nid = %d WHERE a.aid = %d", $form['nid']['#value'], $key));
$form['attributes'][$key]['#default_value'] = $attribute->default_option;
}
}
}
}
?>