I hope someone can help me because I'm rather tired of hacking away at this, trying to come up with a solution.
What I am trying to do is apply a theme to uc_product_add_to_cart; specifically, I need to control the placement of attributes in a node. I know there is a theme_uc_product_add_to_cart that I can easily override, but the problem is that a $node reference is passed into the theme function rather than a $form reference. In the default implementation, the theme function pulls the default rendering from drupal_get_form(). I can't seem to find a way to get in between hook_form _alter - which I have implemented with no trouble - and the rendering of the output for the form. Using hook_theme doesn't work because the form_id is different every time. I also tried setting $form['#theme'] in hook_form_alter, but that didn't work either.
I hope this makes sense. Does anyone have any ideas? I would really appreciate the help.
MK

Well, first of all, I didn't realize there was a uc_attribute_add_to_cart theme. Still, I need to theme the entire add to cart form. I also didn't realize that the #theme attribute had to refer to a function defined in hook_theme().
So, in case anyone else does a similar search and comes across this post, here's what I did.
First, hook_theme():
<?phpfunction my_module_theme() {
return array(
'add_to_cart_form' => array(
'arguments' => array($form => NULL),
),
);
}
?>
Then, hook_form_alter(), with a check to make sure the containing node type was of the type containing the attributes I need to style.
<?phpfunction my_module_form_alter(&$form, $form_state, $form_id) {
...
if($form['#parameters'][2]->type == 'my_type') {
$form['#theme'] = 'add_to_cart_form';
}
}
?>
And, finally, my theme function, complete with form elements and product attributes.
<?phpfunction theme_add_to_cart_form($form) {
...
}
?>