Order Export & Order Import for WooCommerce - Version 1.3.4

Version Description

  • WC 3.4.4 Tested OK.
  • Bug fix.
  • Readme content change.
Download this release

Release Info

Developer webtoffee
Plugin Icon 128x128 Order Export & Order Import for WooCommerce
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

images/storefrog.png ADDED
Binary file
includes/exporter/class-wf-orderimpexpcsv-exporter.php CHANGED
@@ -232,7 +232,7 @@ class WF_OrderImpExpCsv_Exporter {
232
  $order_data = array(
233
  'order_id' => $order->id,
234
  'order_number' => $order->get_order_number(),
235
- 'order_date' => $order->order_date,
236
  'status' => $order->get_status(),
237
  'shipping_total' => $order->get_total_shipping(),
238
  'shipping_tax_total' => wc_format_decimal($order->get_shipping_tax(), 2),
@@ -283,7 +283,7 @@ class WF_OrderImpExpCsv_Exporter {
283
  $order_data = array(
284
  'order_id' => $order->get_id(),
285
  'order_number' => $order->get_order_number(),
286
- 'order_date' => date('Y-m-d H:i:s' , strtotime($order->get_date_created())),
287
  'status' => $order->get_status(),
288
  'shipping_total' => $order->get_total_shipping(),
289
  'shipping_tax_total' => wc_format_decimal($order->get_shipping_tax(), 2),
232
  $order_data = array(
233
  'order_id' => $order->id,
234
  'order_number' => $order->get_order_number(),
235
+ 'order_date' => date('Y-m-d H:i:s', strtotime(get_post($order->id)->post_date)),
236
  'status' => $order->get_status(),
237
  'shipping_total' => $order->get_total_shipping(),
238
  'shipping_tax_total' => wc_format_decimal($order->get_shipping_tax(), 2),
283
  $order_data = array(
284
  'order_id' => $order->get_id(),
285
  'order_number' => $order->get_order_number(),
286
+ 'order_date' => date('Y-m-d H:i:s', strtotime(get_post($order->get_id())->post_date)),
287
  'status' => $order->get_status(),
288
  'shipping_total' => $order->get_total_shipping(),
289
  'shipping_tax_total' => wc_format_decimal($order->get_shipping_tax(), 2),
includes/importer/class-wf-cpnimpexpcsv-coupon-import.php CHANGED
@@ -555,6 +555,7 @@ class WF_CpnImpExpCsv_Coupon_Import extends WP_Importer {
555
  * @param string $file Path to the CSV file for importing
556
  */
557
  public function import_start( $file, $mapping, $start_pos, $end_pos, $eval_field ) {
 
558
 
559
  $memory = size_format( (WC()->version < '2.7.0')?woocommerce_let_to_num( ini_get( 'memory_limit' ) ):wc_let_to_num( ini_get( 'memory_limit' ) ) );
560
  $wp_memory = size_format( (WC()->version < '2.7.0')? woocommerce_let_to_num( WP_MEMORY_LIMIT ) : wc_let_to_num( WP_MEMORY_LIMIT ) );
@@ -563,7 +564,6 @@ class WF_CpnImpExpCsv_Coupon_Import extends WP_Importer {
563
  $this->hf_coupon_log_data_change( 'coupon-csv-import', __( 'Parsing coupons CSV.', 'wf_order_import_export' ) );
564
 
565
  $this->parser = new WF_CSV_Parser_Coupon( 'shop_coupon' );
566
-
567
  list( $this->parsed_data, $this->raw_headers, $position ) = $this->parser->parse_data( $file, $this->delimiter, $mapping, $start_pos, $end_pos, $eval_field );
568
  $this->hf_coupon_log_data_change( 'coupon-csv-import', __( 'Finished parsing coupons CSV.', 'wf_order_import_export' ) );
569
 
@@ -658,214 +658,187 @@ class WF_CpnImpExpCsv_Coupon_Import extends WP_Importer {
658
  /**
659
  * Create new posts based on import information
660
  */
661
- public function process_coupon( $post )
662
- {
663
-
664
- $processing_coupon_id = absint( $post['post_id'] );
665
- $processing_coupon = get_post( $processing_coupon_id );
666
- $processing_coupon_title = $processing_coupon ? $processing_coupon->post_title : '';
667
- $processing_coupon_sku = $processing_coupon ? $processing_coupon->sku : '';
668
- $merging = ! empty( $post['merging'] );
669
-
670
- if ( ! empty( $post['post_title'] ) ) {
671
- $processing_coupon_title = $post['post_title'];
672
- }
673
- $post['post_type'] = 'shop_coupon';
674
-
675
 
676
- if ( ! empty( $processing_coupon_id ) && isset( $this->processed_posts[ $processing_coupon_id ] ) )
677
- {
678
- $this->add_import_result( 'skipped', __( 'Coupon already processed', 'wf_order_import_export' ), $processing_coupon_id, $processing_coupon_title );
679
- $this->hf_coupon_log_data_change( 'coupon-csv-import', __('> Coupon ID already processed. Skipping.', 'wf_order_import_export'), true );
680
- unset( $post );
681
- return;
682
- }
683
 
684
- if ( ! empty ( $post['post_status'] ) && $post['post_status'] == 'auto-draft' )
685
- {
686
- $this->add_import_result( 'skipped', __( 'Skipping auto-draft', 'wf_order_import_export' ), $processing_coupon_id, $processing_coupon_title);
687
- $this->hf_coupon_log_data_change( 'coupon-csv-import', __('> Skipping auto-draft.', 'wf_order_import_export'), true );
688
- unset( $post );
689
- return;
690
- }
691
- if ( ! $merging )
692
- {
693
- if ( $this->coupon_exists( $processing_coupon_title, $processing_coupon_id, $post['post_name'] ) )
694
- {
695
- if(!$processing_coupon_id)
696
- {
 
 
 
697
  $usr_msg = 'Coupon with same title already exists.';
698
- }else{
699
- $usr_msg = 'Coupon already exists.';
700
  }
701
- $this->add_import_result( 'skipped', __( $usr_msg, 'wf_order_import_export' ), $processing_coupon_id, $processing_coupon_title );
702
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __('> &#8220;%s&#8221;'.$usr_msg, 'wf_order_import_export'), esc_html($processing_coupon_title) ), true );
703
- unset( $post );
704
- return;
705
- }
706
-
707
- if ( $processing_coupon_id && is_string( get_post_status( $processing_coupon_id ) ) )
708
- {
709
- $this->add_import_result( 'skipped', __( 'Importing coupon ID conflicts with an existing coupon ID', 'wf_order_import_export' ), $processing_coupon_id, get_the_title( $processing_coupon_id ) );
710
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __('> &#8220;%s&#8221; ID already exists.', 'wf_order_import_export'), esc_html( $processing_coupon_id ) ), true );
711
- unset( $post );
712
- return;
713
- }
714
- }
715
- $is_post_exist_in_db = get_post_type( $processing_coupon_id );
716
-
717
- if ( $merging && $processing_coupon_id && !empty($is_post_exist_in_db) && (get_post_type( $processing_coupon_id ) !== $post['post_type'] ))
718
- {
719
- $this->add_import_result( 'skipped', __( 'Post is not a coupon', 'wf_order_import_export' ), $processing_coupon_id, $processing_coupon_title );
720
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __('> &#8220;%s&#8221; is not a coupon.', 'wf_order_import_export'), esc_html($processing_coupon_id) ), true );
721
-
722
- unset( $post );
723
- return;
724
- }
725
-
726
- if ( $merging && !empty($is_post_exist_in_db) )
727
- {
728
- $post_id = $processing_coupon_id;
729
-
730
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __('> Merging coupon ID %s.', 'wf_order_import_export'), $post_id ), true );
731
-
732
- $postdata = array(
733
- 'ID' => $post_id
734
- );
735
-
736
- if ( $this->merge_empty_cells )
737
- {
738
- if ( isset( $post['post_content'] ) ) {
739
- $postdata['post_content'] = $post['post_content'];
740
- }
741
- if ( isset( $post['post_excerpt'] ) ) {
742
- $postdata['post_excerpt'] = $post['post_excerpt'];
743
- }
744
-
745
- } else {
746
- if ( ! empty( $post['post_content'] ) ) {
747
- $postdata['post_content'] = $post['post_content'];
748
- }
749
- if ( ! empty( $post['post_excerpt'] ) ) {
750
- $postdata['post_excerpt'] = $post['post_excerpt'];
751
- }
752
-
753
- }
754
-
755
- if ( ! empty( $post['post_title'] ) ) {
756
- $postdata['post_title'] = $post['post_title'];
757
- }
758
-
759
- if ( ! empty( $post['post_author'] ) ) {
760
- $postdata['post_author'] = absint( $post['post_author'] );
761
- }
762
- if ( ! empty( $post['post_date'] ) ) {
763
- $postdata['post_date'] = date("Y-m-d H:i:s", strtotime( $post['post_date'] ) );
764
- }
765
- if ( ! empty( $post['post_date_gmt'] ) ) {
766
- $postdata['post_date_gmt'] = date("Y-m-d H:i:s", strtotime( $post['post_date_gmt'] ) );
767
- }
768
- if ( ! empty( $post['post_name'] ) ) {
769
- $postdata['post_name'] = $post['post_name'];
770
- }
771
- if ( ! empty( $post['post_status'] ) ) {
772
- $postdata['post_status'] = $post['post_status'];
773
- }
774
-
775
- if ( sizeof( $postdata ) > 1 )
776
- {
777
- $result = wp_update_post( $postdata );
778
 
779
- if ( ! $result )
780
- {
781
- $this->add_import_result( 'failed', __( 'Failed to update coupon', 'wf_order_import_export' ), $post_id, $processing_coupon_title );
782
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __('> Failed to update coupon %s', 'wf_order_import_export'), $post_id ), true );
783
- unset( $post );
784
- return;
785
- } else {
786
- $this->hf_coupon_log_data_change( 'coupon-csv-import', __( '> Merged post data: ', 'wf_order_import_export' ) . print_r( $postdata, true ) );
787
- }
788
- }
789
 
790
- } else
791
- {
792
- $merging = FALSE;
793
-
794
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __('> Inserting %s', 'wf_order_import_export'), esc_html( $processing_coupon_title ) ), true );
795
- $postdata = array(
796
- 'post_author' => $post['post_author'] ? absint( $post['post_author'] ) : get_current_user_id(),
797
- 'post_date' => ( $post['post_date'] ) ? date( 'Y-m-d H:i:s', strtotime( $post['post_date'] )) : '',
798
- 'post_date_gmt' => ( $post['post_date_gmt'] ) ? date( 'Y-m-d H:i:s', strtotime( $post['post_date_gmt'] )) : '',
799
- 'post_content' => $post['post_excerpt'],
800
- 'post_excerpt' => $post['post_excerpt'],
801
- 'post_title' => $post['post_title'],
802
- 'post_name' => ( $post['post_name'] ) ? $post['post_name'] : sanitize_title( $post['post_title'] ),
803
- 'post_status' => ( $post['post_status'] ) ? $post['post_status'] : 'publish',
804
- 'post_type' => 'shop_coupon',
805
- );
806
-
807
- $post_id = wp_insert_post( $postdata, true );
808
-
809
- if ( is_wp_error( $post_id ) )
810
- {
811
 
812
- $this->add_import_result( 'failed', __( 'Failed to import coupon', 'wf_order_import_export' ), $processing_coupon_id, $processing_coupon_title );
813
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __( 'Failed to import coupon &#8220;%s&#8221;', 'wf_order_import_export' ), esc_html($processing_coupon_title) ) );
814
- unset( $post );
815
- return;
816
 
817
- } else {
 
818
 
819
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __('> Inserted - coupon ID is %s.', 'wf_order_import_export'), $post_id ) );
820
 
821
- }
822
- }
 
823
 
824
- unset( $postdata );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
825
 
826
- if ( empty( $processing_coupon_id ) ) {
827
- $processing_coupon_id = (int) $post_id;
828
- }
829
 
830
- $this->processed_posts[ intval( $processing_coupon_id ) ] = (int) $post_id;
831
- if ( ! empty( $post['postmeta'] ) && is_array( $post['postmeta'] ) )
832
- {
833
- foreach ( $post['postmeta'] as $meta )
834
- {
835
- $key = apply_filters( 'import_post_meta_key', $meta['key'] );
836
 
837
- if ( $key )
838
- {
839
- if($key == 'product_categories' || $key == 'exclude_product_categories')
840
- {
841
- update_post_meta( $post_id, $key, explode(",",$meta['value'] ) );
842
- }
843
- else
844
- {
845
- if($key == 'customer_email'){
846
- $data= explode(',', $meta['value']);
847
- update_post_meta( $post_id, $key,( $data ) );
848
- }else{
849
- update_post_meta( $post_id, $key, maybe_unserialize( $meta['value'] ) );
850
- }
851
- }
852
-
853
- }
854
- }
855
- unset( $post['postmeta'] );
856
- }
857
- if ( $merging )
858
- {
859
- $this->add_import_result( 'merged', 'Coupon Merge successful', $post_id, $processing_coupon_title );
860
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __('> Finished merging post ID %s.', 'wf_order_import_export'), $post_id ) );
861
- } else {
862
- $this->add_import_result( 'imported', 'Coupon Import successful', $post_id, $processing_coupon_title );
863
- $this->hf_coupon_log_data_change( 'coupon-csv-import', sprintf( __('> Finished importing post ID %s.', 'wf_order_import_export'), $post_id ) );
864
- }
865
- unset( $post );
866
- }
867
 
868
- /**
869
  * Log a row's import status
870
  */
871
  protected function add_import_result( $status, $reason, $post_id = '', $post_title = '' ) {
555
  * @param string $file Path to the CSV file for importing
556
  */
557
  public function import_start( $file, $mapping, $start_pos, $end_pos, $eval_field ) {
558
+
559
 
560
  $memory = size_format( (WC()->version < '2.7.0')?woocommerce_let_to_num( ini_get( 'memory_limit' ) ):wc_let_to_num( ini_get( 'memory_limit' ) ) );
561
  $wp_memory = size_format( (WC()->version < '2.7.0')? woocommerce_let_to_num( WP_MEMORY_LIMIT ) : wc_let_to_num( WP_MEMORY_LIMIT ) );
564
  $this->hf_coupon_log_data_change( 'coupon-csv-import', __( 'Parsing coupons CSV.', 'wf_order_import_export' ) );
565
 
566
  $this->parser = new WF_CSV_Parser_Coupon( 'shop_coupon' );
 
567
  list( $this->parsed_data, $this->raw_headers, $position ) = $this->parser->parse_data( $file, $this->delimiter, $mapping, $start_pos, $end_pos, $eval_field );
568
  $this->hf_coupon_log_data_change( 'coupon-csv-import', __( 'Finished parsing coupons CSV.', 'wf_order_import_export' ) );
569
 
658
  /**
659
  * Create new posts based on import information
660
  */
661
+ public function process_coupon($post) {
662
+ $processing_coupon_id = absint($post['post_id']);
663
+ $processing_coupon = get_post($processing_coupon_id);
664
+ $processing_coupon_title = $processing_coupon ? $processing_coupon->post_title : '';
665
+ $processing_coupon_sku = $processing_coupon ? $processing_coupon->sku : '';
666
+ $merging = !empty($post['merging']);
667
+
668
+ if (!empty($post['post_title'])) {
669
+ $processing_coupon_title = $post['post_title'];
670
+ }
671
+ $post['post_type'] = 'shop_coupon';
 
 
 
672
 
 
 
 
 
 
 
 
673
 
674
+ if (!empty($processing_coupon_id) && isset($this->processed_posts[$processing_coupon_id])) {
675
+ $this->add_import_result('skipped', __('Coupon already processed', 'wf_order_import_export'), $processing_coupon_id, $processing_coupon_title);
676
+ $this->hf_coupon_log_data_change('coupon-csv-import', __('> Coupon ID already processed. Skipping.', 'wf_order_import_export'), true);
677
+ unset($post);
678
+ return;
679
+ }
680
+
681
+ if (!empty($post['post_status']) && $post['post_status'] == 'auto-draft') {
682
+ $this->add_import_result('skipped', __('Skipping auto-draft', 'wf_order_import_export'), $processing_coupon_id, $processing_coupon_title);
683
+ $this->hf_coupon_log_data_change('coupon-csv-import', __('> Skipping auto-draft.', 'wf_order_import_export'), true);
684
+ unset($post);
685
+ return;
686
+ }
687
+ if (!$merging) {
688
+ if ($this->coupon_exists($processing_coupon_title, $processing_coupon_id, $post['post_name'])) {
689
+ if (!$processing_coupon_id) {
690
  $usr_msg = 'Coupon with same title already exists.';
691
+ } else {
692
+ $usr_msg = 'Coupon already exists.';
693
  }
694
+ $this->add_import_result('skipped', __($usr_msg, 'wf_order_import_export'), $processing_coupon_id, $processing_coupon_title);
695
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> &#8220;%s&#8221;' . $usr_msg, 'wf_order_import_export'), esc_html($processing_coupon_title)), true);
696
+ unset($post);
697
+ return;
698
+ }
699
+
700
+ if ($processing_coupon_id && is_string(get_post_status($processing_coupon_id))) {
701
+ $this->add_import_result('skipped', __('Importing coupon ID conflicts with an existing coupon ID', 'wf_order_import_export'), $processing_coupon_id, get_the_title($processing_coupon_id));
702
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> &#8220;%s&#8221; ID already exists.', 'wf_order_import_export'), esc_html($processing_coupon_id)), true);
703
+ unset($post);
704
+ return;
705
+ }
706
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
707
 
708
+ $is_post_exist_in_db = get_post_type($processing_coupon_id);
 
 
 
 
 
 
 
 
 
709
 
710
+ if ($merging && $processing_coupon_id && !empty($is_post_exist_in_db) && (get_post_type($processing_coupon_id) !== $post['post_type'] )) {
711
+ $this->add_import_result('skipped', __('Post is not a coupon', 'wf_order_import_export'), $processing_coupon_id, $processing_coupon_title);
712
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> &#8220;%s&#8221; is not a coupon.', 'wf_order_import_export'), esc_html($processing_coupon_id)), true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
713
 
714
+ unset($post);
715
+ return;
716
+ }
 
717
 
718
+ if ($merging && !empty($is_post_exist_in_db)) {
719
+ $post_id = $processing_coupon_id;
720
 
721
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Merging coupon ID %s.', 'wf_order_import_export'), $post_id), true);
722
 
723
+ $postdata = array(
724
+ 'ID' => $post_id
725
+ );
726
 
727
+ if ($this->merge_empty_cells) {
728
+ if (isset($post['post_content'])) {
729
+ $postdata['post_content'] = $post['post_content'];
730
+ }
731
+ if (isset($post['post_excerpt'])) {
732
+ $postdata['post_excerpt'] = $post['post_excerpt'];
733
+ }
734
+ } else {
735
+ if (!empty($post['post_content'])) {
736
+ $postdata['post_content'] = $post['post_content'];
737
+ }
738
+ if (!empty($post['post_excerpt'])) {
739
+ $postdata['post_excerpt'] = $post['post_excerpt'];
740
+ }
741
+ }
742
+
743
+ if (!empty($post['post_title'])) {
744
+ $postdata['post_title'] = $post['post_title'];
745
+ }
746
+
747
+ if (!empty($post['post_author'])) {
748
+ $postdata['post_author'] = absint($post['post_author']);
749
+ }
750
+ if (!empty($post['post_date'])) {
751
+ $postdata['post_date'] = date("Y-m-d H:i:s", strtotime($post['post_date']));
752
+ }
753
+ if (!empty($post['post_date_gmt'])) {
754
+ $postdata['post_date_gmt'] = date("Y-m-d H:i:s", strtotime($post['post_date_gmt']));
755
+ }
756
+ if (!empty($post['post_name'])) {
757
+ $postdata['post_name'] = $post['post_name'];
758
+ }
759
+ if (!empty($post['post_status'])) {
760
+ $postdata['post_status'] = $post['post_status'];
761
+ }
762
+
763
+ if (sizeof($postdata) > 1) {
764
+ $result = wp_update_post($postdata);
765
+
766
+ if (!$result) {
767
+ $this->add_import_result('failed', __('Failed to update coupon', 'wf_order_import_export'), $post_id, $processing_coupon_title);
768
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Failed to update coupon %s', 'wf_order_import_export'), $post_id), true);
769
+ unset($post);
770
+ return;
771
+ } else {
772
+ $this->hf_coupon_log_data_change('coupon-csv-import', __('> Merged post data: ', 'wf_order_import_export') . print_r($postdata, true));
773
+ }
774
+ }
775
+ } else {
776
+ $merging = FALSE;
777
+
778
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Inserting %s', 'wf_order_import_export'), esc_html($processing_coupon_title)), true);
779
+ $postdata = array(
780
+ 'post_author' => $post['post_author'] ? absint($post['post_author']) : get_current_user_id(),
781
+ 'post_date' => ( $post['post_date'] ) ? date('Y-m-d H:i:s', strtotime($post['post_date'])) : '',
782
+ 'post_date_gmt' => ( $post['post_date_gmt'] ) ? date('Y-m-d H:i:s', strtotime($post['post_date_gmt'])) : '',
783
+ 'post_content' => $post['post_excerpt'],
784
+ 'post_excerpt' => $post['post_excerpt'],
785
+ 'post_title' => $post['post_title'],
786
+ 'post_name' => ( $post['post_name'] ) ? $post['post_name'] : sanitize_title($post['post_title']),
787
+ 'post_status' => ( $post['post_status'] ) ? $post['post_status'] : 'publish',
788
+ 'post_type' => 'shop_coupon',
789
+ );
790
+
791
+ $post_id = wp_insert_post($postdata, true);
792
+
793
+ if (is_wp_error($post_id)) {
794
+
795
+ $this->add_import_result('failed', __('Failed to import coupon', 'wf_order_import_export'), $processing_coupon_id, $processing_coupon_title);
796
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('Failed to import coupon &#8220;%s&#8221;', 'wf_order_import_export'), esc_html($processing_coupon_title)));
797
+ unset($post);
798
+ return;
799
+ } else {
800
+
801
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Inserted - coupon ID is %s.', 'wf_order_import_export'), $post_id));
802
+ }
803
+ }
804
 
805
+ unset($postdata);
 
 
806
 
807
+ if (empty($processing_coupon_id)) {
808
+ $processing_coupon_id = (int) $post_id;
809
+ }
 
 
 
810
 
811
+ $this->processed_posts[intval($processing_coupon_id)] = (int) $post_id;
812
+ if (!empty($post['postmeta']) && is_array($post['postmeta'])) {
813
+ foreach ($post['postmeta'] as $meta) {
814
+ $key = apply_filters('import_post_meta_key', $meta['key']);
815
+
816
+ if ($key) {
817
+ if ($key == 'product_categories' || $key == 'exclude_product_categories') {
818
+ update_post_meta($post_id, $key, explode(",", $meta['value']));
819
+ } else {
820
+ if ($key == 'customer_email') {
821
+ $data = explode(',', $meta['value']);
822
+ update_post_meta($post_id, $key, ( $data));
823
+ } else {
824
+ update_post_meta($post_id, $key, maybe_unserialize($meta['value']));
825
+ }
826
+ }
827
+ }
828
+ }
829
+ unset($post['postmeta']);
830
+ }
831
+ if ($merging) {
832
+ $this->add_import_result('merged', 'Coupon Merge successful', $post_id, $processing_coupon_title);
833
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Finished merging post ID %s.', 'wf_order_import_export'), $post_id));
834
+ } else {
835
+ $this->add_import_result('imported', 'Coupon Import successful', $post_id, $processing_coupon_title);
836
+ $this->hf_coupon_log_data_change('coupon-csv-import', sprintf(__('> Finished importing post ID %s.', 'wf_order_import_export'), $post_id));
837
+ }
838
+ unset($post);
839
+ }
 
840
 
841
+ /**
842
  * Log a row's import status
843
  */
844
  protected function add_import_result( $status, $reason, $post_id = '', $post_title = '' ) {
includes/importer/class-wf-csv-parser-coupon.php CHANGED
@@ -71,9 +71,8 @@ class WF_CSV_Parser_Coupon {
71
  $row = array();
72
 
73
  foreach ( $header as $key => $heading ) {
74
- $s_heading = $heading;
75
-
76
-
77
 
78
  if ( $s_heading == '' )
79
  continue;
71
  $row = array();
72
 
73
  foreach ( $header as $key => $heading ) {
74
+ // Heading is the lowercase version of the column name
75
+ $s_heading = strtolower( $heading );
 
76
 
77
  if ( $s_heading == '' )
78
  continue;
license.txt CHANGED
@@ -1,6 +1,6 @@
1
  Order CSV Import Export For WooCommerce
2
 
3
- Copyright 2015 by the contributors
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
1
  Order CSV Import Export For WooCommerce
2
 
3
+ Copyright 2018 by the contributors
4
 
5
  This program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
order-import-export.php CHANGED
@@ -6,9 +6,11 @@ Plugin URI: https://wordpress.org/plugins/order-import-export-for-woocommerce/
6
  Description: Export and Import Order detail including line items, From and To your WooCommerce Store.
7
  Author: WebToffee
8
  Author URI: https://www.webtoffee.com/product/woocommerce-order-coupon-subscription-export-import/
9
- Version: 1.3.3
10
  Text Domain: wf_order_import_export
11
- WC tested up to: 3.4.3
 
 
12
  */
13
 
14
  if ( ! defined( 'ABSPATH' ) || ! is_admin() ) {
@@ -22,7 +24,7 @@ define("WF_CPN_IMP_EXP_ID", "wf_cpn_imp_exp");
22
  define("wf_coupon_csv_im_ex", "wf_coupon_csv_im_ex");
23
 
24
  if (!defined('WF_ORDERIMPEXP_CURRENT_VERSION')) {
25
- define("WF_ORDERIMPEXP_CURRENT_VERSION", "1.3.3");
26
  }
27
 
28
  /**
@@ -54,6 +56,7 @@ if (in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', ge
54
  add_action( 'init', array( $this, 'catch_export_request' ), 20 );
55
  add_action( 'init', array( $this, 'catch_save_settings' ), 20 );
56
  add_action( 'admin_init', array( $this, 'register_importers' ) );
 
57
 
58
  include_once( 'includes/class-wf-orderimpexpcsv-admin-screen.php' );
59
  include_once( 'includes/importer/class-wf-orderimpexpcsv-importer.php' );
@@ -272,11 +275,53 @@ if (in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', ge
272
  }
273
  return $user_ok;
274
  }
275
-
 
276
  }
277
 
278
  endif;
279
 
280
  new WF_Coupon_Import_Export_CSV();
281
 
282
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  Description: Export and Import Order detail including line items, From and To your WooCommerce Store.
7
  Author: WebToffee
8
  Author URI: https://www.webtoffee.com/product/woocommerce-order-coupon-subscription-export-import/
9
+ Version: 1.3.4
10
  Text Domain: wf_order_import_export
11
+ WC tested up to: 3.4.4
12
+ License: GPLv3
13
+ License URI: https://www.gnu.org/licenses/gpl-3.0.html
14
  */
15
 
16
  if ( ! defined( 'ABSPATH' ) || ! is_admin() ) {
24
  define("wf_coupon_csv_im_ex", "wf_coupon_csv_im_ex");
25
 
26
  if (!defined('WF_ORDERIMPEXP_CURRENT_VERSION')) {
27
+ define("WF_ORDERIMPEXP_CURRENT_VERSION", "1.3.4");
28
  }
29
 
30
  /**
56
  add_action( 'init', array( $this, 'catch_export_request' ), 20 );
57
  add_action( 'init', array( $this, 'catch_save_settings' ), 20 );
58
  add_action( 'admin_init', array( $this, 'register_importers' ) );
59
+
60
 
61
  include_once( 'includes/class-wf-orderimpexpcsv-admin-screen.php' );
62
  include_once( 'includes/importer/class-wf-orderimpexpcsv-importer.php' );
275
  }
276
  return $user_ok;
277
  }
278
+
279
+
280
  }
281
 
282
  endif;
283
 
284
  new WF_Coupon_Import_Export_CSV();
285
 
286
+ }
287
+
288
+
289
+
290
+ if (!get_option('OCSEIPF_Webtoffee_storefrog_admin_notices_dismissed')) {
291
+ add_action('admin_notices', 'webtoffee_storefrog_admin_notices');
292
+ add_action('wp_ajax_OCSEIPF_webtoffee_storefrog_notice_dismiss', 'webtoffee_storefrog_notice_dismiss');
293
+ }
294
+ function webtoffee_storefrog_admin_notices() {
295
+
296
+ if (apply_filters('webtoffee_storefrog_suppress_admin_notices', false)) {
297
+ return;
298
+ }
299
+ $screen = get_current_screen();
300
+
301
+ $allowed_screen_ids = array('woocommerce_page_wf_woocommerce_order_im_ex','woocommerce_page_wf_coupon_csv_im_ex', 'admin');
302
+ if (in_array($screen->id, $allowed_screen_ids)) {
303
+
304
+ $notice = __('<h3>Save Time, Money & Hassle on Your WooCommerce Data Migration?</h3>', 'wf_order_import_export');
305
+ $notice .= __('<h3>Use StoreFrog Migration Services.</h3>', 'wf_order_import_export');
306
+
307
+ $content = '<style>.webtoffee-storefrog-nav-tab.updated {display: flex;align-items: center;margin: 18px 20px 10px 0;padding:23px;border-left-color: #2c85d7!important}.webtoffee-storefrog-nav-tab ul {margin: 0;}.webtoffee-storefrog-nav-tab h3 {margin-top: 0;margin-bottom: 9px;font-weight: 500;font-size: 16px;color: #2880d3;}.webtoffee-storefrog-nav-tab h3:last-child {margin-bottom: 0;}.webtoffee-storefrog-banner {flex-basis: 20%;padding: 0 15px;margin-left: auto;} .webtoffee-storefrog-banner a:focus{box-shadow: none;}</style>';
308
+ $content .= '<div class="updated woocommerce-message webtoffee-storefrog-nav-tab notice is-dismissible"><ul>' . $notice . '</ul><div class="webtoffee-storefrog-banner"><a href="http://www.storefrog.com/" target="_blank"> <img src="' . plugins_url(basename(plugin_dir_path(WF_OrderImpExpCsv_FILE))) . '/images/storefrog.png"/></a></div><div style="position: absolute;top: 0;right: 1px;z-index: 10000;" ><button type="button" id="webtoffee-storefrog-notice-dismiss" class="notice-dismiss"><span class="screen-reader-text">' . __('Dismiss this notice.', 'wf_order_import_export') . '</span></button></div></div>';
309
+ echo $content;
310
+
311
+
312
+ wc_enqueue_js("jQuery( '#webtoffee-storefrog-notice-dismiss' ).click( function() {
313
+ jQuery.post( '" . admin_url("admin-ajax.php") . "', { action: 'OCSEIPF_webtoffee_storefrog_notice_dismiss' } );
314
+ jQuery('.webtoffee-storefrog-nav-tab').fadeOut();
315
+ });
316
+ ");
317
+ }
318
+ }
319
+
320
+ function webtoffee_storefrog_notice_dismiss() {
321
+
322
+ if (!current_user_can('manage_woocommerce')) {
323
+ wp_die(-1);
324
+ }
325
+ update_option('OCSEIPF_Webtoffee_storefrog_admin_notices_dismissed', 1);
326
+ wp_die();
327
+ }
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
  === Order Export & Order Import for WooCommerce ===
2
  Contributors: webtoffee
3
- Donate link:
4
  Tags: Order Export, Order Import, WooCommerce Export Orders , WooCommerce Import Orders , Export Orders, Import Orders
5
  Requires at least: 3.0.1
6
- Tested up to: 4.9.7
7
- Stable tag: 1.3.3
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  WooCommerce Export Orders & WooCommerce Import Orders. Easily Export WooCommerce Orders to CSV. Also Import WooCommerce Orders from CSV
12
 
@@ -14,41 +14,39 @@ WooCommerce Export Orders & WooCommerce Import Orders. Easily Export WooCommerce
14
 
15
  = Introduction =
16
  This is perfect tool if you are migrating an existing shop on a different eCommerce platform to WooCommerce, allowing you to maintain your order history including subscription orders (available in premium). Plugin will even allow you to migrate thousands of coupons from your old eCommerce platform or Campaigns.
17
- <ul>
18
- <li>Export Orders to CSV file.</li>
19
- <li>Import Orders from CSV file.</li>
20
- <li>Export Coupons to CSV file.</li>
21
- <li>Import Coupons from CSV file.</li>
22
- <li>Export Subscription Orders to CSV file(Premium Feature).</li>
23
- <li>Import Subscription Orders from CSV file(Premium Feature).</li>
24
- </ul>
25
 
 
 
 
 
 
 
 
26
 
27
  <blockquote>
28
 
29
 
30
  = Order Export & Order Import for WooCommerce Premium Version Features =
31
- <ul>
32
- <li>Export WooCommerce Orders to CSV file.</li>
33
- <li>Import WooCommerce Orders from CSV file..</li>
34
- <li>Export Subscription Orders to CSV file.</li>
35
- <li>Import Subscription Orders from CSV file.</li>
36
- <li>Import Coupons from CSV file.</li>
37
- <li>Export Coupons to CSV file.</li>
38
- <li>Importing Order meta to WooCommerce</li>
39
- <li>Filtering options while Export using Order Status, Date, Coupon Type etc.</li>
40
- <li>Change values while import using Evaluation Field feature.</li>
41
- <li>A number of third party plugins supported.</li>
42
- <li>Column Mapping Feature to Import from any CSV format ( Magento, Shopify, OpenCart etc. ).</li>
43
- <li>Import and Export via FTP.</li>
44
- <li>Schedule automatic import using Cron Job Feature.</li>
45
- <li>Scheduled export using Cron Job Feature.</li>
46
- <li>Import WooCommerce Orders from XML</li>
47
- <li>Export WooCommerce Orders to XML</li>
48
- <li>XML Export/Import supports Stamps.com desktop application, UPS WorldShip, Endicia and FedEx.</li>
49
- <li>Excellent Support for setting it up!</li>
50
-
51
- </ul>
52
 
53
  For complete list of features and details, Please visit <a rel="nofollow" href="https://www.xadapter.com/product/order-import-export-plugin-for-woocommerce/">Order Export Import Plugin for WooCommerce</a> for more details
54
 
@@ -110,8 +108,12 @@ Yes. You can import or export order line item details.
110
 
111
  3. Exported order sample Screen
112
 
113
- == Changelog ==
114
 
 
 
 
 
115
  = 1.3.3 =
116
  * Sample CSV file updated.
117
  * WC 3.4.3 Tested OK.
@@ -189,7 +191,7 @@ Yes. You can import or export order line item details.
189
  * Export /Import WooCommerce Orders.
190
 
191
  == Upgrade Notice ==
192
- = 1.3.3 =
193
- * Sample CSV file updated.
194
- * WC 3.4.3 Tested OK.
195
- * Bug fix.
1
  === Order Export & Order Import for WooCommerce ===
2
  Contributors: webtoffee
3
+ Donate link: https://www.webtoffee.com/plugins/
4
  Tags: Order Export, Order Import, WooCommerce Export Orders , WooCommerce Import Orders , Export Orders, Import Orders
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.9.8
7
+ Stable tag: 1.3.4
8
+ License: GPLv3
9
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
  WooCommerce Export Orders & WooCommerce Import Orders. Easily Export WooCommerce Orders to CSV. Also Import WooCommerce Orders from CSV
12
 
14
 
15
  = Introduction =
16
  This is perfect tool if you are migrating an existing shop on a different eCommerce platform to WooCommerce, allowing you to maintain your order history including subscription orders (available in premium). Plugin will even allow you to migrate thousands of coupons from your old eCommerce platform or Campaigns.
 
 
 
 
 
 
 
 
17
 
18
+ &#128312; Export Orders to CSV file.
19
+ &#128312; Import Orders from CSV file.
20
+ &#128312; Export Coupons to CSV file.
21
+ &#128312; Import Coupons from CSV file.
22
+ &#128312; Export Subscription Orders to CSV file(Premium Feature).
23
+ &#128312; Import Subscription Orders from CSV file(Premium Feature).
24
+ &#128312; Tested OK with WooCommerce 3.4.4.
25
 
26
  <blockquote>
27
 
28
 
29
  = Order Export & Order Import for WooCommerce Premium Version Features =
30
+
31
+ &#9989; Export WooCommerce Orders to CSV file.
32
+ &#9989; Import WooCommerce Orders from CSV file.
33
+ &#9989; Export Subscription Orders to CSV file.
34
+ &#9989; Import Subscription Orders from CSV file.
35
+ &#9989; Import Coupons from CSV file.
36
+ &#9989; Export Coupons to CSV file.
37
+ &#9989; Importing Order meta to WooCommerce.
38
+ &#9989; Filtering options while Export using Order Status, Date, Coupon Type etc.
39
+ &#9989; Change values while import using Evaluation Field feature.
40
+ &#9989; A number of third party plugins supported.
41
+ &#9989;Column Mapping Feature to Import from any CSV format ( Magento, Shopify, OpenCart etc. ).
42
+ &#9989; Import and Export via FTP.
43
+ &#9989; Schedule automatic import using Cron Job Feature.
44
+ &#9989; Scheduled export using Cron Job Feature.
45
+ &#9989; Import WooCommerce Orders from XML.
46
+ &#9989; Export WooCommerce Orders to XML.
47
+ &#9989; XML Export/Import supports Stamps.com desktop application, UPS WorldShip, Endicia and FedEx.
48
+ &#9989; Excellent Support for setting it up!
49
+
 
50
 
51
  For complete list of features and details, Please visit <a rel="nofollow" href="https://www.xadapter.com/product/order-import-export-plugin-for-woocommerce/">Order Export Import Plugin for WooCommerce</a> for more details
52
 
108
 
109
  3. Exported order sample Screen
110
 
111
+ == Changelog ==
112
 
113
+ = 1.3.4 =
114
+ * WC 3.4.4 Tested OK.
115
+ * Bug fix.
116
+ * Readme content change.
117
  = 1.3.3 =
118
  * Sample CSV file updated.
119
  * WC 3.4.3 Tested OK.
191
  * Export /Import WooCommerce Orders.
192
 
193
  == Upgrade Notice ==
194
+ = 1.3.4 =
195
+ * WC 3.4.4 and WP 4.9.8 Tested OK.
196
+ * Bug fix.
197
+ * Readme content change.