Version Description
- Fixed some warnings.
Download this release
Release Info
Developer | xadapter |
Plugin | Order Export & Order Import for WooCommerce |
Version | 1.2.4 |
Comparing to | |
See all releases |
Code changes from version 1.2.3 to 1.2.4
includes/exporter/class-wf-orderimpexpcsv-exporter.php
CHANGED
@@ -137,16 +137,30 @@ class WF_OrderImpExpCsv_Exporter {
|
|
137 |
$product = new WC_Product(0);
|
138 |
}
|
139 |
|
|
|
140 |
$item_meta = new WC_Order_Item_Meta((defined('WC_VERSION') >= 2.4) ? $item : $item['item_meta'] );
|
141 |
$meta = $item_meta->display(true, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
if ($meta) {
|
144 |
|
|
|
145 |
// remove newlines
|
146 |
$meta = str_replace(array("\r", "\r\n", "\n"), '', $meta);
|
147 |
-
|
|
|
148 |
// switch reserved chars (:;|) to =
|
149 |
$meta = str_replace(array(': ', ':', ';', '|'), '=', $meta);
|
|
|
150 |
}
|
151 |
|
152 |
$line_item = array(
|
137 |
$product = new WC_Product(0);
|
138 |
}
|
139 |
|
140 |
+
if(WC()->version < '3.1.0'){
|
141 |
$item_meta = new WC_Order_Item_Meta((defined('WC_VERSION') >= 2.4) ? $item : $item['item_meta'] );
|
142 |
$meta = $item_meta->display(true, true);
|
143 |
+
}else{
|
144 |
+
$arg = array(
|
145 |
+
'before' => '',
|
146 |
+
'after' => '',
|
147 |
+
'separator' => ',',
|
148 |
+
'echo' => false,
|
149 |
+
);
|
150 |
+
|
151 |
+
$meta = wc_display_item_meta( $item,$arg );
|
152 |
+
}
|
153 |
|
154 |
if ($meta) {
|
155 |
|
156 |
+
|
157 |
// remove newlines
|
158 |
$meta = str_replace(array("\r", "\r\n", "\n"), '', $meta);
|
159 |
+
$meta = str_replace(array('<strong class="wc-item-meta-label">', '</strong> <p>', "</p>"), '', $meta);
|
160 |
+
|
161 |
// switch reserved chars (:;|) to =
|
162 |
$meta = str_replace(array(': ', ':', ';', '|'), '=', $meta);
|
163 |
+
$meta = str_replace( 'meta=', '', $meta);
|
164 |
}
|
165 |
|
166 |
$line_item = array(
|
includes/importer/class-wf-csv-parser.php
CHANGED
@@ -168,7 +168,7 @@ class WF_CSV_Parser {
|
|
168 |
$row++;
|
169 |
|
170 |
if ( $row <= $record_offset ) {
|
171 |
-
$WF_CSV_Order_Import->
|
172 |
unset($item);
|
173 |
return;
|
174 |
}
|
@@ -180,7 +180,7 @@ class WF_CSV_Parser {
|
|
180 |
$order_number = ( ! empty( $item['order_number'] ) ) ? $item['order_number'] : null;
|
181 |
$order_number_formatted = ( ! empty( $item['order_number_formatted'] ) ) ? $item['order_number_formatted'] : $order_number;
|
182 |
|
183 |
-
$WF_CSV_Order_Import->
|
184 |
|
185 |
|
186 |
// validate the supplied formatted order number/order number
|
@@ -188,7 +188,7 @@ class WF_CSV_Parser {
|
|
188 |
|
189 |
if ( $order_number && ! is_numeric( $order_number ) ) {
|
190 |
|
191 |
-
$WF_CSV_Order_Import->
|
192 |
$skipped++;
|
193 |
unset($item);
|
194 |
return;
|
@@ -197,14 +197,14 @@ class WF_CSV_Parser {
|
|
197 |
|
198 |
if ( $order_number_formatted && ! $order_number ) {
|
199 |
|
200 |
-
$WF_CSV_Order_Import->
|
201 |
$skipped++;
|
202 |
unset($item);
|
203 |
return;
|
204 |
|
205 |
}
|
206 |
} else {
|
207 |
-
$order_number_formatted = $item['order_id'];
|
208 |
$order_number = ( ! empty( $item['order_number'] ) ? $item['order_number'] : ( is_numeric( $order_number_formatted ) ? $order_number_formatted : 0 ) );
|
209 |
}
|
210 |
|
@@ -229,7 +229,7 @@ class WF_CSV_Parser {
|
|
229 |
|
230 |
if ( $order_id ) {
|
231 |
// skip if order ID already exist.
|
232 |
-
$WF_CSV_Order_Import->
|
233 |
$skipped++;
|
234 |
unset($item);
|
235 |
return;
|
@@ -245,7 +245,7 @@ class WF_CSV_Parser {
|
|
245 |
|
246 |
if ( ! $found_customer ) {
|
247 |
|
248 |
-
$WF_CSV_Order_Import->
|
249 |
$skipped++;
|
250 |
unset($item);
|
251 |
return;;
|
@@ -286,7 +286,7 @@ class WF_CSV_Parser {
|
|
286 |
}
|
287 |
|
288 |
if ( ! $found_status ) {
|
289 |
-
$WF_CSV_Order_Import->
|
290 |
$skipped++;
|
291 |
unset($item);
|
292 |
return;
|
@@ -300,7 +300,7 @@ class WF_CSV_Parser {
|
|
300 |
if ( ! empty( $item['date'] ) ) {
|
301 |
if ( false === ( $item['date'] = strtotime( $item['date'] ) ) ) {
|
302 |
// invalid date format
|
303 |
-
$WF_CSV_Order_Import->
|
304 |
$skipped++;
|
305 |
unset($item);
|
306 |
return;
|
@@ -593,7 +593,7 @@ class WF_CSV_Parser {
|
|
593 |
|
594 |
if ( ! $allow_unknown_products && ! $product_id ) {
|
595 |
// unknown product
|
596 |
-
$WF_CSV_Order_Import->
|
597 |
$skipped++;
|
598 |
$i++;
|
599 |
continue; // break outer loop
|
@@ -628,7 +628,7 @@ class WF_CSV_Parser {
|
|
628 |
|
629 |
if ( ! $sku || ! $qty || ! is_numeric( $total ) ) {
|
630 |
// invalid item
|
631 |
-
$WF_CSV_Order_Import->
|
632 |
$skipped++;
|
633 |
unset($item);
|
634 |
return; // break outer loop
|
@@ -639,7 +639,7 @@ class WF_CSV_Parser {
|
|
639 |
|
640 |
if ( ! $product_id ) {
|
641 |
// unknown product
|
642 |
-
$WF_CSV_Order_Import->
|
643 |
$skipped++;
|
644 |
unset($item);
|
645 |
return; // break outer loop
|
168 |
$row++;
|
169 |
|
170 |
if ( $row <= $record_offset ) {
|
171 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> Row %s - skipped due to record offset.', 'wf_order_import_export' ), $row ) );
|
172 |
unset($item);
|
173 |
return;
|
174 |
}
|
180 |
$order_number = ( ! empty( $item['order_number'] ) ) ? $item['order_number'] : null;
|
181 |
$order_number_formatted = ( ! empty( $item['order_number_formatted'] ) ) ? $item['order_number_formatted'] : $order_number;
|
182 |
|
183 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> Row %s - preparing for import.', 'wf_order_import_export' ), $row ) );
|
184 |
|
185 |
|
186 |
// validate the supplied formatted order number/order number
|
188 |
|
189 |
if ( $order_number && ! is_numeric( $order_number ) ) {
|
190 |
|
191 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> > Skipped. Order number field must be an integer: %s.', 'wf_order_import_export' ), $order_number ) );
|
192 |
$skipped++;
|
193 |
unset($item);
|
194 |
return;
|
197 |
|
198 |
if ( $order_number_formatted && ! $order_number ) {
|
199 |
|
200 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', __( '> > Skipped. Formatted order number provided but no numerical order number, see the documentation for further details.', 'wf_order_import_export' ) );
|
201 |
$skipped++;
|
202 |
unset($item);
|
203 |
return;
|
204 |
|
205 |
}
|
206 |
} else {
|
207 |
+
$order_number_formatted = ! empty( $item['order_id']) ? $item['order_id'] : 0 ;
|
208 |
$order_number = ( ! empty( $item['order_number'] ) ? $item['order_number'] : ( is_numeric( $order_number_formatted ) ? $order_number_formatted : 0 ) );
|
209 |
}
|
210 |
|
229 |
|
230 |
if ( $order_id ) {
|
231 |
// skip if order ID already exist.
|
232 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> > Skipped. Order %s already exists.', 'wf_order_import_export' ), $order_number_formatted ) );
|
233 |
$skipped++;
|
234 |
unset($item);
|
235 |
return;
|
245 |
|
246 |
if ( ! $found_customer ) {
|
247 |
|
248 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> > Skipped. Cannot find customer with id %s.', 'wf_order_import_export' ), $item['customer_id'] ) );
|
249 |
$skipped++;
|
250 |
unset($item);
|
251 |
return;;
|
286 |
}
|
287 |
|
288 |
if ( ! $found_status ) {
|
289 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> > Skipped. Unknown order status %s (%s).', 'wf_order_import_export' ), $item['status'], implode( $available_statuses, ', ' ) ) );
|
290 |
$skipped++;
|
291 |
unset($item);
|
292 |
return;
|
300 |
if ( ! empty( $item['date'] ) ) {
|
301 |
if ( false === ( $item['date'] = strtotime( $item['date'] ) ) ) {
|
302 |
// invalid date format
|
303 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> > Skipped. Invalid date format %s.', 'wf_order_import_export' ), $item['date'] ) );
|
304 |
$skipped++;
|
305 |
unset($item);
|
306 |
return;
|
593 |
|
594 |
if ( ! $allow_unknown_products && ! $product_id ) {
|
595 |
// unknown product
|
596 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> > Skipped. Unknown order item: %s.', 'wf_order_import_export' ), $product_identifier ) );
|
597 |
$skipped++;
|
598 |
$i++;
|
599 |
continue; // break outer loop
|
628 |
|
629 |
if ( ! $sku || ! $qty || ! is_numeric( $total ) ) {
|
630 |
// invalid item
|
631 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> > Row %d - %s - skipped. Missing SKU, quantity or total', 'wf_order_import_export' ), $row, $item['order_id'] ) );
|
632 |
$skipped++;
|
633 |
unset($item);
|
634 |
return; // break outer loop
|
639 |
|
640 |
if ( ! $product_id ) {
|
641 |
// unknown product
|
642 |
+
$WF_CSV_Order_Import->hf_order_log_data_change('order-csv-import', sprintf( __( '> > Row %d - %s - skipped. Unknown order item: %s.', 'wf_order_import_export' ), $row, $item['order_id'], $sku ) );
|
643 |
$skipped++;
|
644 |
unset($item);
|
645 |
return; // break outer loop
|
includes/importer/class-wf-orderimpexpcsv-order-import.php
CHANGED
@@ -33,8 +33,12 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
33 |
*/
|
34 |
public function __construct() {
|
35 |
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
38 |
$this->file_url_import_enabled = apply_filters( 'woocommerce_csv_product_file_url_import_enabled', true );
|
39 |
}
|
40 |
|
@@ -271,7 +275,7 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
271 |
data: data,
|
272 |
type: 'POST',
|
273 |
success: function( response ) {
|
274 |
-
console.log( response );
|
275 |
$('#import-progress tbody').append( '<tr class="complete"><td colspan="5">' + response + '</td></tr>' );
|
276 |
$('.importer-loading').hide();
|
277 |
}
|
@@ -415,8 +419,8 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
415 |
global $woocommerce, $wpdb;
|
416 |
|
417 |
wp_suspend_cache_invalidation( true );
|
418 |
-
$this->
|
419 |
-
$this->
|
420 |
$merging = 1;
|
421 |
$record_offset = 0;
|
422 |
foreach ( $this->parsed_data as $key => &$item ) {
|
@@ -427,10 +431,10 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
427 |
$this->add_import_result( 'failed', $order->get_error_message(), 'Not parsed', json_encode( $item ), '-' );
|
428 |
|
429 |
unset( $item, $order );
|
430 |
-
|
431 |
}
|
432 |
-
|
433 |
-
$this->
|
434 |
wp_suspend_cache_invalidation( false );
|
435 |
}
|
436 |
|
@@ -444,14 +448,14 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
444 |
$memory = size_format( (WC()->version < '2.7.0')?woocommerce_let_to_num( ini_get( 'memory_limit' ) ):wc_let_to_num( ini_get( 'memory_limit' ) ) );
|
445 |
$wp_memory = size_format( (WC()->version < '2.7.0')? woocommerce_let_to_num( WP_MEMORY_LIMIT ) : wc_let_to_num( WP_MEMORY_LIMIT ) );
|
446 |
|
447 |
-
$this->
|
448 |
-
$this->
|
449 |
|
450 |
$this->parser = new WF_CSV_Parser( 'shop_order' );
|
451 |
|
452 |
list( $this->parsed_data, $this->raw_headers, $position ) = $this->parser->parse_data( $file, $this->delimiter, $start_pos, $end_pos );
|
453 |
|
454 |
-
$this->
|
455 |
|
456 |
unset( $import_data );
|
457 |
|
@@ -521,7 +525,7 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
521 |
global $wpdb;
|
522 |
$query = "SELECT ID FROM $wpdb->posts WHERE post_type = 'shop_order' AND post_status IN ( 'wc-pending', 'wc-processing', 'wc-completed', 'wc-on-hold', 'wc-failed' , 'wc-refunded', 'wc-cancelled')";
|
523 |
$args = array();
|
524 |
-
$posts_are_exist =
|
525 |
|
526 |
if ($posts_are_exist) {
|
527 |
foreach ($posts_are_exist as $exist_id) {
|
@@ -546,9 +550,10 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
546 |
|
547 |
// plan a dry run
|
548 |
//$dry_run = isset( $_POST['dry_run'] ) && $_POST['dry_run'] ? true : false;
|
|
|
549 |
|
550 |
-
$this->
|
551 |
-
$this->
|
552 |
|
553 |
// check class-wc-checkout.php for reference
|
554 |
|
@@ -575,7 +580,7 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
575 |
if (!$merging && $is_order_exist) {
|
576 |
$usr_msg = 'Order already exists.';
|
577 |
$this->add_import_result('skipped', __($usr_msg, 'wf_order_import_export'), $post['order_number'], $order_data['post_title'], $post['order_number']);
|
578 |
-
$this->
|
579 |
unset($post);
|
580 |
return;
|
581 |
}
|
@@ -590,7 +595,7 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
590 |
$this->errored++;
|
591 |
$new_added = false;
|
592 |
//$this->add_import_result('failed', __($order_id->get_error_message() , 'wf_order_import_export'), $post['order_number'], $order_data['post_title'], $post['order_number']);
|
593 |
-
$this->
|
594 |
}
|
595 |
|
596 |
}
|
@@ -651,13 +656,21 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
651 |
'order_item_name' => $product ? $product->get_title() : __( 'Unknown Product', 'wf_order_import_export' ),
|
652 |
'order_item_type' => 'line_item',
|
653 |
);
|
654 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
655 |
// standard order item meta
|
656 |
$_order_item_meta = array(
|
657 |
'_qty' => (int) $item['qty'],
|
658 |
'_tax_class' => '', // Tax class (adjusted by filters)
|
659 |
'_product_id' => $item['product_id'],
|
660 |
-
'_variation_id' => $
|
661 |
'_line_subtotal' => number_format( (float) $item['total'], 2, '.', '' ), // Line subtotal (before discounts)
|
662 |
'_line_subtotal_tax' => 0, // Line tax (before discounts)
|
663 |
'_line_total' => number_format( (float) $item['total'], 2, '.', '' ), // Line total (after discounts)
|
@@ -733,9 +746,12 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
733 |
}
|
734 |
|
735 |
// record the product sales
|
736 |
-
|
737 |
-
|
738 |
-
|
|
|
|
|
|
|
739 |
|
740 |
// was an original order number provided?
|
741 |
if ( ! empty( $post['order_number_formatted'] ) ) {
|
@@ -756,13 +772,14 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
756 |
$out_msg = 'Order Imported Successfully.';
|
757 |
|
758 |
$this->add_import_result('imported', __($out_msg, 'wf_order_import_export'), $order_id, $order_data['post_title'], $order_id);
|
759 |
-
$this->
|
760 |
$this->imported++;
|
761 |
-
$this->
|
762 |
|
763 |
// }
|
764 |
|
765 |
-
|
|
|
766 |
|
767 |
unset( $post );
|
768 |
}
|
@@ -819,4 +836,17 @@ class WF_OrderImpExpCsv_Order_Import extends WP_Importer {
|
|
819 |
public function bump_request_timeout( $val ) {
|
820 |
return 60;
|
821 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
822 |
}
|
33 |
*/
|
34 |
public function __construct() {
|
35 |
|
36 |
+
if (WC()->version < '2.7.0') {
|
37 |
+
$this->log = new WC_Logger();
|
38 |
+
} else {
|
39 |
+
$this->log = wc_get_logger();
|
40 |
+
}
|
41 |
+
$this->import_page = 'woocommerce_wf_order_csv';
|
42 |
$this->file_url_import_enabled = apply_filters( 'woocommerce_csv_product_file_url_import_enabled', true );
|
43 |
}
|
44 |
|
275 |
data: data,
|
276 |
type: 'POST',
|
277 |
success: function( response ) {
|
278 |
+
//console.log( response );
|
279 |
$('#import-progress tbody').append( '<tr class="complete"><td colspan="5">' + response + '</td></tr>' );
|
280 |
$('.importer-loading').hide();
|
281 |
}
|
419 |
global $woocommerce, $wpdb;
|
420 |
|
421 |
wp_suspend_cache_invalidation( true );
|
422 |
+
$this->hf_order_log_data_change('order-csv-import', '---' );
|
423 |
+
$this->hf_order_log_data_change('order-csv-import', __( 'Processing orders.', 'wf_order_import_export' ) );
|
424 |
$merging = 1;
|
425 |
$record_offset = 0;
|
426 |
foreach ( $this->parsed_data as $key => &$item ) {
|
431 |
$this->add_import_result( 'failed', $order->get_error_message(), 'Not parsed', json_encode( $item ), '-' );
|
432 |
|
433 |
unset( $item, $order );
|
434 |
+
|
435 |
}
|
436 |
+
|
437 |
+
$this->hf_order_log_data_change('order-csv-import', __( 'Finished processing Orders.', 'wf_order_import_export' ) );
|
438 |
wp_suspend_cache_invalidation( false );
|
439 |
}
|
440 |
|
448 |
$memory = size_format( (WC()->version < '2.7.0')?woocommerce_let_to_num( ini_get( 'memory_limit' ) ):wc_let_to_num( ini_get( 'memory_limit' ) ) );
|
449 |
$wp_memory = size_format( (WC()->version < '2.7.0')? woocommerce_let_to_num( WP_MEMORY_LIMIT ) : wc_let_to_num( WP_MEMORY_LIMIT ) );
|
450 |
|
451 |
+
$this->hf_order_log_data_change('order-csv-import', '---[ New Import ] PHP Memory: ' . $memory . ', WP Memory: ' . $wp_memory );
|
452 |
+
$this->hf_order_log_data_change('order-csv-import', __( 'Parsing products CSV.', 'wf_order_import_export' ) );
|
453 |
|
454 |
$this->parser = new WF_CSV_Parser( 'shop_order' );
|
455 |
|
456 |
list( $this->parsed_data, $this->raw_headers, $position ) = $this->parser->parse_data( $file, $this->delimiter, $start_pos, $end_pos );
|
457 |
|
458 |
+
$this->hf_order_log_data_change('order-csv-import', __( 'Finished parsing products CSV.', 'wf_order_import_export' ) );
|
459 |
|
460 |
unset( $import_data );
|
461 |
|
525 |
global $wpdb;
|
526 |
$query = "SELECT ID FROM $wpdb->posts WHERE post_type = 'shop_order' AND post_status IN ( 'wc-pending', 'wc-processing', 'wc-completed', 'wc-on-hold', 'wc-failed' , 'wc-refunded', 'wc-cancelled')";
|
527 |
$args = array();
|
528 |
+
$posts_are_exist = @$wpdb->get_col($wpdb->prepare($query, $args));
|
529 |
|
530 |
if ($posts_are_exist) {
|
531 |
foreach ($posts_are_exist as $exist_id) {
|
550 |
|
551 |
// plan a dry run
|
552 |
//$dry_run = isset( $_POST['dry_run'] ) && $_POST['dry_run'] ? true : false;
|
553 |
+
$dry_run = FALSE;
|
554 |
|
555 |
+
$this->hf_order_log_data_change('order-csv-import', '---' );
|
556 |
+
$this->hf_order_log_data_change('order-csv-import', __( 'Processing orders.', 'wf_order_import_export' ) );
|
557 |
|
558 |
// check class-wc-checkout.php for reference
|
559 |
|
580 |
if (!$merging && $is_order_exist) {
|
581 |
$usr_msg = 'Order already exists.';
|
582 |
$this->add_import_result('skipped', __($usr_msg, 'wf_order_import_export'), $post['order_number'], $order_data['post_title'], $post['order_number']);
|
583 |
+
$this->hf_order_log_data_change('order-csv-import', sprintf(__('> “%s”' . $usr_msg, 'wf_order_import_export'), esc_html($order_data['post_title'])), true);
|
584 |
unset($post);
|
585 |
return;
|
586 |
}
|
595 |
$this->errored++;
|
596 |
$new_added = false;
|
597 |
//$this->add_import_result('failed', __($order_id->get_error_message() , 'wf_order_import_export'), $post['order_number'], $order_data['post_title'], $post['order_number']);
|
598 |
+
$this->hf_order_log_data_change('order-csv-import', sprintf( __( '> Error inserting %s: %s', 'wf_order_import_export'), $post['order_number'], $order_id->get_error_message() ), true );
|
599 |
}
|
600 |
|
601 |
}
|
656 |
'order_item_name' => $product ? $product->get_title() : __( 'Unknown Product', 'wf_order_import_export' ),
|
657 |
'order_item_type' => 'line_item',
|
658 |
);
|
659 |
+
|
660 |
+
$var_id = 0;
|
661 |
+
if($product){
|
662 |
+
if (WC()->version < '2.7.0' && method_exists( $product,'get_variation_id' )) {
|
663 |
+
$var_id = $product->get_variation_id();
|
664 |
+
}else{
|
665 |
+
$var_id = $product->get_id();
|
666 |
+
}
|
667 |
+
}
|
668 |
// standard order item meta
|
669 |
$_order_item_meta = array(
|
670 |
'_qty' => (int) $item['qty'],
|
671 |
'_tax_class' => '', // Tax class (adjusted by filters)
|
672 |
'_product_id' => $item['product_id'],
|
673 |
+
'_variation_id' => $var_id,
|
674 |
'_line_subtotal' => number_format( (float) $item['total'], 2, '.', '' ), // Line subtotal (before discounts)
|
675 |
'_line_subtotal_tax' => 0, // Line tax (before discounts)
|
676 |
'_line_total' => number_format( (float) $item['total'], 2, '.', '' ), // Line total (after discounts)
|
746 |
}
|
747 |
|
748 |
// record the product sales
|
749 |
+
if (WC()->version < '2.7.0') {
|
750 |
+
$order->record_product_sales();
|
751 |
+
} else {
|
752 |
+
wc_update_total_sales_counts($order_id);
|
753 |
+
}
|
754 |
+
} // ! dry run
|
755 |
|
756 |
// was an original order number provided?
|
757 |
if ( ! empty( $post['order_number_formatted'] ) ) {
|
772 |
$out_msg = 'Order Imported Successfully.';
|
773 |
|
774 |
$this->add_import_result('imported', __($out_msg, 'wf_order_import_export'), $order_id, $order_data['post_title'], $order_id);
|
775 |
+
$this->hf_order_log_data_change('order-csv-import', sprintf(__('> “%s”' . $out_msg, 'wf_order_import_export'), esc_html($order_data['post_title'])), true);
|
776 |
$this->imported++;
|
777 |
+
$this->hf_order_log_data_change( 'order-csv-import', sprintf( __( '> Finished importing order %s', 'wf_order_import_export' ), $dry_run ? "" : $order->get_order_number() ) );
|
778 |
|
779 |
// }
|
780 |
|
781 |
+
|
782 |
+
$this->hf_order_log_data_change( 'order-csv-import', __( 'Finished processing orders.', 'wf_order_import_export' ) );
|
783 |
|
784 |
unset( $post );
|
785 |
}
|
836 |
public function bump_request_timeout( $val ) {
|
837 |
return 60;
|
838 |
}
|
839 |
+
|
840 |
+
|
841 |
+
public function hf_order_log_data_change ($content = 'order-csv-import',$data='')
|
842 |
+
{
|
843 |
+
if (WC()->version < '2.7.0')
|
844 |
+
{
|
845 |
+
$this->log->add($content,$data);
|
846 |
+
}else
|
847 |
+
{
|
848 |
+
$context = array( 'source' => $content );
|
849 |
+
$this->log->log("debug", $data ,$context);
|
850 |
+
}
|
851 |
+
}
|
852 |
}
|
order-import-export.php
CHANGED
@@ -6,7 +6,7 @@ Plugin URI: https://www.xadapter.com/product/order-import-export-plugin-for-wooc
|
|
6 |
Description: Export and Import Order detail including line items, From and To your WooCommerce Store.
|
7 |
Author: XAdapter
|
8 |
Author URI: https://www.xadapter.com/
|
9 |
-
Version: 1.2.
|
10 |
Text Domain: wf_order_import_export
|
11 |
*/
|
12 |
|
6 |
Description: Export and Import Order detail including line items, From and To your WooCommerce Store.
|
7 |
Author: XAdapter
|
8 |
Author URI: https://www.xadapter.com/
|
9 |
+
Version: 1.2.4
|
10 |
Text Domain: wf_order_import_export
|
11 |
*/
|
12 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: order, coupon, subscription, export, import, woocommerce
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.8
|
7 |
-
Stable tag: 1.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -75,6 +75,8 @@ Yes. You can import or export order line item details.
|
|
75 |
3. Exported sample order Screen
|
76 |
|
77 |
== Changelog ==
|
|
|
|
|
78 |
= 1.2.3 =
|
79 |
* Minor Content Change.
|
80 |
= 1.2.2 =
|
@@ -126,6 +128,8 @@ Yes. You can import or export order line item details.
|
|
126 |
* Export /Import WooCommerce Orders.
|
127 |
|
128 |
== Upgrade Notice ==
|
|
|
|
|
129 |
= 1.2.3 =
|
130 |
* Minor Content Change.
|
131 |
= 1.2.2 =
|
4 |
Tags: order, coupon, subscription, export, import, woocommerce
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.8
|
7 |
+
Stable tag: 1.2.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
75 |
3. Exported sample order Screen
|
76 |
|
77 |
== Changelog ==
|
78 |
+
= 1.2.4 =
|
79 |
+
* Fixed some warnings.
|
80 |
= 1.2.3 =
|
81 |
* Minor Content Change.
|
82 |
= 1.2.2 =
|
128 |
* Export /Import WooCommerce Orders.
|
129 |
|
130 |
== Upgrade Notice ==
|
131 |
+
= 1.2.4 =
|
132 |
+
* Fixed some warnings.
|
133 |
= 1.2.3 =
|
134 |
* Minor Content Change.
|
135 |
= 1.2.2 =
|