html-admin-page-product-export.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * Admin View: Product Export
  4. *
  5. * @package WooCommerce/Admin/Export
  6. */
  7. if ( ! defined( 'ABSPATH' ) ) {
  8. exit;
  9. }
  10. wp_enqueue_script( 'wc-product-export' );
  11. $exporter = new WC_Product_CSV_Exporter();
  12. ?>
  13. <div class="wrap woocommerce">
  14. <h1><?php esc_html_e( 'Export Products', 'woocommerce' ); ?></h1>
  15. <div class="woocommerce-exporter-wrapper">
  16. <form class="woocommerce-exporter">
  17. <header>
  18. <span class="spinner is-active"></span>
  19. <h2><?php esc_html_e( 'Export products to a CSV file', 'woocommerce' ); ?></h2>
  20. <p><?php esc_html_e( 'This tool allows you to generate and download a CSV file containing a list of all products.', 'woocommerce' ); ?></p>
  21. </header>
  22. <section>
  23. <table class="form-table woocommerce-exporter-options">
  24. <tbody>
  25. <tr>
  26. <th scope="row">
  27. <label for="woocommerce-exporter-columns"><?php esc_html_e( 'Which columns should be exported?', 'woocommerce' ); ?></label>
  28. </th>
  29. <td>
  30. <select id="woocommerce-exporter-columns" class="woocommerce-exporter-columns wc-enhanced-select" style="width:100%;" multiple data-placeholder="<?php esc_attr_e( 'Export all columns', 'woocommerce' ); ?>">
  31. <?php
  32. foreach ( $exporter->get_default_column_names() as $column_id => $column_name ) {
  33. echo '<option value="' . esc_attr( $column_id ) . '">' . esc_html( $column_name ) . '</option>';
  34. }
  35. ?>
  36. <option value="downloads"><?php esc_html_e( 'Downloads', 'woocommerce' ); ?></option>
  37. <option value="attributes"><?php esc_html_e( 'Attributes', 'woocommerce' ); ?></option>
  38. </select>
  39. </td>
  40. </tr>
  41. <tr>
  42. <th scope="row">
  43. <label for="woocommerce-exporter-types"><?php esc_html_e( 'Which product types should be exported?', 'woocommerce' ); ?></label>
  44. </th>
  45. <td>
  46. <select id="woocommerce-exporter-types" class="woocommerce-exporter-types wc-enhanced-select" style="width:100%;" multiple data-placeholder="<?php esc_attr_e( 'Export all products', 'woocommerce' ); ?>">
  47. <?php
  48. foreach ( wc_get_product_types() as $value => $label ) {
  49. echo '<option value="' . esc_attr( $value ) . '">' . esc_html( $label ) . '</option>';
  50. }
  51. ?>
  52. <option value="variation"><?php esc_html_e( 'Product variations', 'woocommerce' ); ?></option>
  53. </select>
  54. </td>
  55. </tr>
  56. <tr>
  57. <th scope="row">
  58. <label for="woocommerce-exporter-meta"><?php esc_html_e( 'Export custom meta?', 'woocommerce' ); ?></label>
  59. </th>
  60. <td>
  61. <input type="checkbox" id="woocommerce-exporter-meta" value="1" />
  62. <label for="woocommerce-exporter-meta"><?php esc_html_e( 'Yes, export all custom meta', 'woocommerce' ); ?></label>
  63. </td>
  64. </tr>
  65. <?php do_action( 'woocommerce_product_export_row' ); ?>
  66. </tbody>
  67. </table>
  68. <progress class="woocommerce-exporter-progress" max="100" value="0"></progress>
  69. </section>
  70. <div class="wc-actions">
  71. <button type="submit" class="woocommerce-exporter-button button button-primary" value="<?php esc_attr_e( 'Generate CSV', 'woocommerce' ); ?>"><?php esc_html_e( 'Generate CSV', 'woocommerce' ); ?></button>
  72. </div>
  73. </form>
  74. </div>
  75. </div>