• Hi,

    First of all, thanks so much for this fantastic plugin which works out of the box than any other import plugin out there.

    I am building a theme based on Elementor page builder and included Advanced import via TGMPA. All the demo data has been imported successfully except the values set using a select2 settings. For example, if I create an custom extension that adds WooCommerce products and it has options for adding selected category or selected IDs using the code

    $this->add_control(
    			'woo_featured_products_list',
    			[
    				'label' => esc_html__( 'Select Featured products', 'theme-name' ),
    				'type' => Controls_Manager::SELECT2,
    				'multiple' => true,
    				'options' => $this->woo_featured_products_list(),
    			]
    		);

    After importing a demo, the set values aren’t imported and the section looks empty.

    Is there a solution to overcome this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor codersantosh

    (@codersantosh)

    Hello @devframer ,

    I am assuming woo_featured_products_list as an option and store array of post ids ( Product Ids).

    Using hooks available on the plugin Advanced Import, I think you can solve it with the below code.

    add_filter( 'advanced_import_update_value_woo_featured_products_list', 'prefix_replace_post_ids', 10, 2 );
    function prefix_replace_post_ids( $value, $option ) {
    	$new_values = array();
    	foreach ( $value as $old_post_id ) {
    		$new_post_id  = advanced_import_admin()->imported_post_id( $old_post_id );
    		$new_values[] = $new_post_id;
    	}
    	return $new_values;
    }

    Hook used : ‘advanced_import_update_value_’ . $option

    Note: not tested.

    Best Regards!

    Thread Starter devframer

    (@devframer)

    Hi @codersantosh

    Thanks for your reply and sorry for the late response!

    But the above filter doesn’t update the IDs anyhow. The new IDs aren’t updating. Can you suggest any other way to update the IDs or could you tell me where these Elementor widgets values are saved in the database?

    Thread Starter devframer

    (@devframer)

    Hi @codersantosh ,

    FYI: The elementor elements data is stored in the post meta table with meta_key “_elementor_data”.

    Is there any filter to update the IDs in the post meta table?

    The woo_featured_products_list seems stored as serialized data inside all elements data of a page and the woo_featured_products_list like this

    [1] => Array
      (
          [id] => 94c43b8
          [elType] => widget
          [settings] => Array
              (
                  [woo_featured_products_list] => Array
                      (
                          [0] => 12
                          [1] => 18
                          [2] => 24
                          [3] => 35
                          [4] => 39
                      )
    
              )
    
            [elements] => Array
                (
                )
    
            [widgetType] => prefix_featured_products_widget
        )
    Plugin Contributor codersantosh

    (@codersantosh)

    Hello @devframer ,

    Thanks for the info, we are working on it and will update you as soon as possible.

    Best Regards!

    Thread Starter devframer

    (@devframer)

    Hello @codersantosh

    Thank you so much for looking into it!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Does not import Elementor Select2 values’ is closed to new replies.