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

Version Description

  • fixed updating shipping class
Download this release

Release Info

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

Code changes from version 1.1.4 to 1.1.5

helpers/pmwi_is_update_taxonomy.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function pmwi_is_update_taxonomy( $articleData, $options, $tx_name ){
3
+
4
+ if ( ! empty($articleData['ID']) ){
5
+ if ($options['update_all_data'] == "no" and $options['update_categories_logic'] == "all_except" and !empty($options['taxonomies_list'])
6
+ and is_array($options['taxonomies_list']) and in_array($tx_name, $options['taxonomies_list'])) return false;
7
+ if ($options['update_all_data'] == "no" and $options['update_categories_logic'] == "only" and ((!empty($options['taxonomies_list'])
8
+ and is_array($options['taxonomies_list']) and ! in_array($tx_name, $options['taxonomies_list'])) or empty($options['taxonomies_list']))) return false;
9
+ }
10
+
11
+ return true;
12
+ }
models/import/record.php CHANGED
@@ -427,7 +427,7 @@ class PMWI_Import_Record extends PMWI_Model_Record {
427
  );
428
 
429
  }
430
- }
431
 
432
  remove_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html')); kses_init(); // return any filtering rules back if they has been disabled for import procedure
433
 
@@ -505,11 +505,15 @@ class PMWI_Import_Record extends PMWI_Model_Record {
505
  if (empty($articleData['ID']) or $this->is_update_custom_field($existing_meta_keys, $import->options, '_height')) update_post_meta( $pid, '_height', '' );
506
  }
507
 
508
- $this->wpdb->update( $this->wpdb->posts, array('comment_status' => ($product_enable_reviews[$i] == 'yes') ? 'open' : 'closed','menu_order' => ($product_menu_order[$i] != '') ? $product_menu_order[$i] : 0 ), array('ID' => $pid) );
 
 
509
 
510
  // Save shipping class
511
- $product_shipping_class = is_numeric($product_shipping_class[$i]) && $product_shipping_class[$i] > 0 && $product_type != 'external' ? absint( $product_shipping_class[$i] ) : $product_shipping_class[$i];
512
- wp_set_object_terms( $pid, $product_shipping_class, 'product_shipping_class');
 
 
513
 
514
  // Unique SKU
515
  $sku = get_post_meta($pid, '_sku', true);
@@ -620,7 +624,7 @@ class PMWI_Import_Record extends PMWI_Model_Record {
620
  $term_founded = false;
621
  if ( count($terms) > 0 ){
622
  foreach ( $terms as $term ) {
623
- if ( strtolower($term->name) == trim(strtolower($value)) ) {
624
  $attr_values[] = $term->slug;
625
  $term_founded = true;
626
  break;
@@ -867,7 +871,7 @@ class PMWI_Import_Record extends PMWI_Model_Record {
867
  // Upsells
868
  if ( !empty( $product_up_sells[$i] ) ) {
869
  $upsells = array();
870
- $ids = explode(',', $product_up_sells[$i]);
871
  foreach ( $ids as $id ){
872
  $args = array(
873
  'post_type' => 'product',
@@ -893,7 +897,7 @@ class PMWI_Import_Record extends PMWI_Model_Record {
893
  // Cross sells
894
  if ( !empty( $product_cross_sells[$i] ) ) {
895
  $crosssells = array();
896
- $ids = explode(',', $product_cross_sells[$i]);
897
  foreach ( $ids as $id ){
898
  $args = array(
899
  'post_type' => 'product',
@@ -1104,7 +1108,7 @@ class PMWI_Import_Record extends PMWI_Model_Record {
1104
 
1105
  }
1106
 
1107
- //$woocommerce->clear_product_transients( $post_id );
1108
 
1109
  return $added;
1110
  }
@@ -1184,6 +1188,14 @@ class PMWI_Import_Record extends PMWI_Model_Record {
1184
  update_post_meta($new_id, $meta_key, $meta_value);
1185
  }
1186
  }
 
 
 
 
 
 
 
 
1187
  }
1188
 
1189
  function auto_cloak_links($import, &$url){
427
  );
428
 
429
  }
430
+ }
431
 
432
  remove_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html')); kses_init(); // return any filtering rules back if they has been disabled for import procedure
433
 
505
  if (empty($articleData['ID']) or $this->is_update_custom_field($existing_meta_keys, $import->options, '_height')) update_post_meta( $pid, '_height', '' );
506
  }
507
 
508
+ $this->wpdb->update( $this->wpdb->posts, array('comment_status' => ($product_enable_reviews[$i] == 'yes') ? 'open' : 'closed' ), array('ID' => $pid));
509
+ // update menu order
510
+ if ($import->options['is_update_menu_order']) $this->wpdb->update( $this->wpdb->posts, array('menu_order' => ($product_menu_order[$i] != '') ? $product_menu_order[$i] : 0 ), array('ID' => $pid));
511
 
512
  // Save shipping class
513
+ if ( pmwi_is_update_taxonomy($articleData, $import->options, 'product_shipping_class') ){
514
+ $product_shipping_class = is_numeric($product_shipping_class[$i]) && $product_shipping_class[$i] > 0 && $product_type != 'external' ? absint( $product_shipping_class[$i] ) : $product_shipping_class[$i];
515
+ wp_set_object_terms( $pid, $product_shipping_class, 'product_shipping_class');
516
+ }
517
 
518
  // Unique SKU
519
  $sku = get_post_meta($pid, '_sku', true);
624
  $term_founded = false;
625
  if ( count($terms) > 0 ){
626
  foreach ( $terms as $term ) {
627
+ if ( strtolower($term->name) == trim(strtolower($value)) or $term->slug == sanitize_title(trim(strtolower($value)))) {
628
  $attr_values[] = $term->slug;
629
  $term_founded = true;
630
  break;
871
  // Upsells
872
  if ( !empty( $product_up_sells[$i] ) ) {
873
  $upsells = array();
874
+ $ids = array_filter(explode(',', $product_up_sells[$i]), 'trim');
875
  foreach ( $ids as $id ){
876
  $args = array(
877
  'post_type' => 'product',
897
  // Cross sells
898
  if ( !empty( $product_cross_sells[$i] ) ) {
899
  $crosssells = array();
900
+ $ids = array_filter(explode(',', $product_cross_sells[$i]), 'trim');
901
  foreach ( $ids as $id ){
902
  $args = array(
903
  'post_type' => 'product',
1108
 
1109
  }
1110
 
1111
+ wc_delete_product_transients( $post_id );
1112
 
1113
  return $added;
1114
  }
1188
  update_post_meta($new_id, $meta_key, $meta_value);
1189
  }
1190
  }
1191
+
1192
+ update_post_meta( $post->ID, '_stock_tmp', $tmp = get_post_meta( $post->ID, '_stock', true) );
1193
+ update_post_meta( $post->ID, '_stock', '');
1194
+ update_post_meta( $post->ID, '_regular_price_tmp', $tmp = get_post_meta( $post->ID, '_regular_price', true) );
1195
+ update_post_meta( $post->ID, '_regular_price', '' );
1196
+ update_post_meta( $post->ID, '_price_tmp', $tmp = get_post_meta( $post->ID, '_price', true) );
1197
+ update_post_meta( $post->ID, '_price', '');
1198
+
1199
  }
1200
 
1201
  function auto_cloak_links($import, &$url){
plugin.php CHANGED
@@ -3,7 +3,7 @@
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.1.4
7
  Author: Soflyy
8
  */
9
  /**
@@ -24,7 +24,7 @@ define('PMWI_FREE_ROOT_URL', rtrim(plugin_dir_url(__FILE__), '/'));
24
  */
25
  define('PMWI_PREFIX', 'pmwi_');
26
 
27
- define('PMWI_FREE_VERSION', '1.1.4');
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.1.5
7
  Author: Soflyy
8
  */
9
  /**
24
  */
25
  define('PMWI_PREFIX', 'pmwi_');
26
 
27
+ define('PMWI_FREE_VERSION', '1.1.5');
28
 
29
  define('PMWI_EDITION', 'free');
30
 
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Import Products from any XML or CSV to WooCommerce ===
2
  Contributors: soflyy
3
  Requires at least: 3.5
4
- Tested up to: 3.8.2
5
- Stable tag: 1.1.4
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
@@ -73,6 +73,10 @@ The WooCommerce add-on will appear in the Step 4 of WP All Import.
73
 
74
  == Changelog ==
75
 
 
 
 
 
76
  = 1.1.4 =
77
  * fixed automatic fixing of improperly formatted prices
78
  * fixed php notices
1
  === Import Products from any XML or CSV to WooCommerce ===
2
  Contributors: soflyy
3
  Requires at least: 3.5
4
+ Tested up to: 3.9.1
5
+ Stable tag: 1.1.5
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
73
 
74
  == Changelog ==
75
 
76
+ = 1.1.5 =
77
+ * fixed updating shipping class
78
+ = fixed updating tax class
79
+
80
  = 1.1.4 =
81
  * fixed automatic fixing of improperly formatted prices
82
  * fixed php notices