Product Import Export for WooCommerce - Version 1.5.0

Version Description

  • Tested OK with WC 3.5.1
  • Image importing process optimised
  • Bug fix.
Download this release

Release Info

Developer webtoffee
Plugin Icon 128x128 Product Import Export for WooCommerce
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4.9 to 1.5.0

includes/exporter/class-wf-prodimpexpcsv-exporter.php CHANGED
@@ -30,7 +30,9 @@ class WF_ProdImpExpCsv_Exporter {
30
if ( function_exists( 'apache_setenv' ) )
31
@apache_setenv( 'no-gzip', 1 );
32
@ini_set('zlib.output_compression', 0);
33
- @ob_clean();
34
35
36
header( 'Content-Type: text/csv; charset=UTF-8' );
30
if ( function_exists( 'apache_setenv' ) )
31
@apache_setenv( 'no-gzip', 1 );
32
@ini_set('zlib.output_compression', 0);
33
+ if(apply_filters('wt_product_export_ob_clean_enable_flag', TRUE)){
34
+ @ob_clean();
35
+ }
36
37
38
header( 'Content-Type: text/csv; charset=UTF-8' );
includes/importer/class-wf-prodimpexpcsv-product-import.php CHANGED
@@ -1069,11 +1069,18 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
1069
$image_basenames[] = basename( $image );
1070
1071
// Loop attachments already attached to the product
1072
- $attachments = get_posts( 'post_parent=' . $post_id . '&post_type=attachment&fields=ids&post_mime_type=image&numberposts=-1' );
1073
-
1074
foreach ( $attachments as $attachment_key => $attachment ) {
1075
1076
- $attachment_url = wp_get_attachment_url( $attachment );
1077
$attachment_basename = basename( $attachment_url );
1078
1079
// Don't import existing images
@@ -1247,6 +1254,17 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
1247
1248
} else*/
1249
if ( strstr( $url, site_url() ) ) {
1250
$abs_url = str_replace( trailingslashit( site_url() ), trailingslashit( ABSPATH ), urldecode($url) );
1251
$new_name = wp_unique_filename( $upload_dir['path'], basename( urldecode($url) ) );
1252
$new_url = trailingslashit( $upload_dir['path'] ) . $new_name;
@@ -1256,7 +1274,7 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
1256
}
1257
}
1258
1259
- if ( ! strstr( $url, 'http' ) ) {
1260
1261
// Local file
1262
$attachment_file = trailingslashit( $upload_dir['basedir'] ) . 'product_images/' . $url;
@@ -1274,6 +1292,15 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
1274
$post['post_mime_type'] = $info['type'];
1275
else
1276
return new WP_Error( 'attachment_processing_error', __('Invalid file type', 'wordpress-importer') );
1277
1278
$post['guid'] = $attachment_url;
1279
@@ -1317,6 +1344,12 @@ class WF_ProdImpExpCsv_Product_Import extends WP_Importer {
1317
1318
return $attachment_id;
1319
}
1320
1321
/**
1322
* Attempt to download a remote file attachment
1069
$image_basenames[] = basename( $image );
1070
1071
// Loop attachments already attached to the product
1072
+ //$attachments = get_posts( 'post_parent=' . $post_id . '&post_type=attachment&fields=ids&post_mime_type=image&numberposts=-1' );
1073
+
1074
+ $processing_product_object = wc_get_product($post_id);
1075
+ $attachments = $processing_product_object->get_gallery_attachment_ids();
1076
+ $post_thumbnail_id = get_post_thumbnail_id($post_id);
1077
+ if(isset($post_thumbnail_id)&& !empty($post_thumbnail_id)){
1078
+ $attachments[]=$post_thumbnail_id;
1079
+ }
1080
+
1081
foreach ( $attachments as $attachment_key => $attachment ) {
1082
1083
+ $attachment_url = wp_get_attachment_url( $attachment );
1084
$attachment_basename = basename( $attachment_url );
1085
1086
// Don't import existing images
1254
1255
} else*/
1256
if ( strstr( $url, site_url() ) ) {
1257
+
1258
+ $image_id = $this->wt_get_image_id_by_url($url);
1259
+ if($image_id){
1260
+ $attachment_id = $image_id;
1261
+
1262
+ $this->hf_log_data_change('csv-import', sprintf(__('> > (Image already in the site)Inserted image attachment "%s"', 'wf_csv_import_export'), $url));
1263
+
1264
+ $this->attachments[] = $attachment_id;
1265
+
1266
+ return $attachment_id;
1267
+ }
1268
$abs_url = str_replace( trailingslashit( site_url() ), trailingslashit( ABSPATH ), urldecode($url) );
1269
$new_name = wp_unique_filename( $upload_dir['path'], basename( urldecode($url) ) );
1270
$new_url = trailingslashit( $upload_dir['path'] ) . $new_name;
1274
}
1275
}
1276
1277
+ if ( ! strstr( $url, 'http' ) ) { // if not a url
1278
1279
// Local file
1280
$attachment_file = trailingslashit( $upload_dir['basedir'] ) . 'product_images/' . $url;
1292
$post['post_mime_type'] = $info['type'];
1293
else
1294
return new WP_Error( 'attachment_processing_error', __('Invalid file type', 'wordpress-importer') );
1295
+
1296
+
1297
+ $image_id = $this->wt_get_image_id_by_url($attachment_url);
1298
+ if($image_id){
1299
+ $attachment_id = $image_id;
1300
+ $this->hf_log_data_change('csv-import', sprintf(__('> > (Image already in the site)Inserted image attachment "%s"', 'wf_csv_import_export'), $url));
1301
+ $this->attachments[] = $attachment_id;
1302
+ return $attachment_id;
1303
+ }
1304
1305
$post['guid'] = $attachment_url;
1306
1344
1345
return $attachment_id;
1346
}
1347
+
1348
+ function wt_get_image_id_by_url($image_url) {
1349
+ global $wpdb;
1350
+ $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url));
1351
+ return isset($attachment[0])&& $attachment[0]>0 ? $attachment[0]:'';
1352
+ }
1353
1354
/**
1355
* Attempt to download a remote file attachment
includes/views/html-wf-help-guide.php CHANGED
@@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
29
<div class="inner-panel" style="">
30
<img src="<?php echo plugins_url(basename(plugin_dir_path(WF_ProdImpExpCsv_FILE))) . '/images/video.png'; ?>"/>
31
<h3><?php _e('How-to-setup', 'wf_csv_import_export'); ?></h3>
32
- <p style=""><?php _e('Get to know about our produt in 3 minutes with this video', 'wf_csv_import_export'); ?></p>
33
<a href="https://www.webtoffee.com/setting-up-product-import-export-plugin-for-woocommerce/" target="_blank" class="button button-primary">
34
<?php _e('Setup Guide', 'wf_csv_import_export'); ?></a>
35
</div>
29
<div class="inner-panel" style="">
30
<img src="<?php echo plugins_url(basename(plugin_dir_path(WF_ProdImpExpCsv_FILE))) . '/images/video.png'; ?>"/>
31
<h3><?php _e('How-to-setup', 'wf_csv_import_export'); ?></h3>
32
+ <p style=""><?php _e('Get to know about our product in 3 minutes with this video', 'wf_csv_import_export'); ?></p>
33
<a href="https://www.webtoffee.com/setting-up-product-import-export-plugin-for-woocommerce/" target="_blank" class="button button-primary">
34
<?php _e('Setup Guide', 'wf_csv_import_export'); ?></a>
35
</div>
product-csv-import-export.php CHANGED
@@ -5,8 +5,8 @@
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.4.9
9
- WC tested up to: 3.5.0
10
License: GPLv3
11
License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
Text Domain: wf_csv_import_export
@@ -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.4.9");
22
}
23
if (!defined('WF_PROD_IMP_EXP_ID')) {
24
define("WF_PROD_IMP_EXP_ID", "wf_prod_imp_exp");
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.5.0
9
+ WC tested up to: 3.5.1
10
License: GPLv3
11
License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
Text Domain: wf_csv_import_export
18
19
20
if (!defined('WF_PIPE_CURRENT_VERSION')) {
21
+ define("WF_PIPE_CURRENT_VERSION", "1.5.0");
22
}
23
if (!defined('WF_PROD_IMP_EXP_ID')) {
24
define("WF_PROD_IMP_EXP_ID", "wf_prod_imp_exp");
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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
5
Requires at least: 3.0.1
6
Tested up to: 4.9.8
7
- Stable tag: 1.4.9
8
License: GPLv3 or later
9
License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
@@ -20,7 +20,7 @@ Are you trying to import products into WooCommerce store or export WooCommerce p
20
21
&#128312; Export Simple Products in to a CSV file.
22
&#128312; Import Simple Products in CSV format in to WooCommerce Store.
23
- &#128312; Tested OK with WooCommerce 3.5.0.
24
25
26
Highlights: WooCommerce Product Export, WooCommerce Product CSV Import Suite, WooCommerce bulk product upload, WooCommerce import products with images, import amazon products to WooCommerce, Export Products to xls. Pro Version supports both Simple and Variable products.
@@ -144,6 +144,11 @@ Yes. You can import or export product images along with other details
144
145
== Changelog ==
146
147
= 1.4.9 =
148
* Tested OK with WC 3.5.0
149
* Compatible with new meta '_low_stock_amount' which introduced in WC3.5.0
@@ -257,6 +262,7 @@ Yes. You can import or export product images along with other details
257
258
== Upgrade Notice ==
259
260
- = 1.4.9 =
261
- * Tested OK with WC 3.5.0
262
- * Compatible with new meta '_low_stock_amount' which introduced in WC3.5.0
4
Tags: woocommerce product import, woocommerce import products, woocommerce export products, export woocommerce products, import products into woocommerce
5
Requires at least: 3.0.1
6
Tested up to: 4.9.8
7
+ Stable tag: 1.5.0
8
License: GPLv3 or later
9
License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
20
21
&#128312; Export Simple Products in to a CSV file.
22
&#128312; Import Simple Products in CSV format in to WooCommerce Store.
23
+ &#128312; Tested OK with WooCommerce 3.5.1.
24
25
26
Highlights: WooCommerce Product Export, WooCommerce Product CSV Import Suite, WooCommerce bulk product upload, WooCommerce import products with images, import amazon products to WooCommerce, Export Products to xls. Pro Version supports both Simple and Variable products.
144
145
== Changelog ==
146
147
+ = 1.5.0 =
148
+ * Tested OK with WC 3.5.1
149
+ * Image importing process optimised
150
+ * Bug fix.
151
+
152
= 1.4.9 =
153
* Tested OK with WC 3.5.0
154
* Compatible with new meta '_low_stock_amount' which introduced in WC3.5.0
262
263
== Upgrade Notice ==
264
265
+ = 1.5.0 =
266
+ * Tested OK with WC 3.5.1
267
+ * Image importing process optimised.
268
+ * Bug fix.