Support

Account

Forum Replies Created

  • “As long as a field name is not duplicated there isn’t an issue.”

    Sorry, For clarification over the use of Field Name, I’m not talking about the label.

    Example…

    Field Group One would contain:
    Field Label “Wattage”, Field Name “wattage”, Field Key “field_01xtine3m”
    Field Label “Max DB”, Field Name “max_db”, Field Key “field_z9tebe9n5”
    Field Label “Frequency”, Field Name “frequency”, Field Key “field_59ddt5qec”
    Field Label “Avg Temp”, Field Name “avg_temp”, Field Key “field_n5bew9te9”
    Field Label “Impedance”, Field Name “impedance”, Field Key “field_nti5bxte7”

    Location Product Type is equal to “b”

    Assigned to

    Field Group Two would contain:
    Field Label “Wattage”, Field Name “wattage”, Field Key “field_tit501xqec”
    Field Label “Max DB”, Field Name “max_db”, Field Key “field_ebz9tne3m”
    Field Label “Frequency”, Field Name “frequency”, Field Key “field_de59d9n5”
    Field Label “Pressure”, Field Name “pressure”, Field Key “field_te57t501x”
    Field Label “Inductance”, Field Name “inductance”, Field Key “field_te9915s0”

    Location Product Type is equal to “c” or Product Type is equal to “d”

    Field Group Three would contain:
    Field Label “Wattage”, Field Name “wattage”, Field Key “field_ti9d9n5tec”
    Field Label “Max DB”, Field Name “max_db”, Field Key “field_eb501z9xq”
    Field Label “Frequency”, Field Name “frequency”, Field Key “field_dee3m5tn”
    Field Label “Strand Count”, Field Name “strand_ct”, Field Key “field_dfa36xtn”
    Field Label “Channels”, Field Name “channels”, Field Key “field_dtn6ga3x”

    Location Product Type is equal to “e”

    Would this work fine or lead to issues down the road?

  • Doesn’t seem like anything I’ve read will give me the desired result.

    Circling back to the original question: Can fields sharing the same name be filtered and collected together despite having different field keys. If so are there any long-term issues when using fields of the same name for the same purpose in several different field groups?

  • I mostly understand this and it seems like an excellent solution.

    There is an issue I’m running into however…

    I should have mentioned the product types include both parent and child, and there can be instances where the product belongs to multiple product types.

    It seems I can only get the conditional logic to work if the Product Type has only one option selected and the Product Type Taxonomy Field is set to a single value. Radio Button or Select, not checkbox or multi-select.

    I don’t mind adding conditional logic for both a parent Product Type (A with ID 4) and a child Product Type (B with ID 5), but I can’t see how it would work…
    Product Type (field) Selection is Greater than 4 and Less than 6 isn’t returning Product Type B when both B and A are selected.

    Is there a way around this?

    “You remove the taxonomy metabox in WP by setting the “meta_box_cb” argument to false.”

    In the edit taxonomy page for the Product Type taxonomy I set Visibility->Meta Box to “No Meta Box”, but I don’t see any difference. Any clarification would be greatly appreciated.

  • This makes sense looking at it, except for the $group_field_value = array() … I’m not seeing how that’s used(?) …

    That aside it seemed like it would work, but there is no change on the field in the post edit screen and there’s no obvious changes or additions in the postmeta.

  • “your group field is, for some reason, being confused for a repeater”

    You get it! I sincerely appreciate the response. I believe acf/load_value would work, as acf/update_value works. I’ve just had some issues consistently accessing $field[‘key’], and in any case it really complicates the code. If we can get update_field working, that would be ideal. I’d really like to make sure I’m not misunderstanding anything before going any further with the plugin I’m working on, so I want to avoid workarounds. If you think I’ve misunderstood, please explain.

    After looking and looking, I have become fixated on the group in the field registration because I can’t find any documentation for how to register this…
    https://www.advancedcustomfields.com/resources/group/
    …via php.

    So now, I’m not sure how I came up with this…

    
    array(
    	'key' => 'field_q3md98zvnm241',
            'label' => 'Additional Information',
            'name' => 'additional_information',
            'type' => 'group',
            'sub_fields' => array(
    

    …outside of intuition. You say it looks right and it mostly works. It looks fine on the backend post editor. Something I forgot to mention is that when recalling the information that’s been manually saved, get_field works fine.

    
    $activeAddtlDetails = get_field('additional_information', $post_id);
    $activeOwnerName = $activeAddtlDetails['owner_name'];
    

    $activeOwnerName returns the owner name that was saved in additional_information_owner_name postmeta.

    Does this offer any clues?

    I should also mention that this…

    
    update_field('field_4v8yw6n2hbpqs', $old_owner_name, $post_id);
    

    …in place of the update_sub_field creates…

    
    owner_name | Another Test Owner Name
    _owner_name | field_4v8yw6n2hbpqs
    

    I think it’s interesting that either way it’s creating new postmeta rows with the correct information from the registered field, disregarding it’s placement in the schema.

Viewing 6 posts - 1 through 6 (of 6 total)