Booster for WooCommerce - Version 1.4.0

Version Description

  • 07/09/2014 =
  • Dev - Custom Price Labels - Support for price labels showing on Pages, added. Suggested by Axel.
  • Fix - PDF Invoices - Bug with some item table columns not showing, fixed. Suggested by Tomas.
  • Dev - PDF Invoices - Discount as separate item option added.
  • Dev - PDF Invoices - Shipping as separate item option added. Suggested by Tomas.
  • Dev - All tools (i.e. Old Slugs and Custom Order Statuses) moved to WooCommerce > Jetpack Tools.
Download this release

Release Info

Developer algoritmika
Plugin Icon 128x128 Booster for WooCommerce
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.0 to 1.4.0

includes/admin/tools/class-wcj-tools.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Jetpack Tools
4
+ *
5
+ * The WooCommerce Jetpack Tools class.
6
+ *
7
+ * @class WCJ_Tools
8
+ * @version 1.0.0
9
+ * @category Class
10
+ * @author Algoritmika Ltd.
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
+
15
+ if ( ! class_exists( 'WCJ_Tools' ) ) :
16
+
17
+ class WCJ_Tools {
18
+
19
+ public function __construct() {
20
+ if ( is_admin() ) {
21
+ add_action( 'admin_menu', array($this, 'add_wcj_tools'), 100 );
22
+ }
23
+ }
24
+
25
+ public function add_wcj_tools() {
26
+ add_submenu_page( 'woocommerce', 'WooCommerce Jetpack Tools', 'Jetpack Tools', 'manage_options', 'wcj-tools', array( $this, 'create_tools_page' ) );
27
+ }
28
+
29
+ public function create_tools_page() {
30
+
31
+ $tabs = array(
32
+ array(
33
+ 'id' => 'dashboard',
34
+ 'title' => __( 'Tools Dashboard', 'woocommerce-jetpack' ),
35
+ //'desc' => __( 'WooCommerce Jetpack Tools Dashboard', 'woocommerce-jetpack' ),
36
+ ),
37
+ );
38
+
39
+ $tabs = apply_filters( 'wcj_tools_tabs', $tabs );
40
+
41
+ $html = '<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">';
42
+
43
+ $active_tab = 'dashboard';
44
+ if ( isset( $_GET['tab'] ) )
45
+ $active_tab = $_GET['tab'];
46
+
47
+ foreach ( $tabs as $tab ) {
48
+
49
+ $is_active = '';
50
+ if ( $active_tab === $tab['id'] )
51
+ $is_active = 'nav-tab-active';
52
+
53
+ //$html .= '<a href="' . get_admin_url() . 'admin.php?page=wcj-tools&tab=' . $tab['id'] . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
54
+ //$html .= '<a href="' . add_query_arg( 'tab', $tab['id'] ) . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
55
+ $html .= '<a href="admin.php?page=wcj-tools&tab=' . $tab['id'] . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
56
+
57
+ }
58
+ $html .= '</h2>';
59
+
60
+ echo $html;
61
+
62
+ do_action( 'wcj_tools_' . $active_tab );
63
+ }
64
+ }
65
+
66
+ endif;
67
+
68
+ return new WCJ_Tools();
includes/class-wcj-old-slugs.php CHANGED
@@ -1,15 +1,16 @@
1
  <?php
2
  /**
3
- * WooCommerce Jetpack Old Product Slugs
4
  *
5
- * The WooCommerce Jetpack Old Product Slugs class.
6
  *
7
  * @class WCJ_Old_Slugs
8
- * @version 1.0.0
9
  * @package WC_Jetpack/Classes
10
  * @category Class
11
  * @author Algoritmika Ltd.
12
  */
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
 
15
  if ( ! class_exists( 'WCJ_Old_Slugs' ) ) :
@@ -25,16 +26,42 @@ class WCJ_Old_Slugs {
25
 
26
  if ( is_admin() ) {
27
 
28
- add_action( 'admin_menu', array($this, 'add_old_slugs_tool'), 100 ); // Add Remove Old Slugs tool to WooCommerce menu
 
 
 
29
  }
30
  }
 
31
 
32
  // Settings hooks
33
- add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) ); // Add section to WooCommerce > Settings > Jetpack
34
- add_filter( 'wcj_settings_old_slugs', array( $this, 'get_settings' ), 100 ); // Add the settings
35
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 ); // Add Enable option to Jetpack Settings Dashboard
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * add_enabled_option.
40
  */
@@ -57,7 +84,8 @@ class WCJ_Old_Slugs {
57
  array(
58
  'title' => __( 'Old Slugs', 'woocommerce-jetpack' ),
59
  'desc' => __( 'Enable the Remove Old Product Slugs feature', 'woocommerce-jetpack' ),
60
- 'desc_tip' => __( 'Remove old product slugs. Tool is accessible through <a href="/wp-admin/admin.php?page=woocommerce-jetpack-old-slugs">WooCommerce > Remove Old Slugs</a>.', 'woocommerce-jetpack' ),
 
61
  'id' => 'wcj_old_slugs_enabled',
62
  'default' => 'yes',
63
  'type' => 'checkbox'
@@ -74,15 +102,15 @@ class WCJ_Old_Slugs {
74
  */
75
  function settings_section( $sections ) {
76
 
77
- $sections['old_slugs'] = 'Old Slugs';
78
 
79
  return $sections;
80
  }
81
 
82
- public function add_old_slugs_tool() {
83
 
84
  add_submenu_page( 'woocommerce', 'Jetpack - Remove Old Slugs', 'Remove Old Slugs', 'manage_options', 'woocommerce-jetpack-old-slugs', array( $this, 'create_old_slugs_tool' ) );
85
- }
86
 
87
  public function create_old_slugs_tool() {
88
 
@@ -128,15 +156,14 @@ class WCJ_Old_Slugs {
128
  $remove_result_html = '<div class="updated"><p><strong>Removing old slugs from database finished! ' . ($num_old_slugs-$recheck_result_count) . ' old slug(s) deleted. Please <a href="">refresh</a> the page.</strong></p></div>';
129
  }
130
  }
131
- ?>
132
- <div>
133
  <h2><?php _e( 'WooCommerce Jetpack - Remove Old Product Slugs', 'woocommerce-jetpack' ); ?></h2>
134
  <p><?php _e( 'Tool removes old slugs/permalinks from database.', 'woocommerce-jetpack' ); ?></p>
135
  <?php echo $remove_result_html; ?>
136
  <?php
137
  $num_old_slugs_products = count( $posts_ids['products'] );
138
  if ( $num_old_slugs_products > 0 ) { ?>
139
- <h3>Old products slugs found: <?php echo $num_old_slugs_products; ?></h3>
140
  <p><?php echo $old_slugs_list_products; ?></p>
141
  <form method="post" action="">
142
  <input type="submit" name="remove_old_products_slugs" value="Remove All Old Product Slugs"/>
@@ -144,17 +171,16 @@ class WCJ_Old_Slugs {
144
  <?php }
145
  $num_old_slugs_none_products = count( $posts_ids['none_products'] );
146
  if ( $num_old_slugs_none_products > 0 ) { ?>
147
- <h3>None-products slugs found: <?php echo $num_old_slugs_none_products; ?></h3>
148
  <p><?php echo $old_slugs_list; ?></p>
149
  <form method="post" action="">
150
  <input type="submit" name="remove_old_none_products_slugs" value="Remove All Old None-Product Slugs"/>
151
  </form>
152
  <?php }
153
  if ( $num_old_slugs == 0 ) { ?>
154
- <div class="updated"><p><strong>No old slugs found.</strong></p></div>
155
  <?php } ?>
156
- </div>
157
- <?php
158
  }
159
  }
160
 
1
  <?php
2
  /**
3
+ * WooCommerce Jetpack Old Slugs
4
  *
5
+ * The WooCommerce Jetpack Old Slugs class.
6
  *
7
  * @class WCJ_Old_Slugs
8
+ * @version 1.1.0
9
  * @package WC_Jetpack/Classes
10
  * @category Class
11
  * @author Algoritmika Ltd.
12
  */
13
+
14
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
 
16
  if ( ! class_exists( 'WCJ_Old_Slugs' ) ) :
26
 
27
  if ( is_admin() ) {
28
 
29
+ //add_action( 'admin_menu', array($this, 'add_old_slugs_tool'), 100 ); // Add Remove Old Slugs tool to WooCommerce menu
30
+
31
+ add_filter( 'wcj_tools_tabs', array( $this, 'add_old_slugs_tool_tab' ), 100 );
32
+ add_action( 'wcj_tools_old_slugs', array( $this, 'create_old_slugs_tool' ), 100 );
33
  }
34
  }
35
+ add_action( 'wcj_tools_dashboard', array( $this, 'add_old_slugs_tool_info_to_tools_dashboard' ), 100 );
36
 
37
  // Settings hooks
38
+ add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) ); // Add section to WooCommerce > Settings > Jetpack
39
+ add_filter( 'wcj_settings_old_slugs', array( $this, 'get_settings' ), 100 ); // Add the settings
40
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 ); // Add Enable option to Jetpack Settings Dashboard
41
  }
42
 
43
+ /**
44
+ * add_old_slugs_tool_info_to_tools_dashboard.
45
+ */
46
+ public function add_old_slugs_tool_info_to_tools_dashboard() {
47
+ if ( 'yes' === get_option( 'wcj_old_slugs_enabled' ) )
48
+ echo '<h3>Remove Old Slugs tool is enabled.</h3>';
49
+ else
50
+ echo '<h3>Remove Old Slugs tool is disabled.</h3>';
51
+ echo '<p>Tool removes old slugs/permalinks from database.</p>';
52
+ }
53
+
54
+ /**
55
+ * add_old_slugs_tool_tab.
56
+ */
57
+ public function add_old_slugs_tool_tab( $tabs ) {
58
+ $tabs[] = array(
59
+ 'id' => 'old_slugs',
60
+ 'title' => __( 'Remove Old Slugs', 'woocommerce-jetpack' ),
61
+ );
62
+ return $tabs;
63
+ }
64
+
65
  /**
66
  * add_enabled_option.
67
  */
84
  array(
85
  'title' => __( 'Old Slugs', 'woocommerce-jetpack' ),
86
  'desc' => __( 'Enable the Remove Old Product Slugs feature', 'woocommerce-jetpack' ),
87
+ //'desc_tip' => __( 'Remove old product slugs. Tool is accessible through <a href="/wp-admin/admin.php?page=woocommerce-jetpack-old-slugs">WooCommerce > Remove Old Slugs</a>.', 'woocommerce-jetpack' ),
88
+ 'desc_tip' => __( 'Remove old product slugs.', 'woocommerce-jetpack' ),
89
  'id' => 'wcj_old_slugs_enabled',
90
  'default' => 'yes',
91
  'type' => 'checkbox'
102
  */
103
  function settings_section( $sections ) {
104
 
105
+ $sections['old_slugs'] = __( 'Old Slugs', 'woocommerce-jetpack' );
106
 
107
  return $sections;
108
  }
109
 
110
+ /*public function add_old_slugs_tool() {
111
 
112
  add_submenu_page( 'woocommerce', 'Jetpack - Remove Old Slugs', 'Remove Old Slugs', 'manage_options', 'woocommerce-jetpack-old-slugs', array( $this, 'create_old_slugs_tool' ) );
113
+ }*/
114
 
115
  public function create_old_slugs_tool() {
116
 
156
  $remove_result_html = '<div class="updated"><p><strong>Removing old slugs from database finished! ' . ($num_old_slugs-$recheck_result_count) . ' old slug(s) deleted. Please <a href="">refresh</a> the page.</strong></p></div>';
157
  }
158
  }
159
+ ?><div>
 
160
  <h2><?php _e( 'WooCommerce Jetpack - Remove Old Product Slugs', 'woocommerce-jetpack' ); ?></h2>
161
  <p><?php _e( 'Tool removes old slugs/permalinks from database.', 'woocommerce-jetpack' ); ?></p>
162
  <?php echo $remove_result_html; ?>
163
  <?php
164
  $num_old_slugs_products = count( $posts_ids['products'] );
165
  if ( $num_old_slugs_products > 0 ) { ?>
166
+ <h3><?php _e( 'Old products slugs found:', 'woocommerce-jetpack' ); ?> <?php echo $num_old_slugs_products; ?></h3>
167
  <p><?php echo $old_slugs_list_products; ?></p>
168
  <form method="post" action="">
169
  <input type="submit" name="remove_old_products_slugs" value="Remove All Old Product Slugs"/>
171
  <?php }
172
  $num_old_slugs_none_products = count( $posts_ids['none_products'] );
173
  if ( $num_old_slugs_none_products > 0 ) { ?>
174
+ <h3><?php _e( 'None-products slugs found:', 'woocommerce-jetpack' ); ?> <?php echo $num_old_slugs_none_products; ?></h3>
175
  <p><?php echo $old_slugs_list; ?></p>
176
  <form method="post" action="">
177
  <input type="submit" name="remove_old_none_products_slugs" value="Remove All Old None-Product Slugs"/>
178
  </form>
179
  <?php }
180
  if ( $num_old_slugs == 0 ) { ?>
181
+ <div class="updated"><p><strong><?php _e( 'No old slugs found.', 'woocommerce-jetpack' ); ?></strong></p></div>
182
  <?php } ?>
183
+ </div><?php
 
184
  }
185
  }
186
 
includes/class-wcj-orders.php CHANGED
@@ -5,7 +5,7 @@
5
  * The WooCommerce Jetpack Orders class.
6
  *
7
  * @class WCJ_Orders
8
- * @version 1.0.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
@@ -38,9 +38,12 @@ class WCJ_Orders {
38
  }
39
 
40
  if ( 'yes' === get_option( 'wcj_orders_custom_statuses_enabled' ) ) {
41
- add_action( 'admin_menu', array( $this, 'add_custom_statuses_tool' ), 100 );
42
- add_action( 'admin_head', array( $this, 'hook_statuses_icons_css' ) );
 
 
43
  }
 
44
 
45
  if ( 'yes' === get_option( 'wcj_order_auto_complete_enabled' ) )
46
  add_action( 'woocommerce_thankyou', array( $this, 'auto_complete_order' ) );
@@ -55,6 +58,28 @@ class WCJ_Orders {
55
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /**
59
  * Auto Complete all WooCommerce orders.
60
  */
@@ -98,7 +123,7 @@ class WCJ_Orders {
98
 
99
  /**
100
  * add_custom_statuses_tool to WooCommerce menu (menu link).
101
- */
102
  public function add_custom_statuses_tool() {
103
 
104
  add_submenu_page( 'woocommerce', 'Jetpack - Custom Statuses', 'Custom Statuses', 'manage_options', 'woocommerce-jetpack-custom-statuses', array( $this, 'create_custom_statuses_tool' ) );
5
  * The WooCommerce Jetpack Orders class.
6
  *
7
  * @class WCJ_Orders
8
+ * @version 1.1.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
38
  }
39
 
40
  if ( 'yes' === get_option( 'wcj_orders_custom_statuses_enabled' ) ) {
41
+ //add_action( 'admin_menu', array( $this, 'add_custom_statuses_tool' ), 100 );
42
+ add_action( 'admin_head', array( $this, 'hook_statuses_icons_css' ) );
43
+ add_filter( 'wcj_tools_tabs', array( $this, 'add_custom_statuses_tool_tab' ), 100 );
44
+ add_action( 'wcj_tools_custom_statuses', array( $this, 'create_custom_statuses_tool' ), 100 );
45
  }
46
+ add_action( 'wcj_tools_dashboard', array( $this, 'add_custom_statuses_tool_info_to_tools_dashboard' ), 100 );
47
 
48
  if ( 'yes' === get_option( 'wcj_order_auto_complete_enabled' ) )
49
  add_action( 'woocommerce_thankyou', array( $this, 'auto_complete_order' ) );
58
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
59
  }
60
 
61
+ /**
62
+ * add_custom_statuses_tool_info_to_tools_dashboard.
63
+ */
64
+ public function add_custom_statuses_tool_info_to_tools_dashboard() {
65
+ if ( 'yes' === get_option( 'wcj_orders_custom_statuses_enabled' ) )
66
+ echo '<h3>Custom Statuses tool is enabled.</h3>';
67
+ else
68
+ echo '<h3>Custom Statuses tool is disabled.</h3>';
69
+ echo '<p>The tool lets you add or delete any custom status for WooCommerce orders.</p>';
70
+ }
71
+
72
+ /**
73
+ * add_custom_statuses_tool_tab.
74
+ */
75
+ public function add_custom_statuses_tool_tab( $tabs ) {
76
+ $tabs[] = array(
77
+ 'id' => 'custom_statuses',
78
+ 'title' => __( 'Custom Statuses', 'woocommerce-jetpack' ),
79
+ );
80
+ return $tabs;
81
+ }
82
+
83
  /**
84
  * Auto Complete all WooCommerce orders.
85
  */
123
 
124
  /**
125
  * add_custom_statuses_tool to WooCommerce menu (menu link).
126
+ *
127
  public function add_custom_statuses_tool() {
128
 
129
  add_submenu_page( 'woocommerce', 'Jetpack - Custom Statuses', 'Custom Statuses', 'manage_options', 'woocommerce-jetpack-custom-statuses', array( $this, 'create_custom_statuses_tool' ) );
includes/class-wcj-pdf-invoices.php CHANGED
@@ -5,7 +5,7 @@
5
  * The WooCommerce Jetpack PDF Invoices class.
6
  *
7
  * @class WCJ_PDF_Invoices
8
- * @version 1.1.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
@@ -178,12 +178,34 @@ class WCJ_PDF_Invoices {
178
  $order_number = $the_order->get_order_number();
179
  $order_currency_array = array( 'currency' => $the_order->get_order_currency() );
180
  // Getting Totals
181
- $order_total = $the_order->get_total();
182
- $order_total_tax = $the_order->get_total_tax();
183
- $order_total_shipping = $the_order->get_total_shipping();
184
- $order_total_discount = $the_order->get_total_discount();
185
- $order_subtotal = $order_total - $order_total_tax - $order_total_shipping + $order_total_discount;
186
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  $billing_address_formatted = $the_order->get_formatted_billing_address();
188
 
189
  // Count optional columns number for column width calculation
@@ -297,7 +319,7 @@ class WCJ_PDF_Invoices {
297
  'title' => get_option( 'wcj_pdf_invoices_column_price_tax_text' ),
298
  'css' => 'width:' . $price_column_width . '%;',
299
  'required' => false,
300
- 'value_var' => 'line_total_tax',
301
  'td_css' => 'text-align:right;',
302
  ),
303
  array(
@@ -315,6 +337,67 @@ class WCJ_PDF_Invoices {
315
  $html .= '<th style="' . $column['css'] . '">' . $column['title'] . '</th>';
316
  $html .= '</tr>';
317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  // ITEMS LOOP //
319
  $item_counter = 0;
320
  foreach ( $the_items as $item ) {
@@ -325,15 +408,15 @@ class WCJ_PDF_Invoices {
325
  $item_tax = $the_order->get_item_tax( $item, true );
326
  $item_total_incl_tax = $the_order->get_item_total( $item, true, true );
327
  $item_total_excl_tax_formatted = wc_price( $item_total_excl_tax, $order_currency_array );
328
- $item_tax_formatted = wc_price( $item_tax, $order_currency_array );
329
  $item_total_incl_tax_formatted = wc_price( $item_total_incl_tax, $order_currency_array );
330
  // Line Prices
331
  $line_total_excl_tax = $the_order->get_line_total( $item, false );//$the_order->get_line_subtotal( $item, false, true );//$item['line_subtotal'];//$item['line_total'];
332
  $line_tax = $the_order->get_line_tax( $item );//$item['line_tax'];
333
- $line_tax_percent = round( ( $item['line_tax'] / $item['line_subtotal'] * 100 ), 2 );
334
  $line_total_incl_tax = $the_order->get_line_total( $item, true );//$line_total_excl_tax + $line_tax;
335
  $line_total_excl_tax_formatted = wc_price( $line_total_excl_tax, $order_currency_array );
336
- $line_tax_formatted = wc_price( $line_tax, $order_currency_array );
337
  $line_total_incl_tax_formatted = wc_price( $line_total_incl_tax, $order_currency_array );
338
  // Item Quantity
339
  $item_quantity = $item['qty'];
@@ -361,20 +444,29 @@ class WCJ_PDF_Invoices {
361
  }
362
  $html .= '</tbody></table>';
363
 
364
-
365
  // ORDER TOTALS //
366
  $html .= '<p><table class="pdf_invoice_totals_table_wcj"><tbody>';
367
  // SUBTOTAL
 
368
  $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_subtotal_text' ) . '</th><td>' . wc_price( $order_subtotal, $order_currency_array ) . '</td></tr>';
369
- // TAXES
370
- if ( $order_total_tax != 0 )
371
- $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_total_tax_text' ) . '</th><td>' . wc_price( $order_total_tax, $order_currency_array ) . '</td></tr>';
372
  // SHIPPING
373
- if ( $order_total_shipping != 0 )
374
- $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_shipping_text' ) . '</th><td>' . wc_price( $order_total_shipping, $order_currency_array ) . '</td></tr>';
 
375
  // DISCOUNT
 
 
 
 
 
 
 
 
 
 
376
  if ( $order_total_discount != 0 )
377
- $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_discount_text' ) . '</th><td>-' . wc_price( $order_total_discount, $order_currency_array ) . '</td></tr>';
378
  // TOTAL
379
  $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_total_text' ) . '</th><td>' . $the_order->get_formatted_order_total() . '</td></tr>';
380
  $html .= '</tbody></table></p>';
@@ -577,7 +669,7 @@ class WCJ_PDF_Invoices {
577
  array( 'title' => __( 'Items', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_pdf_invoices_items_options' ),
578
 
579
  array(
580
- 'title' => __( 'Items', 'woocommerce-jetpack' ),
581
  //'desc_tip' => __( 'Items text', 'woocommerce-jetpack' ),
582
  'id' => 'wcj_pdf_invoices_items_text',
583
  'default' => __( 'Items', 'woocommerce-jetpack' ),
@@ -585,6 +677,28 @@ class WCJ_PDF_Invoices {
585
  'css' => 'width:33%;min-width:300px;',
586
  ),
587
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
588
  array( 'type' => 'sectionend', 'id' => 'wcj_pdf_invoices_items_options' ),
589
 
590
  array( 'title' => __( 'Items Columns', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you set column names in invoice items table. You can disable some columns by leaving blank column name.', 'woocommerce-jetpack' ), 'id' => 'wcj_pdf_invoices_items_columns_options' ),
@@ -691,12 +805,12 @@ class WCJ_PDF_Invoices {
691
  'type' => 'text',
692
  'css' => 'width:33%;min-width:300px;',
693
  ),
694
-
695
  array(
696
- 'title' => __( 'Order Total Taxes', 'woocommerce-jetpack' ),
697
- //'desc_tip' => __( 'Order Subtotal = Total - Taxes - Shipping - Discounts', 'woocommerce-jetpack' ),
698
- 'id' => 'wcj_pdf_invoices_order_total_tax_text',
699
- 'default' => __( 'Taxes', 'woocommerce-jetpack' ),
700
  'type' => 'text',
701
  'css' => 'width:33%;min-width:300px;',
702
  ),
@@ -709,12 +823,21 @@ class WCJ_PDF_Invoices {
709
  'type' => 'text',
710
  'css' => 'width:33%;min-width:300px;',
711
  ),
 
 
 
 
 
 
 
 
 
712
 
713
  array(
714
- 'title' => __( 'Total Discount', 'woocommerce-jetpack' ),
715
- //'desc_tip' => __( 'Total Discount text', 'woocommerce-jetpack' ),
716
- 'id' => 'wcj_pdf_invoices_order_discount_text',
717
- 'default' => __( 'Discount', 'woocommerce-jetpack' ),
718
  'type' => 'text',
719
  'css' => 'width:33%;min-width:300px;',
720
  ),
5
  * The WooCommerce Jetpack PDF Invoices class.
6
  *
7
  * @class WCJ_PDF_Invoices
8
+ * @version 1.2.0
9
  * @category Class
10
  * @author Algoritmika Ltd.
11
  */
178
  $order_number = $the_order->get_order_number();
179
  $order_currency_array = array( 'currency' => $the_order->get_order_currency() );
180
  // Getting Totals
181
+ $order_total = $the_order->get_total();
182
+ $order_total_tax = $the_order->get_total_tax();
183
+ $order_total_shipping = $the_order->get_total_shipping();
184
+ $order_total_shipping_tax = $the_order->get_shipping_tax();
185
+ $order_total_discount = $the_order->get_total_discount();
186
+
187
+
188
+
189
+ $order_tax_percent = 0;
190
+ $order_total_before_discount = $order_total + $order_total_discount;
191
+ if ( 0 != $order_total_before_discount )
192
+ $order_tax_percent = $order_total_tax / $order_total_before_discount;
193
+ if ( 0 != $order_total_discount ) {
194
+ $order_total_discount_tax = -1 * ( $order_total_discount * $order_tax_percent );
195
+ $order_total_discount_excl_tax = -1 * ( $order_total_discount + $order_total_discount_tax );
196
+
197
+ $order_total_tax = $order_total_tax + $order_total_discount_tax;
198
+ }
199
+
200
+ $order_subtotal = $order_total - $order_total_tax;
201
+ $order_total_excl_tax = $order_subtotal;
202
+ if ( '' === get_option( 'wcj_pdf_invoices_display_shipping_as_item_text' ) )
203
+ $order_subtotal = $order_subtotal - $order_total_shipping;
204
+ if ( '' === get_option( 'wcj_pdf_invoices_display_discount_as_item_text' ) )
205
+ $order_subtotal = $order_subtotal + $order_total_discount + $order_total_discount_tax;
206
+
207
+
208
+
209
  $billing_address_formatted = $the_order->get_formatted_billing_address();
210
 
211
  // Count optional columns number for column width calculation
319
  'title' => get_option( 'wcj_pdf_invoices_column_price_tax_text' ),
320
  'css' => 'width:' . $price_column_width . '%;',
321
  'required' => false,
322
+ 'value_var' => 'line_total_tax_formatted',
323
  'td_css' => 'text-align:right;',
324
  ),
325
  array(
337
  $html .= '<th style="' . $column['css'] . '">' . $column['title'] . '</th>';
338
  $html .= '</tr>';
339
 
340
+ // Shipping as item
341
+ //$display_shipping_as_item = true;
342
+ //if ( ( true === $display_shipping_as_item ) &&
343
+ if ( ( '' != get_option( 'wcj_pdf_invoices_display_shipping_as_item_text' ) ) &&
344
+ ( $order_total_shipping > 0 ) ) {
345
+ $the_items[] = array(
346
+ 'name' => get_option( 'wcj_pdf_invoices_display_shipping_as_item_text' ),
347
+ 'type' => 'line_item',
348
+ 'qty' => 1,
349
+ //'tax_class' => ,
350
+ //'product_id' => 123,
351
+ //'variation_id' => ,
352
+ 'line_subtotal' => $order_total_shipping,
353
+ 'line_total' => $order_total_shipping,
354
+ 'line_tax' => $order_total_shipping_tax,
355
+ 'line_subtotal_tax' => $order_total_shipping_tax,
356
+ 'item_meta' => array(
357
+ '_qty' => array( 1 ),
358
+ //'_tax_class' => array(),
359
+ //'_product_id' => array( 123 ),
360
+ //'_variation_id' => array(),
361
+ '_line_subtotal' => array( $order_total_shipping ),
362
+ '_line_total' => array( $order_total_shipping ),
363
+ '_line_tax' => array( $order_total_shipping_tax ),
364
+ '_line_subtotal_tax' => array( $order_total_shipping_tax ),
365
+ ),
366
+ );
367
+ }
368
+
369
+ // Discount as item
370
+
371
+
372
+ //$display_discount_as_item = true;
373
+ //if ( ( true === $display_discount_as_item ) &&
374
+ if ( ( '' != get_option( 'wcj_pdf_invoices_display_discount_as_item_text' ) ) &&
375
+ ( 0 != $order_total_discount ) ) {
376
+
377
+ $the_items[] = array(
378
+ 'name' => get_option( 'wcj_pdf_invoices_display_discount_as_item_text' ),
379
+ 'type' => 'line_item',
380
+ 'qty' => 1,
381
+ //'tax_class' => ,
382
+ //'product_id' => 123,
383
+ //'variation_id' => ,
384
+ 'line_subtotal' => $order_total_discount_excl_tax,
385
+ 'line_total' => $order_total_discount_excl_tax,
386
+ 'line_tax' => $order_total_discount_tax,
387
+ 'line_subtotal_tax' => $order_total_discount_tax,
388
+ 'item_meta' => array(
389
+ '_qty' => array( 1 ),
390
+ //'_tax_class' => array(),
391
+ //'_product_id' => array( 123 ),
392
+ //'_variation_id' => array(),
393
+ '_line_subtotal' => array( $order_total_discount_excl_tax ),
394
+ '_line_total' => array( $order_total_discount_excl_tax ),
395
+ '_line_tax' => array( $order_total_discount_tax ),
396
+ '_line_subtotal_tax' => array( $order_total_discount_tax ),
397
+ ),
398
+ );
399
+ }
400
+
401
  // ITEMS LOOP //
402
  $item_counter = 0;
403
  foreach ( $the_items as $item ) {
408
  $item_tax = $the_order->get_item_tax( $item, true );
409
  $item_total_incl_tax = $the_order->get_item_total( $item, true, true );
410
  $item_total_excl_tax_formatted = wc_price( $item_total_excl_tax, $order_currency_array );
411
+ $item_total_tax_formatted = wc_price( $item_tax, $order_currency_array );
412
  $item_total_incl_tax_formatted = wc_price( $item_total_incl_tax, $order_currency_array );
413
  // Line Prices
414
  $line_total_excl_tax = $the_order->get_line_total( $item, false );//$the_order->get_line_subtotal( $item, false, true );//$item['line_subtotal'];//$item['line_total'];
415
  $line_tax = $the_order->get_line_tax( $item );//$item['line_tax'];
416
+ $line_total_tax_percent = round( ( $item['line_tax'] / $item['line_subtotal'] * 100 ), 2 );
417
  $line_total_incl_tax = $the_order->get_line_total( $item, true );//$line_total_excl_tax + $line_tax;
418
  $line_total_excl_tax_formatted = wc_price( $line_total_excl_tax, $order_currency_array );
419
+ $line_total_tax_formatted = wc_price( $line_tax, $order_currency_array );
420
  $line_total_incl_tax_formatted = wc_price( $line_total_incl_tax, $order_currency_array );
421
  // Item Quantity
422
  $item_quantity = $item['qty'];
444
  }
445
  $html .= '</tbody></table>';
446
 
447
+
448
  // ORDER TOTALS //
449
  $html .= '<p><table class="pdf_invoice_totals_table_wcj"><tbody>';
450
  // SUBTOTAL
451
+ //$html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_subtotal_text' ) . '</th><td>' . wc_price( ( $order_subtotal + $order_total_discount_excl_tax ), $order_currency_array ) . '</td></tr>';
452
  $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_subtotal_text' ) . '</th><td>' . wc_price( $order_subtotal, $order_currency_array ) . '</td></tr>';
 
 
 
453
  // SHIPPING
454
+ if ( ( '' === get_option( 'wcj_pdf_invoices_display_shipping_as_item_text' ) ) &&
455
+ ( $order_total_shipping > 0 ) )
456
+ $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_shipping_text' ) . '</th><td>' . wc_price( $order_total_shipping, $order_currency_array ) . '</td></tr>';
457
  // DISCOUNT
458
+ if ( ( '' === get_option( 'wcj_pdf_invoices_display_discount_as_item_text' ) ) &&
459
+ ( 0 != $order_total_discount ) )
460
+ $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_discount_text' ) . '</th><td>-' . wc_price( ( $order_total_discount + $order_total_discount_tax ), $order_currency_array ) . '</td></tr>';
461
+ // SUBTOTAL2 - with discount and shipping
462
+ if ( $order_total_excl_tax != $order_subtotal )
463
+ $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_total_excl_tax_text' ) . '</th><td>' . wc_price( $order_total_excl_tax, $order_currency_array ) . '</td></tr>';
464
+ // TAXES
465
+ if ( 0 != $order_total_tax )
466
+ $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_total_tax_text' ) . '</th><td>' . wc_price( $order_total_tax, $order_currency_array ) . '</td></tr>';
467
+ /*// DISCOUNT
468
  if ( $order_total_discount != 0 )
469
+ $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_discount_text' ) . '</th><td>-' . wc_price( $order_total_discount, $order_currency_array ) . '</td></tr>';*/
470
  // TOTAL
471
  $html .= '<tr><th>' . get_option( 'wcj_pdf_invoices_order_total_text' ) . '</th><td>' . $the_order->get_formatted_order_total() . '</td></tr>';
472
  $html .= '</tbody></table></p>';
669
  array( 'title' => __( 'Items', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_pdf_invoices_items_options' ),
670
 
671
  array(
672
+ 'title' => __( 'Items Table Heading Text', 'woocommerce-jetpack' ),
673
  //'desc_tip' => __( 'Items text', 'woocommerce-jetpack' ),
674
  'id' => 'wcj_pdf_invoices_items_text',
675
  'default' => __( 'Items', 'woocommerce-jetpack' ),
677
  'css' => 'width:33%;min-width:300px;',
678
  ),
679
 
680
+ array(
681
+ 'title' => __( 'Shipping as Item', 'woocommerce-jetpack' ),
682
+ 'desc_tip' => __( 'Leave blank to disable', 'woocommerce-jetpack' ),
683
+ 'desc' => __( 'Display shipping as item', 'woocommerce-jetpack' ),
684
+ //'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
685
+ 'id' => 'wcj_pdf_invoices_display_shipping_as_item_text',
686
+ 'default' => '',
687
+ 'type' => 'text',
688
+ //'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
689
+ ),
690
+
691
+ array(
692
+ 'title' => __( 'Discount as Item', 'woocommerce-jetpack' ),
693
+ 'desc_tip' => __( 'Leave blank to disable', 'woocommerce-jetpack' ),
694
+ 'desc' => __( 'Display discount as item', 'woocommerce-jetpack' ),
695
+ //'desc_tip' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
696
+ 'id' => 'wcj_pdf_invoices_display_discount_as_item_text',
697
+ 'default' => '',
698
+ 'type' => 'text',
699
+ //'custom_attributes' => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
700
+ ),
701
+
702
  array( 'type' => 'sectionend', 'id' => 'wcj_pdf_invoices_items_options' ),
703
 
704
  array( 'title' => __( 'Items Columns', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you set column names in invoice items table. You can disable some columns by leaving blank column name.', 'woocommerce-jetpack' ), 'id' => 'wcj_pdf_invoices_items_columns_options' ),
805
  'type' => 'text',
806
  'css' => 'width:33%;min-width:300px;',
807
  ),
808
+
809
  array(
810
+ 'title' => __( 'Total Discount', 'woocommerce-jetpack' ),
811
+ //'desc_tip' => __( 'Total Discount text', 'woocommerce-jetpack' ),
812
+ 'id' => 'wcj_pdf_invoices_order_discount_text',
813
+ 'default' => __( 'Discount', 'woocommerce-jetpack' ),
814
  'type' => 'text',
815
  'css' => 'width:33%;min-width:300px;',
816
  ),
823
  'type' => 'text',
824
  'css' => 'width:33%;min-width:300px;',
825
  ),
826
+
827
+ array(
828
+ 'title' => __( 'Order Total (TAX excl.)', 'woocommerce-jetpack' ),
829
+ 'desc_tip' => __( 'Order Total (TAX excl.) = Total - Taxes. Shown only if discount or shipping is not equal to zero. In other words: if "Order Total (TAX excl.)" not equal to "Order Subtotal"', 'woocommerce-jetpack' ),
830
+ 'id' => 'wcj_pdf_invoices_order_total_excl_tax_text',
831
+ 'default' => __( 'Order Total (TAX excl.)', 'woocommerce-jetpack' ),
832
+ 'type' => 'text',
833
+ 'css' => 'width:33%;min-width:300px;',
834
+ ),
835
 
836
  array(
837
+ 'title' => __( 'Order Total Taxes', 'woocommerce-jetpack' ),
838
+ //'desc_tip' => __( 'Order Subtotal = Total - Taxes - Shipping - Discounts', 'woocommerce-jetpack' ),
839
+ 'id' => 'wcj_pdf_invoices_order_total_tax_text',
840
+ 'default' => __( 'Taxes', 'woocommerce-jetpack' ),
841
  'type' => 'text',
842
  'css' => 'width:33%;min-width:300px;',
843
  ),
includes/class-wcj-price-labels.php CHANGED
@@ -4,10 +4,10 @@
4
  *
5
  * The WooCommerce Jetpack Price Labels class.
6
  *
7
- * @class WCJ_Price_Labels
8
- * @version 1.0.0
9
  * @category Class
10
- * @author Algoritmika Ltd.
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -25,13 +25,14 @@ class WCJ_Price_Labels {
25
  '_between' => 'Between the regular and sale price',
26
  '_after' => 'After the price',
27
  );
28
- public $custom_tab_section_variations = array ( '_text', '_enabled', '_home', '_products', '_single', /*'_simple',*/ '_variable', '_variation', /*'_grouped',*/ );
29
  public $custom_tab_section_variations_titles = array (
30
  '_text' => 'The label',
31
  '_enabled' => 'Enable',// for compatibility with Custom Price Label Pro plugin should use ''
32
  '_home' => 'Hide on home page',
33
  '_products' => 'Hide on products page',
34
  '_single' => 'Hide on single',
 
35
  //'_simple' => 'Hide for simple product',
36
  '_variable' => 'Hide for variable product (main price) - ignored if product type is not variable',
37
  '_variation' => 'Hide for each variation of variable product - ignored if product type is not variable',
@@ -270,7 +271,8 @@ class WCJ_Price_Labels {
270
  if (
271
  ( ( $labels_array['variation_home'] == 'off' ) && ( is_front_page() ) ) ||
272
  ( ( $labels_array['variation_products'] == 'off' ) && ( is_archive() ) ) ||
273
- ( ( $labels_array['variation_single'] == 'off' ) && ( is_single() ) )
 
274
  )
275
  {
276
  //$current_filter_name = current_filter();
4
  *
5
  * The WooCommerce Jetpack Price Labels class.
6
  *
7
+ * @class WCJ_Price_Labels
8
+ * @version 1.0.1
9
  * @category Class
10
+ * @author Algoritmika Ltd.
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
25
  '_between' => 'Between the regular and sale price',
26
  '_after' => 'After the price',
27
  );
28
+ public $custom_tab_section_variations = array ( '_text', '_enabled', '_home', '_products', '_single', '_page', /*'_simple',*/ '_variable', '_variation', /*'_grouped',*/ );
29
  public $custom_tab_section_variations_titles = array (
30
  '_text' => 'The label',
31
  '_enabled' => 'Enable',// for compatibility with Custom Price Label Pro plugin should use ''
32
  '_home' => 'Hide on home page',
33
  '_products' => 'Hide on products page',
34
  '_single' => 'Hide on single',
35
+ '_page' => 'Hide on pages',
36
  //'_simple' => 'Hide for simple product',
37
  '_variable' => 'Hide for variable product (main price) - ignored if product type is not variable',
38
  '_variation' => 'Hide for each variation of variable product - ignored if product type is not variable',
271
  if (
272
  ( ( $labels_array['variation_home'] == 'off' ) && ( is_front_page() ) ) ||
273
  ( ( $labels_array['variation_products'] == 'off' ) && ( is_archive() ) ) ||
274
+ ( ( $labels_array['variation_single'] == 'off' ) && ( is_single() ) ) ||
275
+ ( ( $labels_array['variation_page'] == 'off' ) && ( is_page() ) )
276
  )
277
  {
278
  //$current_filter_name = current_filter();
includes/class-wcj-reports.php ADDED
@@ -0,0 +1,498 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Jetpack Reports
4
+ *
5
+ * The WooCommerce Jetpack Reports class.
6
+ *
7
+ * @class WCJ_Reports
8
+ * @version 1.0.0
9
+ * @package WC_Jetpack/Classes
10
+ * @category Class
11
+ * @author Algoritmika Ltd.
12
+ */
13
+
14
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15
+
16
+ if ( ! class_exists( 'WCJ_Reports' ) ) :
17
+
18
+ class WCJ_Reports {
19
+
20
+ /**
21
+ * Constructor.
22
+ */
23
+ public function __construct() {
24
+
25
+ // Main hooks
26
+ if ( get_option( 'wcj_reports_enabled' ) == 'yes' ) {
27
+ if ( is_admin() ) {
28
+ add_filter( 'wcj_tools_tabs', array( $this, 'add_reports_tool_tab' ), 100 );
29
+ add_action( 'wcj_tools_reports', array( $this, 'create_reports_tool' ), 100 );
30
+ }
31
+ }
32
+
33
+ // Settings hooks
34
+ add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) ); // Add section to WooCommerce > Settings > Jetpack
35
+ add_filter( 'wcj_settings_reports', array( $this, 'get_settings' ), 100 ); // Add the settings
36
+ add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 ); // Add Enable option to Jetpack Settings Dashboard
37
+ }
38
+
39
+ /**
40
+ * Add tab to WooCommerce > Jetpack Tools.
41
+ */
42
+ public function add_reports_tool_tab( $tabs ) {
43
+ $tabs[] = array(
44
+ 'id' => 'reports',
45
+ 'title' => __( 'Smart Reports', 'woocommerce-jetpack' ),
46
+ );
47
+ return $tabs;
48
+ }
49
+
50
+ /**
51
+ * Add Enable option to Jetpack Settings Dashboard.
52
+ */
53
+ public function add_enabled_option( $settings ) {
54
+
55
+ $all_settings = $this->get_settings();
56
+ $settings[] = $all_settings[1];
57
+
58
+ return $settings;
59
+ }
60
+
61
+ /*
62
+ * Add the settings.
63
+ */
64
+ function get_settings() {
65
+
66
+ $settings = array(
67
+
68
+ array( 'title' => __( 'Reports Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_reports_options' ),
69
+
70
+ array(
71
+ 'title' => __( 'Reports', 'woocommerce-jetpack' ),
72
+ 'desc' => __( 'Enable the Reports feature', 'woocommerce-jetpack' ),
73
+ 'id' => 'wcj_reports_enabled',
74
+ 'default' => 'yes',
75
+ 'type' => 'checkbox'
76
+ ),
77
+
78
+ array( 'type' => 'sectionend', 'id' => 'wcj_reports_options' ),
79
+ );
80
+
81
+ return $settings;
82
+ }
83
+
84
+ /*
85
+ * Add settings section to WooCommerce > Settings > Jetpack.
86
+ */
87
+ function settings_section( $sections ) {
88
+
89
+ $sections['reports'] = __( 'Smart Reports', 'woocommerce-jetpack' );
90
+
91
+ return $sections;
92
+ }
93
+
94
+ /*
95
+ * add_reports_tool.
96
+ *
97
+ public function add_reports_tool() {
98
+ add_submenu_page( 'woocommerce', 'Jetpack - Smart Reports', 'Smart Reports', 'manage_options', 'woocommerce-jetpack-reports', array( $this, 'create_reports_tool' ) );
99
+ }
100
+
101
+ /*
102
+ * get_products_info.
103
+ */
104
+ public function get_products_info( &$products_info ) {
105
+
106
+ $args = array(
107
+ 'post_type' => 'product',
108
+ 'posts_per_page' => -1
109
+ );
110
+
111
+ $loop = new WP_Query( $args );
112
+ if ( $loop->have_posts() ) {
113
+
114
+ while ( $loop->have_posts() ) : $loop->the_post();
115
+
116
+ $the_ID = get_the_ID();
117
+ $the_product = new WC_Product( $the_ID );
118
+ $the_price = $the_product->get_price();
119
+ $the_stock = $the_product->get_total_stock();
120
+ $the_title = get_the_title();
121
+ $the_date = get_the_date();
122
+ $the_permalink = get_the_permalink();
123
+ $total_sales = get_post_custom( $the_ID )['total_sales'][0];
124
+
125
+ $products_info[$the_ID] = array(
126
+ 'ID' => $the_ID,
127
+ 'title' => $the_title,
128
+ 'permalink' => $the_permalink,
129
+ 'price' => $the_price,
130
+ 'stock' => $the_stock,
131
+ 'stock_price' => $the_price * $the_stock,
132
+ 'total_sales' => $total_sales,
133
+ 'date_added' => $the_date,
134
+ 'last_sale' => 0,
135
+ 'sales_in_period' => array(
136
+ 7 => 0,
137
+ 14 => 0,
138
+ 30 => 0,
139
+ 60 => 0,
140
+ 90 => 0,
141
+ 180 => 0,
142
+ 360 => 0,
143
+ ),
144
+ );
145
+
146
+ endwhile;
147
+ }
148
+ }
149
+
150
+ /*
151
+ * get_orders_info.
152
+ */
153
+ public function get_orders_info( &$products_info ) {
154
+
155
+ $args_orders = array(
156
+ 'post_type' => 'shop_order',
157
+ 'post_status' => 'publish',
158
+ 'posts_per_page' => -1,
159
+ 'orderby' => 'date',
160
+ 'order' => 'DESC',
161
+ 'tax_query' => '',
162
+ );
163
+
164
+ $loop_orders = new WP_Query( $args_orders );
165
+ while ( $loop_orders->have_posts() ) : $loop_orders->the_post();
166
+
167
+ $order_id = $loop_orders->post->ID;
168
+ $order = new WC_Order( $order_id );
169
+ $items = $order->get_items();
170
+
171
+ foreach ( $items as $item ) {
172
+
173
+ $the_timestamp = get_the_time( 'U' );
174
+ $now_time = time();
175
+ $order_age = ( $now_time - $the_timestamp );
176
+ $one_day_seconds = ( 24 * 60 * 60 );
177
+
178
+ foreach ( $products_info[$item['product_id']]['sales_in_period'] as $the_period => $the_value ) {
179
+ if ( $order_age < ( $the_period * $one_day_seconds ) ) {
180
+ $products_info[$item['product_id']]['sales_in_period'][$the_period] += $item['qty'];
181
+ //$products_info[$item['product_id']]['orders_in_period'][$the_period]++;
182
+ }
183
+ }
184
+
185
+ if ( 0 == $products_info[$item['product_id']]['last_sale'] ) {
186
+ $products_info[$item['product_id']]['last_sale'] = $the_timestamp;
187
+ }
188
+
189
+ }
190
+
191
+ endwhile;
192
+
193
+ //wp_reset_query();
194
+ }
195
+
196
+ /*
197
+ * count_info.
198
+ */
199
+ public function count_info( &$info, &$products_info ) {
200
+
201
+ $info['total_stock_price'] = 0;
202
+ $info['stock_price_average'] = 0;
203
+ $info['stock_average'] = 0;
204
+ $info['sales_in_period_average'] = 0;
205
+ $stock_non_zero_number = 0;
206
+
207
+ foreach ( $products_info as $product_info ) {
208
+
209
+ if ( $product_info['sales_in_period'][$this->period] > 0 )
210
+ $products_info[ $product_info['ID'] ]['stock_to_sales'] = $product_info['stock'] / $product_info['sales_in_period'][$this->period];
211
+ else
212
+ $products_info[ $product_info['ID'] ]['stock_to_sales'] = 0;
213
+
214
+ if ( $product_info['stock_price'] > 0 ) {
215
+ $info['stock_price_average'] += $product_info['stock_price'];
216
+ $info['stock_average'] = $product_info['stock'];
217
+ $info['sales_in_period_average'] += $product_info['sales_in_period'][$this->period];
218
+ $stock_non_zero_number++;
219
+ }
220
+
221
+ $info['total_stock_price'] += $product_info['stock_price'];
222
+ }
223
+
224
+ $info['stock_price_average'] /= $stock_non_zero_number;
225
+ $info['stock_average'] /= $stock_non_zero_number;
226
+ $info['sales_in_period_average'] /= $stock_non_zero_number;
227
+ }
228
+
229
+ /*
230
+ * sort_products_info.
231
+ */
232
+ public function sort_products_info( &$products_info, $field_name, $second_field_name = '', $order_of_sorting = SORT_DESC ) {
233
+ $field_name_array = array();
234
+ foreach ( $products_info as $key => $row ) {
235
+ if ( '' == $second_field_name ) $field_name_array[ $key ] = $row[ $field_name ];
236
+ else $field_name_array[ $key ] = $row[ $field_name ][ $second_field_name ];
237
+ }
238
+ array_multisort( $field_name_array, $order_of_sorting, $products_info );
239
+ }
240
+
241
+ /*
242
+ * output_submenu.
243
+ */
244
+ public function output_submenu() {
245
+ ?><ul class="subsubsub"><?php
246
+ $periods = array( 90, 30, 7, );
247
+ foreach ( $periods as $the_period ) {
248
+ echo '<li><a href="' . get_admin_url() . 'admin.php?page=wcj-tools&tab=' . $_GET['tab'] . '&report=' . $this->report . '&period=' . $the_period . '" class="">' . $the_period . ' days</a> | </li>';
249
+ }
250
+ ?></ul>
251
+ <br class="clear">
252
+ <ul class="subsubsub"><?php
253
+ foreach ( $this->reports_info as $report => $report_info ) {
254
+ echo '<li><a href="' . get_admin_url() . 'admin.php?page=wcj-tools&tab=' . $_GET['tab'] . '&report=' . $report . '" class="">' . $report_info['title'] . '</a> | </li>';
255
+ }
256
+ ?></ul>
257
+ <br class="clear">
258
+ <h3><?php _e( 'Reports', 'woocommerce-jetpack' ); ?></h3><?php
259
+ }
260
+
261
+ /*
262
+ * output_report.
263
+ */
264
+ public function output_report( $products_info, $info, $report_info ) {
265
+
266
+ // Style
267
+ $html = '<style>';
268
+ $html .= '.wcj_report_table { width: 90%; border-collapse: collapse; }';
269
+ $html .= '.wcj_report_table th { border: 1px solid black; }';
270
+ $html .= '.wcj_report_table td { border: 1px solid black; text-align: right; }';
271
+ $html .= '.wcj_report_table_sales_columns { background-color: #F6F6F6; }';
272
+ $html .= '.widefat { width: 90%; }';
273
+ $html .= '</style>';
274
+
275
+ // Products table - header
276
+ $html .= '<table class="widefat"><tbody>';
277
+ $html .= '<tr>';
278
+ $html .= '<th>#</th>';
279
+ $html .= '<th>' . __( 'Product', 'woocommerce-jetpack' ) . '</th>';
280
+ $html .= '<th>' . __( 'Price', 'woocommerce-jetpack' ) . '</th>';
281
+ $html .= '<th>' . __( 'Stock', 'woocommerce-jetpack' ) . '</th>';
282
+ $html .= '<th>' . __( 'Stock price', 'woocommerce-jetpack' ) . '</th>';
283
+
284
+ $html .= '<th class="wcj_report_table_sales_columns">' . __( 'Last sale', 'woocommerce-jetpack' ) . '</th>';
285
+ $html .= '<th class="wcj_report_table_sales_columns">' . sprintf( __( 'Sales in last %s days', 'woocommerce-jetpack' ), $this->period ) . '</th>';
286
+ $html .= '<th class="wcj_report_table_sales_columns">' . __( 'Sales in previous period', 'woocommerce-jetpack' ) . '</th>';
287
+ $html .= '<th class="wcj_report_table_sales_columns">' . __( 'Total sales', 'woocommerce-jetpack' ) . '</th>';
288
+ $html .= '</tr>';
289
+
290
+ // Products table - info loop
291
+ $total_current_stock_price = 0;
292
+ $product_counter = 0;
293
+ foreach ( $products_info as $product_info ) {
294
+
295
+ /*if ( ( time() - strtotime( $product_info['date_added'] ) ) < 60*60*24*30 )
296
+ continue;*/
297
+
298
+ if (
299
+ /*(
300
+ ( $info['sales_in_90_days_average'] > $product_info['sales_in_90_days'] ) &&
301
+ ( $info['stock_price_average'] < $product_info['stock_price'] ) &&
302
+ //( 0 != $product_info['stock'] ) &&
303
+ ( 'bad_stock' === $report_info['id'] )
304
+ ) || */
305
+ (
306
+ ( $info['stock_price_average'] < $product_info['stock_price'] ) &&
307
+ //( 0 != $product_info['stock'] ) &&
308
+ ( 'most_stock_price' === $report_info['id'] )
309
+ ) ||
310
+ (
311
+ ( $product_info['sales_in_period'][$this->period] < $info['sales_in_period_average'] ) &&
312
+ ( $product_info['stock'] > 0 ) &&
313
+ ( 'bad_sales' === $report_info['id'] )
314
+ ) ||
315
+ (
316
+ ( 0 == $product_info['sales_in_period'][$this->period] ) &&
317
+ ( $product_info['stock'] > 0 ) &&
318
+ ( 'no_sales' === $report_info['id'] )
319
+ ) ||
320
+ /*(
321
+ ( $info['sales_in_90_days_average'] < $product_info['sales_in_90_days'] ) &&
322
+ ( 'good_sales' === $report_info['id'] )
323
+ ) ||
324
+ (
325
+ ( $info['sales_in_90_days_average'] < $product_info['sales_in_90_days'] ) &&
326
+ //( $info['stock_average'] > $product_info['stock'] ) &&
327
+ // ( $product_info['sales_in_90_days'] > $product_info['stock'] ) &&
328
+ ( ( $product_info['stock'] / $product_info['sales_in_90_days'] ) <= 0.33 ) &&
329
+ ( '' !== $product_info['stock'] ) &&
330
+ ( 'good_sales_low_stock' === $report_info['id'] )
331
+ ) ||*/
332
+ (
333
+ ( $product_info['stock'] > 0 ) &&
334
+ ( 'on_stock' === $report_info['id'] )
335
+ ) ||
336
+ (
337
+ //( 0 != $product_info['stock'] ) &&
338
+ ( 'any_sale' === $report_info['id'] )
339
+ ) ||
340
+ (
341
+ //( $info['sales_in_90_days_average'] < $product_info['sales_in_90_days'] ) &&
342
+ ( ( $product_info['sales_in_period'][ $this->period * 2 ] - $product_info['sales_in_period'][$this->period] ) < $product_info['sales_in_period'][$this->period] ) &&
343
+ ( 'sales_up' === $report_info['id'] )
344
+ ) ||
345
+ (
346
+ ( ( $product_info['sales_in_period'][180] - $product_info['sales_in_period'][90] ) > $product_info['sales_in_period'][90] ) &&
347
+ ( 'sales_down' === $report_info['id'] )
348
+ )
349
+ )
350
+ {
351
+ $total_current_stock_price += $product_info['stock_price'];
352
+ $product_counter++;
353
+ $html .= '<tr>';
354
+ $html .= '<td>' . $product_counter . '</td>';
355
+ $html .= '<th>' . '<a href='. $product_info['permalink'] . '>' . $product_info['title'] . '</a>' . '</th>';
356
+ $html .= '<td>' . wc_price( $product_info['price'] ) . '</td>';
357
+ $html .= '<td>' . $product_info['stock'] . '</td>';
358
+ $html .= '<td>' . wc_price( $product_info['stock_price'] ) . '</td>';
359
+
360
+ $html .= '<td class="wcj_report_table_sales_columns">';
361
+ if ( 0 == $product_info['last_sale'] ) $html .= __( 'No sales yet', 'woocommerce-jetpack' );
362
+ else $html .= date( get_option( 'date_format' ), $product_info['last_sale'] );
363
+ $html .= '</td>';
364
+ $html .= '<td class="wcj_report_table_sales_columns">' . $product_info['sales_in_period'][ $this->period ] . '</td>';
365
+ $html .= '<td class="wcj_report_table_sales_columns">' . $product_info['sales_in_period'][ $this->period * 2 ] . '</td>';
366
+ //$html .= '<td>' . $product_info['orders_in_90_days'] . '</td>';
367
+ $html .= '<td class="wcj_report_table_sales_columns">' . $product_info['total_sales'] . '</td>';
368
+ //$html .= '<td>' . $product_info['date_added'] . '</td>';
369
+ //$html .= '<td>' . wc_price( $total_current_stock_price ) . ' (' . number_format( ( ( $total_current_stock_price / $info['total_stock_price'] ) * 100 ), 2, '.', '' ) . ')' . '</td>';
370
+ $html .= '</tr>';
371
+ }
372
+ }
373
+ $html .= '</tbody></table>';
374
+
375
+ $html_header = '<h4>' . $report_info['title'] . ': ' . $report_info['desc'] . '</h4>';
376
+ $html_header .= '<div class="updated1">' . __( 'Total current stock value: ', 'woocommerce-jetpack' ) . wc_price( $total_current_stock_price ) . '</div>';
377
+ $html_header .= '<div class="updated1">' . __( 'Total stock value: ', 'woocommerce-jetpack' ) . wc_price( $info['total_stock_price'] ) . '</div>';
378
+ //$html_header .= '<div class="updated1">' . __( 'Product sales in 90 average: ', 'woocommerce-jetpack' ) . number_format( $info['sales_in_90_days_average'], 2, '.', '' ) . '</div>';
379
+ $html_header .= '<div class="updated1">' . __( 'Product stock value average: ', 'woocommerce-jetpack' ) . wc_price( $info['stock_price_average'] ) . '</div>';
380
+ $html_header .= '<div class="updated1">' . __( 'Product stock average: ', 'woocommerce-jetpack' ) . number_format( $info['stock_average'], 2, '.', '' ) . '</div>';
381
+
382
+
383
+ // Report title and description
384
+ //$html_report_title = '<h4>' . $report_info['title'] . ': ' . $report_info['desc'] . '</h4>';
385
+ //$html_report_title = sprintf( $html_report_title, number_format( $info['sales_in_90_days_average'], 2, '.', '' ) );
386
+
387
+ echo $html_header . $html;
388
+ }
389
+
390
+ /*
391
+ * create_reports_tool.
392
+ */
393
+ public function create_reports_tool() {
394
+
395
+ $this->reports_info = array(
396
+ 'bad_stock' => array(
397
+ 'id' => 'bad_stock',
398
+ 'title' => __( 'Low sales - big stock', 'woocommerce-jetpack' ),
399
+ 'desc' => __( 'Report shows you products with stock bigger than <span style="color:green;">%s</span> average, but with sales in last 90 days lower than average. Sorted by total stock value.', 'woocommerce-jetpack' ),
400
+ //__( 'You should consider setting lower prices for products in table below. These products have: a) less than average sales in last 90 days, and b) larger than average stock price.', 'woocommerce-jetpack' ),
401
+ ),
402
+ 'bad_sales' => array(
403
+ 'id' => 'bad_sales',
404
+ 'title' => __( 'Low sales - on stock', 'woocommerce-jetpack' ),
405
+ 'desc' => __( 'Report shows you products on stock, but with sales in last 90 days lower than average. Sorted by total stock value.', 'woocommerce-jetpack' ),
406
+ ),
407
+ 'no_sales' => array(
408
+ 'id' => 'no_sales',
409
+ 'title' => __( 'No sales - on stock', 'woocommerce-jetpack' ),
410
+ 'desc' => __( 'Report shows you products on stock, but with not a single sale in last 90 days. Sorted by total stock value.', 'woocommerce-jetpack' ),
411
+ ),
412
+ 'most_stock_price' => array(
413
+ 'id' => 'most_stock_price',
414
+ 'title' => __( 'Most stock price', 'woocommerce-jetpack' ),
415
+ 'desc' => __( 'Report shows you products with stock bigger than average. Sorted by total stock value.', 'woocommerce-jetpack' ),
416
+ ),
417
+ 'good_sales' => array(
418
+ 'id' => 'good_sales',
419
+ 'title' => __( 'Good sales', 'woocommerce-jetpack' ),
420
+ 'desc' => __( 'Report shows you products with sales in last 90 days higher than average. Sorted by total stock value.', 'woocommerce-jetpack' ),
421
+ ),
422
+ 'good_sales_low_stock' => array(
423
+ 'id' => 'good_sales_low_stock',
424
+ 'title' => __( 'Good sales - low stock', 'woocommerce-jetpack' ),
425
+ 'desc' => __( 'Report shows you products with sales in last 90 days higher than average, but stock lower than products sales in 90 days. Sorted by total stock value.', 'woocommerce-jetpack' ),
426
+ ),
427
+ 'on_stock' => array(
428
+ 'id' => 'on_stock',
429
+ 'title' => __( 'on_stock', 'woocommerce-jetpack' ),
430
+ 'desc' => __( 'on_stock.', 'woocommerce-jetpack' ),
431
+ ),
432
+ 'any_sale' => array(
433
+ 'id' => 'any_sale',
434
+ 'title' => __( 'any_sale', 'woocommerce-jetpack' ),
435
+ 'desc' => __( 'any_sale.', 'woocommerce-jetpack' ),
436
+ ),
437
+ 'sales_up' => array(
438
+ 'id' => 'sales_up',
439
+ 'title' => __( 'Sales up', 'woocommerce-jetpack' ),
440
+ 'desc' => __( 'with sales more than average and up in last 90 days comparing to 90 days before.', 'woocommerce-jetpack' ),
441
+ 'desc_sort' => __( 'sales in 90 days', 'woocommerce-jetpack' ),
442
+ ),
443
+ 'sales_down' => array(
444
+ 'id' => 'sales_down',
445
+ 'title' => __( 'sales_down', 'woocommerce-jetpack' ),
446
+ 'desc' => __( 'sales_down.', 'woocommerce-jetpack' ),
447
+ ),
448
+ );
449
+
450
+ $this->output_submenu();
451
+
452
+ if ( isset( $_GET['report'] ) ) {
453
+
454
+ $time = microtime( true );
455
+
456
+ $this->report = $_GET['report'];
457
+
458
+ $this->period = 90; // default
459
+ if ( isset( $_GET['period'] ) )
460
+ $this->period = $_GET['period'];
461
+
462
+ $products_info = array();
463
+ $this->get_products_info( $products_info );
464
+ // if ( 'most_stock_price' !== $this->report )
465
+ $this->get_orders_info( $products_info );
466
+ //wp_reset_postdata();
467
+ $info = array();
468
+ $this->count_info( $info, $products_info );
469
+
470
+ $this->sort_products_info( $products_info, 'stock_price' );
471
+
472
+ if ( 'sales_up' === $this->report )
473
+ $this->sort_products_info( $products_info, 'sales_in_period', $this->period );
474
+
475
+ if ( 'good_sales_low_stock' === $this->report )
476
+ $this->sort_products_info( $products_info, 'stock_to_sales', $this->period );
477
+
478
+
479
+ $this->output_report( $products_info, $info, $this->reports_info[$this->report] );
480
+
481
+ echo 'Time Elapsed: ' . ( microtime( true ) - $time ) . 's';
482
+ echo get_option( 'woocommerce_manage_stock' );
483
+ }
484
+ else {
485
+ echo '<p>' . __( 'Here you can generate reports. Some reports are generated using all your orders and products, so if you have a lot of them - it may take a while.', 'woocommerce-jetpack' ) . '</p>';
486
+ echo '<p>' . __( 'Reports:', 'woocommerce-jetpack' ) . '</p>';
487
+ echo '<ul>';
488
+ foreach ( $this->reports_info as $report => $report_info ) {
489
+ echo '<li><a href="admin.php?page=wcj-tools&tab=reports&report=' . $report . '">' . $report_info['title'] . '</a> - ' . $report_info['desc'] . '</li>';
490
+ }
491
+ echo '</ul>';
492
+ }
493
+ }
494
+ }
495
+
496
+ endif;
497
+
498
+ return new WCJ_Reports();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://algoritmika.com/donate/
4
  Tags: woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon,auto-complete all orders,custom order statuses,custom order status,remove text from price
5
  Requires at least: 3.9.1
6
  Tested up to: 4.0
7
- Stable tag: 1.3.0
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -16,18 +16,18 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
16
 
17
  = Features =
18
 
19
- * Payment Gateways - Add and customize simple custom offline payment gateway. Change icons (images) for all default (COD - Cash on Delivery, Cheque, BACS, Mijireh Checkout, PayPal) WooCommerce payment gateways.
 
 
 
20
  * Orders - Sequential order numbering, custom order number prefix and number width. Set minimum order amount.
 
 
21
  * Checkout - Customize checkout fields: disable/enable fields, set required, change labels and/or placeholders.
22
  * Shipping - Hide shipping when free is available.
23
  * Emails - Add another email recipient(s) to all WooCommerce emails.
24
  * Product Info - Customize single product tabs. Change related products number.
25
  * Cart - Add "Empty Cart" button to cart page, automatically add product to cart on visit.
26
- * Custom Price Labels - Create any custom price label for any product.
27
- * Call for Price - Create any custom price label, like "Call for price", for all products with empty price.
28
- * Currencies - Add all world currencies, change currency symbol.
29
- * PDF Invoices - Add PDF invoices for store owners and for customers.
30
- * More Sorting Options - Add more sorting options or remove sorting at all (including WooCommerce default).
31
  * Add to Cart - Change text for add to cart buttons for each product type. Display "Product already in cart" instead of "Add to cart" button. Redirect add to cart button to any url (e.g. checkout page).
32
  * Old Slugs - Remove old product slugs.
33
 
@@ -63,19 +63,41 @@ Please let us know if you want anything added to list by <a href="http://woojetp
63
 
64
  If you wish that some task would go up the queue to make it faster, please contact us by <a href="http://woojetpack.com/contact-us/">filling this form</a>. We are listening carefully to our users!
65
 
 
 
 
 
 
 
 
 
 
66
  1. Upgrade Feature - Custom Price Labels - Add "global labels".
67
  1. Upgrade Feature - Shipping - Add "Custom Shipping Method".
68
  1. Upgrade Feature - Product Info - Add "total sales" and "time since last sale" info.
69
  1. Upgrade Feature - Orders - Custom Order Statuses - Add options for selecting icons and color.
 
 
70
  1. New Feature - Products per Page - Add "products per page" option for customers (i.e. front end).
 
 
71
  1. Upgrade Feature - Custom Price Labels - Add "local remove".
72
  1. Upgrade Feature - Orders - Bulk orders (start from global discount for all products; later - discounts for individual products).
73
  1. Upgrade Feature - Custom Price Labels - Add different labels for archives, single, homepage, related. Add option to select which price hooks to use. Different labels for variable and variation.
74
- 1. Dev - Recheck, comment the code.
75
  1. Upgrade Feature - Cart - Cart discount.
76
 
 
 
 
77
  == Changelog ==
78
 
 
 
 
 
 
 
 
79
  = 1.3.0 - 25/08/2014 =
80
  * Feature Upgraded - PDF Invoices - Major upgrade: single item price, item and line taxes, payment and shipping methods, additional footer, font size, custom css added.
81
 
@@ -83,7 +105,7 @@ If you wish that some task would go up the queue to make it faster, please conta
83
  * Feature Upgraded - Orders - Auto-complete all orders option added.
84
  * Feature Upgraded - Orders - Custom Order Statuses added.
85
  * Feature Upgraded - Custom Price Labels - Added global remove text from price option.
86
- * Feature Upgraded - Custom Price Labels - Added compatibility with bookable products.
87
  * Dev - Links to Jetpack settings added to plugins page and to WooCommerce back end menu.
88
  * Feature Upgraded - Checkout - Customizable "Place order" ("Order now") button text.
89
 
4
  Tags: woocommerce,woocommerce jetpack,custom price labels,call for price,currency symbol,remove sorting,remove old product slugs,add to cart text,order number,sequential order numbering,pdf invoice,pdf invoices,already in cart,empty cart,redirect to checkout,minimum order amount,customize checkout fields,checkout fields,email,customize product tabs,product tabs,related products number,empty cart,redirect add to cart,redirect to checkout,product already in cart,custom payment gateway,payment gateway icon,auto-complete all orders,custom order statuses,custom order status,remove text from price
5
  Requires at least: 3.9.1
6
  Tested up to: 4.0
7
+ Stable tag: 1.4.0
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
16
 
17
  = Features =
18
 
19
+ * Custom Price Labels - Create any custom price label for any product.
20
+ * Call for Price - Create any custom price label, like "Call for price", for all products with empty price.
21
+ * Currencies - Add all world currencies, change currency symbol.
22
+ * PDF Invoices - Add PDF invoices for store owners and for customers.
23
  * Orders - Sequential order numbering, custom order number prefix and number width. Set minimum order amount.
24
+ * More Sorting Options - Add more sorting options or remove sorting at all (including WooCommerce default).
25
+ * Payment Gateways - Add and customize simple custom offline payment gateway. Change icons (images) for all default (COD - Cash on Delivery, Cheque, BACS, Mijireh Checkout, PayPal) WooCommerce payment gateways.
26
  * Checkout - Customize checkout fields: disable/enable fields, set required, change labels and/or placeholders.
27
  * Shipping - Hide shipping when free is available.
28
  * Emails - Add another email recipient(s) to all WooCommerce emails.
29
  * Product Info - Customize single product tabs. Change related products number.
30
  * Cart - Add "Empty Cart" button to cart page, automatically add product to cart on visit.
 
 
 
 
 
31
  * Add to Cart - Change text for add to cart buttons for each product type. Display "Product already in cart" instead of "Add to cart" button. Redirect add to cart button to any url (e.g. checkout page).
32
  * Old Slugs - Remove old product slugs.
33
 
63
 
64
  If you wish that some task would go up the queue to make it faster, please contact us by <a href="http://woojetpack.com/contact-us/">filling this form</a>. We are listening carefully to our users!
65
 
66
+ = 1.5.0 - 11/09/2014 =
67
+ 1. Fix - Payment Gateways - Instructions are not showing. Suggested by Jen.
68
+ 1. Upgrade Feature - PDF Invoices - Send PDF invoice or link to invoice to the customer. Make this option available for certain payment methods only (user selection). Idea by Jen.
69
+ 1. Upgrade Feature - Shipping - Advance free shipping - Free shipping for multiple country/places. Each country/places different prices. Idea by LQTOYS.
70
+
71
+ = 1.6.0 - 18/09/2014 =
72
+ 1. New Feature - Smart Reports - Various reports based on products prices, sales, stock.
73
+
74
+ = 1.7.0 - 01/10/2014 =
75
  1. Upgrade Feature - Custom Price Labels - Add "global labels".
76
  1. Upgrade Feature - Shipping - Add "Custom Shipping Method".
77
  1. Upgrade Feature - Product Info - Add "total sales" and "time since last sale" info.
78
  1. Upgrade Feature - Orders - Custom Order Statuses - Add options for selecting icons and color.
79
+
80
+ = 1.8.0 - 07/10/2014 =
81
  1. New Feature - Products per Page - Add "products per page" option for customers (i.e. front end).
82
+
83
+ = 1.9.0 - 21/10/2014 =
84
  1. Upgrade Feature - Custom Price Labels - Add "local remove".
85
  1. Upgrade Feature - Orders - Bulk orders (start from global discount for all products; later - discounts for individual products).
86
  1. Upgrade Feature - Custom Price Labels - Add different labels for archives, single, homepage, related. Add option to select which price hooks to use. Different labels for variable and variation.
 
87
  1. Upgrade Feature - Cart - Cart discount.
88
 
89
+ = 2.0.0 - 01/11/2014 =
90
+ 1. Dev - Major source code, documentation, locking mechanism etc. recheck.
91
+
92
  == Changelog ==
93
 
94
+ = 1.4.0 - 07/09/2014 =
95
+ * Dev - Custom Price Labels - Support for price labels showing on Pages, added. Suggested by Axel.
96
+ * Fix - PDF Invoices - Bug with some item table columns not showing, fixed. Suggested by Tomas.
97
+ * Dev - PDF Invoices - Discount as separate item option added.
98
+ * Dev - PDF Invoices - Shipping as separate item option added. Suggested by Tomas.
99
+ * Dev - All tools (i.e. Old Slugs and Custom Order Statuses) moved to WooCommerce > Jetpack Tools.
100
+
101
  = 1.3.0 - 25/08/2014 =
102
  * Feature Upgraded - PDF Invoices - Major upgrade: single item price, item and line taxes, payment and shipping methods, additional footer, font size, custom css added.
103
 
105
  * Feature Upgraded - Orders - Auto-complete all orders option added.
106
  * Feature Upgraded - Orders - Custom Order Statuses added.
107
  * Feature Upgraded - Custom Price Labels - Added global remove text from price option.
108
+ * Feature Upgraded - Custom Price Labels - Added compatibility with bookable products. Suggested by Axel.
109
  * Dev - Links to Jetpack settings added to plugins page and to WooCommerce back end menu.
110
  * Feature Upgraded - Checkout - Customizable "Place order" ("Order now") button text.
111
 
woocommerce-jetpack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WooCommerce Jetpack
4
  Plugin URI: http://woojetpack.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
- Version: 1.3.0
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
@@ -75,11 +75,9 @@ final class WC_Jetpack {
75
 
76
  // Settings
77
  if ( is_admin() ) {
78
-
79
  add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_wcj_settings_tab' ) );
80
- add_filter( 'get_wc_jetpack_plus_message', array( $this, 'display_get_wcj_plus_message' ), 100, 2 );
81
-
82
- add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) );
83
  add_action( 'admin_menu', array( $this, 'jetpack_menu' ), 100 );
84
  }
85
 
@@ -88,10 +86,10 @@ final class WC_Jetpack {
88
  }
89
 
90
  /**
91
- * Addons menu item
92
  */
93
  public function jetpack_menu() {
94
- add_submenu_page( 'woocommerce', __( 'WooCommerce Jetpack', 'woocommerce' ), __( 'Jetpack Settings', 'woocommerce' ) , 'manage_woocommerce', 'admin.php?page=wc-settings&tab=jetpack' );
95
  }
96
 
97
  /**
@@ -117,9 +115,9 @@ final class WC_Jetpack {
117
  }
118
 
119
  /**
120
- * display_get_wcj_plus_message.
121
  */
122
- public function display_get_wcj_plus_message( $value, $message_type ) {
123
 
124
  switch ( $message_type ) {
125
 
@@ -160,6 +158,8 @@ final class WC_Jetpack {
160
  */
161
  private function includes() {
162
 
 
 
163
  $settings = array();
164
 
165
  $settings[] = include_once( 'includes/class-wcj-price-labels.php' );
@@ -177,10 +177,9 @@ final class WC_Jetpack {
177
  $settings[] = include_once( 'includes/class-wcj-orders.php' );
178
  $settings[] = include_once( 'includes/class-wcj-emails.php' );
179
  $settings[] = include_once( 'includes/class-wcj-pdf-invoices.php' );
 
180
  $settings[] = include_once( 'includes/class-wcj-old-slugs.php' );
181
 
182
- //include_once( 'includes/class-wc-gateway-wcj-custom.php' );
183
-
184
  // Add options
185
  if ( is_admin() ) {
186
  foreach ( $settings as $section ) {
3
  Plugin Name: WooCommerce Jetpack
4
  Plugin URI: http://woojetpack.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 1.4.0
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
75
 
76
  // Settings
77
  if ( is_admin() ) {
 
78
  add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_wcj_settings_tab' ) );
79
+ add_filter( 'get_wc_jetpack_plus_message', array( $this, 'get_wcj_plus_message' ), 100, 2 );
80
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) );
 
81
  add_action( 'admin_menu', array( $this, 'jetpack_menu' ), 100 );
82
  }
83
 
86
  }
87
 
88
  /**
89
+ * Add menu item
90
  */
91
  public function jetpack_menu() {
92
+ add_submenu_page( 'woocommerce', __( 'WooCommerce Jetpack', 'woocommerce' ), __( 'Jetpack Settings', 'woocommerce' ) , 'manage_woocommerce', 'admin.php?page=wc-settings&tab=jetpack' );
93
  }
94
 
95
  /**
115
  }
116
 
117
  /**
118
+ * get_wcj_plus_message.
119
  */
120
+ public function get_wcj_plus_message( $value, $message_type ) {
121
 
122
  switch ( $message_type ) {
123
 
158
  */
159
  private function includes() {
160
 
161
+ include_once( 'includes/admin/tools/class-wcj-tools.php' );
162
+
163
  $settings = array();
164
 
165
  $settings[] = include_once( 'includes/class-wcj-price-labels.php' );
177
  $settings[] = include_once( 'includes/class-wcj-orders.php' );
178
  $settings[] = include_once( 'includes/class-wcj-emails.php' );
179
  $settings[] = include_once( 'includes/class-wcj-pdf-invoices.php' );
180
+ //$settings[] = include_once( 'includes/class-wcj-reports.php' );
181
  $settings[] = include_once( 'includes/class-wcj-old-slugs.php' );
182
 
 
 
183
  // Add options
184
  if ( is_admin() ) {
185
  foreach ( $settings as $section ) {