0

Is there a way to get current row's ID/number while exporting orders with WP All Export plugin (http://www.wpallimport.com/export/)?

First row would contains the columns' name, but we need that the first column contains a growing number, so second row (which contains first order details) first column value should be 1; third row (which contains second order details) first column value should be 2; etc...

Situation is complicated because orders export limit is 50 (In each iteration, process 50 records), so if you have 60 orders 51. order's first column should be 51, not 1.

I have tried with $i variable and $_SESSION[] variable too, but this are not the best solutions.

0

We've got a solution from plugin's developers:

  1. Add this code to theme's functions.php file

// run a function before export starts, it deletes counter value from DB add_action('pmxe_before_export', 'wp_all_export_pmxe_before_export', 10, 1); function wp_all_export_pmxe_before_export($export_id) { delete_option('wp_all_export_current_row'); }

  1. Add this to All Export plugin's Edit Export screen under " Export the value returned by a PHP function" section

// update counter value while exporting function get_row_number() { $current = get_option('wp_all_export_current_row', 1); update_option('wp_all_export_current_row', $current + 1); return $current; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.