From d642212205231d6e943bae2f6173dfcd025ff366 Mon Sep 17 00:00:00 2001 From: claudiulodro Date: Wed, 3 May 2017 14:53:31 -0700 Subject: [PATCH] More parser progress --- .../admin/importers/class-wc-product-importer.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/includes/admin/importers/class-wc-product-importer.php b/includes/admin/importers/class-wc-product-importer.php index e609a18bc1c..cb82bb3e8b0 100644 --- a/includes/admin/importers/class-wc-product-importer.php +++ b/includes/admin/importers/class-wc-product-importer.php @@ -220,6 +220,9 @@ class WC_Product_Importer extends WP_Importer { return apply_filters( 'woocommerce_csv_product_import_data', $data, $file, $args ); } + /** + * @param array $mapping 'raw column name' => 'mapped column name' + */ private function map_headers( $data, $mapping ) { $data['headers'] = array(); foreach ( $data['raw_headers'] as $heading ) { @@ -232,16 +235,15 @@ class WC_Product_Importer extends WP_Importer { * Map and format raw data to known fields. * * @param array $data - * @param array $mapping 'raw column name' => 'mapped column name' */ - private function parse_data( $data, $mapping ) { + private function parse_data( $data ) { $data_formatting = array( 'ID' => 'absint', 'Published' => 'boolval', 'Is featured' => 'boolval', - 'Date sale price starts' => 'wc_format_datetime', - 'Date sale price ends' => 'wc_format_datetime', + //'Date sale price starts' => 'wc_format_datetime', + //'Date sale price ends' => 'wc_format_datetime', 'In stock?' => 'boolval', 'Sold individually?' => 'boolval', 'Weight' => 'absint', @@ -300,10 +302,12 @@ class WC_Product_Importer extends WP_Importer { } public function parse_comma_field( $field ) { - return $field; + return array_map( 'esc_attr', explode( ',', $field ) ); } public function parse_categories( $field ) { + $sections = explode( ',', $field ); + return $field; }