html-csv-import-done.php
2 years ago
html-csv-import-footer.php
8 years ago
html-csv-import-header.php
8 years ago
html-csv-import-mapping.php
3 years ago
html-csv-import-progress.php
8 years ago
html-csv-import-steps.php
8 years ago
html-product-csv-import-form.php
3 years ago
html-csv-import-mapping.php
69 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Admin View: Importer - CSV mapping |
| 4 | * |
| 5 | * @package WooCommerce\Admin\Importers |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; |
| 10 | } |
| 11 | ?> |
| 12 | <form class="wc-progress-form-content woocommerce-importer" method="post" action="<?php echo esc_url( $this->get_next_step_link() ); ?>"> |
| 13 | <header> |
| 14 | <h2><?php esc_html_e( 'Map CSV fields to products', 'woocommerce' ); ?></h2> |
| 15 | <p><?php esc_html_e( 'Select fields from your CSV file to map against products fields, or to ignore during import.', 'woocommerce' ); ?></p> |
| 16 | </header> |
| 17 | <section class="wc-importer-mapping-table-wrapper"> |
| 18 | <table class="widefat wc-importer-mapping-table"> |
| 19 | <thead> |
| 20 | <tr> |
| 21 | <th><?php esc_html_e( 'Column name', 'woocommerce' ); ?></th> |
| 22 | <th><?php esc_html_e( 'Map to field', 'woocommerce' ); ?></th> |
| 23 | </tr> |
| 24 | </thead> |
| 25 | <tbody> |
| 26 | <?php foreach ( $headers as $index => $name ) : ?> |
| 27 | <?php $mapped_value = $mapped_items[ $index ]; ?> |
| 28 | <tr> |
| 29 | <td class="wc-importer-mapping-table-name"> |
| 30 | <?php echo esc_html( $name ); ?> |
| 31 | <?php if ( ! empty( $sample[ $index ] ) ) : ?> |
| 32 | <span class="description"><?php esc_html_e( 'Sample:', 'woocommerce' ); ?> <code><?php echo esc_html( $sample[ $index ] ); ?></code></span> |
| 33 | <?php endif; ?> |
| 34 | </td> |
| 35 | <td class="wc-importer-mapping-table-field"> |
| 36 | <input type="hidden" name="map_from[<?php echo esc_attr( $index ); ?>]" value="<?php echo esc_attr( $name ); ?>" /> |
| 37 | <select name="map_to[<?php echo esc_attr( $index ); ?>]"> |
| 38 | <option value=""><?php esc_html_e( 'Do not import', 'woocommerce' ); ?></option> |
| 39 | <option value="">--------------</option> |
| 40 | <?php foreach ( $this->get_mapping_options( $mapped_value ) as $key => $value ) : ?> |
| 41 | <?php if ( is_array( $value ) ) : ?> |
| 42 | <optgroup label="<?php echo esc_attr( $value['name'] ); ?>"> |
| 43 | <?php foreach ( $value['options'] as $sub_key => $sub_value ) : ?> |
| 44 | <option value="<?php echo esc_attr( $sub_key ); ?>" <?php selected( $mapped_value, $sub_key ); ?>><?php echo esc_html( $sub_value ); ?></option> |
| 45 | <?php endforeach ?> |
| 46 | </optgroup> |
| 47 | <?php else : ?> |
| 48 | <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $mapped_value, $key ); ?>><?php echo esc_html( $value ); ?></option> |
| 49 | <?php endif; ?> |
| 50 | <?php endforeach ?> |
| 51 | </select> |
| 52 | </td> |
| 53 | </tr> |
| 54 | <?php endforeach; ?> |
| 55 | </tbody> |
| 56 | </table> |
| 57 | </section> |
| 58 | <div class="wc-actions"> |
| 59 | <button type="submit" class="button button-primary button-next" value="<?php esc_attr_e( 'Run the importer', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Run the importer', 'woocommerce' ); ?></button> |
| 60 | <input type="hidden" name="file" value="<?php echo esc_attr( $this->file ); ?>" /> |
| 61 | <input type="hidden" name="delimiter" value="<?php echo esc_attr( $this->delimiter ); ?>" /> |
| 62 | <input type="hidden" name="update_existing" value="<?php echo (int) $this->update_existing; ?>" /> |
| 63 | <?php if ( $args['character_encoding'] ) { ?> |
| 64 | <input type="hidden" name="character_encoding" value="<?php echo esc_html( $args['character_encoding'] ); ?>" /> |
| 65 | <?php } ?> |
| 66 | <?php wp_nonce_field( 'woocommerce-csv-importer' ); ?> |
| 67 | </div> |
| 68 | </form> |
| 69 |