• paolopiselli

    (@paolopiselli)


    Hello, in version 2.0.6 there seems to be some problems related to the Select value/label and related to DatePicker error messages:
    1) In the Cart, the field choosed from a select is showing the Value and not the Label;
    2) In the frontend, if a DatePicker is required but not compiled, no error message is showing.
    Thanks in advance for this good plugin!

Viewing 1 replies (of 1 total)
  • Thread Starter paolopiselli

    (@paolopiselli)

    In the Cart page, you usually get the VALUE of the Select options: if you would prefere to get the LABEL, you can apply this little modification to the file \wp-content\plugins\wc-fields-factory\includes\wcff-cart-data.php

    Substitute around line 259 with this if:

    /* To visualize the Label instead of the Value for the Select options */
    if (isset($_field[“choices”])) {
    $this->wccpf_items[] = array(“name” => $cif_data[“field_key”], “value” => find_label($cif_data[“field_val”], $_field[“choices”]));
    } else {
    $this->wccpf_items[] = array(“name” => $cif_data[“field_key”], “value” => $cif_data[“field_val”]);
    }

    Add this little function at the end of the file:

    function find_label($_val, $_choices) {
    $_choi = explode(“;”,$_choices);
    foreach ($_choi as $_couple) {
    $_temp = explode(“|”,$_couple);
    if ( $_temp[0] == $_val ) {
    return $_temp[1];
    }
    }
    return $_val;
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Select and Validations’ is closed to new replies.