Version Description
- Enhancement: Added 'tab' and 'space' delimiter support for import CSV.
- Bug Fix: Improved error handling for file upload issues.
- Plugin update information hook added.
Download this release
Release Info
Developer | webtoffee |
Plugin | Product Import Export for WooCommerce |
Version | 1.6.5 |
Comparing to | |
See all releases |
Code changes from version 1.6.4 to 1.6.5
includes/importer/class-wf-csv-parser.php
CHANGED
@@ -68,7 +68,7 @@ class WF_CSV_Parser {
|
|
68 |
|
69 |
// Put all CSV data into an associative array
|
70 |
if (( $handle = fopen($file, "r") ) !== FALSE) {
|
71 |
-
|
72 |
$header = fgetcsv($handle, 0, $delimiter);
|
73 |
if ($start_pos != 0)
|
74 |
fseek($handle, $start_pos);
|
68 |
|
69 |
// Put all CSV data into an associative array
|
70 |
if (( $handle = fopen($file, "r") ) !== FALSE) {
|
71 |
+
$delimiter = WF_ProdImpExpCsv_Product_Import::wt_get_csv_delimiter($delimiter); //(strtolower($delimiter) == 'tab' ? "\t" : $delimiter);
|
72 |
$header = fgetcsv($handle, 0, $delimiter);
|
73 |
if ($start_pos != 0)
|
74 |
fseek($handle, $start_pos);
|
includes/importer/class-wf-prodimpexpcsv-product-import.php
CHANGED
@@ -57,9 +57,9 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
|
|
57 |
global $woocommerce, $wpdb;
|
58 |
|
59 |
if ( ! empty( $_POST['delimiter'] ) ) {
|
60 |
-
$this->delimiter = stripslashes(
|
61 |
}else if ( ! empty( $_GET['delimiter'] ) ) {
|
62 |
-
$this->delimiter = stripslashes(
|
63 |
}
|
64 |
|
65 |
if ( ! $this->delimiter )
|
@@ -255,8 +255,8 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
|
|
255 |
|
256 |
// Get CSV positions
|
257 |
if ( ( $handle = fopen( $file, "r" ) ) !== FALSE ) {
|
258 |
-
|
259 |
-
while ( ( $postmeta = fgetcsv( $handle, 0, $
|
260 |
$count++;
|
261 |
|
262 |
if ( $count >= $limit ) {
|
@@ -516,6 +516,11 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
|
|
516 |
$file = ABSPATH . $this->file_url;
|
517 |
else
|
518 |
return;
|
|
|
|
|
|
|
|
|
|
|
519 |
|
520 |
// Set locale
|
521 |
$enc = mb_detect_encoding( $file, 'UTF-8, ISO-8859-1', true );
|
@@ -526,9 +531,10 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
|
|
526 |
if ( ( $handle = fopen( $file, "r" ) ) !== FALSE ) {
|
527 |
|
528 |
$row = $raw_headers = array();
|
529 |
-
|
|
|
530 |
|
531 |
-
while ( ( $postmeta = fgetcsv( $handle, 0, $
|
532 |
foreach ( $header as $key => $heading ) {
|
533 |
if ( ! $heading ) continue;
|
534 |
$s_heading = strtolower( $heading );
|
@@ -589,6 +595,7 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
|
|
589 |
|
590 |
$this->hf_log_data_change( 'csv-import', '---' );
|
591 |
$this->hf_log_data_change( 'csv-import', __( 'Processing products.', 'product-import-export-for-woo' ) );
|
|
|
592 |
foreach ( $this->parsed_data as $key => &$item ) {
|
593 |
|
594 |
$product = $this->parser->parse_product( $item, $this->merge_empty_cells );
|
@@ -1655,4 +1662,18 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
|
|
1655 |
|
1656 |
return $result;
|
1657 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1658 |
}
|
57 |
global $woocommerce, $wpdb;
|
58 |
|
59 |
if ( ! empty( $_POST['delimiter'] ) ) {
|
60 |
+
$this->delimiter = stripslashes( ( $_POST['delimiter'] ) );
|
61 |
}else if ( ! empty( $_GET['delimiter'] ) ) {
|
62 |
+
$this->delimiter = stripslashes( ( $_GET['delimiter'] ) );
|
63 |
}
|
64 |
|
65 |
if ( ! $this->delimiter )
|
255 |
|
256 |
// Get CSV positions
|
257 |
if ( ( $handle = fopen( $file, "r" ) ) !== FALSE ) {
|
258 |
+
$csv_delimiter = self::wt_get_csv_delimiter($this->delimiter);//(strtolower($this->delimiter) == 'tab' ? "\t" : $this->delimiter);
|
259 |
+
while ( ( $postmeta = fgetcsv( $handle, 0, $csv_delimiter ) ) !== FALSE ) {
|
260 |
$count++;
|
261 |
|
262 |
if ( $count >= $limit ) {
|
516 |
$file = ABSPATH . $this->file_url;
|
517 |
else
|
518 |
return;
|
519 |
+
|
520 |
+
if(!$file){
|
521 |
+
_e( 'An error occurred uploading file. Please try again later.', 'product-import-export-for-woo' );
|
522 |
+
return;
|
523 |
+
}
|
524 |
|
525 |
// Set locale
|
526 |
$enc = mb_detect_encoding( $file, 'UTF-8, ISO-8859-1', true );
|
531 |
if ( ( $handle = fopen( $file, "r" ) ) !== FALSE ) {
|
532 |
|
533 |
$row = $raw_headers = array();
|
534 |
+
$csv_delimiter = self::wt_get_csv_delimiter($this->delimiter); //(strtolower($this->delimiter) == 'tab' ? "\t" : $this->delimiter);
|
535 |
+
$header = fgetcsv( $handle, 0, $csv_delimiter );
|
536 |
|
537 |
+
while ( ( $postmeta = fgetcsv( $handle, 0, $csv_delimiter ) ) !== FALSE ) {
|
538 |
foreach ( $header as $key => $heading ) {
|
539 |
if ( ! $heading ) continue;
|
540 |
$s_heading = strtolower( $heading );
|
595 |
|
596 |
$this->hf_log_data_change( 'csv-import', '---' );
|
597 |
$this->hf_log_data_change( 'csv-import', __( 'Processing products.', 'product-import-export-for-woo' ) );
|
598 |
+
|
599 |
foreach ( $this->parsed_data as $key => &$item ) {
|
600 |
|
601 |
$product = $this->parser->parse_product( $item, $this->merge_empty_cells );
|
1662 |
|
1663 |
return $result;
|
1664 |
}
|
1665 |
+
|
1666 |
+
public static function wt_get_csv_delimiter($delemiter=','){
|
1667 |
+
$delemiter = strtolower($delemiter);
|
1668 |
+
switch ($delemiter) {
|
1669 |
+
case 'tab':
|
1670 |
+
$delemiter = "\t";
|
1671 |
+
break;
|
1672 |
+
|
1673 |
+
case 'space':
|
1674 |
+
$delemiter = " ";
|
1675 |
+
break;
|
1676 |
+
}
|
1677 |
+
return $delemiter;
|
1678 |
+
}
|
1679 |
}
|
product-import-export-for-woo.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
Description: Import and Export Products From and To your WooCommerce Store.
|
6 |
Author: WebToffee
|
7 |
Author URI: https://www.webtoffee.com/product/product-import-export-woocommerce/
|
8 |
-
Version: 1.6.
|
9 |
WC tested up to: 3.7.0
|
10 |
License: GPLv3
|
11 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
@@ -18,7 +18,7 @@ if (!defined('ABSPATH') || !is_admin()) {
|
|
18 |
|
19 |
|
20 |
if (!defined('WF_PIPE_CURRENT_VERSION')) {
|
21 |
-
define("WF_PIPE_CURRENT_VERSION", "1.6.
|
22 |
}
|
23 |
if (!defined('WF_PROD_IMP_EXP_ID')) {
|
24 |
define("WF_PROD_IMP_EXP_ID", "wf_prod_imp_exp");
|
@@ -499,4 +499,19 @@ if (!function_exists('impexp_welcome')) {
|
|
499 |
wp_safe_redirect(add_query_arg(array('page' => 'wf_woocommerce_csv_im_ex'), admin_url('admin.php')));
|
500 |
}
|
501 |
|
502 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
Description: Import and Export Products From and To your WooCommerce Store.
|
6 |
Author: WebToffee
|
7 |
Author URI: https://www.webtoffee.com/product/product-import-export-woocommerce/
|
8 |
+
Version: 1.6.5
|
9 |
WC tested up to: 3.7.0
|
10 |
License: GPLv3
|
11 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
18 |
|
19 |
|
20 |
if (!defined('WF_PIPE_CURRENT_VERSION')) {
|
21 |
+
define("WF_PIPE_CURRENT_VERSION", "1.6.5");
|
22 |
}
|
23 |
if (!defined('WF_PROD_IMP_EXP_ID')) {
|
24 |
define("WF_PROD_IMP_EXP_ID", "wf_prod_imp_exp");
|
499 |
wp_safe_redirect(add_query_arg(array('page' => 'wf_woocommerce_csv_im_ex'), admin_url('admin.php')));
|
500 |
}
|
501 |
|
502 |
+
}
|
503 |
+
|
504 |
+
/*
|
505 |
+
* Displays update information for a plugin.
|
506 |
+
*/
|
507 |
+
function wt_product_import_export_for_woo_update_message( $data, $response )
|
508 |
+
{
|
509 |
+
if(isset( $data['upgrade_notice']))
|
510 |
+
{
|
511 |
+
printf(
|
512 |
+
'<div class="update-message wt-update-message">%s</div>',
|
513 |
+
$data['upgrade_notice']
|
514 |
+
);
|
515 |
+
}
|
516 |
+
}
|
517 |
+
add_action( 'in_plugin_update_message-product-import-export-for-woo/product-import-export-for-woo.php', 'wt_product_import_export_for_woo_update_message', 10, 2 );
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: webtoffee
|
|
3 |
Donate link: https://www.webtoffee.com/plugins/
|
4 |
Tags: woocommerce product import, woocommerce import products, woocommerce export products, export woocommerce products, import products into woocommerce ,product, export, import, woocommerce ,csv
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 5.2
|
7 |
-
Stable tag: 1.6.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -153,6 +153,11 @@ By default, admin and store manager are given access to export orders from your
|
|
153 |
|
154 |
== Changelog ==
|
155 |
|
|
|
|
|
|
|
|
|
|
|
156 |
= 1.6.4 =
|
157 |
* Tested OK with WC 3.7.0
|
158 |
|
@@ -327,5 +332,7 @@ By default, admin and store manager are given access to export orders from your
|
|
327 |
|
328 |
== Upgrade Notice ==
|
329 |
|
330 |
-
= 1.6.
|
331 |
-
*
|
|
|
|
3 |
Donate link: https://www.webtoffee.com/plugins/
|
4 |
Tags: woocommerce product import, woocommerce import products, woocommerce export products, export woocommerce products, import products into woocommerce ,product, export, import, woocommerce ,csv
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 5.2.2
|
7 |
+
Stable tag: 1.6.5
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
153 |
|
154 |
== Changelog ==
|
155 |
|
156 |
+
= 1.6.5 =
|
157 |
+
* Enhancement: Added 'tab' and 'space' delimiter support for import CSV.
|
158 |
+
* Bug Fix: Improved error handling for file upload issues.
|
159 |
+
* Plugin update information hook added.
|
160 |
+
|
161 |
= 1.6.4 =
|
162 |
* Tested OK with WC 3.7.0
|
163 |
|
332 |
|
333 |
== Upgrade Notice ==
|
334 |
|
335 |
+
= 1.6.5 =
|
336 |
+
* Enhancement: Added 'tab' and 'space' delimiter support for import CSV.
|
337 |
+
* Bug Fix: Improved error handling for file upload issues.
|
338 |
+
* Plugin update information hook added.
|