Support

Account

Forum Replies Created

  • The solution that I am posting actually works for me!
    I will post more info about just for anyone that might need it in the future.

    WP All Import cannot import multiply values to a ACF Repeater field if the values are on multiply rows on the xml sheet.

    As the WP All Import authors suggest there is a workaround for that. You can find it here https://www.wpallimport.com/documentation/developers/code-snippets/#append-acf-repeater-data.

    Unfortunately, the above workaround works only if there is one sub-field in the Repeater field.

    So, for my case where the sub-fields are 4, I need to work on another solution.
    The solution is quite simple if you understand the workaround. You need to create a custom field for each ACF Repeater sub-field.

    For my example my 4 subfields are car_make, car_model, car_year and car_type (you need to use field name as shown on ACF on WP admin panel). So I need to create 4 different custom fields, one for each ACF Repeater sub-field.

    I created the my_repeater_data_car_make, my_repeater_data_car_model, my_repeater_data_car_year and my_repeater_data_car_type.

    Then on the import process I used the custom fields option in order to link the data from my xml to the custom fields, please check here https://prnt.sc/19ray48

    Then I just added the below code in the functions editor.

    add_action( 'pmxi_saved_post', 'soflyy_add_data', 10, 3 );
    
    function soflyy_add_data( $id, $xml, $update ) {
      $selector = 'car_make_model_year'; // Parent field name
      $subfield1 = 'car_make'; // The repeating field you want to add the first value to
      $subfield2 = 'car_model'; // The repeating field you want to add the second value to
      $subfield3 = 'car_year'; // The repeating field you want to add the third value to
      $subfield4 = 'car_type'; // The repeating field you want to add the forth value to
    
      if ( $value1 = get_post_meta( $id, 'my_repeater_data_car_make', true )) {
    	  $value2 = get_post_meta( $id, 'my_repeater_data_car_model', true );
    	  $value3 = get_post_meta( $id, 'my_repeater_data_car_year', true );
    	  $value4 = get_post_meta( $id, 'my_repeater_data_car_type', true );
        $row = array( $subfield1 => $value1, $subfield2 => $value2, $subfield3 => $value3, $subfield4 => $value4,  );
        add_row( $selector, $row, $id );
      }
    
      delete_post_meta( $id, 'my_repeater_data_car_make' );
      delete_post_meta( $id, 'my_repeater_data_car_model' );
      delete_post_meta( $id, 'my_repeater_data_car_year' );
      delete_post_meta( $id, 'my_repeater_data_car_type' );
    }

    Run the import and that’s all.

  • After reading tons of documentation I came up with this:

    add_action( 'pmxi_saved_post', 'soflyy_add_data', 10, 3 );
    
    function soflyy_add_data( $id, $xml, $update ) {
      $selector = 'car_make_model_year'; // Parent field name
      $subfield1 = 'car_make'; // The repeating field you want to add the first value to
      $subfield2 = 'car_model'; // The repeating field you want to add the second value to
      $subfield3 = 'car_year'; // The repeating field you want to add the third value to
      $subfield4 = 'car_type'; // The repeating field you want to add the forth value to
    
      if ( $value1 = get_post_meta( $id, 'my_repeater_data_car_make', true )) {
    	  $value2 = get_post_meta( $id, 'my_repeater_data_car_model', true );
    	  $value3 = get_post_meta( $id, 'my_repeater_data_car_year', true );
    	  $value4 = get_post_meta( $id, 'my_repeater_data_car_type', true );
        $row = array( $subfield1 => $value1, $subfield2 => $value2, $subfield3 => $value3, $subfield4 => $value4,  );
        add_row( $selector, $row, $id );
      }
    
      delete_post_meta( $id, 'my_repeater_data_car_make' );
      delete_post_meta( $id, 'my_repeater_data_car_model' );
      delete_post_meta( $id, 'my_repeater_data_car_year' );
      delete_post_meta( $id, 'my_repeater_data_car_type' );
    }

    and it looks like it works.
    I do not know if this the proper syntax or the best way to do it.

  • I apologise for the very long delay.

    THANK YOU VERY MUCH!!!

    This code work for me too! Now my map is fully functional!!

    Greetings from sunny Greece!

  • Hi,

    I’m trying to put the map in to a jQuery tab, just like you did. I’m using the Twitter Bootstrap as a framework and the bootstrap.min.js is loading on every page.

    On your last post you wrote this
    “…I attached a click event to one of my tab links that loads the map. Now, it will only load the map when someone clicks that particular link/tab (which I’m okay with). So, on tab click, render map and resize to 100% width and height….”

    Can you please provide a little more info about this?
    I want to make the map show properly but instead I only get only a part of it working (the upper left corner only show I get the same error like in your attached image).

    Thank you in advance for your willingness to help!

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