Home Forums Plugins Product Importer Deluxe [Resolved] import post_date and post_modified

This topic contains 3 replies, has 2 voices, and was last updated by  Michael Visser 2 years, 4 months ago.

Welcome to our community support forums! We're here to help - but if you have an urgent request for a Pro Plugin, you will get a prioritised response through our Premium Support page.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #46622

    Dima
    Participant

    It looks like your code is importing those fields as the current date:
    'post_date' => current_time( 'mysql' ) in includes/product-new.php line 64
    Which is totally ignoring these fields if imported in csv.

    #46625

    Michael Visser
    Keymaster

    Hi Dima, thanks for raising this, you’re right we do set the Product post_date to the current time within woo_pd_create_product() but then during woo_pd_create_product_details() we go and update that post_date to what’s provided in the CSV file (see “// Insert Post Date”, line #552 of /includes/product-new.php).

    This was done intentionally where corrupt date’s were being provided, we do a bunch of checking now using woo_pd_is_valid_post_date() (line #398 of /includes/product.php) which could be where you are having a problem as it returns null if the validation fails; and will then keep the original post_date which is current_time(). Can you include a sample of the Post Date column you’re importing here?

    #46628

    Dima
    Participant

    Ok I found the problem:
    You got a typo in the function woo_pd_is_valid_post_date,
    line #841 ‘if( !empty( $post_data ) ) {‘ , should be $post_date

    Another concern is the format you expect the date to be. As you know different places use different date format styles, you might consider adding it as an option into settings. As there is an option in WP settings->general “Date Format”.

    Now as for post_modified field: it still puts current date there and not the import. It might be due to the fact that the product actually is being updated(modified), anyhow if its not imported from csv there is no reason to use it at all.

    #46633

    Michael Visser
    Keymaster

    *headsmack* Yup, that would do it. I’ve made a note in the next release to add support for multiple date formats; the code is already done just need to make it fit (we do date formatting in Store Exporter Deluxe for the Order Date filtering). I’m pushing the official 2.0.4 release now.

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

The topic ‘[Resolved] import post_date and post_modified’ is closed to new replies.