I am currently working on a Drupal Commerce site that offers highly customizable products with multiple attributes. I am at the stage where i am trying to theme my add to cart form, and am a bit lost.
In my theme, I have created a hook_form_alter, and check for my add to cart form. The $form variable has 2 groups of form fields:
$form['attributes'] // Contains 'Attr_1', and 'Attr_2'. $form['line_item_fields'] // Contains 'Attr_1_c1', 'Attr_1_c2', 'Attr_2_c1', 'Attr_2_c2'
So each attribute has 2 customization options specific to that attribute. I would like to output my form like so:
Attribute 1: (Select Box) Customization 1: (input) // Attr_1_c1 Customization 2: (input) // Attr_1_c2 Attribute 2: (Select Box) Customization 1: (input) // Attr_2_c1 Customization 2: (input) // Attr_2_c2
Thus grouping the proper customization line_item_fields with the proper attributes. However, since attributes are already grouped in the $form variable, and are separate from the line_item_fields, I am not sure how to do this. Any thoughts on the best way to proceed?