Booster for WooCommerce - Version 3.1.2

Version Description

  • 22/09/2017 =
  • Dev - WooCommerce v3.2 compatibility - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - change_price_shipping() - Taxes.
  • Dev - Shortcodes - Orders - [wcj_order_items_table] - wcj_pdf_invoicing_cell_data filter - order argument added.
  • Dev - Shortcodes - Orders - [wcj_order_items_table] - hide_zero_prices - attribute added.
  • Fix - Shortcodes - Orders - [wcj_order_refunds_table] - columns - refund_number fixed.
  • Dev - Shortcodes - Orders - [wcj_order_refunds_table] - insert_page_break attribute added.
  • Dev - Shortcodes - Orders - [wcj_order_total_after_refund] shortcode added.
  • Dev - Shortcodes - Orders - [wcj_order_total_tax_after_refund] shortcode added.
  • Dev - Shortcodes - Orders - [wcj_order_total_tax] - Code refactoring.
  • Dev - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - Admin settings restyled.
  • Dev - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - "Advanced: Additional Price Filters" option added.
  • Fix - PRICES & CURRENCIES - Multicurrency Product Base Price - Advanced: Saved Calculated Products Prices - Filter bug fixed.
  • Dev - SHIPPING & ORDERS - Order Custom Statuses - "Make Custom Status Orders Editable" option added.
  • Fix - EMAILS & MISC. - Custom Emails - Email attachments fixed.
Download this release

Release Info

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

Code changes from version 3.1.1 to 3.1.2

includes/class-wcj-multicurrency.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Multicurrency (Currency Switcher)
4
  *
5
- * @version 3.1.0
6
  * @since 2.4.3
7
  * @author Algoritmika Ltd.
8
  */
@@ -16,7 +16,7 @@ class WCJ_Multicurrency extends WCJ_Module {
16
  /**
17
  * Constructor.
18
  *
19
- * @version 2.8.0
20
  */
21
  function __construct() {
22
 
@@ -24,7 +24,10 @@ class WCJ_Multicurrency extends WCJ_Module {
24
  $this->short_desc = __( 'Multicurrency (Currency Switcher)', 'woocommerce-jetpack' );
25
  $this->desc = __( 'Add multiple currencies (currency switcher) to WooCommerce.', 'woocommerce-jetpack' );
26
  $this->link_slug = 'woocommerce-multicurrency-currency-switcher';
27
- $this->extra_desc = __( 'After setting currencies in the Currencies Options below, use <em>Booster - Multicurrency Switcher</em> widget, or <em>[wcj_currency_select_drop_down_list]</em> shortcode. If you want to insert switcher in your PHP code, just use <em>echo do_shortcode( \'[wcj_currency_select_drop_down_list]\' );</em>', 'woocommerce-jetpack' );
 
 
 
28
  parent::__construct();
29
 
30
  if ( $this->is_enabled() ) {
@@ -45,7 +48,7 @@ class WCJ_Multicurrency extends WCJ_Module {
45
  /**
46
  * add_hooks.
47
  *
48
- * @version 3.1.0
49
  */
50
  function add_hooks() {
51
  // Session
@@ -72,6 +75,17 @@ class WCJ_Multicurrency extends WCJ_Module {
72
 
73
  // "WooCommerce Product Add-ons" plugin
74
  add_filter( 'get_product_addons', array( $this, 'change_price_addons' ) );
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
  }
77
 
@@ -184,7 +198,7 @@ class WCJ_Multicurrency extends WCJ_Module {
184
  /**
185
  * change_price.
186
  *
187
- * @version 2.7.0
188
  */
189
  function change_price( $price, $_product ) {
190
 
@@ -204,7 +218,7 @@ class WCJ_Multicurrency extends WCJ_Module {
204
  if ( 'woocommerce_get_price_including_tax' == $_current_filter || 'woocommerce_get_price_excluding_tax' == $_current_filter ) {
205
  return wcj_get_product_display_price( $_product );
206
 
207
- } elseif ( WCJ_PRODUCT_GET_PRICE_FILTER == $_current_filter || 'woocommerce_variation_prices_price' == $_current_filter || 'woocommerce_product_variation_get_price' == $_current_filter ) {
208
  $sale_price_per_product = get_post_meta( $_product_id, '_' . 'wcj_multicurrency_per_product_sale_price_' . $this->get_current_currency_code(), true );
209
  return ( '' != $sale_price_per_product && $sale_price_per_product < $regular_price_per_product ) ? $sale_price_per_product : $regular_price_per_product;
210
 
@@ -289,20 +303,29 @@ class WCJ_Multicurrency extends WCJ_Module {
289
  /**
290
  * change_price_shipping.
291
  *
292
- * @version 2.7.0
293
  */
294
  function change_price_shipping( $package_rates, $package ) {
295
  if ( $this->do_revert() ) {
296
  return $package_rates;
297
  }
298
- $currency_exchange_rate = $this->get_currency_exchange_rate( $this->get_current_currency_code() );
299
- $modified_package_rates = array();
 
300
  foreach ( $package_rates as $id => $package_rate ) {
301
  if ( 1 != $currency_exchange_rate && isset( $package_rate->cost ) ) {
302
  $package_rate->cost = $package_rate->cost * $currency_exchange_rate;
303
  if ( isset( $package_rate->taxes ) && ! empty( $package_rate->taxes ) ) {
304
- foreach ( $package_rate->taxes as $tax_id => $tax ) {
305
- $package_rate->taxes[ $tax_id ] = $package_rate->taxes[ $tax_id ] * $currency_exchange_rate;
 
 
 
 
 
 
 
 
306
  }
307
  }
308
  }
2
  /**
3
  * Booster for WooCommerce - Module - Multicurrency (Currency Switcher)
4
  *
5
+ * @version 3.1.2
6
  * @since 2.4.3
7
  * @author Algoritmika Ltd.
8
  */
16
  /**
17
  * Constructor.
18
  *
19
+ * @version 3.1.2
20
  */
21
  function __construct() {
22
 
24
  $this->short_desc = __( 'Multicurrency (Currency Switcher)', 'woocommerce-jetpack' );
25
  $this->desc = __( 'Add multiple currencies (currency switcher) to WooCommerce.', 'woocommerce-jetpack' );
26
  $this->link_slug = 'woocommerce-multicurrency-currency-switcher';
27
+ $this->extra_desc = sprintf( __( 'After setting currencies in the Currencies Options section below, use %s <strong>widget</strong>, or %s <strong>shortcode</strong>. If you want to insert switcher in your <strong>PHP code</strong>, just use %s code.', 'woocommerce-jetpack' ),
28
+ '<em>' . __( 'Booster - Multicurrency Switcher', 'woocommerce-jetpack' ) . '</em>',
29
+ '<code>[wcj_currency_select_drop_down_list]</code>',
30
+ '<code>echo&nbsp;do_shortcode(&nbsp;\'[wcj_currency_select_drop_down_list]\'&nbsp;);</code>' );
31
  parent::__construct();
32
 
33
  if ( $this->is_enabled() ) {
48
  /**
49
  * add_hooks.
50
  *
51
+ * @version 3.1.2
52
  */
53
  function add_hooks() {
54
  // Session
75
 
76
  // "WooCommerce Product Add-ons" plugin
77
  add_filter( 'get_product_addons', array( $this, 'change_price_addons' ) );
78
+
79
+ // Additional Price Filters
80
+ $this->additional_price_filters = get_option( 'wcj_multicurrency_switcher_additional_price_filters', '' );
81
+ if ( ! empty( $this->additional_price_filters ) ) {
82
+ $this->additional_price_filters = array_map( 'trim', explode( PHP_EOL, $this->additional_price_filters ) );
83
+ foreach ( $this->additional_price_filters as $additional_price_filter ) {
84
+ add_filter( $additional_price_filter, array( $this, 'change_price' ), PHP_INT_MAX - 1, 2 );
85
+ }
86
+ } else {
87
+ $this->additional_price_filters = array();
88
+ }
89
  }
90
  }
91
 
198
  /**
199
  * change_price.
200
  *
201
+ * @version 3.1.2
202
  */
203
  function change_price( $price, $_product ) {
204
 
218
  if ( 'woocommerce_get_price_including_tax' == $_current_filter || 'woocommerce_get_price_excluding_tax' == $_current_filter ) {
219
  return wcj_get_product_display_price( $_product );
220
 
221
+ } elseif ( WCJ_PRODUCT_GET_PRICE_FILTER == $_current_filter || 'woocommerce_variation_prices_price' == $_current_filter || 'woocommerce_product_variation_get_price' == $_current_filter || in_array( $_current_filter, $this->additional_price_filters ) ) {
222
  $sale_price_per_product = get_post_meta( $_product_id, '_' . 'wcj_multicurrency_per_product_sale_price_' . $this->get_current_currency_code(), true );
223
  return ( '' != $sale_price_per_product && $sale_price_per_product < $regular_price_per_product ) ? $sale_price_per_product : $regular_price_per_product;
224
 
303
  /**
304
  * change_price_shipping.
305
  *
306
+ * @version 3.1.2
307
  */
308
  function change_price_shipping( $package_rates, $package ) {
309
  if ( $this->do_revert() ) {
310
  return $package_rates;
311
  }
312
+ $currency_exchange_rate = $this->get_currency_exchange_rate( $this->get_current_currency_code() );
313
+ $modified_package_rates = array();
314
+ $is_wc_version_at_least_3_2 = version_compare( WCJ_WC_VERSION, '3.2.0', '>=' );
315
  foreach ( $package_rates as $id => $package_rate ) {
316
  if ( 1 != $currency_exchange_rate && isset( $package_rate->cost ) ) {
317
  $package_rate->cost = $package_rate->cost * $currency_exchange_rate;
318
  if ( isset( $package_rate->taxes ) && ! empty( $package_rate->taxes ) ) {
319
+ if ( $is_wc_version_at_least_3_2 ) {
320
+ $rate_taxes = $package_rate->taxes;
321
+ foreach ( $rate_taxes as &$tax ) {
322
+ $tax *= $currency_exchange_rate;
323
+ }
324
+ $package_rate->taxes = $rate_taxes;
325
+ } else {
326
+ foreach ( $package_rate->taxes as $tax_id => $tax ) {
327
+ $package_rate->taxes[ $tax_id ] = $package_rate->taxes[ $tax_id ] * $currency_exchange_rate;
328
+ }
329
  }
330
  }
331
  }
includes/class-wcj-order-custom-statuses.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Module - Order Custom Statuses
4
  *
5
- * @version 2.8.0
6
  * @since 2.2.0
7
  * @author Algoritmika Ltd.
8
  */
@@ -16,7 +16,7 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
16
  /**
17
  * Constructor.
18
  *
19
- * @version 2.8.0
20
  * @todo copy all changes from Custom Order Status plugin
21
  * @todo `wcj_orders_custom_statuses_processing_and_completed_actions` to Custom Order Status plugin
22
  */
@@ -60,9 +60,47 @@ class WCJ_Order_Custom_Statuses extends WCJ_Module {
60
  add_filter( 'woocommerce_admin_order_actions', array( $this, 'add_custom_status_to_processing_and_completed_actions' ), PHP_INT_MAX, 2 );
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * add_custom_status_to_processing_and_completed_actions.
68
  *
2
  /**
3
  * Booster for WooCommerce - Module - Order Custom Statuses
4
  *
5
+ * @version 3.1.2
6
  * @since 2.2.0
7
  * @author Algoritmika Ltd.
8
  */
16
  /**
17
  * Constructor.
18
  *
19
+ * @version 3.1.2
20
  * @todo copy all changes from Custom Order Status plugin
21
  * @todo `wcj_orders_custom_statuses_processing_and_completed_actions` to Custom Order Status plugin
22
  */
60
  add_filter( 'woocommerce_admin_order_actions', array( $this, 'add_custom_status_to_processing_and_completed_actions' ), PHP_INT_MAX, 2 );
61
  }
62
 
63
+ // Is order editable
64
+ if ( 'yes' === apply_filters( 'booster_get_option', 'no', get_option( 'wcj_orders_custom_statuses_is_order_editable', 'no' ) ) ) {
65
+ add_filter( 'wc_order_is_editable', array( $this, 'add_custom_order_statuses_to_order_editable' ), PHP_INT_MAX, 2 );
66
+ }
67
+
68
+ }
69
+ }
70
+
71
+ /**
72
+ * get_custom_order_statuses.
73
+ *
74
+ * @version 3.1.2
75
+ * @since 3.1.2
76
+ */
77
+ function get_custom_order_statuses( $cut_prefix = false ) {
78
+ $orders_custom_statuses = get_option( 'wcj_orders_custom_statuses_array', '' );
79
+ if ( empty( $orders_custom_statuses ) ) {
80
+ return array();
81
+ } else {
82
+ if ( $cut_prefix ) {
83
+ $orders_custom_statuses_no_prefix = array();
84
+ foreach( $orders_custom_statuses as $status => $status_name ) {
85
+ $orders_custom_statuses_no_prefix[ substr( $status, 3 ) ] = $status_name;
86
+ }
87
+ return $orders_custom_statuses_no_prefix;
88
+ } else {
89
+ return $orders_custom_statuses;
90
+ }
91
  }
92
  }
93
 
94
+ /**
95
+ * add_custom_order_statuses_to_order_editable.
96
+ *
97
+ * @version 3.1.2
98
+ * @since 3.1.2
99
+ */
100
+ function add_custom_order_statuses_to_order_editable( $is_editable, $_order ) {
101
+ return ( in_array( $_order->get_status(), array_keys( $this->get_custom_order_statuses( true ) ) ) ? true : $is_editable );
102
+ }
103
+
104
  /**
105
  * add_custom_status_to_processing_and_completed_actions.
106
  *
includes/emails/class-wc-email-wcj-custom.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * An email sent to recipient list when selected triggers are called.
6
  *
7
- * @version 3.1.0
8
  * @since 2.3.9
9
  * @author Algoritmika Ltd.
10
  * @extends WC_Email
@@ -104,7 +104,7 @@ class WC_Email_WCJ_Custom extends WC_Email {
104
  /**
105
  * trigger.
106
  *
107
- * @version 3.1.0
108
  */
109
  function trigger( $order_id ) {
110
 
@@ -114,17 +114,17 @@ class WC_Email_WCJ_Custom extends WC_Email {
114
 
115
  if ( $order_id ) {
116
 
117
- $order = wc_get_order( $order_id );
118
 
119
  if ( $this->customer_email ) {
120
- $this->recipient = wcj_get_order_billing_email( $order );
121
  }
122
 
123
  $this->find['order-date'] = '{order_date}';
124
  $this->find['order-number'] = '{order_number}';
125
 
126
- $this->replace['order-date'] = date_i18n( wc_date_format(), strtotime( wcj_get_order_date( $order ) ) );
127
- $this->replace['order-number'] = $order->get_order_number();
128
 
129
  global $post;
130
  if ( 'woocommerce_checkout_order_processed_notification' === current_filter() ) {
@@ -134,7 +134,7 @@ class WC_Email_WCJ_Custom extends WC_Email {
134
  foreach ( $trigger_hooks as $trigger_hook ) {
135
  if ( false !== ( $pos = strpos( $trigger_hook, 'woocommerce_new_order_notification' ) ) ) {
136
  $the_status = 'wc-' . substr( $trigger_hook, 35 );
137
- if ( 'wc-wcj_any_status' === $the_status || $order->post_status === $the_status ) {
138
  $is_status_found = true;
139
  break;
140
  }
@@ -144,7 +144,7 @@ class WC_Email_WCJ_Custom extends WC_Email {
144
  return;
145
  }
146
  }
147
- $post = ( WCJ_IS_WC_VERSION_BELOW_3 ? $order->post : get_post( $order_id ) );
148
  setup_postdata( $post );
149
  }
150
 
4
  *
5
  * An email sent to recipient list when selected triggers are called.
6
  *
7
+ * @version 3.1.2
8
  * @since 2.3.9
9
  * @author Algoritmika Ltd.
10
  * @extends WC_Email
104
  /**
105
  * trigger.
106
  *
107
+ * @version 3.1.2
108
  */
109
  function trigger( $order_id ) {
110
 
114
 
115
  if ( $order_id ) {
116
 
117
+ $this->object = wc_get_order( $order_id ); // must be `object` as it's named so in parent class (`WC_Email`). E.g. for attachments.
118
 
119
  if ( $this->customer_email ) {
120
+ $this->recipient = wcj_get_order_billing_email( $this->object );
121
  }
122
 
123
  $this->find['order-date'] = '{order_date}';
124
  $this->find['order-number'] = '{order_number}';
125
 
126
+ $this->replace['order-date'] = date_i18n( wc_date_format(), strtotime( wcj_get_order_date( $this->object ) ) );
127
+ $this->replace['order-number'] = $this->object->get_order_number();
128
 
129
  global $post;
130
  if ( 'woocommerce_checkout_order_processed_notification' === current_filter() ) {
134
  foreach ( $trigger_hooks as $trigger_hook ) {
135
  if ( false !== ( $pos = strpos( $trigger_hook, 'woocommerce_new_order_notification' ) ) ) {
136
  $the_status = 'wc-' . substr( $trigger_hook, 35 );
137
+ if ( 'wc-wcj_any_status' === $the_status || $this->object->post_status === $the_status ) {
138
  $is_status_found = true;
139
  break;
140
  }
144
  return;
145
  }
146
  }
147
+ $post = ( WCJ_IS_WC_VERSION_BELOW_3 ? $this->object->post : get_post( $order_id ) );
148
  setup_postdata( $post );
149
  }
150
 
includes/functions/wcj-price-currency-functions.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Functions - Price and Currency
4
  *
5
- * @version 3.1.0
6
  * @since 2.7.0
7
  * @author Algoritmika Ltd.
8
  */
@@ -98,7 +98,7 @@ if ( ! function_exists( 'wcj_price_by_product_base_currency' ) ) {
98
  /**
99
  * wcj_price_by_product_base_currency.
100
  *
101
- * @version 3.1.0
102
  * @since 2.5.6
103
  */
104
  function wcj_price_by_product_base_currency( $price, $product_id ) {
@@ -106,8 +106,14 @@ if ( ! function_exists( 'wcj_price_by_product_base_currency' ) ) {
106
  return $price;
107
  }
108
  $do_save = ( 'yes' === get_option( 'wcj_multicurrency_base_price_save_prices', 'no' ) );
109
- if ( $do_save && isset( WCJ()->modules['multicurrency_base_price']->calculated_products_prices[ $product_id ] ) ) {
110
- return WCJ()->modules['multicurrency_base_price']->calculated_products_prices[ $product_id ];
 
 
 
 
 
 
111
  }
112
  $multicurrency_base_price_currency = get_post_meta( $product_id, '_' . 'wcj_multicurrency_base_price_currency', true );
113
  if ( '' != $multicurrency_base_price_currency ) {
@@ -117,7 +123,7 @@ if ( ! function_exists( 'wcj_price_by_product_base_currency' ) ) {
117
  $_price = round( $_price, get_option( 'wcj_multicurrency_base_price_round_precision', get_option( 'woocommerce_price_num_decimals' ) ) );
118
  }
119
  if ( $do_save ) {
120
- WCJ()->modules['multicurrency_base_price']->calculated_products_prices[ $product_id ] = $_price;
121
  }
122
  return $_price;
123
  }
2
  /**
3
  * Booster for WooCommerce - Functions - Price and Currency
4
  *
5
+ * @version 3.1.2
6
  * @since 2.7.0
7
  * @author Algoritmika Ltd.
8
  */
98
  /**
99
  * wcj_price_by_product_base_currency.
100
  *
101
+ * @version 3.1.2
102
  * @since 2.5.6
103
  */
104
  function wcj_price_by_product_base_currency( $price, $product_id ) {
106
  return $price;
107
  }
108
  $do_save = ( 'yes' === get_option( 'wcj_multicurrency_base_price_save_prices', 'no' ) );
109
+ if ( $do_save ) {
110
+ $_current_filter = current_filter();
111
+ if ( '' == $_current_filter ) {
112
+ $_current_filter = 'wcj_filter__none';
113
+ }
114
+ }
115
+ if ( $do_save && isset( WCJ()->modules['multicurrency_base_price']->calculated_products_prices[ $product_id ][ $_current_filter ] ) ) {
116
+ return WCJ()->modules['multicurrency_base_price']->calculated_products_prices[ $product_id ][ $_current_filter ];
117
  }
118
  $multicurrency_base_price_currency = get_post_meta( $product_id, '_' . 'wcj_multicurrency_base_price_currency', true );
119
  if ( '' != $multicurrency_base_price_currency ) {
123
  $_price = round( $_price, get_option( 'wcj_multicurrency_base_price_round_precision', get_option( 'woocommerce_price_num_decimals' ) ) );
124
  }
125
  if ( $do_save ) {
126
+ WCJ()->modules['multicurrency_base_price']->calculated_products_prices[ $product_id ][ $_current_filter ] = $_price;
127
  }
128
  return $_price;
129
  }
includes/settings/wcj-settings-multicurrency.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Settings - Multicurrency (Currency Switcher)
4
  *
5
- * @version 2.8.0
6
  * @since 2.8.0
7
  * @author Algoritmika Ltd.
8
  * @todo "pretty prices"
@@ -10,7 +10,7 @@
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
- $currency_from = get_woocommerce_currency();
14
  $all_currencies = wcj_get_currencies_names_and_symbols();
15
  $settings = array(
16
  array(
@@ -71,11 +71,20 @@ $settings = array(
71
  ),
72
  array(
73
  'title' => __( 'Currency Switcher Template', 'woocommerce-jetpack' ),
74
- 'desc' => __( 'Replaced values:', 'woocommerce-jetpack' ) . ' ' . '%currency_name%, %currency_symbol%, %currency_code%.',
75
  'id' => 'wcj_multicurrency_switcher_template',
76
  'default' => '%currency_name% (%currency_symbol%)',
77
  'type' => 'text',
78
- 'css' => 'min-width:300px;width:66%;',
 
 
 
 
 
 
 
 
 
79
  ),
80
  array(
81
  'type' => 'sectionend',
2
  /**
3
  * Booster for WooCommerce - Settings - Multicurrency (Currency Switcher)
4
  *
5
+ * @version 3.1.2
6
  * @since 2.8.0
7
  * @author Algoritmika Ltd.
8
  * @todo "pretty prices"
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
+ $currency_from = get_woocommerce_currency();
14
  $all_currencies = wcj_get_currencies_names_and_symbols();
15
  $settings = array(
16
  array(
71
  ),
72
  array(
73
  'title' => __( 'Currency Switcher Template', 'woocommerce-jetpack' ),
74
+ 'desc' => wcj_message_replaced_values( array( '%currency_name%', '%currency_symbol%', '%currency_code%' ) ),
75
  'id' => 'wcj_multicurrency_switcher_template',
76
  'default' => '%currency_name% (%currency_symbol%)',
77
  'type' => 'text',
78
+ 'class' => 'widefat',
79
+ ),
80
+ array(
81
+ 'title' => __( 'Advanced: Additional Price Filters', 'woocommerce-jetpack' ),
82
+ 'desc_tip' => __( 'Add additional price filters here. One per line. Leave blank if not sure.' ),
83
+ 'desc' => sprintf( __( 'E.g.: %s' ), '<code>' . 'woocommerce_subscriptions_product_price' . '</code>' . ', ' .'<code>' . 'woocommerce_get_price' . '</code>' . '.' ),
84
+ 'id' => 'wcj_multicurrency_switcher_additional_price_filters',
85
+ 'default' => '',
86
+ 'type' => 'textarea',
87
+ 'css' => 'min-width:300px;height:150px;',
88
  ),
89
  array(
90
  'type' => 'sectionend',
includes/settings/wcj-settings-order-custom-statuses.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce Settings - Order Custom Statuses
4
  *
5
- * @version 2.8.0
6
  * @since 2.8.0
7
  * @author Algoritmika Ltd.
8
  */
@@ -38,6 +38,15 @@ return array(
38
  'default' => 'yes',
39
  'type' => 'checkbox',
40
  ),
 
 
 
 
 
 
 
 
 
41
  array(
42
  'title' => __( '"Processing" and "Complete" Action Buttons', 'woocommerce-jetpack' ),
43
  'desc_tip' => __( 'By default, when order has custom status, "Processing" and "Complete" action buttons are hidden. You can enable it here. Possible values are: Show both; Show "Processing" only; Show "Complete" only; Hide (default).', 'woocommerce-jetpack' ),
2
  /**
3
  * Booster for WooCommerce Settings - Order Custom Statuses
4
  *
5
+ * @version 3.1.2
6
  * @since 2.8.0
7
  * @author Algoritmika Ltd.
8
  */
38
  'default' => 'yes',
39
  'type' => 'checkbox',
40
  ),
41
+ array(
42
+ 'title' => __( 'Make Custom Status Orders Editable', 'woocommerce-jetpack' ),
43
+ 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
44
+ 'id' => 'wcj_orders_custom_statuses_is_order_editable',
45
+ 'default' => 'no',
46
+ 'type' => 'checkbox',
47
+ 'desc_tip' => apply_filters( 'booster_get_message', '', 'desc' ),
48
+ 'custom_attributes' => apply_filters( 'booster_get_message', '', 'disabled' ),
49
+ ),
50
  array(
51
  'title' => __( '"Processing" and "Complete" Action Buttons', 'woocommerce-jetpack' ),
52
  'desc_tip' => __( 'By default, when order has custom status, "Processing" and "Complete" action buttons are hidden. You can enable it here. Possible values are: Show both; Show "Processing" only; Show "Complete" only; Hide (default).', 'woocommerce-jetpack' ),
includes/shortcodes/class-wcj-order-items-shortcodes.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Shortcodes - Order Items
4
  *
5
- * @version 3.1.0
6
  * @author Algoritmika Ltd.
7
  */
8
 
@@ -27,7 +27,7 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
27
  /**
28
  * add_extra_atts.
29
  *
30
- * @version 3.1.0
31
  */
32
  function add_extra_atts( $atts ) {
33
  $modified_atts = array_merge( array(
@@ -59,6 +59,7 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
59
  'multiply_cost' => 1,
60
  'multiply_profit' => 1,
61
  'refunded_items_table' => 'no',
 
62
  ), $atts );
63
  return $modified_atts;
64
  }
@@ -104,9 +105,12 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
104
  /**
105
  * wcj_price_shortcode.
106
  *
107
- * @version 2.7.0
108
  */
109
  private function wcj_price_shortcode( $raw_price, $atts ) {
 
 
 
110
  return wcj_price( $atts['price_prefix'] . $raw_price, wcj_get_order_currency( $this->the_order ), $atts['hide_currency'] );
111
  }
112
 
@@ -273,7 +277,7 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
273
  /**
274
  * wcj_order_items_table.
275
  *
276
- * @version 3.1.0
277
  */
278
  function wcj_order_items_table( $atts, $content = '' ) {
279
 
@@ -651,6 +655,7 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
651
  'item_id' => $item_id,
652
  'item_counter' => $item_counter,
653
  'product' => $the_product,
 
654
  ) );
655
  }
656
  }
@@ -666,11 +671,11 @@ class WCJ_Order_Items_Shortcodes extends WCJ_Shortcodes {
666
  'columns_styles' => $columns_styles,
667
  );
668
  if ( '' != $atts['insert_page_break'] ) {
669
- $page_breaks = explode ( '|', $atts['insert_page_break'] );
670
- $data_size = count( $data );
671
  $slice_offset = 0;
672
- $html = '';
673
- $slices = 0;
674
  while ( $slice_offset < $data_size ) {
675
  if ( 0 != $slice_offset ) {
676
  $html .= '<tcpdf method="AddPage" />';
2
  /**
3
  * Booster for WooCommerce - Shortcodes - Order Items
4
  *
5
+ * @version 3.1.2
6
  * @author Algoritmika Ltd.
7
  */
8
 
27
  /**
28
  * add_extra_atts.
29
  *
30
+ * @version 3.1.2
31
  */
32
  function add_extra_atts( $atts ) {
33
  $modified_atts = array_merge( array(
59
  'multiply_cost' => 1,
60
  'multiply_profit' => 1,
61
  'refunded_items_table' => 'no',
62
+ 'hide_zero_prices' => 'no',
63
  ), $atts );
64
  return $modified_atts;
65
  }
105
  /**
106
  * wcj_price_shortcode.
107
  *
108
+ * @version 3.1.2
109
  */
110
  private function wcj_price_shortcode( $raw_price, $atts ) {
111
+ if ( 'yes' === $atts['hide_zero_prices'] && 0 == $raw_price ) {
112
+ return '';
113
+ }
114
  return wcj_price( $atts['price_prefix'] . $raw_price, wcj_get_order_currency( $this->the_order ), $atts['hide_currency'] );
115
  }
116
 
277
  /**
278
  * wcj_order_items_table.
279
  *
280
+ * @version 3.1.2
281
  */
282
  function wcj_order_items_table( $atts, $content = '' ) {
283
 
655
  'item_id' => $item_id,
656
  'item_counter' => $item_counter,
657
  'product' => $the_product,
658
+ 'order' => $this->the_order,
659
  ) );
660
  }
661
  }
671
  'columns_styles' => $columns_styles,
672
  );
673
  if ( '' != $atts['insert_page_break'] ) {
674
+ $page_breaks = explode ( '|', $atts['insert_page_break'] );
675
+ $data_size = count( $data );
676
  $slice_offset = 0;
677
+ $html = '';
678
+ $slices = 0;
679
  while ( $slice_offset < $data_size ) {
680
  if ( 0 != $slice_offset ) {
681
  $html .= '<tcpdf method="AddPage" />';
includes/shortcodes/class-wcj-orders-shortcodes.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Booster for WooCommerce - Shortcodes - Orders
4
  *
5
- * @version 3.1.0
6
  * @author Algoritmika Ltd.
7
  */
8
 
@@ -15,7 +15,7 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
15
  /**
16
  * Constructor.
17
  *
18
- * @version 3.1.0
19
  */
20
  function __construct() {
21
 
@@ -63,6 +63,7 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
63
  'wcj_order_taxes_html',
64
  'wcj_order_time',
65
  'wcj_order_total',
 
66
  'wcj_order_total_by_tax_class',
67
  'wcj_order_total_discount',
68
  'wcj_order_total_excl_shipping',
@@ -77,6 +78,7 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
77
  'wcj_order_total_shipping_refunded',
78
  'wcj_order_total_refunded',
79
  'wcj_order_total_tax',
 
80
  'wcj_order_total_tax_percent',
81
  'wcj_order_total_tax_refunded',
82
  'wcj_order_total_weight',
@@ -90,7 +92,7 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
90
  /**
91
  * add_extra_atts.
92
  *
93
- * @version 3.1.0
94
  */
95
  function add_extra_atts( $atts ) {
96
  $modified_atts = array_merge( array(
@@ -123,6 +125,7 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
123
  'columns' => '',
124
  'price_prefix' => '',
125
  'display_refunded' => 'yes',
 
126
  ), $atts );
127
 
128
  return $modified_atts;
@@ -201,7 +204,7 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
201
  /**
202
  * wcj_order_refunds_table.
203
  *
204
- * @version 3.1.0
205
  * @since 3.1.0
206
  * @todo add `refund_items_or_reason_or_title` column
207
  * @todo add `refund_items_quantities` column (`$_item->get_quantity()`)
@@ -242,20 +245,41 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
242
  break;
243
  }
244
  $row[] = $cell;
245
- $i++;
246
  }
 
247
  $table_data[] = $row;
248
  }
249
- return ( ! empty( $table_data ) ?
250
- wcj_get_table_html(
251
- array_merge( array( ( '' == $atts['columns_titles'] ? array() : explode( '|', $atts['columns_titles'] ) ) ), $table_data ),
252
- array(
253
- 'table_class' => $atts['table_class'],
254
- 'columns_styles' => ( '' == $atts['columns_styles'] ? array() : explode( '|', $atts['columns_styles'] ) ),
255
- )
256
- ) :
257
- ''
258
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  }
260
 
261
  /**
@@ -994,11 +1018,21 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
994
 
995
  /**
996
  * wcj_order_total_tax.
 
 
997
  */
998
  function wcj_order_total_tax( $atts ) {
999
- $order_total_tax = $this->the_order->get_total_tax();
1000
- $order_total_tax = apply_filters( 'wcj_order_total_tax', $order_total_tax, $this->the_order );
1001
- return $this->wcj_price_shortcode( $order_total_tax, $atts );
 
 
 
 
 
 
 
 
1002
  }
1003
 
1004
  /**
@@ -1072,14 +1106,27 @@ class WCJ_Orders_Shortcodes extends WCJ_Shortcodes {
1072
 
1073
  /**
1074
  * wcj_order_total.
1075
- *
1076
- * @todo (maybe) add attribute to deduct refunded (check `get_total_refunded()`, `get_total_tax_refunded()`, `get_total_shipping_refunded()`)
1077
  */
1078
  function wcj_order_total( $atts ) {
1079
  $order_total = ( true === $atts['excl_tax'] ) ? $this->the_order->get_total() - $this->the_order->get_total_tax() : $this->the_order->get_total();
1080
  return $this->wcj_price_shortcode( $order_total, $atts );
1081
  }
1082
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1083
  /**
1084
  * mb_ucfirst - for wcj_order_total_in_words.
1085
  *
2
  /**
3
  * Booster for WooCommerce - Shortcodes - Orders
4
  *
5
+ * @version 3.1.2
6
  * @author Algoritmika Ltd.
7
  */
8
 
15
  /**
16
  * Constructor.
17
  *
18
+ * @version 3.1.2
19
  */
20
  function __construct() {
21
 
63
  'wcj_order_taxes_html',
64
  'wcj_order_time',
65
  'wcj_order_total',
66
+ 'wcj_order_total_after_refund',
67
  'wcj_order_total_by_tax_class',
68
  'wcj_order_total_discount',
69
  'wcj_order_total_excl_shipping',
78
  'wcj_order_total_shipping_refunded',
79
  'wcj_order_total_refunded',
80
  'wcj_order_total_tax',
81
+ 'wcj_order_total_tax_after_refund',
82
  'wcj_order_total_tax_percent',
83
  'wcj_order_total_tax_refunded',
84
  'wcj_order_total_weight',
92
  /**
93
  * add_extra_atts.
94
  *
95
+ * @version 3.1.2
96
  */
97
  function add_extra_atts( $atts ) {
98
  $modified_atts = array_merge( array(
125
  'columns' => '',
126
  'price_prefix' => '',
127
  'display_refunded' => 'yes',
128
+ 'insert_page_break' => '',
129
  ), $atts );
130
 
131
  return $modified_atts;
204
  /**
205
  * wcj_order_refunds_table.
206
  *
207
+ * @version 3.1.2
208
  * @since 3.1.0
209
  * @todo add `refund_items_or_reason_or_title` column
210
  * @todo add `refund_items_quantities` column (`$_item->get_quantity()`)
245
  break;
246
  }
247
  $row[] = $cell;
 
248
  }
249
+ $i++;
250
  $table_data[] = $row;
251
  }
252
+ if ( empty( $table_data ) ) {
253
+ return '';
254
+ }
255
+ $table_html_args = array(
256
+ 'table_class' => $atts['table_class'],
257
+ 'columns_classes' => array(),
258
+ 'columns_styles' => ( '' == $atts['columns_styles'] ? array() : explode( '|', $atts['columns_styles'] ) ),
 
 
259
  );
260
+ $columns_titles = array( ( '' == $atts['columns_titles'] ? array() : explode( '|', $atts['columns_titles'] ) ) );
261
+ if ( '' != $atts['insert_page_break'] ) {
262
+ $page_breaks = explode ( '|', $atts['insert_page_break'] );
263
+ $data_size = count( $table_data );
264
+ $slice_offset = 0;
265
+ $html = '';
266
+ $slices = 0;
267
+ while ( $slice_offset < $data_size ) {
268
+ if ( 0 != $slice_offset ) {
269
+ $html .= '<tcpdf method="AddPage" />';
270
+ }
271
+ if ( isset( $page_breaks[ $slices ] ) ) {
272
+ $current_page_break = $page_breaks[ $slices ];
273
+ }
274
+ $data_slice = array_slice( $table_data, $slice_offset, $current_page_break );
275
+ $html .= wcj_get_table_html( array_merge( $columns_titles, $data_slice ), $table_html_args );
276
+ $slice_offset += $current_page_break;
277
+ $slices++;
278
+ }
279
+ } else {
280
+ $html = wcj_get_table_html( array_merge( $columns_titles, $table_data ), $table_html_args );
281
+ }
282
+ return $html;
283
  }
284
 
285
  /**
1018
 
1019
  /**
1020
  * wcj_order_total_tax.
1021
+ *
1022
+ * @version 3.1.2
1023
  */
1024
  function wcj_order_total_tax( $atts ) {
1025
+ return $this->wcj_price_shortcode( apply_filters( 'wcj_order_total_tax', $this->the_order->get_total_tax(), $this->the_order ), $atts );
1026
+ }
1027
+
1028
+ /**
1029
+ * wcj_order_total_tax_after_refund.
1030
+ *
1031
+ * @version 3.1.2
1032
+ * @since 3.1.2
1033
+ */
1034
+ function wcj_order_total_tax_after_refund( $atts ) {
1035
+ return $this->wcj_price_shortcode( ( $this->the_order->get_total_tax() - $this->the_order->get_total_tax_refunded() ), $atts );
1036
  }
1037
 
1038
  /**
1106
 
1107
  /**
1108
  * wcj_order_total.
 
 
1109
  */
1110
  function wcj_order_total( $atts ) {
1111
  $order_total = ( true === $atts['excl_tax'] ) ? $this->the_order->get_total() - $this->the_order->get_total_tax() : $this->the_order->get_total();
1112
  return $this->wcj_price_shortcode( $order_total, $atts );
1113
  }
1114
 
1115
+ /**
1116
+ * wcj_order_total_after_refund.
1117
+ *
1118
+ * @version 3.1.2
1119
+ * @since 3.1.2
1120
+ * @todo (maybe) `get_total_shipping_refunded()`
1121
+ */
1122
+ function wcj_order_total_after_refund( $atts ) {
1123
+ $order_total_after_refund = $this->the_order->get_total() - $this->the_order->get_total_refunded();
1124
+ if ( true === $atts['excl_tax'] ) {
1125
+ $order_total_after_refund -= ( $this->the_order->get_total_tax() - $this->the_order->get_total_tax_refunded() );
1126
+ }
1127
+ return $this->wcj_price_shortcode( $order_total_after_refund, $atts );
1128
+ }
1129
+
1130
  /**
1131
  * mb_ucfirst - for wcj_order_total_in_words.
1132
  *
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: algoritmika,anbinder
3
  Tags: woocommerce,booster for woocommerce,woocommerce jetpack
4
  Requires at least: 4.4
5
  Tested up to: 4.8
6
- Stable tag: 3.1.1
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -167,6 +167,21 @@ You can see the differences between versions in this [table](https://booster.io/
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  = 3.1.1 - 17/09/2017 =
171
  * Dev - Version message added.
172
  * Dev - `WCJ_Module` - `create_meta_box()` - `show_value` option added.
3
  Tags: woocommerce,booster for woocommerce,woocommerce jetpack
4
  Requires at least: 4.4
5
  Tested up to: 4.8
6
+ Stable tag: 3.1.2
7
  License: GNU General Public License v3.0
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
167
 
168
  == Changelog ==
169
 
170
+ = 3.1.2 - 22/09/2017 =
171
+ * Dev - WooCommerce v3.2 compatibility - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - `change_price_shipping()` - Taxes.
172
+ * Dev - Shortcodes - Orders - `[wcj_order_items_table]` - `wcj_pdf_invoicing_cell_data` filter - `order` argument added.
173
+ * Dev - Shortcodes - Orders - `[wcj_order_items_table]` - `hide_zero_prices` - attribute added.
174
+ * Fix - Shortcodes - Orders - `[wcj_order_refunds_table]` - `columns` - `refund_number` fixed.
175
+ * Dev - Shortcodes - Orders - `[wcj_order_refunds_table]` - `insert_page_break` attribute added.
176
+ * Dev - Shortcodes - Orders - `[wcj_order_total_after_refund]` shortcode added.
177
+ * Dev - Shortcodes - Orders - `[wcj_order_total_tax_after_refund]` shortcode added.
178
+ * Dev - Shortcodes - Orders - `[wcj_order_total_tax]` - Code refactoring.
179
+ * Dev - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - Admin settings restyled.
180
+ * Dev - PRICES & CURRENCIES - Multicurrency (Currency Switcher) - "Advanced: Additional Price Filters" option added.
181
+ * Fix - PRICES & CURRENCIES - Multicurrency Product Base Price - Advanced: Saved Calculated Products Prices - Filter bug fixed.
182
+ * Dev - SHIPPING & ORDERS - Order Custom Statuses - "Make Custom Status Orders Editable" option added.
183
+ * Fix - EMAILS & MISC. - Custom Emails - Email attachments fixed.
184
+
185
  = 3.1.1 - 17/09/2017 =
186
  * Dev - Version message added.
187
  * Dev - `WCJ_Module` - `create_meta_box()` - `show_value` option added.
woocommerce-jetpack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: https://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
- Version: 3.1.1
7
  Author: Algoritmika Ltd
8
  Author URI: https://booster.io
9
  Text Domain: woocommerce-jetpack
@@ -74,7 +74,7 @@ final class WC_Jetpack {
74
  * @var string
75
  * @since 2.4.7
76
  */
77
- public $version = '3.1.1';
78
 
79
  /**
80
  * @var WC_Jetpack The single instance of the class
3
  Plugin Name: Booster for WooCommerce
4
  Plugin URI: https://booster.io
5
  Description: Supercharge your WooCommerce site with these awesome powerful features.
6
+ Version: 3.1.2
7
  Author: Algoritmika Ltd
8
  Author URI: https://booster.io
9
  Text Domain: woocommerce-jetpack
74
  * @var string
75
  * @since 2.4.7
76
  */
77
+ public $version = '3.1.2';
78
 
79
  /**
80
  * @var WC_Jetpack The single instance of the class