WooCommerce Code Reference

WC_Product_CSV_Importer_Controller

Product importer controller - handles file upload and forms in admin.

Tags
version
3.1.0

Table of Contents

$delimiter  : string
The current delimiter for the file being read.
$errors  : array
Errors.
$file  : string
The path to the current file.
$map_preferences  : bool
Whether to use previous mapping selections.
$step  : string
The current import step.
$steps  : array
Progress steps.
$update_existing  : bool
Whether to skip existing products.
__construct()  : mixed
Constructor.
auto_map_user_preferences()  : array
Map columns using the user's lastest import mappings.
dispatch()  : mixed
Dispatch current step and show correct view.
get_importer()  : WC_Product_CSV_Importer
Get importer instance.
get_next_step_link()  : string
Get the URL for the next step's screen.
handle_upload()  : string|WP_Error
Handles the CSV upload and initial parsing of the file to prepare for displaying author import options.
import()  : mixed
Import the file if it exists and is valid.
is_file_valid_csv()  : bool
Check whether a file is a valid CSV file.
upload_form_handler()  : mixed
Handle the upload form and store options.
add_error()  : mixed
Add error message.
auto_map_columns()  : array
Auto map column names.
done()  : mixed
Done step.
get_mapping_options()  : array
Get mapping options.
get_special_columns()  : array
Get special columns.
get_valid_csv_filetypes()  : array
Get all the valid filetypes for a CSV file.
mapping_form()  : mixed
Mapping step.
normalize_columns_names()  : array
Columns to normalize.
output_errors()  : mixed
Add error message.
output_footer()  : mixed
Output footer view.
output_header()  : mixed
Output header view.
output_steps()  : mixed
Output steps view.
sanitize_special_column_name_regex()  : string
Sanitize special column name regex.
upload_form()  : mixed
Output information about the uploading process.

Properties

Methods

Get the URL for the next step's screen.

public get_next_step_link([string $step = '' ]) : string
Parameters
$step : string = ''

slug (default: current step).

Return values
stringURL for next step if a next step exists. Admin URL if it's the last step. Empty string on failure.

is_file_valid_csv()

Check whether a file is a valid CSV file.

public static is_file_valid_csv(string $file[, bool $check_path = true ]) : bool
Parameters
$file : string

File path.

$check_path : bool = true

Whether to also check the file is located in a valid location (Default: true).

Tags
todo

Replace this method with wc_is_file_valid_csv() function.

Return values
bool

auto_map_columns()

Auto map column names.

protected auto_map_columns(array $raw_headers[, bool $num_indexes = true ]) : array
Parameters
$raw_headers : array

Raw header columns.

$num_indexes : bool = true

If should use numbers or raw header columns as indexes.

Return values
array