Currently labels are displayed above a select dropdown. It would be nice to be able to add the label as item 0 {Select A Color} as the first item in the dropdown. Could add this now as an attribute, and make it default, but it would generate a new node I believe if submitted. So functionality is:

1) Ability to add labels to select box as item 0
2) The select box would be a required field, and item 0 should not be included as a valid answer.

Comments

greg@beargroup.com’s picture

Ok one unsupported way to do this for anyone else interested:

1) Add a variation for "Select an Item", and make it the default. This will add it to the dropdown as item #1, however you can submit it as a product now.

2) To prevent it from being submitted, add a print_r($data) inside the ec_live_subproducts_subproduct_set() function around line 1045. Submit an item to the cart, and you'll be able to see the array index you need to exclude the item.

3) Then add this validation, around line 1048:

function ec_live_subproducts_subproduct_set(&$node, &$data, $show_erros = NULL) {
  if (empty($data)) {
    return FALSE;
  }
+  if ($data[1] == 257) {  //set the array index and number to match whatever your variation is
+    if (empty($show_erros)) {
+      drupal_set_message(t("Please first select an item from the dropdown menu"), "error");
+    }
+    return FALSE;
+  }

Obviously will all break if you change the weight of variants, or update the module. Works for today though.

brmassa’s picture

Status: Active » Fixed

Greg,

There are some jQuery libraries to do so.

regrads,

massa

Anonymous’s picture

Status: Fixed » Closed (fixed)