Booster for WooCommerce - Version 2.0.12

Version Description

  • 14/01/2015 =
  • Dev - Reports - WooJetpack Orders Reports: More Ranges.
  • Fix - CURRENCIES - Prices and Currencies by Country - Slicing the array in update_database().
  • Fix - PRODUCTS - SKU - Fix in set_product_sku function. Bug caused SKU not autogenerating when adding new product. Reported by Gary.
Download this release

Release Info

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

Code changes from version 2.0.10 to 2.0.12

includes/class-wcj-checkout-custom-fields.php CHANGED
@@ -31,6 +31,8 @@ class WCJ_Checkout_Custom_Fields {
31
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'add_custom_order_and_account_fields_to_admin_order_display' ), PHP_INT_MAX );
32
 
33
  add_action( 'woocommerce_email_after_order_table', array( $this, 'add_custom_fields_to_emails' ), PHP_INT_MAX, 2 );
 
 
34
 
35
 
36
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_custom_checkout_fields_order_meta' ) );
@@ -60,11 +62,22 @@ class WCJ_Checkout_Custom_Fields {
60
  }
61
 
62
  /**
63
- * add_custom_fields_to_customer_emails.
64
  */
65
- public function add_custom_fields_to_customer_emails() {
66
-
 
67
 
 
 
 
 
 
 
 
 
 
 
68
  }
69
 
70
  /**
31
  add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'add_custom_order_and_account_fields_to_admin_order_display' ), PHP_INT_MAX );
32
 
33
  add_action( 'woocommerce_email_after_order_table', array( $this, 'add_custom_fields_to_emails' ), PHP_INT_MAX, 2 );
34
+
35
+ add_filter( 'woo_ce_order_fields', array( $this, 'add_custom_fields_to_store_exporter' ) );
36
 
37
 
38
  add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'update_custom_checkout_fields_order_meta' ) );
62
  }
63
 
64
  /**
65
+ * add_custom_fields_to_store_exporter.
66
  */
67
+ public function add_custom_fields_to_store_exporter( $fields ) {
68
+ for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_checkout_custom_fields_total_number', 1 ) ); $i++ ) {
69
+ if ( 'yes' === get_option( 'wcj_checkout_custom_field_enabled_' . $i ) ) {
70
 
71
+ $the_section = get_option( 'wcj_checkout_custom_field_section_' . $i );
72
+ $the_key = 'wcj_checkout_field_' . $i;
73
+
74
+ $fields[] = array(
75
+ 'name' => $the_section . '_' . $the_key,
76
+ 'label' => get_option( 'wcj_checkout_custom_field_label_' . $i ),
77
+ );
78
+ }
79
+ }
80
+ return $fields;
81
  }
82
 
83
  /**
includes/class-wcj-orders.php CHANGED
@@ -52,6 +52,8 @@ class WCJ_Orders {
52
 
53
  add_filter( 'woocommerce_default_order_status',
54
  array( $this, 'set_default_order_status' ), 100 );
 
 
55
 
56
  }
57
  add_action( 'wcj_tools_dashboard', array( $this, 'add_custom_statuses_tool_info_to_tools_dashboard' ), 100 );
@@ -70,6 +72,25 @@ class WCJ_Orders {
70
  // CUSTOM STATUSES //
71
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * set_default_order_status.
75
  */
@@ -163,9 +184,9 @@ class WCJ_Orders {
163
  // Checking status
164
  $statuses_updated = ( '' == get_option( 'wcj_orders_custom_statuses_array' ) ) ? array() : get_option( 'wcj_orders_custom_statuses_array' );
165
  $new_key = 'wc-' . $_POST['new_status'];
166
- if ( isset( $statuses_updated[$new_key] ) )
167
  return '<div class="error"><p>' . __( 'Duplicate slug. Status not added.', 'woocommerce-jetpack' ) . '</p></div>';
168
- $statuses_updated[$new_key] = $_POST['new_status_label'];
169
 
170
  // Adding custom status
171
  $result = update_option( 'wcj_orders_custom_statuses_array', $statuses_updated );
52
 
53
  add_filter( 'woocommerce_default_order_status',
54
  array( $this, 'set_default_order_status' ), 100 );
55
+
56
+ add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'add_custom_order_statuses_to_reports' ), PHP_INT_MAX );
57
 
58
  }
59
  add_action( 'wcj_tools_dashboard', array( $this, 'add_custom_statuses_tool_info_to_tools_dashboard' ), 100 );
72
  // CUSTOM STATUSES //
73
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
74
 
75
+ /**
76
+ * add_custom_order_statuses_to_reports.
77
+ */
78
+ public function add_custom_order_statuses_to_reports( $args ) {
79
+
80
+ if ( in_array( 'shop_order_refund', $args['order_types'] ) )
81
+ return $args;
82
+ if ( is_array( $args['order_status'] ) && 1 === count( $args['order_status'] ) && in_array( 'refunded', $args['order_status'] ) )
83
+ return $args;
84
+
85
+ $custom_order_statuses = get_option( 'wcj_orders_custom_statuses_array' );
86
+ if ( ! empty( $custom_order_statuses ) && is_array( $custom_order_statuses ) ) {
87
+ foreach ( $custom_order_statuses as $slug => $label ) {
88
+ $args['order_status'][] = substr( $slug, 3 );
89
+ }
90
+ }
91
+ return $args;
92
+ }
93
+
94
  /**
95
  * set_default_order_status.
96
  */
184
  // Checking status
185
  $statuses_updated = ( '' == get_option( 'wcj_orders_custom_statuses_array' ) ) ? array() : get_option( 'wcj_orders_custom_statuses_array' );
186
  $new_key = 'wc-' . $_POST['new_status'];
187
+ if ( isset( $statuses_updated[ $new_key ] ) )
188
  return '<div class="error"><p>' . __( 'Duplicate slug. Status not added.', 'woocommerce-jetpack' ) . '</p></div>';
189
+ $statuses_updated[ $new_key ] = $_POST['new_status_label'];
190
 
191
  // Adding custom status
192
  $result = update_option( 'wcj_orders_custom_statuses_array', $statuses_updated );
includes/class-wcj-pdf-invoices.php CHANGED
@@ -109,7 +109,8 @@ class WCJ_PDF_Invoices {
109
  $total_weight = 0;
110
  $the_items = $the_order->get_items();
111
  foreach( $the_items as $the_item ) {
112
- $the_product = new WC_Product( $the_item['product_id'] );
 
113
  $total_weight += $the_item['qty'] * $the_product->get_weight();
114
  }
115
  return ( 0 == $total_weight ) ? '' : $total_weight;
109
  $total_weight = 0;
110
  $the_items = $the_order->get_items();
111
  foreach( $the_items as $the_item ) {
112
+ //$the_product = new WC_Product( $the_item['product_id'] );
113
+ $the_product = wc_get_product( $the_item['product_id'] );
114
  $total_weight += $the_item['qty'] * $the_product->get_weight();
115
  }
116
  return ( 0 == $total_weight ) ? '' : $total_weight;
includes/class-wcj-price-by-country.php CHANGED
@@ -24,7 +24,7 @@ class WCJ_Price_By_Country {
24
  $this->customer_country = null;
25
  $this->customer_country_group_id = null;
26
 
27
- $this->current_db_file_version = 4;
28
 
29
  //$this->currency_symbols = include( 'currencies/wcj-currency-symbols.php' );
30
  /*$currencies = include( 'currencies/wcj-currencies.php' );
@@ -56,7 +56,7 @@ class WCJ_Price_By_Country {
56
  add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'filter_reports'), PHP_INT_MAX, 1 );
57
  add_filter( 'woocommerce_currency_symbol', array( $this, 'change_currency_symbol_reports'), PHP_INT_MAX, 2 );
58
  //add_filter( 'woocommerce_currency', array( $this, 'change_currency_code_reports'), PHP_INT_MAX, 2 );
59
- add_action( 'admin_bar_menu', array( $this, 'toolbar_link_to_mypage' ), 999 );
60
 
61
  // Debug
62
  add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'add_debug_info'), PHP_INT_MAX, 0 );
@@ -89,7 +89,7 @@ class WCJ_Price_By_Country {
89
  }
90
  }
91
 
92
- public function toolbar_link_to_mypage( $wp_admin_bar ) {
93
 
94
  //http://codex.wordpress.org/Function_Reference/add_node
95
 
@@ -215,7 +215,7 @@ class WCJ_Price_By_Country {
215
  */
216
  public function get_country_by_ip_mysql( $ip ) {
217
  global $wpdb;
218
- $results = $wpdb->get_results( "SELECT `country_code` FROM `wp_woojetpack_country_ip` WHERE `ip_from` <= $ip AND `ip_to` >= $ip", OBJECT );
219
  if ( 1 !== count( $results ) )
220
  return null;
221
  return $results[0]->country_code;
@@ -225,176 +225,65 @@ class WCJ_Price_By_Country {
225
  * check_and_update_database.
226
  */
227
  public function update_database() {
228
-
 
 
229
  // Started
230
  update_option( 'wcj_geoipcountry_db_version', -1 );
231
 
232
- ob_start();
 
 
 
233
 
234
- // Get IPs from file
235
- // This product includes GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.
236
- //$csv = array_map( array( $this, 'parse_csv_line' ), file( plugin_dir_path( __FILE__ ) . 'lib/ipdb.csv' ) );
237
- $csv = array_map( array( $this, 'parse_csv_line' ), file( plugin_dir_path( __FILE__ ) . 'lib/ipdb.csv' ) );
238
- if ( ! empty ( $csv ) ) {
239
- // $the_values = file_get_contents( plugin_dir_path( __FILE__ ) . 'lib/ipdb.sql' );
240
- // if ( ! empty ( $the_values ) ) {
 
 
241
 
242
- global $wpdb;
 
 
 
243
 
244
- $charset_collate = $wpdb->get_charset_collate();
245
 
246
- $table_name = $wpdb->prefix . 'woojetpack_country_ip';
247
-
248
- //echo ( false === $wpdb->query( "DROP TABLE $table_name;" ) ) ? 'truncate-false' : 'truncate-true';
249
- $wpdb->query( "DROP TABLE $table_name;" );
250
-
251
- /*$sql = "CREATE TABLE $table_name (
252
- ip_from BIGINT NOT NULL,
253
- ip_to BIGINT NOT NULL,
254
- country_code text NOT NULL,
255
- UNIQUE KEY ip_from (ip_from)
256
- ) $charset_collate;";*/
257
-
258
- $sql = "CREATE TABLE $table_name (
259
- ip_from BIGINT NOT NULL,
260
- ip_to BIGINT NOT NULL,
261
- country_code VARCHAR(2) NOT NULL,
262
- UNIQUE KEY ip_from (ip_from)
263
- ) $charset_collate;";
264
- //echo ( false === $wpdb->query( $sql ) ) ? 'false' : 'true';
265
- $wpdb->query( $sql );
266
-
267
- //print_r( $wpdb->get_results("SELECT * FROM $table_name;") );
268
-
269
- //require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
270
- //dbDelta( $sql );
271
-
272
- $i = 0;
273
- $the_values = '';
274
- $max_insert_size = 10000;
275
- $the_size = count( $csv );
276
- //echo $the_size;
277
- foreach ( $csv as $key => $data ) {
278
- $the_values .= "('$data[0]', '$data[1]', '$data[2]'), ";
279
- //$the_values .= "('" . implode( "', '", $data ) . "'), ";
280
- $i++;
281
- if ( $i >= $max_insert_size ) {
282
- $the_values = rtrim( $the_values, ', ' );
283
- $wpdb->query( "INSERT INTO $table_name (`ip_from`, `ip_to`, `country_code`) VALUES $the_values;" );
284
- $i = 0;
285
- $the_values = '';
286
  }
287
- }
288
- if ( '' != $the_values ) {
289
  $the_values = rtrim( $the_values, ', ' );
290
- $wpdb->query( "INSERT INTO $table_name (`ip_from`, `ip_to`, `country_code`) VALUES $the_values;" );
291
- }
292
-
293
- $count_db_table = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name;" );
294
- //print_r( $count_db_table );
295
-
296
- if ( $the_size != $count_db_table ) {
297
- // Something went wrong
298
- update_option( 'wcj_geoipcountry_db_version', -2 );
299
- }
300
- else {
301
- // Finished
302
- update_option( 'wcj_geoipcountry_db_version', $this->current_db_file_version );
303
  }
304
-
305
-
306
- // Depreciated - cleaning
307
- update_option( 'wcj_geoipcountry_db_from', array() );
308
- update_option( 'wcj_geoipcountry_db_to', array() );
309
- update_option( 'wcj_geoipcountry_db_country', array() );
310
-
311
-
312
-
313
-
314
- /**
315
- update_option( 'wcj_geoipcountry_db_from', array() );
316
- update_option( 'wcj_geoipcountry_db_to', array() );
317
- update_option( 'wcj_geoipcountry_db_country', array() );
318
 
319
- foreach ( $csv as $key => $data ) {
320
- $column_ip_from[ $key ] = $data[0];
321
- $column_ip_to[ $key ] = $data[1];
322
- $column_ip_country[ $key ] = $data[2];
323
- }
324
-
325
- update_option( 'wcj_geoipcountry_db_from', $column_ip_from );
326
- update_option( 'wcj_geoipcountry_db_to', $column_ip_to );
327
- update_option( 'wcj_geoipcountry_db_country', $column_ip_country );
328
- /**/
329
-
330
-
331
- /**
332
- global $wpdb;
333
-
334
- $sql = "CREATE TABLE {$wpdb->prefix}wcj_country_ip (
335
- ip_from INT(10) UNSIGNED NOT NULL,
336
- ip_to INT(10) UNSIGNED NOT NULL,
337
- country_code VARCHAR(2) NOT NULL
338
- )";
339
- $results = $wpdb->get_results( $sql );
340
-
341
- if ( ( $handle = fopen( plugin_dir_path( __FILE__ ) . 'lib/ipdb.csv', "r" ) ) !== FALSE ) {
342
- while ( ($data = fgetcsv( $handle, 100, "," ) ) !== FALSE ) {
343
-
344
- print_r( $wpdb->insert(
345
- '$wpdb->prefix' . 'wcj_country_ip',
346
- array(
347
- 'ip_from' => $data[0],
348
- 'ip_to' => $data[1] ,
349
- 'country_code' => $data[2],
350
- ),
351
- array(
352
- '%d',
353
- '%d',
354
- '%s',
355
- )
356
- ) );
357
- }
358
- fclose( $handle );
359
- }
360
- /**/
361
-
362
- /**
363
- // IPs from
364
- foreach ( $csv as $key => $data )
365
- $column[ $key ] = $data[0];
366
- update_option( 'wcj_geoipcountry_db_from', $column );
367
-
368
- // IPs to
369
- foreach ( $csv as $key => $data )
370
- $column[ $key ] = $data[1];
371
- update_option( 'wcj_geoipcountry_db_to', $column );
372
-
373
- // Countries
374
- foreach ( $csv as $key => $data )
375
- $column[ $key ] = $data[2];
376
- update_option( 'wcj_geoipcountry_db_country', $column );
377
- /**/
378
- /**
379
- $count_db_from = count( get_option( 'wcj_geoipcountry_db_from', array() ) );
380
- $count_db_to = count( get_option( 'wcj_geoipcountry_db_to', array() ) );
381
- $count_db_country = count( get_option( 'wcj_geoipcountry_db_country', array() ) );
382
-
383
- if ( 0 == $count_db_from || $count_db_from != $count_db_to || $count_db_from != $count_db_country ) {
384
- // Something went wrong
385
- update_option( 'wcj_geoipcountry_db_version', -2 );
386
- }
387
- else {
388
- // Finished
389
- update_option( 'wcj_geoipcountry_db_version', $this->current_db_file_version );
390
- }
391
- /**/
392
  }
393
-
394
- $output_buffer = ob_get_contents();
395
- ob_end_clean();
396
- //echo $output_buffer;
397
- update_option( 'wcj_geoipcountry_db_update_log', $output_buffer );
 
 
 
 
398
  }
399
 
400
  /**
24
  $this->customer_country = null;
25
  $this->customer_country_group_id = null;
26
 
27
+ $this->current_db_file_version = 5;
28
 
29
  //$this->currency_symbols = include( 'currencies/wcj-currency-symbols.php' );
30
  /*$currencies = include( 'currencies/wcj-currencies.php' );
56
  add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'filter_reports'), PHP_INT_MAX, 1 );
57
  add_filter( 'woocommerce_currency_symbol', array( $this, 'change_currency_symbol_reports'), PHP_INT_MAX, 2 );
58
  //add_filter( 'woocommerce_currency', array( $this, 'change_currency_code_reports'), PHP_INT_MAX, 2 );
59
+ add_action( 'admin_bar_menu', array( $this, 'add_reports_currency_to_admin_bar' ), PHP_INT_MAX );
60
 
61
  // Debug
62
  add_action( 'woocommerce_after_add_to_cart_button', array( $this, 'add_debug_info'), PHP_INT_MAX, 0 );
89
  }
90
  }
91
 
92
+ public function add_reports_currency_to_admin_bar( $wp_admin_bar ) {
93
 
94
  //http://codex.wordpress.org/Function_Reference/add_node
95
 
215
  */
216
  public function get_country_by_ip_mysql( $ip ) {
217
  global $wpdb;
218
+ $results = $wpdb->get_results( "SELECT `country_code` FROM `{$wpdb->prefix}woojetpack_country_ip` WHERE `ip_from` <= $ip AND `ip_to` >= $ip", OBJECT );
219
  if ( 1 !== count( $results ) )
220
  return null;
221
  return $results[0]->country_code;
225
  * check_and_update_database.
226
  */
227
  public function update_database() {
228
+ // Get IPs from file
229
+ // This product includes GeoLite data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.
230
+
231
  // Started
232
  update_option( 'wcj_geoipcountry_db_version', -1 );
233
 
234
+ global $wpdb;
235
+
236
+ $charset_collate = $wpdb->get_charset_collate();
237
+ $table_name = $wpdb->prefix . 'woojetpack_country_ip';
238
 
239
+ $wpdb->query( "DROP TABLE $table_name;" );
240
+
241
+ $sql = "CREATE TABLE $table_name (
242
+ ip_from BIGINT NOT NULL,
243
+ ip_to BIGINT NOT NULL,
244
+ country_code VARCHAR(2) NOT NULL,
245
+ UNIQUE KEY ip_from (ip_from)
246
+ ) $charset_collate;";
247
+ $wpdb->query( $sql );
248
 
249
+ $the_values = '';
250
+ $max_insert_size = 10000;
251
+ $the_offset = 0;
252
+ $the_predifined_size = 104402;
253
 
254
+ $the_array = file( plugin_dir_path( __FILE__ ) . 'lib/ipdb.csv' );
255
 
256
+ // Adding data to table
257
+ while ( $the_offset < $the_predifined_size ) {
258
+ $the_array_slice = array_slice( $the_array, $the_offset, $max_insert_size, true );
259
+ $csv = array_map( array( $this, 'parse_csv_line' ), $the_array_slice );
260
+ if ( ! empty ( $csv ) ) {
261
+ foreach ( $csv as $key => $data ) {
262
+ $the_values .= "('$data[0]', '$data[1]', '$data[2]'), ";
263
+ //$the_values .= "('" . implode( "', '", $data ) . "'), ";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  }
 
 
265
  $the_values = rtrim( $the_values, ', ' );
266
+ $wpdb->query( "INSERT INTO $table_name (`ip_from`, `ip_to`, `country_code`) VALUES $the_values;" );
267
+ $the_values = '';
 
 
 
 
 
 
 
 
 
 
 
268
  }
269
+ $the_offset += $max_insert_size;
270
+ }
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
+ // Checking if OK
273
+ $count_db_table = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name;" );
274
+ if ( $the_predifined_size != $count_db_table ) {
275
+ // Something went wrong
276
+ update_option( 'wcj_geoipcountry_db_version', -2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  }
278
+ else {
279
+ // Finished
280
+ update_option( 'wcj_geoipcountry_db_version', $this->current_db_file_version );
281
+ }
282
+
283
+ // Depreciated - cleaning
284
+ update_option( 'wcj_geoipcountry_db_from', array() );
285
+ update_option( 'wcj_geoipcountry_db_to', array() );
286
+ update_option( 'wcj_geoipcountry_db_country', array() );
287
  }
288
 
289
  /**
includes/class-wcj-product-bulk-price-converter.php CHANGED
@@ -53,16 +53,18 @@ class WCJ_Bulk_Price_Converter {
53
  $the_price = get_post_meta( $product_id, '_' . $price_type, true );
54
  if ( '' != $the_price ) {
55
  $precision = get_option( 'woocommerce_price_num_decimals', 2 );
56
- $the_multiplied_price = round( $the_price * $multiply_price_by, $precision );
 
 
57
  if ( ! $is_preview )
58
- update_post_meta( $product_id, '_' . $price_type, $the_multiplied_price );
59
  }
60
 
61
  echo '<tr>' .
62
  '<td>' . get_the_title( $product_id ) . '</td>' .
63
  '<td><em>' . $price_type . '</em></td>' .
64
  '<td>' . $the_price . '</td>' .
65
- '<td>' . $the_multiplied_price . '</td>' .
66
  '</tr>';
67
  }
68
 
@@ -152,11 +154,70 @@ class WCJ_Bulk_Price_Converter {
152
  <?php echo __( 'Multiply all product prices by', 'woocommerce-jetpack' ); ?> <input class="" type="text" name="multiply_prices_by" id="multiply_prices_by" value="<?php echo $multiply_prices_by; ?>">
153
  <input class="button-primary" type="submit" name="bulk_change_prices_preview" id="bulk_change_prices_preview" value="Preview Prices">
154
  <input class="button-primary" type="submit" name="bulk_change_prices" id="bulk_change_prices" value="Change Prices">
 
155
  </form></p>
156
  <?php if ( $is_preview ) echo $result_changing_prices; ?>
157
  </div>
158
  <?php
159
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
  /**
162
  * add_bulk_price_converter_tool_info_to_tools_dashboard.
53
  $the_price = get_post_meta( $product_id, '_' . $price_type, true );
54
  if ( '' != $the_price ) {
55
  $precision = get_option( 'woocommerce_price_num_decimals', 2 );
56
+ $the_modified_price = round( $the_price * $multiply_price_by, $precision );
57
+ /*if ( isset( $_POST['make_pretty_prices'] ) )
58
+ $the_modified_price = $this->make_pretty_price( $the_modified_price );*/
59
  if ( ! $is_preview )
60
+ update_post_meta( $product_id, '_' . $price_type, $the_modified_price );
61
  }
62
 
63
  echo '<tr>' .
64
  '<td>' . get_the_title( $product_id ) . '</td>' .
65
  '<td><em>' . $price_type . '</em></td>' .
66
  '<td>' . $the_price . '</td>' .
67
+ '<td>' . $the_modified_price . '</td>' .
68
  '</tr>';
69
  }
70
 
154
  <?php echo __( 'Multiply all product prices by', 'woocommerce-jetpack' ); ?> <input class="" type="text" name="multiply_prices_by" id="multiply_prices_by" value="<?php echo $multiply_prices_by; ?>">
155
  <input class="button-primary" type="submit" name="bulk_change_prices_preview" id="bulk_change_prices_preview" value="Preview Prices">
156
  <input class="button-primary" type="submit" name="bulk_change_prices" id="bulk_change_prices" value="Change Prices">
157
+ <?php /*<input type="checkbox" name="make_pretty_prices" id="make_pretty_prices" value="">Make Pretty Prices*/ ?>
158
  </form></p>
159
  <?php if ( $is_preview ) echo $result_changing_prices; ?>
160
  </div>
161
  <?php
162
+ }
163
+
164
+
165
+ /**
166
+ * make_pretty_price.
167
+ *
168
+ function make_pretty_price( $price ) {
169
+
170
+ if ( 0 == $price )
171
+ return $price;
172
+
173
+ $the_price = $price;
174
+ $the_multiplied_price = $price;
175
+
176
+ if ( $the_price < 20 ) {
177
+
178
+
179
+ $mod_10_cents = ( $the_multiplied_price * 10 - floor( $the_multiplied_price * 10 ) ) / 10;
180
+ // E.g. 14.44 -> 14.39
181
+ if ( $mod_10_cents < 0.05 )
182
+ $the_multiplied_price = $the_multiplied_price - ( $mod_10_cents + 0.01 );
183
+ // E.g. 14.45 -> 14.49
184
+ else if ( $mod_10_cents >= 0.05 )
185
+ $the_multiplied_price = $the_multiplied_price + ( 0.1 - ( $mod_10_cents + 0.01 ) );
186
+
187
+ $mod_100_cents = ( $the_multiplied_price - floor( $the_multiplied_price ) );
188
+ // E.g. 14.09 -> 13.99
189
+ if ( $mod_100_cents < 0.10 )
190
+ $the_multiplied_price = $the_multiplied_price - ( $mod_100_cents + 0.01 );
191
+ }
192
+
193
+
194
+ if ( $the_price < 99 && $the_price >= 20 )
195
+ // E.g. 45.36 -> 44.99
196
+ // E.g. 45.60 -> 45.99
197
+ $the_multiplied_price = round( $the_multiplied_price ) - 0.01;
198
+
199
+ if ( $the_price >= 100 ) {
200
+
201
+ $the_multiplied_price = round( $the_multiplied_price );
202
+
203
+ $mod_10 = $the_multiplied_price % 10;
204
+ if ( $mod_10 < 5 )
205
+ // E.g. 114.00 -> 109.00
206
+ $the_multiplied_price = $the_multiplied_price - ( $mod_10 + 1 );
207
+ else if ( $mod_10 >= 5 )
208
+ // E.g. 115.00 -> 119.00
209
+ $the_multiplied_price = $the_multiplied_price + ( 10 - ( $mod_10 + 1 ) );
210
+
211
+ if ( $the_price >= 200 ) {
212
+ $mod_100 = $the_multiplied_price % 100;
213
+ if ( $mod_100 < 10 )
214
+ // E.g. 209.00 -> 199.00
215
+ $the_multiplied_price = $the_multiplied_price - ( $mod_100 + 1 );
216
+ }
217
+ }
218
+
219
+ return $the_multiplied_price;
220
+ }
221
 
222
  /**
223
  * add_bulk_price_converter_tool_info_to_tools_dashboard.
includes/class-wcj-reports.php CHANGED
@@ -39,6 +39,8 @@ class WCJ_Reports {
39
 
40
  include_once( 'reports/wcj-class-reports-customers.php' );
41
  include_once( 'reports/wcj-class-reports-stock.php' );
 
 
42
  }
43
  }
44
 
@@ -48,6 +50,96 @@ class WCJ_Reports {
48
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 ); // Add Enable option to Jetpack Settings Dashboard
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  /**
52
  * catch_arguments.
53
  */
39
 
40
  include_once( 'reports/wcj-class-reports-customers.php' );
41
  include_once( 'reports/wcj-class-reports-stock.php' );
42
+
43
+ add_action( 'admin_bar_menu', array( $this, 'add_custom_order_reports_ranges_to_admin_bar' ), PHP_INT_MAX );
44
  }
45
  }
46
 
50
  add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 ); // Add Enable option to Jetpack Settings Dashboard
51
  }
52
 
53
+
54
+ /**
55
+ * add_custom_order_reports_ranges_to_admin_bar.
56
+ */
57
+ public function add_custom_order_reports_ranges_to_admin_bar( $wp_admin_bar ) {
58
+ $is_reports = ( isset( $_GET['page'] ) && 'wc-reports' === $_GET['page'] ) ? true : false;
59
+ $is_orders_reports = ( isset( $_GET['tab'] ) && 'orders' === $_GET['tab'] || ! isset( $_GET['tab'] ) ) ? true : false;
60
+ if ( $is_reports && $is_orders_reports ) {
61
+
62
+ $parent = 'reports_orders_more_ranges';
63
+ $args = array(
64
+ 'parent' => false,
65
+ 'id' => $parent,
66
+ 'title' => __( 'WooJetpack: More Ranges', 'woocommerce-jetpack' ),
67
+ 'href' => false,
68
+ 'meta' => array( 'title' => __( 'Select Range', 'woocommerce-jetpack' ), ),
69
+ );
70
+ $wp_admin_bar->add_node( $args );
71
+
72
+ $nodes = array(
73
+ array(
74
+ 'parent' => $parent,
75
+ 'id' => $parent . '_' . 'last_14_days',
76
+ 'title' => __( 'Last 14 Days', 'woocommerce-jetpack' ),
77
+ 'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => date( 'Y-m-d', strtotime( '-14 days' ) ), 'end_date' => date( 'Y-m-d' ), ) ),
78
+ 'meta' => array( 'title' => __( 'Last 14 Days', 'woocommerce-jetpack' ), ),
79
+ ),
80
+ array(
81
+ 'parent' => $parent,
82
+ 'id' => $parent . '_' . 'last_30_days',
83
+ 'title' => __( 'Last 30 Days', 'woocommerce-jetpack' ),
84
+ 'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => date( 'Y-m-d', strtotime( '-30 days' ) ), 'end_date' => date( 'Y-m-d' ), ) ),
85
+ 'meta' => array( 'title' => __( 'Last 30 Days', 'woocommerce-jetpack' ), ),
86
+ ),
87
+ array(
88
+ 'parent' => $parent,
89
+ 'id' => $parent . '_' . 'last_3_months',
90
+ 'title' => __( 'Last 3 Months', 'woocommerce-jetpack' ),
91
+ 'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => date( 'Y-m-d', strtotime( '-3 months' ) ), 'end_date' => date( 'Y-m-d' ), ) ),
92
+ 'meta' => array( 'title' => __( 'Last 3 Months', 'woocommerce-jetpack' ), ),
93
+ ),
94
+ array(
95
+ 'parent' => $parent,
96
+ 'id' => $parent . '_' . 'last_6_months',
97
+ 'title' => __( 'Last 6 Months', 'woocommerce-jetpack' ),
98
+ 'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => date( 'Y-m-d', strtotime( '-6 months' ) ), 'end_date' => date( 'Y-m-d' ), ) ),
99
+ 'meta' => array( 'title' => __( 'Last 6 Months', 'woocommerce-jetpack' ), ),
100
+ ),
101
+ array(
102
+ 'parent' => $parent,
103
+ 'id' => $parent . '_' . 'last_12_months',
104
+ 'title' => __( 'Last 12 Months', 'woocommerce-jetpack' ),
105
+ 'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => date( 'Y-m-d', strtotime( '-12 months' ) ), 'end_date' => date( 'Y-m-d' ), ) ),
106
+ 'meta' => array( 'title' => __( 'Last 12 Months', 'woocommerce-jetpack' ), ),
107
+ ),
108
+ array(
109
+ 'parent' => $parent,
110
+ 'id' => $parent . '_' . 'last_24_months',
111
+ 'title' => __( 'Last 24 Months', 'woocommerce-jetpack' ),
112
+ 'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => date( 'Y-m-d', strtotime( '-24 months' ) ), 'end_date' => date( 'Y-m-d' ), ) ),
113
+ 'meta' => array( 'title' => __( 'Last 24 Months', 'woocommerce-jetpack' ), ),
114
+ ),
115
+ array(
116
+ 'parent' => $parent,
117
+ 'id' => $parent . '_' . 'same_days_last_month',
118
+ 'title' => __( 'Same Days Last Month', 'woocommerce-jetpack' ),
119
+ 'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => date( 'Y-m-01', strtotime( '-1 month' ) ), 'end_date' => date( 'Y-m-d', strtotime( '-1 month' ) ), ) ),
120
+ 'meta' => array( 'title' => __( 'Same Days Last Month', 'woocommerce-jetpack' ), ),
121
+ ),
122
+ /*array(
123
+ 'parent' => $parent,
124
+ 'id' => $parent . '_' . 'last_week',
125
+ 'title' => __( 'Last Week', 'woocommerce-jetpack' ),
126
+ 'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => date( 'Y-m-d', strtotime( 'last monday' ) ), 'end_date' => date( 'Y-m-d', strtotime( 'last sunday' ) ), ) ),
127
+ 'meta' => array( 'title' => __( 'Last Week', 'woocommerce-jetpack' ), ),
128
+ ),*/
129
+ array(
130
+ 'parent' => $parent,
131
+ 'id' => $parent . '_' . 'last_year',
132
+ 'title' => __( 'Last Year', 'woocommerce-jetpack' ),
133
+ 'href' => add_query_arg( array( 'range' => 'custom', 'start_date' => date( 'Y-01-01', strtotime( '-1 year' ) ), 'end_date' => date( 'Y-12-31', strtotime( '-1 year' ) ), ) ),
134
+ 'meta' => array( 'title' => __( 'Last Year', 'woocommerce-jetpack' ), ),
135
+ ),
136
+ );
137
+ foreach ( $nodes as $node ) {
138
+ $wp_admin_bar->add_node( $node );
139
+ }
140
+ }
141
+ }
142
+
143
  /**
144
  * catch_arguments.
145
  */
includes/class-wcj-sku.php CHANGED
@@ -108,8 +108,9 @@ class WCJ_SKU {
108
  * set_product_sku.
109
  */
110
  public function set_product_sku( $post_ID, $post, $update ) {
111
- if ( 'product' !== $post->type )
112
  return;
 
113
  if ( false === $update ) {
114
  $this->set_sku_with_variable( $post_ID, false );
115
  }
108
  * set_product_sku.
109
  */
110
  public function set_product_sku( $post_ID, $post, $update ) {
111
+ if ( 'product' != $post->post_type ) {
112
  return;
113
+ }
114
  if ( false === $update ) {
115
  $this->set_sku_with_variable( $post_ID, false );
116
  }
includes/reports/wcj-class-reports-stock.php CHANGED
@@ -104,7 +104,8 @@ class WCJ_Reports_Stock {
104
  while ( $loop->have_posts() ) : $loop->the_post();
105
 
106
  $the_ID = get_the_ID();
107
- $the_product = new WC_Product( $the_ID );
 
108
  $the_price = $the_product->get_price();
109
  $the_stock = $the_product->get_total_stock();
110
  //if ( 0 == $the_stock )
104
  while ( $loop->have_posts() ) : $loop->the_post();
105
 
106
  $the_ID = get_the_ID();
107
+ //$the_product = new WC_Product( $the_ID );
108
+ $the_product = wc_get_product( $the_ID );
109
  $the_price = $the_product->get_price();
110
  $the_stock = $the_product->get_total_stock();
111
  //if ( 0 == $the_stock )
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: algoritmika
3
  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,email pdf invoice,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,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,payment gateway fee,
5
- Requires at least: 3.9.1
6
  Tested up to: 4.1
7
- Stable tag: 2.0.10
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -68,6 +68,18 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  = 2.0.10 - 04/01/2015 =
72
  * Fix - PRODUCTS - **Product Info** - `id` option bug, fixed.
73
  * Fix - CURRENCIES - **Currencies** - Empty symbol bug, fixed.
@@ -126,16 +138,16 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
126
  Currently only fields of `text` type are available.
127
  * Dev - PRODUCTS - **Product Info** - Wordpress shortcodes added for every WooJetpack shortcode.
128
  WooJetpack shortcodes are now depreciated and will be removed in future releases. See v.1.9.0 changelog for more details.
129
- This covers Wordpress.org Support Forum thread by dudemcpek - https://wordpress.org/support/topic/not-displaying-shortcodes.
130
  * Dev - CART - **Add to Cart per Category** - Add to cart button text on *per category* basis (single or category view). Idea by Craig.
131
  * Dev - CART - **Add to Cart per Product** - Custom add to cart button text on *per product* basis (single or category view). Idea by Craig.
132
  * Dev - CART - **Cart** - Option to change position of `Empty cart` button. Suggested by Patryk.
133
  * Dev - CART - **Cart** - Option to hide "Note: Shipping and taxes are estimated and ..." message on Cart page, added.
134
  * Dev - SHIPPING - **Shipping Calculator** - Customize shipping calculator on cart page. Idea by Xavier.
135
- * Dev - CURRENCIES - **Prices and Currencies by Country**, added. Idea by Illona.
136
  * Dev - CURRENCIES - **Different Currency for External Products**, added. Idea by Leon, Krishan.
137
  * Dev - CURRENCIES - **Currencies** - *Hide currency symbol* option, added.
138
- * Dev - CHECKOUT - **Custom Checkout Fields**, added. Idea by: Patryk, Tom, https://wordpress.org/support/topic/delivery-date-picker.
139
  * Dev - CHECKOUT - **Payment Gateways** - Payment fees - Maximum and/or minimum cart amount for adding fee option, added.
140
  * Dev - CHECKOUT - **Payment Gateways** - Option to set *default order status* for custom gateway, added.
141
  * Dev - ORDERS - **Custom Statuses** - *Default Order Status* option added. Idea by Patryk.
2
  Contributors: algoritmika
3
  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,email pdf invoice,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,custom css,hide categories count,hide subcategories count,hide category count,hide subcategory count,display total sales,custom product tabs,remove product tab,payment gateway fee,
5
+ Requires at least: 3.8
6
  Tested up to: 4.1
7
+ Stable tag: 2.0.12
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
68
 
69
  == Changelog ==
70
 
71
+ = 2.0.12 - 14/01/2015 =
72
+ * Dev - **Reports** - WooJetpack Orders Reports: More Ranges.
73
+ * Fix - CURRENCIES - **Prices and Currencies by Country** - Slicing the array in `update_database()`.
74
+ * Fix - PRODUCTS - **SKU** - Fix in `set_product_sku` function. Bug caused SKU *not* autogenerating when adding new product. Reported by Gary.
75
+
76
+ = 2.0.11 - 08/01/2015 =
77
+ * Dev - CHECKOUT - **Custom Checkout Fields** - Filter for custom checkout fields for "WooCommerce - Store Exporter" plugin, added.
78
+ * Fix - ORDERS - Custom Statuses added to WooCommerce reports.
79
+ * Fix - CURRENCIES - **Prices and Currencies by Country** - `$wpdb->prefix` fix. Reported by John.
80
+ * Fix - **Reports** - `wc_get_product` instead of `new WC_Product`.
81
+ * Fix - **PDF Invoices** - `wc_get_product` instead of `new WC_Product`.
82
+
83
  = 2.0.10 - 04/01/2015 =
84
  * Fix - PRODUCTS - **Product Info** - `id` option bug, fixed.
85
  * Fix - CURRENCIES - **Currencies** - Empty symbol bug, fixed.
138
  Currently only fields of `text` type are available.
139
  * Dev - PRODUCTS - **Product Info** - Wordpress shortcodes added for every WooJetpack shortcode.
140
  WooJetpack shortcodes are now depreciated and will be removed in future releases. See v.1.9.0 changelog for more details.
141
+ This covers Wordpress.org Support Forum thread by dudemcpek - https://wordpress.org/support/topic/not-displaying-shortcodes.
142
  * Dev - CART - **Add to Cart per Category** - Add to cart button text on *per category* basis (single or category view). Idea by Craig.
143
  * Dev - CART - **Add to Cart per Product** - Custom add to cart button text on *per product* basis (single or category view). Idea by Craig.
144
  * Dev - CART - **Cart** - Option to change position of `Empty cart` button. Suggested by Patryk.
145
  * Dev - CART - **Cart** - Option to hide "Note: Shipping and taxes are estimated and ..." message on Cart page, added.
146
  * Dev - SHIPPING - **Shipping Calculator** - Customize shipping calculator on cart page. Idea by Xavier.
147
+ * Dev - CURRENCIES - **Prices and Currencies by Country**, added. Idea by Illona.
148
  * Dev - CURRENCIES - **Different Currency for External Products**, added. Idea by Leon, Krishan.
149
  * Dev - CURRENCIES - **Currencies** - *Hide currency symbol* option, added.
150
+ * Dev - CHECKOUT - **Custom Checkout Fields**, added. Idea by: Patryk, Tom, https://wordpress.org/support/topic/delivery-date-picker.
151
  * Dev - CHECKOUT - **Payment Gateways** - Payment fees - Maximum and/or minimum cart amount for adding fee option, added.
152
  * Dev - CHECKOUT - **Payment Gateways** - Option to set *default order status* for custom gateway, added.
153
  * Dev - ORDERS - **Custom Statuses** - *Default Order Status* option added. Idea by Patryk.
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: 2.0.10
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.
3
  Plugin Name: WooCommerce Jetpack
4
  Plugin URI: http://woojetpack.com
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 2.0.12
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2014 Algoritmika Ltd.