Support

Account

Home Forums General Issues Displaying Array Data in Product Pages Reply To: Displaying Array Data in Product Pages

  • Thanks James.

    I have over 3000 products, and 29 custom fields. Maybe I have misinterpreted your response but are you saying I have to use the_field/get_field functions and do it by hand for each product?

    So far, I have managed to automate the product import to Woocommerce, each of them showing on my product pages. I would have thought that there must be an easier way to retrieve the custom fields and display them, by some php coding that I insert into my template rather than insert each field by hand?

    Also, having looked at the link you supplied, I don’t have an ID number in the php created by ACF tool, I only have the following, and the only unique reference in the file is ‘key’ => ‘group_5715ebca23858’. Can this be used to pull in the array data to the product pages? If so, how do I do that?

    Here is the php output by ACF php tool that I need to be displayed in the product pages:
    if( function_exists(‘acf_add_local_field_group’) ):

    acf_add_local_field_group(array (
    ‘key’ => ‘group_5715ebca23858’,
    ‘title’ => ‘xxx’,
    ‘fields’ => array (
    array (
    ‘key’ => ‘field_5715ebd45f805’,
    ‘label’ => ‘Model’,
    ‘name’ => ‘model’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ed8d5f806’,
    ‘label’ => ‘Product Size’,
    ‘name’ => ‘product_size’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715eda85f807’,
    ‘label’ => ‘Product Power’,
    ‘name’ => ‘product_power’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),

    array (
    ‘key’ => ‘field_5715ede25f80a’,
    ‘label’ => ‘Liquid Volume’,
    ‘name’ => ‘liquid_volume’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),

    array (
    ‘key’ => ‘field_5715edfe5f80c’,
    ‘label’ => ‘Fastening’,
    ‘name’ => ‘fastening’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ee115f80d’,
    ‘label’ => ‘Washable’,
    ‘name’ => ‘washable’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),

    array (
    ‘key’ => ‘field_5715ee225f80f’,
    ‘label’ => ‘Diameter’,
    ‘name’ => ‘diameter’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),

    array (
    ‘key’ => ‘field_5715ee3a5f811’,
    ‘label’ => ‘Original Circumference’,
    ‘name’ => ‘original_circumference’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ee4f5f812’,
    ‘label’ => ‘Original Diameter’,
    ‘name’ => ‘original_diameter’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ee615f813’,
    ‘label’ => ‘Product Width’,
    ‘name’ => ‘product_width’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ee6c5f814’,
    ‘label’ => ‘Colour’,
    ‘name’ => ‘colour’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ee7b5f815’,
    ‘label’ => ‘Flexibility’,
    ‘name’ => ‘flexibility’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ee865f816’,
    ‘label’ => ‘Controller’,
    ‘name’ => ‘controller’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ee8e5f817’,
    ‘label’ => ‘Waterproof’,
    ‘name’ => ‘waterproof’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ee985f818’,
    ‘label’ => ‘Designed For Who’,
    ‘name’ => ‘designed_for_who’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715eead5f819’,
    ‘label’ => ‘What Is It’,
    ‘name’ => ‘what_is_it’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715eec65f81a’,
    ‘label’ => ‘What Is It For’,
    ‘name’ => ‘what_is_it_for’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715eef65f81b’,
    ‘label’ => ‘Product Action’,
    ‘name’ => ‘product_action’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ef045f81c’,
    ‘label’ => ‘Features’,
    ‘name’ => ‘features’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ef0f5f81d’,
    ‘label’ => ‘Miscellaneous’,
    ‘name’ => ‘miscellaneous’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ef195f81e’,
    ‘label’ => ‘Material Name’,
    ‘name’ => ‘material_name’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ef2a5f81f’,
    ‘label’ => ‘Brand Name’,
    ‘name’ => ‘brand_name’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ef335f820’,
    ‘label’ => ‘Style Name’,
    ‘name’ => ‘style_name’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    array (
    ‘key’ => ‘field_5715ef3d5f821’,
    ‘label’ => ‘EAN’,
    ‘name’ => ‘ean’,
    ‘type’ => ‘text’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array (
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘default_value’ => ”,
    ‘placeholder’ => ”,
    ‘prepend’ => ”,
    ‘append’ => ”,
    ‘maxlength’ => ”,
    ‘readonly’ => 0,
    ‘disabled’ => 0,
    ),
    ),
    ‘location’ => array (
    array (
    array (
    ‘param’ => ‘post_type’,
    ‘operator’ => ‘==’,
    ‘value’ => ‘product’,
    ),
    ),
    ),
    ‘menu_order’ => 1,
    ‘position’ => ‘normal’,
    ‘style’ => ‘default’,
    ‘label_placement’ => ‘top’,
    ‘instruction_placement’ => ‘label’,
    ‘hide_on_screen’ => ”,
    ‘active’ => 1,
    ‘description’ => ”,
    ));

    endif;