Skip to content

Commit

Permalink
Merge pull request woocommerce#18247 from AdamQuadmon/wc-exporter-cus…
Browse files Browse the repository at this point in the history
…tom-filters

Add product export row action hook
  • Loading branch information
claudiulodro committed Dec 21, 2017
2 parents 59ccb00 + 1b42973 commit 4f94d9d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion includes/admin/class-wc-admin-exporters.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@ public function do_ajax_product_export() {
$exporter->set_page( $step );
$exporter->generate_file();

$query_args = apply_filters( 'woocommerce_export_get_ajax_query_args', array( 'nonce' => wp_create_nonce( 'product-csv' ), 'action' => 'download_product_csv' ) );

if ( 100 === $exporter->get_percent_complete() ) {
wp_send_json_success( array(
'step' => 'done',
'percentage' => 100,
'url' => add_query_arg( array( 'nonce' => wp_create_nonce( 'product-csv' ), 'action' => 'download_product_csv' ), admin_url( 'edit.php?post_type=product&page=product_exporter' ) ),
'url' => add_query_arg( $query_args, admin_url( 'edit.php?post_type=product&page=product_exporter' ) ),
) );
} else {
wp_send_json_success( array(
Expand Down
1 change: 1 addition & 0 deletions includes/admin/views/html-admin-page-product-export.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<label for="woocommerce-exporter-meta"><?php esc_html_e( 'Yes, export all custom meta', 'woocommerce' ); ?></label>
</td>
</tr>
<?php do_action( 'woocommerce_product_export_row' ); ?>
</tbody>
</table>
<progress class="woocommerce-exporter-progress" max="100" value="0"></progress>
Expand Down
4 changes: 3 additions & 1 deletion includes/export/abstract-wc-csv-exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ public function send_headers() {
* @return string
*/
public function get_filename() {
return sanitize_file_name( 'wc-' . $this->export_type . '-export-' . date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) . '.csv' );
$filename = 'wc-' . $this->export_type . '-export-' . date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) . '.csv';

return sanitize_file_name( apply_filters( "woocommerce_{$this->export_type}_export_get_filename", $filename ) );
}

/**
Expand Down

0 comments on commit 4f94d9d

Please sign in to comment.