Import Products from any XML or CSV to WooCommerce - Version 1.3.7

Version Description

  • improvement: added new filter wp_all_import_recount_terms_after_import
  • bug fix: compatibility with woo commerce 2.6
  • bug fix: do not update stock_status if _stock is not set to update
Download this release

Release Info

Developer soflyy
Plugin Icon 128x128 Import Products from any XML or CSV to WooCommerce
Version 1.3.7
Comparing to
See all releases

Code changes from version 1.3.6 to 1.3.7

actions/pmxi_after_xml_import.php CHANGED
@@ -7,14 +7,36 @@ function pmwi_pmxi_after_xml_import($import_id)
7
  $import->getById($import_id);
8
 
9
  // Re-count WooCommerce Terms
10
- if ( ! $import->isEmpty() and in_array($import->options['custom_type'], array('product', 'product_variation')) and ( ($import->options['create_new_records'] and $import->options['is_keep_former_posts'] == 'yes') or ($import->options['is_keep_former_posts'] == 'no' and ( $import->options['update_all_data'] == 'yes' or $import->options['is_update_categories']))))
11
  {
12
- $product_cats = get_terms( 'product_cat', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
- _wc_term_recount( $product_cats, get_taxonomy( 'product_cat' ), true, false );
 
 
 
 
 
15
 
16
- $product_tags = get_terms( 'product_tag', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
17
-
18
- _wc_term_recount( $product_tags, get_taxonomy( 'product_tag' ), true, false );
19
  }
20
  }
7
  $import->getById($import_id);
8
 
9
  // Re-count WooCommerce Terms
10
+ if ( ! $import->isEmpty() and in_array($import->options['custom_type'], array('product', 'product_variation')))
11
  {
12
+ $recount_terms_after_import = true;
13
+ $recount_terms_after_import = apply_filters('wp_all_import_recount_terms_after_import', $recount_terms_after_import, $import_id);
14
+ if ( $recount_terms_after_import && ( ($import->options['create_new_records'] and $import->options['is_keep_former_posts'] == 'yes') or ($import->options['is_keep_former_posts'] == 'no' and ( $import->options['update_all_data'] == 'yes' or $import->options['is_update_categories'])))) {
15
+ $product_cats = get_terms( 'product_cat', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
16
+ _wc_term_recount( $product_cats, get_taxonomy( 'product_cat' ), true, false );
17
+ $product_tags = get_terms( 'product_tag', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
18
+ _wc_term_recount( $product_tags, get_taxonomy( 'product_tag' ), true, false );
19
+ }
20
+ $maybe_to_delete = get_option('wp_all_import_products_maybe_to_delete_' . $import_id);
21
+ if ( ! empty($maybe_to_delete)){
22
+ foreach ($maybe_to_delete as $pid){
23
+ $children = get_posts( array(
24
+ 'post_parent' => $pid,
25
+ 'posts_per_page'=> -1,
26
+ 'post_type' => 'product_variation',
27
+ 'fields' => 'ids',
28
+ 'orderby' => 'ID',
29
+ 'order' => 'ASC',
30
+ 'post_status' => array('draft', 'publish', 'trash', 'pending', 'future', 'private')
31
+ ) );
32
 
33
+ if ( empty($children) ){
34
+ wp_delete_post($pid, true);
35
+ }
36
+ }
37
+ delete_option('wp_all_import_products_maybe_to_delete_' . $import_id);
38
+ }
39
 
40
+ delete_option('wp_all_import_not_linked_products_' . $import_id);
 
 
41
  }
42
  }
actions/pmxi_before_xml_import.php CHANGED
@@ -2,5 +2,7 @@
2
  function pmwi_pmxi_before_xml_import( $import_id )
3
  {
4
  delete_option('wp_all_import_' . $import_id . '_parent_product');
5
- delete_option('wp_all_import_not_linked_products_' . $import_id);
 
 
6
  }
2
  function pmwi_pmxi_before_xml_import( $import_id )
3
  {
4
  delete_option('wp_all_import_' . $import_id . '_parent_product');
5
+ delete_option('wp_all_import_not_linked_products_' . $import_id);
6
+ delete_option('wp_all_import_previously_updated_order_' . $import_id);
7
+ delete_option('wp_all_import_products_maybe_to_delete_' . $import_id);
8
  }
filters/wp_all_import_existing_meta_keys.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
 
3
  function pmwi_wp_all_import_existing_meta_keys( $existing_meta_keys, $custom_type )
4
- {
5
- if ( $custom_type == 'product')
6
- {
7
  $hide_fields = array('_regular_price_tmp', '_sale_price_tmp', '_sale_price_dates_from_tmp', '_sale_price_dates_from_tmp', '_sale_price_dates_to_tmp', '_price_tmp', '_stock_tmp', '_stock_status_tmp', '_product_image_gallery_tmp');
8
  if (version_compare(WOOCOMMERCE_VERSION, '3.0') >= 0){
9
  $hide_fields[] = '_stock_status';
@@ -13,6 +13,7 @@ function pmwi_wp_all_import_existing_meta_keys( $existing_meta_keys, $custom_typ
13
  foreach ($existing_meta_keys as $key => $value) {
14
  if ( in_array($value, $hide_fields) || strpos($value, '_v_') === 0 ) unset($existing_meta_keys[$key]);
15
  }
16
- }
17
- return $existing_meta_keys;
 
18
  }
1
  <?php
2
 
3
  function pmwi_wp_all_import_existing_meta_keys( $existing_meta_keys, $custom_type )
4
+ {
5
+ if ( $custom_type == 'product')
6
+ {
7
  $hide_fields = array('_regular_price_tmp', '_sale_price_tmp', '_sale_price_dates_from_tmp', '_sale_price_dates_from_tmp', '_sale_price_dates_to_tmp', '_price_tmp', '_stock_tmp', '_stock_status_tmp', '_product_image_gallery_tmp');
8
  if (version_compare(WOOCOMMERCE_VERSION, '3.0') >= 0){
9
  $hide_fields[] = '_stock_status';
13
  foreach ($existing_meta_keys as $key => $value) {
14
  if ( in_array($value, $hide_fields) || strpos($value, '_v_') === 0 ) unset($existing_meta_keys[$key]);
15
  }
16
+ $existing_meta_keys = array_values($existing_meta_keys);
17
+ }
18
+ return $existing_meta_keys;
19
  }
models/import/record.php CHANGED
@@ -1195,7 +1195,7 @@ class PMWI_Import_Record extends PMWI_Model_Record {
1195
  $this->pushmeta($pid, '_manage_stock', $manage_stock);
1196
  $this->pushmeta($pid, '_backorders', $backorders);
1197
 
1198
- if ( $stock_status ) {
1199
  update_post_meta( $pid, '_stock_status', $stock_status );
1200
  }
1201
 
1195
  $this->pushmeta($pid, '_manage_stock', $manage_stock);
1196
  $this->pushmeta($pid, '_backorders', $backorders);
1197
 
1198
+ if ( $this->is_update_cf('_stock') && $stock_status ) {
1199
  update_post_meta( $pid, '_stock_status', $stock_status );
1200
  }
1201
 
plugin.php CHANGED
@@ -3,8 +3,9 @@
3
  Plugin Name: WP All Import - WooCommerce Add-On
4
  Plugin URI: http://www.wpallimport.com/
5
  Description: An extremely easy, drag & drop importer to import WooCommerce simple products. A paid upgrade is available for premium support and support for Variable, Grouped, and External/Affiliate products
6
- Version: 1.3.6
7
  Author: Soflyy
 
8
  */
9
  /**
10
  * Plugin root dir with forward slashes as directory separator regardless of actuall DIRECTORY_SEPARATOR value
@@ -24,7 +25,7 @@ define('PMWI_ROOT_URL', rtrim(plugin_dir_url(__FILE__), '/'));
24
  */
25
  define('PMWI_PREFIX', 'pmwi_');
26
 
27
- define('PMWI_FREE_VERSION', '1.3.6');
28
 
29
  define('PMWI_EDITION', 'free');
30
 
3
  Plugin Name: WP All Import - WooCommerce Add-On
4
  Plugin URI: http://www.wpallimport.com/
5
  Description: An extremely easy, drag & drop importer to import WooCommerce simple products. A paid upgrade is available for premium support and support for Variable, Grouped, and External/Affiliate products
6
+ Version: 1.3.7
7
  Author: Soflyy
8
+ WC tested up to: 3.3.1
9
  */
10
  /**
11
  * Plugin root dir with forward slashes as directory separator regardless of actuall DIRECTORY_SEPARATOR value
25
  */
26
  define('PMWI_PREFIX', 'pmwi_');
27
 
28
+ define('PMWI_FREE_VERSION', '1.3.7');
29
 
30
  define('PMWI_EDITION', 'free');
31
 
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Import Products from any XML or CSV to WooCommerce ===
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
- Tested up to: 4.8.1
5
- Stable tag: 1.3.6
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Tags: woocommerce xml import, woocommerce csv import, woocommerce, import, xml, csv, wp all import, csv import, import csv, xml import, import xml, woocommerce csv importer, woocommerce xml importer, csv importer, csv import suite
@@ -83,6 +83,11 @@ The WooCommerce add-on will appear in the Step 4 of WP All Import.
83
 
84
  == Changelog ==
85
 
 
 
 
 
 
86
  = 1.3.6 =
87
  * improvement: added 'WooCommerce Advanced Options' to re-import section
88
  * bug fix: variations title
1
  === Import Products from any XML or CSV to WooCommerce ===
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
+ Tested up to: 4.9
5
+ Stable tag: 1.3.7
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Tags: woocommerce xml import, woocommerce csv import, woocommerce, import, xml, csv, wp all import, csv import, import csv, xml import, import xml, woocommerce csv importer, woocommerce xml importer, csv importer, csv import suite
83
 
84
  == Changelog ==
85
 
86
+ = 1.3.7 =
87
+ * improvement: added new filter wp_all_import_recount_terms_after_import
88
+ * bug fix: compatibility with woo commerce 2.6
89
+ * bug fix: do not update stock_status if _stock is not set to update
90
+
91
  = 1.3.6 =
92
  * improvement: added 'WooCommerce Advanced Options' to re-import section
93
  * bug fix: variations title
views/admin/import/_tabs/_attributes.php CHANGED
@@ -12,7 +12,7 @@
12
  <td><?php _e('Name', 'wpai_woocommerce_addon_plugin'); ?></td>
13
  <td style="padding-bottom: 5px;">
14
  <?php _e('Values', 'wpai_woocommerce_addon_plugin'); ?>
15
- <a href="#help" class="wpallimport-help" title="<?php _e('Separate mutiple values with a |', 'wpai_woocommerce_addon_plugin') ?>" style="top:-1px;">?</a>
16
  </td>
17
  <td></td>
18
  </tr>
12
  <td><?php _e('Name', 'wpai_woocommerce_addon_plugin'); ?></td>
13
  <td style="padding-bottom: 5px;">
14
  <?php _e('Values', 'wpai_woocommerce_addon_plugin'); ?>
15
+ <a href="#help" class="wpallimport-help" title="<?php _e('Separate multiple values with a |', 'wpai_woocommerce_addon_plugin') ?>" style="top:-1px;">?</a>
16
  </td>
17
  <td></td>
18
  </tr>
views/admin/import/_tabs/_inventory.php CHANGED
@@ -49,7 +49,7 @@
49
  <p class="form-field wpallimport-radio-field">
50
  <input type="radio" id="product_stock_status_automatically" class="switcher" name="product_stock_status" value="auto" <?php echo 'auto' == $post['product_stock_status'] ? 'checked="checked"': '' ?>/>
51
  <label for="product_stock_status_automatically" style="width:105px;"><?php _e("Set automatically", "wpai_woocommerce_addon_plugin"); ?></label>
52
- <a href="#help" class="wpallimport-help" title="<?php _e('Set the stock status to In Stock for positive Stock Qty values, and Out Of Stock if Stock Qty is 0 or blank.', 'wpai_woocommerce_addon_plugin') ?>" style="position:relative; top:2px;">?</a>
53
  </p>
54
  <div class="form-field wpallimport-radio-field">
55
  <input type="radio" id="product_stock_status_xpath" class="switcher" name="product_stock_status" value="xpath" <?php echo 'xpath' == $post['product_stock_status'] ? 'checked="checked"': '' ?>/>
49
  <p class="form-field wpallimport-radio-field">
50
  <input type="radio" id="product_stock_status_automatically" class="switcher" name="product_stock_status" value="auto" <?php echo 'auto' == $post['product_stock_status'] ? 'checked="checked"': '' ?>/>
51
  <label for="product_stock_status_automatically" style="width:105px;"><?php _e("Set automatically", "wpai_woocommerce_addon_plugin"); ?></label>
52
+ <a href="#help" class="wpallimport-help" title="<?php _e('Set the stock status to In Stock for positive or blank Stock Qty values, and Out Of Stock if Stock Qty is 0.', 'wpai_woocommerce_addon_plugin') ?>" style="position:relative; top:2px;">?</a>
53
  </p>
54
  <div class="form-field wpallimport-radio-field">
55
  <input type="radio" id="product_stock_status_xpath" class="switcher" name="product_stock_status" value="xpath" <?php echo 'xpath' == $post['product_stock_status'] ? 'checked="checked"': '' ?>/>