diff --git a/includes/class-wc-datetime.php b/includes/class-wc-datetime.php index fe7873d78f9..985efff2d78 100644 --- a/includes/class-wc-datetime.php +++ b/includes/class-wc-datetime.php @@ -5,7 +5,8 @@ if ( ! defined( 'ABSPATH' ) ) { } /** - * WC Wrapper for PHP DateTime. + * WC Wrapper for PHP DateTime which adds support for gmt/utc offset when a + * timezone is absent. * * @class WC_DateTime * @since 3.0.0 @@ -16,13 +17,15 @@ if ( ! defined( 'ABSPATH' ) ) { class WC_DateTime extends DateTime { /** - * UTC Offset if needed. + * UTC Offset, if needed. Only used when a timezone is not set. When + * timezones are used this will equal 0. + * * @var integer */ protected $utc_offset = 0; /** - * Output an ISO 8601 date string in local timezone. + * Output an ISO 8601 date string in local (WordPress) timezone. * * @since 3.0.0 * @return string @@ -32,7 +35,7 @@ class WC_DateTime extends DateTime { } /** - * Set UTC offset. + * Set UTC offset - this is a fixed offset instead of a timezone. * * @param int $offset */ @@ -41,7 +44,7 @@ class WC_DateTime extends DateTime { } /** - * getOffset. + * Get UTC offset if set, or default to the DateTime object's offset. */ public function getOffset() { if ( $this->utc_offset ) { @@ -64,7 +67,7 @@ class WC_DateTime extends DateTime { } /** - * Missing in PHP 5.2. + * Missing in PHP 5.2 so just here so it can be supported consistently. * * @since 3.0.0 * @return int diff --git a/includes/import/class-wc-product-csv-importer.php b/includes/import/class-wc-product-csv-importer.php index 19b52b692de..8ac995e10c0 100644 --- a/includes/import/class-wc-product-csv-importer.php +++ b/includes/import/class-wc-product-csv-importer.php @@ -186,10 +186,9 @@ class WC_Product_CSV_Importer extends WC_Product_Importer { * for rows following this one. * * @param stirng $field - * @param array $raw_data * @return int */ - public function parse_id_field( $field, $raw_data = array() ) { + public function parse_id_field( $field ) { global $wpdb; $id = absint( $field ); @@ -208,7 +207,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer { // Not updating? Make sure we have a new placeholder for this ID. if ( ! $this->params['update_existing'] ) { // If row has a SKU, make sure placeholder was not made already. - if ( isset( $raw_data['sku'] ) && $id = wc_get_product_id_by_sku( $raw_data['sku'] ) ) { + if ( isset( $this->raw_data['sku'] ) && $id = wc_get_product_id_by_sku( $this->raw_data['sku'] ) ) { return $id; } @@ -218,8 +217,8 @@ class WC_Product_CSV_Importer extends WC_Product_Importer { $product->add_meta_data( '_original_id', $id, true ); // If row has a SKU, make sure placeholder has it too. - if ( isset( $raw_data['sku'] ) ) { - $product->set_sku( $raw_data['sku'] ); + if ( isset( $this->raw_data['sku'] ) ) { + $product->set_sku( $this->raw_data['sku'] ); } $id = $product->save(); } @@ -705,7 +704,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer { $value = wp_check_invalid_utf8( $value, true ); } - $data[ $mapped_keys[ $id ] ] = call_user_func( $parse_functions[ $id ], $value, array_combine( $mapped_keys, $row ) ); + $data[ $mapped_keys[ $id ] ] = call_user_func( $parse_functions[ $id ], $value ); } $this->parsed_data[] = apply_filters( 'woocommerce_product_importer_parsed_data', $this->expand_data( $data ), $this );