overriding ubercart's way of displaying attributes options selection (drupal)
I found a problem with ubercart for Drupal and I am trying to find a workaround. I would like to display the options of 开发者_JAVA技巧an attribute as radio buttons by default instead of a select box. The problem with ubercart is that there is a way to set the default by setting it at admin/store/attributes/ but it is always overriden at the product level. So the content uploader has to select radio buttons for every product.
The work around I would like to implement is with hook_form_alter or similar. But I am struggling at finding the right function to override. If it can be of any help, here is the source code of the select box:
<div class="attribute attribute-1 odd">
<div id="edit-attributes-1-wrapper" class="form-item">
<label for="edit-attributes-1">
Color:
<span class="form-required" title="This field is required.">*</span>
</label>
<select id="edit-attributes-1" class="form-select required" name="attributes[1]">
<option selected="selected" value="">Please select</option>
<option value="7">Black | 000000</option>
<option value="6">Blue | 5E79A4</option>
<option value="5">Red | C33438</option>
</select>
</div>
</div>
This was fixed in Drupal 7/Ubercart 3. Have you tried deifining product classes and the defaults for that class. Your default options may stick when adding a product under a class.
精彩评论