WooCommerce – Store Exporter - Version 2.5

Version Description

  • Added: Export button to the Products, Categories, Product Tags and Orders screen
  • Fixed: Quantity not populating for Variable Products in WooCommerce version 3.8 and above (thanks Hanny)
Download this release

Release Info

Developer byronkeet
Plugin Icon 128x128 WooCommerce – Store Exporter
Version 2.5
Comparing to
See all releases

Code changes from version 2.4 to 2.5

exporter.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce - Store Exporter
4
  * Plugin URI: http://www.visser.com.au/woocommerce/plugins/exporter/
5
  * Description: Export store details out of WooCommerce into simple formatted files (e.g. CSV, TSV, Excel formats including XLS and XLSX, XML, etc.)
6
- * Version: 2.4
7
  * Author: Visser Labs
8
  * Author URI: http://www.visser.com.au/solutions/
9
  * License: GPL2
@@ -12,7 +12,7 @@
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 2.3
15
- * WC tested up to: 3.8
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
  * Plugin Name: WooCommerce - Store Exporter
4
  * Plugin URI: http://www.visser.com.au/woocommerce/plugins/exporter/
5
  * Description: Export store details out of WooCommerce into simple formatted files (e.g. CSV, TSV, Excel formats including XLS and XLSX, XML, etc.)
6
+ * Version: 2.5
7
  * Author: Visser Labs
8
  * Author URI: http://www.visser.com.au/solutions/
9
  * License: GPL2
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 2.3
15
+ * WC tested up to: 4.1.1
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
includes/admin.php CHANGED
@@ -240,6 +240,11 @@ function woo_ce_admin_export_bar_menu( $admin_bar ) {
240
  function woo_ce_admin_current_screen() {
241
 
242
  $screen = get_current_screen();
 
 
 
 
 
243
  switch( $screen->id ) {
244
 
245
  case 'woocommerce_page_woo_ce':
240
  function woo_ce_admin_current_screen() {
241
 
242
  $screen = get_current_screen();
243
+
244
+ wp_enqueue_style( 'dashicons' );
245
+ wp_enqueue_style( 'woo_ce_styles', plugins_url( '/templates/admin/export.css', WOO_CE_RELPATH ) );
246
+ wp_enqueue_script( 'woo_ce_scripts', plugins_url( '/templates/admin/export.js', WOO_CE_RELPATH ), array( 'jquery', 'jquery-ui-sortable' ) );
247
+
248
  switch( $screen->id ) {
249
 
250
  case 'woocommerce_page_woo_ce':
includes/product.php CHANGED
@@ -749,6 +749,36 @@ function woo_ce_get_product_data( $product_id = 0, $args = array() ) {
749
  $product->upsell_ids = woo_ce_get_product_assoc_upsell_ids( $product_id );
750
  $product->crosssell_ids = woo_ce_get_product_assoc_crosssell_ids( $product_id );
751
  $product->quantity = get_post_meta( $product_id, '_stock', true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
752
  $product->stock_status = woo_ce_format_product_stock_status( get_post_meta( $product_id, '_stock_status', true ), $product->quantity );
753
  $product->image = woo_ce_get_product_assoc_featured_image( $product_id );
754
  $product->product_gallery = woo_ce_get_product_assoc_product_gallery( $product_id );
749
  $product->upsell_ids = woo_ce_get_product_assoc_upsell_ids( $product_id );
750
  $product->crosssell_ids = woo_ce_get_product_assoc_crosssell_ids( $product_id );
751
  $product->quantity = get_post_meta( $product_id, '_stock', true );
752
+ // Override Variable with total stock quantity
753
+ $term_taxonomy = 'product_type';
754
+ if ( has_term( 'variable', $term_taxonomy, $product_id ) ) {
755
+ if (
756
+ version_compare( woo_get_woo_version(), '3.0', '>=' ) &&
757
+ $product->manage_stock == 'no'
758
+ ) {
759
+ $product_variations = ( method_exists( $_product, 'get_available_variations' ) ? $_product->get_available_variations() : $product->quantity );
760
+ if( ! empty( $product_variations ) ) {
761
+ $quantity = 0;
762
+ foreach ( $product_variations as $variation ) {
763
+ $quantity += $variation['max_qty'];
764
+ }
765
+ $product->quantity = $quantity;
766
+ unset( $variation, $quantity );
767
+ }
768
+ unset( $product_variations );
769
+ } else if ( version_compare( woo_get_woo_version(), '2.7', '>=' ) ) {
770
+ $product->quantity = ( method_exists( $_product, 'get_stock_quantity' ) ? $_product->get_stock_quantity() : $product->quantity );
771
+ } else {
772
+ $product->quantity = ( method_exists( $_product, 'get_total_stock' ) ? $_product->get_total_stock() : $product->quantity );
773
+ }
774
+ }
775
+ $product->quantity = ( function_exists( 'wc_stock_amount' ) ? wc_stock_amount( $product->quantity ) : $product->quantity );
776
+ if(
777
+ $product->manage_stock == 'no' &&
778
+ ! $product->quantity
779
+ ) {
780
+ $product->quantity = '';
781
+ }
782
  $product->stock_status = woo_ce_format_product_stock_status( get_post_meta( $product_id, '_stock_status', true ), $product->quantity );
783
  $product->image = woo_ce_get_product_assoc_featured_image( $product_id );
784
  $product->product_gallery = woo_ce_get_product_assoc_product_gallery( $product_id );
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === WooCommerce - Store Exporter ===
2
 
3
- Contributors: visser, visser.labs
4
  Donate link: https://www.visser.com.au/donations/
5
  Tags: woocommerce, export, products, sales, orders, coupons, users, subscriptions, csv
6
  Requires at least: 2.9.2
7
- Tested up to: 5.3.2
8
- Stable tag: 2.4
9
  License: GPLv2 or later
10
 
11
  Export store details out of WooCommerce into simple formatted files (e.g. CSV, XML, Excel 2007, XLS, etc.).
@@ -154,6 +154,10 @@ If you have any problems, questions or suggestions please create a topic here on
154
 
155
  == Changelog ==
156
 
 
 
 
 
157
  = 2.4 =
158
  * Fixed: CSV Injection Vulnerability affecting exports (thanks FortiGuard Labs)
159
 
1
  === WooCommerce - Store Exporter ===
2
 
3
+ Contributors: visser, visser.labs, byronkeet
4
  Donate link: https://www.visser.com.au/donations/
5
  Tags: woocommerce, export, products, sales, orders, coupons, users, subscriptions, csv
6
  Requires at least: 2.9.2
7
+ Tested up to: 5.4.1
8
+ Stable tag: 2.5
9
  License: GPLv2 or later
10
 
11
  Export store details out of WooCommerce into simple formatted files (e.g. CSV, XML, Excel 2007, XLS, etc.).
154
 
155
  == Changelog ==
156
 
157
+ = 2.5 =
158
+ * Added: Export button to the Products, Categories, Product Tags and Orders screen
159
+ * Fixed: Quantity not populating for Variable Products in WooCommerce version 3.8 and above (thanks Hanny)
160
+
161
  = 2.4 =
162
  * Fixed: CSV Injection Vulnerability affecting exports (thanks FortiGuard Labs)
163
 
templates/admin/export.js CHANGED
@@ -554,6 +554,42 @@ $j(function() {
554
  $j('#'+type).trigger('click');
555
  }
556
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
557
  });
558
 
559
  });
554
  $j('#'+type).trigger('click');
555
  }
556
 
557
+ // Adds the Export button to WooCommerce screens within the WordPress Administration
558
+ var export_url = 'admin.php?page=woo_ce';
559
+ var export_text = 'Export';
560
+ var export_text_override = 'Export with <attr value="Store Exporter">SE</attr>';
561
+ var export_html = '<a href="' + export_url + '" class="page-title-action">' + export_text + '</a>';
562
+
563
+ // Adds the Export button to the Products screen
564
+ var product_screen = $j( '.edit-php.post-type-product' );
565
+ var title_action = product_screen.find( '.page-title-action:last' );
566
+ export_html = '<a href="' + export_url + '#export-product" class="page-title-action" title="Export Products with Store Exporter">' + export_text_override + '</a>';
567
+ title_action.after( export_html );
568
+
569
+ // Adds the Export button to the Category screen
570
+ var category_screen = $j( '.edit-tags-php.post-type-product.taxonomy-product_cat' );
571
+ var title_action = category_screen.find( '.wp-heading-inline' );
572
+ export_html = '<a href="' + export_url + '#export-category" class="page-title-action" title="Export Categories with Store Exporter">' + export_text + '</a>';
573
+ title_action.after( export_html );
574
+
575
+ // Adds the Export button to the Product Tag screen
576
+ var tag_screen = $j( '.edit-tags-php.post-type-product.taxonomy-product_tag' );
577
+ var title_action = tag_screen.find( '.wp-heading-inline' );
578
+ export_html = '<a href="' + export_url + '#export-tag" class="page-title-action" title="Export Product Tags with Store Exporter">' + export_text + '</a>';
579
+ title_action.after( export_html );
580
+
581
+ // Adds the Export button to the Orders screen
582
+ var order_screen = $j( '.edit-php.post-type-shop_order' );
583
+ var title_action = order_screen.find( '.page-title-action:last' );
584
+ export_html = '<a href="' + export_url + '#export-order" class="page-title-action" title="Export Orders with Store Exporter">' + export_text + '</a>';
585
+ title_action.after( export_html );
586
+
587
+ // Adds the Export button to the Users screen
588
+ var user_screen = $j( '.users-php' );
589
+ var title_action = user_screen.find( '.page-title-action:last' );
590
+ export_html = '<a href="' + export_url + '#export-user" class="page-title-action" title="Export Users with Store Exporter">' + export_text + '</a>';
591
+ title_action.after( export_html );
592
+
593
  });
594
 
595
  });