Struggling with ACF repeater format

Closed
ImportWP Pro - WordPress XML & CSV Importer ImportWP Pro - WordPress XML & CSV Importer August 13, 2019
Login to reply
Jon Eynon
4 years ago

Awesome! I will test this afternoon. Thank you so much for the effort. I appreciate it!

James Collings Support Agent commented privately
Jon Eynon
4 years ago

Thanks.

I have been tinkering with a hack in which I could upload the csv file to a file uploader in ACF attached to those repeaters. I would then run some code that would open that csv, look through it, and use the add_row() of ACF to update.


if(get_field('csv_file'))
{
  $file_arr =get_field('csv_file');
  $csv = get_attached_file($file_arr['id']);
  if(($handle = fopen($csv, "r")) !== FALSE)
  {
    $count=0;
    while(($data = fgetcsv($handle, 1000, ",")) !== FALSE)
    {
        $row = array(
        'company_name' => $data[0],
       etc.....   
  );
        add_row('images', $row);
      $count++;
    }
    fclose($handle);
  }
}

James Collings Support Agent
4 years ago

Thanks for sending over that, i am currently looking into a way to solve your problem and i will update you once i have looked further into this.

James

Jon Eynon
4 years ago
Sorry forgot my custom fields. These are indeed in map_page
Jon Eynon
4 years ago

Thanks for the response and quickly!

Sorry when I said 360 maps. I meant rows. I have 360 rows of data that I need imported into this one repeater. Attached is the spreadsheet I have as a test. These headers I want to match up with the repeaters on the Test Page.  There will be 360 rows when all ready to go.

James Collings Support Agent
4 years ago

Hi Jon

When you create your import select the post_type that you are trying to import into, for example you mention a test page, i would select "page" from the dropdown. The "acf-field-type" post_type that you mention is a private post_type that acf uses and this is not what you want to import to. 

From your attached screenshot it seems that you are trying to import into the repeater field with the key "map_page", onto its sub field with the key "company_name" with the value "Ashley Chicot Electric Coop Inc"

Sorry i am not to sure what you mean by " Are you saying I need to make 360 maps on this page", what is a 360 map?

If you need abit more help can you send me a copy of the csv or a sample of it to understand what data you are trying to import, and a screenshot or export of the acf fields you are trying to import into (you can reply and make the ticket private if you do not want anyone else to see the files/data).

Thanks

james

Jon Eynon
4 years ago

Hi there. Hoping this plugin was going to work but I wonder now. I have been reading the documentation https://www.importwp.com/documentation/importing-advanced-custom-fields/. 

I have a page "Test Page" that contains a repeating ACF with subfields. I have a spreadsheet with headers that match these subfields. When I get to the import type do I select acf-field-type from the Custom Post Type drop down?

Once I am on the page I have don't touch anything in the Import Settings. In the Template Fields:post  I get lost. I have gone under Custom Fields and mapped out based on what you have in your instructions. See attached picture. I have 270 rows in that csv. Are you saying I need to make 360 maps on this page? Doesn't that defeat the purpose of the mass uploader?

When I map just the first field and only 1 item in the uploader and run it, it tells me I have done 17 rows (my test sheet has 17) successfully. I can't seem to find them anywhere. They are not attached to the Test Page.I am clearly doing something wrong.  Any help is appreciated.

Thanks!

Jon