Posted by halloffame on November 26, 2012 at 9:35pm
How do you use hook_form_alter to add to cart form (ubercart) since their form id is uc_product_add_to_cart_form_[nodeID]. Thus, each product has their own add to cart form. If we want to alter some stuff on that form... for a ton of products... well you get the idea.
Comments
In the past I've
In the past I've used:
<?php
if(preg_match('/uc_product_add_to_cart_form_\d+$/', $form_id))
{
}
?>
You may also want to look at hook_forms(), it could possibly solve your problem.
Jaypan We build websites
Will foreach work?
How about iterating form elements?
$form['items'][0]['desc']['#value']
$form['items'][1]['desc']['#value']
$form['items'][2]['desc']['#value']
so on and so forth...
Will foreach work in this case?