Booster for WooCommerce - Version 2.2.1

Version Description

  • 04/07/2015 =
  • Dev - Shortcodes - location, site_visibility, wpml_language attributes added to all shortcodes.
  • Dev - PRICES & CURRENCIES - Price by Country - "by user selection" option added. [wcj_country_select_drop_down_list] shortcode added.
  • Fix - PRICES & CURRENCIES - Wholesale Price - decimal point in discount percent, fixed.
  • Dev - PRODUCTS - Related Products - Separate option for hiding the related products added.
  • Dev - CART & CHECKOUT - Empty Cart Button - "Confirmation by pop up box" option added.
  • Dev - CART & CHECKOUT - Empty Cart Button - Initial module release.
  • Dev - CART & CHECKOUT - Cart - Code refactoring.
  • Dev - PDF Invoicing - Invoice report tool added.
  • Dev - PDF Invoicing - PDF invoices Header and Footer font set as "general font" set in "Styling" section.
  • Dev - PDF Invoicing - Renumerate Invoices Tool - date_query added (fix for "memory exhausted" message, on large number of total shop orders).
  • Fix - EMAILS & MISC. - WPML - wcj_wpml_translate added to General Shortcodes list.
  • Dev - EMAILS & MISC. - General - "Enable shortcodes in WordPress text widgets" option added.
  • Dev - EMAILS & MISC. - General - Code refactoring.
Download this release

Release Info

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

Code changes from version 2.2.0 to 2.2.1

includes/admin/class-wc-settings-jetpack.php CHANGED
@@ -61,7 +61,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
61
  $custom_attributes = ( is_array( $value['custom_attributes'] ) ) ? $value['custom_attributes'] : array();
62
  $description = ' <span class="description">' . $value['desc'] . '</span>';
63
  $save_button = apply_filters( 'wcj_get_option_filter', '', ' <input name="save" class="button-primary" type="submit" value="' . __( 'Save changes', 'woocommerce' ) . '">' );
64
-
65
  ?><tr valign="top">
66
  <th scope="row" class="titledesc">
67
  <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
@@ -247,7 +247,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
247
  foreach ( $this->cats as $cat_id => $cat_label_info ) {
248
  if ( 'dashboard' === $cat_id ) continue;
249
  echo '<h4>' . $cat_label_info['label'] . '</h4>';
250
- $readme_html .= '**' . $cat_label_info['label'] . '**' . PHP_EOL;
251
  $readme_html .= $this->output_dashboard_modules( $the_settings, $cat_id );
252
  }
253
  }
@@ -330,7 +330,7 @@ class WC_Settings_Jetpack extends WC_Settings_Page {
330
 
331
  $html .= '</tr>';
332
 
333
- $readme_html .= '* ' . $the_feature['title'] . ' - ' . $the_feature['desc_tip'] . PHP_EOL;
334
  }
335
  echo $html;
336
  ?></tbody>
61
  $custom_attributes = ( is_array( $value['custom_attributes'] ) ) ? $value['custom_attributes'] : array();
62
  $description = ' <span class="description">' . $value['desc'] . '</span>';
63
  $save_button = apply_filters( 'wcj_get_option_filter', '', ' <input name="save" class="button-primary" type="submit" value="' . __( 'Save changes', 'woocommerce' ) . '">' );
64
+
65
  ?><tr valign="top">
66
  <th scope="row" class="titledesc">
67
  <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
247
  foreach ( $this->cats as $cat_id => $cat_label_info ) {
248
  if ( 'dashboard' === $cat_id ) continue;
249
  echo '<h4>' . $cat_label_info['label'] . '</h4>';
250
+ $readme_html .= PHP_EOL . '**' . $cat_label_info['label'] . '**' . PHP_EOL . PHP_EOL;
251
  $readme_html .= $this->output_dashboard_modules( $the_settings, $cat_id );
252
  }
253
  }
330
 
331
  $html .= '</tr>';
332
 
333
+ $readme_html .= '* *' . $the_feature['title'] . '* - ' . $the_feature['desc_tip'] . PHP_EOL;
334
  }
335
  echo $html;
336
  ?></tbody>
includes/admin/wcj-modules-cats.php CHANGED
@@ -4,9 +4,9 @@
4
  *
5
  * The WooCommerce Modules Array.
6
  *
7
- * @version 2.2.0
8
- * @since 2.2.0
9
- * @author Algoritmika Ltd.
10
  */
11
 
12
  return array(
@@ -34,7 +34,7 @@ return array(
34
  ),
35
 
36
  'labels' => array(
37
- 'label' => __( 'Price & Button Labels', 'woocommerce-jetpack' ),
38
  'default_cat_id' => 'price_labels',
39
  'all_cat_ids' => array(
40
  'price_labels',
@@ -66,6 +66,7 @@ return array(
66
  'default_cat_id' => 'cart',
67
  'all_cat_ids' => array(
68
  'cart',
 
69
  'mini_cart',
70
  'checkout_core_fields',
71
  'checkout_custom_fields',
4
  *
5
  * The WooCommerce Modules Array.
6
  *
7
+ * @version 2.2.1
8
+ * @since 2.2.0
9
+ * @author Algoritmika Ltd.
10
  */
11
 
12
  return array(
34
  ),
35
 
36
  'labels' => array(
37
+ 'label' => __( 'Button & Price Labels', 'woocommerce-jetpack' ),
38
  'default_cat_id' => 'price_labels',
39
  'all_cat_ids' => array(
40
  'price_labels',
66
  'default_cat_id' => 'cart',
67
  'all_cat_ids' => array(
68
  'cart',
69
+ 'empty_cart',
70
  'mini_cart',
71
  'checkout_core_fields',
72
  'checkout_custom_fields',
includes/class-wcj-admin-tools.php CHANGED
@@ -4,10 +4,8 @@
4
  *
5
  * The WooCommerce Jetpack Admin Tools class.
6
  *
7
- * @class WCJ_Admin_Tools
8
- * @version 1.0.0
9
- * @category Class
10
- * @author Algoritmika Ltd.
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit;
@@ -85,82 +83,6 @@ class WCJ_Admin_Tools {
85
 
86
  echo '<p>' . $the_log . '</p>';
87
 
88
- /**
89
- // Show invoices
90
- $data = array();
91
- $data[] = array(
92
- 'Invoice Nr.',
93
- 'Invoice Date',
94
- 'Order ID',
95
- 'Customer Country',
96
- 'Tax %',
97
- 'Order Total Tax Excl.',
98
- 'Order Taxes',
99
- 'Order Total',
100
- );
101
-
102
- $total_sum = 0;
103
- $total_sum_excl_tax = 0;
104
- $total_tax = 0;
105
-
106
- $args = array(
107
- 'post_type' => 'shop_order',
108
- 'post_status' => 'any',
109
- 'posts_per_page' => -1,
110
- 'orderby' => 'date',
111
- 'order' => 'ASC',
112
-
113
- 'year' => 2015,
114
- 'monthnum' => 1,
115
- );
116
- $loop = new WP_Query( $args );
117
- while ( $loop->have_posts() ) : $loop->the_post();
118
- $order_id = $loop->post->ID;
119
- $invoice_type_id = 'invoice';
120
-
121
-
122
- if ( wcj_is_invoice_created( $order_id, $invoice_type_id ) ) {
123
-
124
- $the_order = wc_get_order( $order_id );
125
-
126
- $user_meta = get_user_meta( $the_order->get_user_id() );
127
- $billing_country = isset( $user_meta['billing_country'][0] ) ? $user_meta['billing_country'][0] : '';
128
- $shipping_country = isset( $user_meta['shipping_country'][0] ) ? $user_meta['shipping_country'][0] : '';
129
- $customer_country = ( '' == $billing_country ) ? $shipping_country : $billing_country;
130
-
131
- $order_total = $the_order->get_total();
132
-
133
- $order_tax = apply_filters( 'wcj_order_total_tax', $the_order->get_total_tax(), $the_order );
134
- //$order_tax_percent = ( isset( $taxes_by_countries_eu[ $customer_country ] ) ) ? $taxes_by_countries_eu[ $customer_country ] : 0;
135
- //$order_tax_percent /= 100;
136
- //$order_tax = $order_total * $order_tax_percent;
137
- $order_total_exlc_tax = $order_total - $order_tax;
138
- $order_tax_percent = ( 0 == $order_total ) ? 0 : $order_tax / $order_total_exlc_tax;
139
-
140
- $total_sum += $order_total;
141
- $total_sum_excl_tax += $order_total_exlc_tax;
142
- $total_tax += $order_tax;
143
-
144
- //$order_tax_html = ( 0 == $order_tax ) ? '' : sprintf( '$ %.2f', $order_tax );
145
- $order_tax_html = sprintf( '$ %.2f', $order_tax );
146
-
147
- $data[] = array(
148
- wcj_get_invoice_number( $order_id, $invoice_type_id ),
149
- wcj_get_invoice_date( $order_id, $invoice_type_id, 0, get_option( 'date_format' ) ),
150
- $order_id,
151
- $customer_country,
152
- sprintf( '%.0f %%', $order_tax_percent * 100 ),
153
- sprintf( '$ %.2f', $order_total_exlc_tax ),
154
- $order_tax_html,
155
- sprintf( '$ %.2f', $order_total ),
156
- );
157
- }
158
- endwhile;
159
- echo '<h3>' . 'Total Sum Excl. Tax: ' . sprintf( '$ %.2f', $total_sum_excl_tax ) . '</h3>';
160
- echo '<h3>' . 'Total Sum: ' . sprintf( '$ %.2f', $total_sum ) . '</h3>';
161
- echo '<h3>' . 'Total Tax: ' . sprintf( '$ %.2f', $total_tax ) . '</h3>';
162
- echo wcj_get_table_html( $data, array( 'table_class' => 'widefat', ) );
163
- /**/
164
  }
165
 
166
  /**
4
  *
5
  * The WooCommerce Jetpack Admin Tools class.
6
  *
7
+ * @version 2.2.1
8
+ * @author Algoritmika Ltd.
 
 
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
83
 
84
  echo '<p>' . $the_log . '</p>';
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  }
87
 
88
  /**
includes/class-wcj-cart.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Cart class.
6
  *
7
- * @version 2.2.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -12,24 +12,19 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
 
13
  if ( ! class_exists( 'WCJ_Cart' ) ) :
14
 
15
- class WCJ_Cart {
16
 
17
- /**
18
- * Constructor.
19
- */
20
- public function __construct() {
21
-
22
- // Main hooks
23
- if ( 'yes' === get_option( 'wcj_cart_enabled' ) ) {
24
 
25
- if ( 'yes' === get_option( 'wcj_empty_cart_enabled' ) ) {
26
- add_action( 'init', array( $this, 'empty_cart' ) );
27
- //add_action( get_option( 'wcj_empty_cart_position', 'woocommerce_after_cart' ), array( $this, 'add_empty_cart_link' ) );
28
- add_action( apply_filters( 'wcj_get_option_filter', 'woocommerce_after_cart', get_option( 'wcj_empty_cart_position', 'woocommerce_after_cart' ) ),
29
- array( $this, 'add_empty_cart_link' ) );
30
 
31
- //add_filter( 'wcj_empty_cart_button_filter', array( $this, 'empty_cart_button_filter_function' ), 100, 2 );
32
- }
33
 
34
  /*if ( 'yes' === get_option( 'wcj_cart_hide_shipping_and_taxes_estimated_message' ) )
35
  add_filter( 'gettext', array( $this, 'hide_shipping_and_taxes_estimated_message' ), 20, 3 );*/
@@ -40,16 +35,11 @@ class WCJ_Cart {
40
  add_action( get_option( 'wcj_cart_custom_info_hook_' . $i, 'woocommerce_after_cart_totals' ), array( $this, 'add_cart_custom_info' ) );
41
  }
42
  }
 
43
 
44
- // Settings hooks
45
- add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
46
- add_filter( 'wcj_settings_cart', array( $this, 'get_settings' ), 100 );
47
- add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
48
- }
49
-
50
- /**
51
- * add_cart_custom_info.
52
- */
53
  function add_cart_custom_info() {
54
  $current_filter = current_filter();
55
  $total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_cart_custom_info_total_number', 1 ) );
@@ -60,50 +50,10 @@ class WCJ_Cart {
60
  }
61
  }
62
 
63
- /*
64
- * empty_cart_button_filter_function.
65
- *
66
- public function empty_cart_button_filter_function ( $value, $type ) {
67
-
68
- if ( 'text' == $type ) return 'Empty Cart';
69
- if ( 'div-style' == $type ) return 'float: right';
70
- }
71
-
72
- /**
73
- * add_empty_cart_link.
74
- */
75
- public function add_empty_cart_link() {
76
- echo '<div style="' . apply_filters( 'wcj_get_option_filter', 'float: right;', get_option( 'wcj_empty_cart_div_style' ) ) . '"><form action="" method="post"><input type="submit" class="button" name="empty_cart" value="' . apply_filters( 'wcj_get_option_filter', 'Empty Cart', get_option( 'wcj_empty_cart_text' ) ) . '"></form></div>';
77
- //echo '<input type="submit" class="button" name="empty_cart" value="' . apply_filters( 'wcj_get_option_filter', 'Empty Cart', get_option( 'wcj_empty_cart_text' ) ) . '">';
78
- }
79
-
80
- /**
81
- * empty_cart.
82
- */
83
- public function empty_cart() {
84
-
85
- if ( isset( $_POST['empty_cart'] ) ) {
86
-
87
- global $woocommerce;
88
- $woocommerce->cart->empty_cart();
89
- }
90
- }
91
-
92
- /**
93
- * add_enabled_option.
94
- */
95
- public function add_enabled_option( $settings ) {
96
-
97
- $all_settings = $this->get_settings();
98
- $settings[] = $all_settings[1];
99
-
100
- return $settings;
101
- }
102
-
103
  /**
104
- * change_labels.
105
- *
106
- public function hide_shipping_and_taxes_estimated_message( $translated_text, $text, $domain ) {
107
 
108
  if ( ! function_exists( 'is_cart' ) || ! is_cart() )
109
  return $translated_text;
@@ -114,25 +64,12 @@ class WCJ_Cart {
114
  return $translated_text;
115
  }
116
 
 
 
 
 
117
 
118
-
119
- /**
120
- * get_settings.
121
- */
122
- function get_settings() {
123
-
124
- $settings = array(
125
-
126
- array( 'title' => __( 'Cart Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_cart_options' ),
127
-
128
- array(
129
- 'title' => __( 'Cart', 'woocommerce-jetpack' ),
130
- 'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
131
- 'desc_tip' => __( 'Add custom info to WooCommerce cart page. Add empty cart button.', 'woocommerce-jetpack' ),
132
- 'id' => 'wcj_cart_enabled',
133
- 'default' => 'no',
134
- 'type' => 'checkbox',
135
- ),
136
 
137
  /*array(
138
  'title' => __( 'Hide "Note: Shipping and taxes are estimated..." message on Cart page', 'woocommerce-jetpack' ),
@@ -142,9 +79,6 @@ class WCJ_Cart {
142
  'type' => 'checkbox',
143
  ),*/
144
 
145
- array( 'type' => 'sectionend', 'id' => 'wcj_cart_options' ),
146
- );
147
-
148
  // Cart Custom Info Options
149
  $settings[] = array( 'title' => __( 'Cart Custom Info Blocks', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_cart_custom_info_options' );
150
 
@@ -155,7 +89,7 @@ class WCJ_Cart {
155
  'type' => 'custom_number',
156
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
157
  'custom_attributes'
158
- => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
159
  );
160
 
161
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_cart_custom_info_options' );
@@ -192,7 +126,7 @@ class WCJ_Cart {
192
  'woocommerce_after_cart_contents' => __( 'After cart contents', 'woocommerce-jetpack' ),
193
  'woocommerce_after_cart_table' => __( 'After cart table', 'woocommerce-jetpack' ),
194
  'woocommerce_cart_collaterals' => __( 'Cart collaterals', 'woocommerce-jetpack' ),
195
- 'woocommerce_after_cart' => __( 'After cart', 'woocommerce-jetpack' ),
196
 
197
  'woocommerce_before_cart_totals' => __( 'Before cart totals', 'woocommerce-jetpack' ),
198
  'woocommerce_cart_totals_before_shipping' => __( 'Cart totals: Before shipping', 'woocommerce-jetpack' ),
@@ -222,71 +156,8 @@ class WCJ_Cart {
222
  ) );
223
  }
224
 
225
- $settings = array_merge( $settings, array(
226
-
227
- array( 'title' => __( 'Empty Cart Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you add and customize "Empty Cart" button to cart page.', 'woocommerce-jetpack' ), 'id' => 'wcj_empty_cart_options' ),
228
-
229
- array(
230
- 'title' => __( 'Empty Cart', 'woocommerce-jetpack' ),
231
- 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
232
- 'id' => 'wcj_empty_cart_enabled',
233
- 'default' => 'yes',
234
- 'type' => 'checkbox',
235
- ),
236
-
237
- array(
238
- 'title' => __( 'Empty Cart Button Text', 'woocommerce-jetpack' ),
239
- 'id' => 'wcj_empty_cart_text',
240
- 'default' => 'Empty Cart',
241
- 'type' => 'text',
242
- 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
243
- 'custom_attributes'
244
- => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
245
- ),
246
-
247
- array(
248
- 'title' => __( 'Wrapping DIV style', 'woocommerce-jetpack' ),
249
- 'desc_tip' => __( 'Style for the button\'s div. Default is "float: right;"', 'woocommerce-jetpack' ),
250
- 'id' => 'wcj_empty_cart_div_style',
251
- 'default' => 'float: right;',
252
- 'type' => 'text',
253
- /*'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
254
- 'custom_attributes'
255
- => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),*/
256
- ),
257
-
258
- array(
259
- 'title' => __( 'Button position on the Cart page', 'woocommerce-jetpack' ),
260
- 'id' => 'wcj_empty_cart_position',
261
- 'default' => 'woocommerce_after_cart',
262
- 'type' => 'select',
263
- 'options' => array(
264
- 'woocommerce_after_cart' => __( 'After Cart', 'woocommerce-jetpack' ),
265
- 'woocommerce_before_cart' => __( 'Before Cart', 'woocommerce-jetpack' ),
266
- 'woocommerce_proceed_to_checkout' => __( 'After Proceed to Checkout button', 'woocommerce-jetpack' ),
267
- 'woocommerce_after_cart_totals' => __( 'After Cart Totals', 'woocommerce-jetpack' ),
268
- ),
269
- 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
270
- 'custom_attributes'
271
- => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
272
- ),
273
-
274
- array( 'type' => 'sectionend', 'id' => 'wcj_empty_cart_options' ),
275
-
276
- ) );
277
-
278
- return $settings;
279
- }
280
-
281
- /**
282
- * settings_section.
283
- */
284
- function settings_section( $sections ) {
285
-
286
- $sections['cart'] = __( 'Cart', 'woocommerce-jetpack' );
287
-
288
- return $sections;
289
- }
290
  }
291
 
292
  endif;
4
  *
5
  * The WooCommerce Jetpack Cart class.
6
  *
7
+ * @version 2.2.1
8
  * @author Algoritmika Ltd.
9
  */
10
 
12
 
13
  if ( ! class_exists( 'WCJ_Cart' ) ) :
14
 
15
+ class WCJ_Cart extends WCJ_Module {
16
 
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
 
 
 
21
 
22
+ $this->id = 'cart';
23
+ $this->short_desc = __( 'Cart', 'woocommerce-jetpack' );
24
+ $this->desc = __( 'Add custom info to WooCommerce cart page. Add empty cart button.', 'woocommerce-jetpack' );
25
+ parent::__construct();
 
26
 
27
+ if ( $this->is_enabled() ) {
 
28
 
29
  /*if ( 'yes' === get_option( 'wcj_cart_hide_shipping_and_taxes_estimated_message' ) )
30
  add_filter( 'gettext', array( $this, 'hide_shipping_and_taxes_estimated_message' ), 20, 3 );*/
35
  add_action( get_option( 'wcj_cart_custom_info_hook_' . $i, 'woocommerce_after_cart_totals' ), array( $this, 'add_cart_custom_info' ) );
36
  }
37
  }
38
+ }
39
 
40
+ /**
41
+ * add_cart_custom_info.
42
+ */
 
 
 
 
 
 
43
  function add_cart_custom_info() {
44
  $current_filter = current_filter();
45
  $total_number = apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_cart_custom_info_total_number', 1 ) );
50
  }
51
  }
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  /**
54
+ * change_labels.
55
+ *
56
+ public function hide_shipping_and_taxes_estimated_message( $translated_text, $text, $domain ) {
57
 
58
  if ( ! function_exists( 'is_cart' ) || ! is_cart() )
59
  return $translated_text;
64
  return $translated_text;
65
  }
66
 
67
+ /**
68
+ * get_settings.
69
+ */
70
+ function get_settings() {
71
 
72
+ $settings = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  /*array(
75
  'title' => __( 'Hide "Note: Shipping and taxes are estimated..." message on Cart page', 'woocommerce-jetpack' ),
79
  'type' => 'checkbox',
80
  ),*/
81
 
 
 
 
82
  // Cart Custom Info Options
83
  $settings[] = array( 'title' => __( 'Cart Custom Info Blocks', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_cart_custom_info_options' );
84
 
89
  'type' => 'custom_number',
90
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
91
  'custom_attributes'
92
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
93
  );
94
 
95
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_cart_custom_info_options' );
126
  'woocommerce_after_cart_contents' => __( 'After cart contents', 'woocommerce-jetpack' ),
127
  'woocommerce_after_cart_table' => __( 'After cart table', 'woocommerce-jetpack' ),
128
  'woocommerce_cart_collaterals' => __( 'Cart collaterals', 'woocommerce-jetpack' ),
129
+ 'woocommerce_after_cart' => __( 'After cart', 'woocommerce-jetpack' ),
130
 
131
  'woocommerce_before_cart_totals' => __( 'Before cart totals', 'woocommerce-jetpack' ),
132
  'woocommerce_cart_totals_before_shipping' => __( 'Cart totals: Before shipping', 'woocommerce-jetpack' ),
156
  ) );
157
  }
158
 
159
+ return $this->add_enable_module_setting( $settings );
160
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
162
 
163
  endif;
includes/class-wcj-empty-cart-button.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Jetpack Empty Cart Button
4
+ *
5
+ * The WooCommerce Jetpack Empty Cart Button class.
6
+ *
7
+ * @version 2.2.1
8
+ * @since 2.2.1
9
+ * @author Algoritmika Ltd.
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ if ( ! class_exists( 'WCJ_Empty_Cart_Button' ) ) :
15
+
16
+ class WCJ_Empty_Cart_Button extends WCJ_Module {
17
+
18
+ /**
19
+ * Constructor.
20
+ */
21
+ function __construct() {
22
+
23
+ $this->id = 'empty_cart';
24
+ $this->short_desc = __( 'Empty Cart Button', 'woocommerce-jetpack' );
25
+ $this->desc = __( 'Add and customize "Empty Cart" button to cart page.', 'woocommerce-jetpack' );
26
+ parent::__construct();
27
+
28
+ if ( $this->is_enabled() ) {
29
+
30
+ add_action( 'init', array( $this, 'empty_cart' ) );
31
+ //add_action( get_option( 'wcj_empty_cart_position', 'woocommerce_after_cart' ), array( $this, 'add_empty_cart_link' ) );
32
+ add_action( apply_filters( 'wcj_get_option_filter', 'woocommerce_after_cart', get_option( 'wcj_empty_cart_position', 'woocommerce_after_cart' ) ),
33
+ array( $this, 'add_empty_cart_link' ) );
34
+
35
+ //add_action( 'wp_head', array( $this, 'add_confirmation_script' ) );
36
+
37
+ //add_filter( 'wcj_empty_cart_button_filter', array( $this, 'empty_cart_button_filter_function' ), 100, 2 );
38
+
39
+ }
40
+ }
41
+
42
+ /**
43
+ * add_confirmation_script.
44
+ *
45
+ function add_confirmation_script() {
46
+ ?><script type="text/javascript">
47
+ function clicked() {
48
+ if (confirm('Do you wanna to submit?')) {
49
+ yourformelement.submit();
50
+ } else {
51
+ return false;
52
+ }
53
+ }
54
+ </script><?
55
+ }
56
+
57
+ /*
58
+ * empty_cart_button_filter_function.
59
+ *
60
+ public function empty_cart_button_filter_function ( $value, $type ) {
61
+
62
+ if ( 'text' == $type ) return 'Empty Cart';
63
+ if ( 'div-style' == $type ) return 'float: right';
64
+ }
65
+
66
+ /**
67
+ * add_empty_cart_link.
68
+ */
69
+ public function add_empty_cart_link() {
70
+ $confirmation_html = ( 'confirm_with_pop_up_box' == get_option( 'wcj_empty_cart_confirmation', 'no_confirmation' ) ) ? ' onclick="return confirm(\'' . get_option( 'wcj_empty_cart_confirmation_text' ) . '\')"' : '';
71
+ echo '<div style="' . apply_filters( 'wcj_get_option_filter', 'float: right;', get_option( 'wcj_empty_cart_div_style' ) ) . '"><form action="" method="post"><input type="submit" class="button" name="empty_cart" value="' . apply_filters( 'wcj_get_option_filter', 'Empty Cart', get_option( 'wcj_empty_cart_text' ) ) . '"' . $confirmation_html . '></form></div>';
72
+ //echo '<input type="submit" class="button" name="empty_cart" value="' . apply_filters( 'wcj_get_option_filter', 'Empty Cart', get_option( 'wcj_empty_cart_text' ) ) . '">';
73
+ }
74
+
75
+ /**
76
+ * empty_cart.
77
+ */
78
+ public function empty_cart() {
79
+
80
+ if ( isset( $_POST['empty_cart'] ) ) {
81
+
82
+ global $woocommerce;
83
+ $woocommerce->cart->empty_cart();
84
+ }
85
+ }
86
+
87
+ /**
88
+ * get_settings.
89
+ */
90
+ function get_settings() {
91
+
92
+ $settings = array();
93
+
94
+ $settings = array_merge( $settings, array(
95
+
96
+ array( 'title' => __( 'Empty Cart Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'This section lets you add and customize "Empty Cart" button to cart page.', 'woocommerce-jetpack' ), 'id' => 'wcj_empty_cart_customization_options' ),
97
+
98
+ /* array(
99
+ 'title' => __( 'Empty Cart', 'woocommerce-jetpack' ),
100
+ 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
101
+ 'id' => 'wcj_empty_cart_enabled',
102
+ 'default' => 'yes',
103
+ 'type' => 'checkbox',
104
+ ), */
105
+
106
+ array(
107
+ 'title' => __( 'Empty Cart Button Text', 'woocommerce-jetpack' ),
108
+ 'id' => 'wcj_empty_cart_text',
109
+ 'default' => 'Empty Cart',
110
+ 'type' => 'text',
111
+ 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
112
+ 'custom_attributes'
113
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),
114
+ ),
115
+
116
+ array(
117
+ 'title' => __( 'Wrapping DIV style', 'woocommerce-jetpack' ),
118
+ 'desc_tip' => __( 'Style for the button\'s div. Default is "float: right;"', 'woocommerce-jetpack' ),
119
+ 'id' => 'wcj_empty_cart_div_style',
120
+ 'default' => 'float: right;',
121
+ 'type' => 'text',
122
+ /*'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
123
+ 'custom_attributes'
124
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ),*/
125
+ ),
126
+
127
+ array(
128
+ 'title' => __( 'Button position on the Cart page', 'woocommerce-jetpack' ),
129
+ 'id' => 'wcj_empty_cart_position',
130
+ 'default' => 'woocommerce_after_cart',
131
+ 'type' => 'select',
132
+ 'options' => array(
133
+ 'woocommerce_after_cart' => __( 'After Cart', 'woocommerce-jetpack' ),
134
+ 'woocommerce_before_cart' => __( 'Before Cart', 'woocommerce-jetpack' ),
135
+ 'woocommerce_proceed_to_checkout' => __( 'After Proceed to Checkout button', 'woocommerce-jetpack' ),
136
+ 'woocommerce_after_cart_totals' => __( 'After Cart Totals', 'woocommerce-jetpack' ),
137
+ ),
138
+ 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
139
+ 'custom_attributes'
140
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ),
141
+ ),
142
+
143
+ array(
144
+ 'title' => __( 'Confirmation', 'woocommerce-jetpack' ),
145
+ 'id' => 'wcj_empty_cart_confirmation',
146
+ 'default' => 'no_confirmation',
147
+ 'type' => 'select',
148
+ 'options' => array(
149
+ 'no_confirmation' => __( 'No confirmation', 'woocommerce-jetpack' ),
150
+ 'confirm_with_pop_up_box' => __( 'Confirm by pop up box', 'woocommerce-jetpack' ),
151
+ ),
152
+ /* 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
153
+ 'custom_attributes'
154
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'disabled' ), */
155
+ ),
156
+
157
+ array(
158
+ 'title' => __( 'Confirmation Text (if enabled)', 'woocommerce-jetpack' ),
159
+ 'id' => 'wcj_empty_cart_confirmation_text',
160
+ 'default' => __( 'Are you sure?', 'woocommerce-jetpack' ),
161
+ 'type' => 'text',
162
+ /* 'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
163
+ 'custom_attributes'
164
+ => apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ), */
165
+ ),
166
+
167
+ array( 'type' => 'sectionend', 'id' => 'wcj_empty_cart_customization_options' ),
168
+
169
+ ) );
170
+
171
+ return $this->add_enable_module_setting( $settings );
172
+ }
173
+ }
174
+
175
+ endif;
176
+
177
+ return new WCJ_Empty_Cart_Button();
includes/class-wcj-general.php CHANGED
@@ -4,117 +4,117 @@
4
  *
5
  * The WooCommerce Jetpack General class.
6
  *
7
- * @class WCJ_General
8
- * @version 1.1.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_General' ) ) :
16
-
17
- class WCJ_General {
18
-
19
- /**
20
- * Constructor.
21
- */
22
- public function __construct() {
23
- // Main hooks
24
- if ( 'yes' === get_option( 'wcj_general_enabled' ) ) {
25
-
26
- if ( '' != get_option( 'wcj_general_custom_css' ) )
27
- add_action( 'wp_head', array( $this, 'hook_custom_css' ) );
28
- if ( '' != get_option( 'wcj_general_custom_admin_css' ) )
29
- add_action( 'admin_head', array( $this, 'hook_custom_admin_css' ) );
30
- }
31
-
32
- // Settings hooks
33
- add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
34
- add_filter( 'wcj_settings_general', array( $this, 'get_settings' ), 100 );
35
- add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
36
- }
37
-
38
- /**
39
- * hook_custom_css.
40
- */
41
- public function hook_custom_css() {
42
- $output = '<style>' . get_option( 'wcj_general_custom_css' ) . '</style>';
 
 
 
 
 
 
43
  echo $output;
44
- }
45
-
46
- /**
47
- * hook_custom_admin_css.
48
- */
49
- public function hook_custom_admin_css() {
50
- $output = '<style>' . get_option( 'wcj_general_custom_admin_css' ) . '</style>';
51
  echo $output;
52
- }
53
-
54
- /**
55
- * add_enabled_option.
56
- */
57
- public function add_enabled_option( $settings ) {
58
-
59
- $all_settings = $this->get_settings();
60
- $settings[] = $all_settings[1];
61
-
62
- return $settings;
63
- }
64
-
65
- /**
66
- * get_settings.
67
- */
68
- function get_settings() {
69
-
70
- $settings = array(
71
-
72
- array( 'title' => __( 'General Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( '', 'woocommerce-jetpack' ), 'id' => 'wcj_general_options' ),
73
-
74
- array(
75
- 'title' => __( 'General', 'woocommerce-jetpack' ),
76
- 'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
77
- 'desc_tip' => __( 'Separate custom CSS for front and back end.', 'woocommerce-jetpack' ),
78
- 'id' => 'wcj_general_enabled',
79
- 'default' => 'no',
80
- 'type' => 'checkbox',
81
- ),
82
-
83
- array( 'type' => 'sectionend', 'id' => 'wcj_general_options' ),
84
-
85
- array( 'title' => __( 'Custom CSS Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => __( 'Another custom CSS, if you need one.', 'woocommerce-jetpack' ), 'id' => 'wcj_general_custom_css_options' ),
86
-
87
- array(
88
- 'title' => __( 'Custom CSS - Front end (Customers)', 'woocommerce-jetpack' ),
89
- 'id' => 'wcj_general_custom_css',
90
- 'default' => '',
91
- 'type' => 'textarea',
92
- 'css' => 'width:66%;min-width:300px;min-height:300px;',
93
- ),
94
-
95
- array(
96
- 'title' => __( 'Custom CSS - Back end (Admin)', 'woocommerce-jetpack' ),
97
- 'id' => 'wcj_general_custom_admin_css',
98
- 'default' => '',
99
- 'type' => 'textarea',
100
- 'css' => 'width:66%;min-width:300px;min-height:300px;',
101
- ),
102
-
103
- array( 'type' => 'sectionend', 'id' => 'wcj_general_custom_css_options' ),
104
- );
105
-
106
- return $settings;
107
- }
108
-
109
- /**
110
- * settings_section.
111
- */
112
- function settings_section( $sections ) {
113
- $sections['general'] = __( 'General', 'woocommerce-jetpack' );
114
- return $sections;
115
- }
116
  }
117
-
118
  endif;
119
-
120
  return new WCJ_General();
4
  *
5
  * The WooCommerce Jetpack General class.
6
  *
7
+ * @version 2.2.1
8
+ * @author Algoritmika Ltd.
 
 
9
  */
10
+
11
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
+
13
  if ( ! class_exists( 'WCJ_General' ) ) :
14
+
15
+ class WCJ_General extends WCJ_Module {
16
+
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
+
22
+ $this->id = 'general';
23
+ $this->short_desc = __( 'General', 'woocommerce-jetpack' );
24
+ $this->desc = __( 'Separate custom CSS for front and back end. Shortcodes in Wordpress text widgets.', 'woocommerce-jetpack' );
25
+ parent::__construct();
26
+
27
+ if ( $this->is_enabled() ) {
28
+
29
+ if ( 'yes' === get_option( 'wcj_general_shortcodes_in_text_widgets_enabled' ) ) {
30
+ add_filter( 'widget_text', 'do_shortcode' );
31
+ }
32
+
33
+ if ( '' != get_option( 'wcj_general_custom_css' ) ) {
34
+ add_action( 'wp_head', array( $this, 'hook_custom_css' ) );
35
+ }
36
+ if ( '' != get_option( 'wcj_general_custom_admin_css' ) ) {
37
+ add_action( 'admin_head', array( $this, 'hook_custom_admin_css' ) );
38
+ }
39
+ }
40
+ }
41
+
42
+ /**
43
+ * hook_custom_css.
44
+ */
45
+ public function hook_custom_css() {
46
+ $output = '<style>' . get_option( 'wcj_general_custom_css' ) . '</style>';
47
  echo $output;
48
+ }
49
+
50
+ /**
51
+ * hook_custom_admin_css.
52
+ */
53
+ public function hook_custom_admin_css() {
54
+ $output = '<style>' . get_option( 'wcj_general_custom_admin_css' ) . '</style>';
55
  echo $output;
56
+ }
57
+
58
+ /**
59
+ * get_settings.
60
+ */
61
+ function get_settings() {
62
+
63
+ $settings = array(
64
+
65
+ array(
66
+ 'title' => __( 'Shortcodes Options', 'woocommerce-jetpack' ),
67
+ 'type' => 'title',
68
+ 'desc' => '',
69
+ 'id' => 'wcj_general_shortcodes_options',
70
+ ),
71
+
72
+ array(
73
+ 'title' => __( 'Enable Shortcodes in WordPress Text Widgets', 'woocommerce-jetpack' ),
74
+ 'desc' => __( 'Enable', 'woocommerce-jetpack' ),
75
+ 'id' => 'wcj_general_shortcodes_in_text_widgets_enabled',
76
+ 'default' => 'no',
77
+ 'type' => 'checkbox',
78
+ ),
79
+
80
+ array(
81
+ 'type' => 'sectionend',
82
+ 'id' => 'wcj_general_shortcodes_options',
83
+ ),
84
+
85
+ array(
86
+ 'title' => __( 'Custom CSS Options', 'woocommerce-jetpack' ),
87
+ 'type' => 'title',
88
+ 'desc' => __( 'Another custom CSS, if you need one.', 'woocommerce-jetpack' ),
89
+ 'id' => 'wcj_general_custom_css_options',
90
+ ),
91
+
92
+ array(
93
+ 'title' => __( 'Custom CSS - Front end (Customers)', 'woocommerce-jetpack' ),
94
+ 'id' => 'wcj_general_custom_css',
95
+ 'default' => '',
96
+ 'type' => 'textarea',
97
+ 'css' => 'width:66%;min-width:300px;min-height:300px;',
98
+ ),
99
+
100
+ array(
101
+ 'title' => __( 'Custom CSS - Back end (Admin)', 'woocommerce-jetpack' ),
102
+ 'id' => 'wcj_general_custom_admin_css',
103
+ 'default' => '',
104
+ 'type' => 'textarea',
105
+ 'css' => 'width:66%;min-width:300px;min-height:300px;',
106
+ ),
107
+
108
+ array(
109
+ 'type' => 'sectionend',
110
+ 'id' => 'wcj_general_custom_css_options',
111
+ ),
112
+ );
113
+
114
+ return $this->add_enable_module_setting( $settings );
115
+ }
 
 
 
 
116
  }
117
+
118
  endif;
119
+
120
  return new WCJ_General();
includes/class-wcj-pdf-invoicing.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack PDF Invoicing class.
6
  *
7
- * @version 2.2.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -22,6 +22,7 @@ class WCJ_PDF_Invoicing {
22
  if ( get_option( 'wcj_pdf_invoicing_enabled' ) == 'yes' ) {
23
 
24
  include_once( 'pdf-invoices/class-wcj-pdf-invoicing-renumerate-tool.php' );
 
25
 
26
  add_action( 'init', array( $this, 'catch_args' ) );
27
  add_action( 'init', array( $this, 'generate_pdf_on_init' ) );
4
  *
5
  * The WooCommerce Jetpack PDF Invoicing class.
6
  *
7
+ * @version 2.2.1
8
  * @author Algoritmika Ltd.
9
  */
10
 
22
  if ( get_option( 'wcj_pdf_invoicing_enabled' ) == 'yes' ) {
23
 
24
  include_once( 'pdf-invoices/class-wcj-pdf-invoicing-renumerate-tool.php' );
25
+ include_once( 'pdf-invoices/class-wcj-pdf-invoicing-report-tool.php' );
26
 
27
  add_action( 'init', array( $this, 'catch_args' ) );
28
  add_action( 'init', array( $this, 'generate_pdf_on_init' ) );
includes/class-wcj-price-by-country.php CHANGED
@@ -4,8 +4,8 @@
4
  *
5
  * The WooCommerce Jetpack Price by Country class.
6
  *
7
- * @version 2.2.0
8
- * @author Algoritmika Ltd.
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
@@ -14,13 +14,13 @@ if ( ! class_exists( 'WCJ_Price_By_Country' ) ) :
14
 
15
  class WCJ_Price_By_Country {
16
 
17
- /**
18
- * Constructor.
19
- */
20
- public function __construct() {
21
 
22
- // Main hooks
23
- if ( 'yes' === get_option( 'wcj_price_by_country_enabled' ) ) {
24
  if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
25
  //wcj_log( 'WCJ_Price_By_Country: frontend' );
26
  include_once( 'price-by-country/class-wcj-price-by-country-core.php' );
@@ -32,79 +32,92 @@ class WCJ_Price_By_Country {
32
  include_once( 'price-by-country/class-wcj-price-by-country-local.php' );
33
  }
34
  }
35
- }
36
  include_once( 'price-by-country/class-wcj-exchange-rates.php' );
37
  include_once( 'price-by-country/class-wcj-exchange-rates-crons.php' );
38
 
39
- // Settings hooks
40
- add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
41
- add_filter( 'wcj_settings_price_by_country', array( $this, 'get_settings' ), 100 );
42
- add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
43
- }
44
-
45
- /**
46
- * add_enabled_option.
47
- */
48
- public function add_enabled_option( $settings ) {
49
- $all_settings = $this->get_settings();
50
- $settings[] = $all_settings[1];
51
- return $settings;
52
- }
53
-
54
- /**
55
- * get_settings.
56
- */
57
- function get_settings() {
58
-
59
- $settings = array(
60
-
61
- array(
62
  'title' => __( 'Price by Country Options', 'woocommerce-jetpack' ),
63
  'type' => 'title',
64
- 'desc' => __( 'Change product\'s price and currency by customer\'s country. Customer\'s country is detected automatically by IP.', 'woocommerce-jetpack' ),
65
  'id' => 'wcj_price_by_country_options' ),
66
 
67
- array(
68
- 'title' => __( 'Prices and Currencies by Country', 'woocommerce-jetpack' ),
69
- 'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
70
- 'desc_tip' => __( 'Change WooCommerce product price and currency automatically by customer\'s country.', 'woocommerce-jetpack' ),
71
- 'id' => 'wcj_price_by_country_enabled',
72
- 'default' => 'no',
73
- 'type' => 'checkbox',
74
- ),
75
-
76
- array(
77
- 'title' => __( 'Price Rounding', 'woocommerce-jetpack' ),
78
- 'desc' => __( 'If you choose to multiply price, set rounding options here.', 'woocommerce-jetpack' ),
79
- 'id' => 'wcj_price_by_country_rounding',
80
- 'default' => 'none',
81
- 'type' => 'select',
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  'options' => array(
83
  'none' => __( 'No rounding', 'woocommerce-jetpack' ),
84
  'round' => __( 'Round', 'woocommerce-jetpack' ),
85
  'floor' => __( 'Round down', 'woocommerce-jetpack' ),
86
  'ceil' => __( 'Round up', 'woocommerce-jetpack' ),
87
  ),
88
- ),
89
 
90
  array(
91
- 'title' => __( 'Price by Country on per Product Basis', 'woocommerce-jetpack' ),
92
  'desc' => __( 'Enable', 'woocommerce-jetpack' ),
93
  'desc_tip' => __( 'This will add meta boxes in product edit.', 'woocommerce-jetpack' ),
94
- 'id' => 'wcj_price_by_country_local_enabled',
95
- 'default' => 'yes',
96
- 'type' => 'checkbox',
97
  ),
98
 
99
- array( 'type' => 'sectionend', 'id' => 'wcj_price_by_country_options' ),
100
 
101
  array( 'title' => __( 'Country Groups', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_by_country_country_groups_options' ),
102
 
103
- array(
104
- 'title' => __( 'Groups Number', 'woocommerce-jetpack' ),
105
- 'id' => 'wcj_price_by_country_total_groups_number',
106
- 'default' => 1,
107
- 'type' => 'custom_number',
108
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
109
  'custom_attributes' => array_merge(
110
  is_array( apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) ) ? apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) : array(),
@@ -116,34 +129,34 @@ class WCJ_Price_By_Country {
116
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
117
 
118
  $settings[] = array(
119
- 'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
120
  'desc' => __( 'Countries. List of comma separated country codes.<br>For country codes and predifined sets visit <a href="http://woojetpack.com/features/prices-and-currencies-by-customers-country">WooJetpack.com</a>', 'woocommerce-jetpack' ),
121
- 'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i,
122
- 'default' => '',
123
- 'type' => 'textarea',
124
  'css' => 'width:50%;min-width:300px;height:100px;',
125
- );
126
 
127
  /* TODO: Multiselect instead of comma separated list.
128
  $settings[] = array(
129
- 'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
130
- 'id' => 'wcj_price_by_country_countries_group_' . $i,
131
- 'default' => '',
132
  'type' => 'multiselect',
133
  'options' => wcj_get_countries(),
134
  //'class' => 'chosen_select',
135
  'css' => 'width:50%;min-width:300px;height:100px;',
136
- );
137
  */
138
 
139
- $settings[] = array(
140
- 'title' => '',
141
  'desc' => __( 'Currency', 'woocommerce-jetpack' ),
142
- 'id' => 'wcj_price_by_country_exchange_rate_currency_group_' . $i,
143
- 'default' => 'EUR',
144
- 'type' => 'select',
145
  'options' => wcj_get_currencies_names_and_symbols(),
146
- );
147
  }
148
 
149
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_price_by_country_country_groups_options' );
@@ -181,10 +194,10 @@ class WCJ_Price_By_Country {
181
  if ( $currency_from == $currency_to )
182
  $custom_attributes['disabled'] = 'disabled';
183
 
184
- $settings[] = array(
185
- 'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
186
  'desc' => __( 'Multiply Price by', 'woocommerce-jetpack' ),
187
- 'id' => 'wcj_price_by_country_exchange_rate_group_' . $i,
188
  'default' => 1,
189
  'type' => 'exchange_rate',
190
  'css' => 'width:100px;',
@@ -192,7 +205,7 @@ class WCJ_Price_By_Country {
192
  'custom_attributes_button' => $custom_attributes,
193
  'value' => $currency_from . '/' . $currency_to,
194
  'value_title' => sprintf( __( 'Grab %s rate from Yahoo.com', 'woocommerce-jetpack' ), $currency_from . '/' . $currency_to ),
195
- );
196
 
197
  /* $settings[] = array(
198
  'title' => '',
@@ -204,27 +217,84 @@ class WCJ_Price_By_Country {
204
  'custom_attributes' => $custom_attributes,
205
  ); */
206
 
207
- $settings[] = array(
208
- 'title' => '',
209
  'desc' => __( 'Make empty price', 'woocommerce-jetpack' ),
210
- 'id' => 'wcj_price_by_country_make_empty_price_group_' . $i,
211
  'default' => 'no',
212
  'type' => 'checkbox',
213
- );
214
  }
215
 
216
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_price_by_country_exchange_rate_options' );
217
 
218
- return $settings;
219
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
- /**
222
- * settings_section.
223
- */
224
- function settings_section( $sections ) {
225
- $sections['price_by_country'] = __( 'Prices and Currencies by Country', 'woocommerce-jetpack' );
226
- return $sections;
227
- }
 
 
 
 
 
 
 
 
 
228
  }
229
 
230
  endif;
4
  *
5
  * The WooCommerce Jetpack Price by Country class.
6
  *
7
+ * @version 2.2.1
8
+ * @author Algoritmika Ltd.
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
  class WCJ_Price_By_Country {
16
 
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
 
22
+ // Main hooks
23
+ if ( 'yes' === get_option( 'wcj_price_by_country_enabled' ) ) {
24
  if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
25
  //wcj_log( 'WCJ_Price_By_Country: frontend' );
26
  include_once( 'price-by-country/class-wcj-price-by-country-core.php' );
32
  include_once( 'price-by-country/class-wcj-price-by-country-local.php' );
33
  }
34
  }
35
+ }
36
  include_once( 'price-by-country/class-wcj-exchange-rates.php' );
37
  include_once( 'price-by-country/class-wcj-exchange-rates-crons.php' );
38
 
39
+ // Settings hooks
40
+ add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
41
+ add_filter( 'wcj_settings_price_by_country', array( $this, 'get_settings' ), 100 );
42
+ add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
43
+ }
44
+
45
+ /**
46
+ * add_enabled_option.
47
+ */
48
+ public function add_enabled_option( $settings ) {
49
+ $all_settings = $this->get_settings();
50
+ $settings[] = $all_settings[1];
51
+ return $settings;
52
+ }
53
+
54
+ /**
55
+ * get_settings.
56
+ */
57
+ function get_settings() {
58
+
59
+ $settings = array(
60
+
61
+ array(
62
  'title' => __( 'Price by Country Options', 'woocommerce-jetpack' ),
63
  'type' => 'title',
64
+ 'desc' => __( 'Change product\'s price and currency by customer\'s country. Customer\'s country is detected automatically by IP, or selected by customer manually.', 'woocommerce-jetpack' ),
65
  'id' => 'wcj_price_by_country_options' ),
66
 
67
+ array(
68
+ 'title' => __( 'Prices and Currencies by Country', 'woocommerce-jetpack' ),
69
+ 'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
70
+ 'desc_tip' => __( 'Change WooCommerce product price and currency automatically by customer\'s country.', 'woocommerce-jetpack' ),
71
+ 'id' => 'wcj_price_by_country_enabled',
72
+ 'default' => 'no',
73
+ 'type' => 'checkbox',
74
+ ),
75
+
76
+ array(
77
+ 'title' => __( 'Customer Country Detection Method', 'woocommerce-jetpack' ),
78
+ 'id' => 'wcj_price_by_country_customer_country_detection_method',
79
+ 'desc' => __( 'If you choose "by user selection", use [wcj_country_select_drop_down_list] shortcode to display country selection list on frontend.', 'woocommerce-jetpack' ),
80
+ 'default' => 'by_ip',
81
+ 'type' => 'select',
82
+ 'options' => array(
83
+ 'by_ip' => __( 'by IP', 'woocommerce-jetpack' ),
84
+ 'by_user_selection' => __( 'by user selection', 'woocommerce-jetpack' ),
85
+ //'by_wpml' => __( 'by WPML', 'woocommerce-jetpack' ),
86
+ ),
87
+ ),
88
+
89
+ array(
90
+ 'title' => __( 'Price Rounding', 'woocommerce-jetpack' ),
91
+ 'desc' => __( 'If you choose to multiply price, set rounding options here.', 'woocommerce-jetpack' ),
92
+ 'id' => 'wcj_price_by_country_rounding',
93
+ 'default' => 'none',
94
+ 'type' => 'select',
95
  'options' => array(
96
  'none' => __( 'No rounding', 'woocommerce-jetpack' ),
97
  'round' => __( 'Round', 'woocommerce-jetpack' ),
98
  'floor' => __( 'Round down', 'woocommerce-jetpack' ),
99
  'ceil' => __( 'Round up', 'woocommerce-jetpack' ),
100
  ),
101
+ ),
102
 
103
  array(
104
+ 'title' => __( 'Price by Country on per Product Basis', 'woocommerce-jetpack' ),
105
  'desc' => __( 'Enable', 'woocommerce-jetpack' ),
106
  'desc_tip' => __( 'This will add meta boxes in product edit.', 'woocommerce-jetpack' ),
107
+ 'id' => 'wcj_price_by_country_local_enabled',
108
+ 'default' => 'yes',
109
+ 'type' => 'checkbox',
110
  ),
111
 
112
+ array( 'type' => 'sectionend', 'id' => 'wcj_price_by_country_options' ),
113
 
114
  array( 'title' => __( 'Country Groups', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_price_by_country_country_groups_options' ),
115
 
116
+ array(
117
+ 'title' => __( 'Groups Number', 'woocommerce-jetpack' ),
118
+ 'id' => 'wcj_price_by_country_total_groups_number',
119
+ 'default' => 1,
120
+ 'type' => 'custom_number',
121
  'desc' => apply_filters( 'get_wc_jetpack_plus_message', '', 'desc' ),
122
  'custom_attributes' => array_merge(
123
  is_array( apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) ) ? apply_filters( 'get_wc_jetpack_plus_message', '', 'readonly' ) : array(),
129
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_price_by_country_total_groups_number', 1 ) ); $i++ ) {
130
 
131
  $settings[] = array(
132
+ 'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
133
  'desc' => __( 'Countries. List of comma separated country codes.<br>For country codes and predifined sets visit <a href="http://woojetpack.com/features/prices-and-currencies-by-customers-country">WooJetpack.com</a>', 'woocommerce-jetpack' ),
134
+ 'id' => 'wcj_price_by_country_exchange_rate_countries_group_' . $i,
135
+ 'default' => '',
136
+ 'type' => 'textarea',
137
  'css' => 'width:50%;min-width:300px;height:100px;',
138
+ );
139
 
140
  /* TODO: Multiselect instead of comma separated list.
141
  $settings[] = array(
142
+ 'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
143
+ 'id' => 'wcj_price_by_country_countries_group_' . $i,
144
+ 'default' => '',
145
  'type' => 'multiselect',
146
  'options' => wcj_get_countries(),
147
  //'class' => 'chosen_select',
148
  'css' => 'width:50%;min-width:300px;height:100px;',
149
+ );
150
  */
151
 
152
+ $settings[] = array(
153
+ 'title' => '',
154
  'desc' => __( 'Currency', 'woocommerce-jetpack' ),
155
+ 'id' => 'wcj_price_by_country_exchange_rate_currency_group_' . $i,
156
+ 'default' => 'EUR',
157
+ 'type' => 'select',
158
  'options' => wcj_get_currencies_names_and_symbols(),
159
+ );
160
  }
161
 
162
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_price_by_country_country_groups_options' );
194
  if ( $currency_from == $currency_to )
195
  $custom_attributes['disabled'] = 'disabled';
196
 
197
+ $settings[] = array(
198
+ 'title' => __( 'Group', 'woocommerce-jetpack' ) . ' #' . $i,
199
  'desc' => __( 'Multiply Price by', 'woocommerce-jetpack' ),
200
+ 'id' => 'wcj_price_by_country_exchange_rate_group_' . $i,
201
  'default' => 1,
202
  'type' => 'exchange_rate',
203
  'css' => 'width:100px;',
205
  'custom_attributes_button' => $custom_attributes,
206
  'value' => $currency_from . '/' . $currency_to,
207
  'value_title' => sprintf( __( 'Grab %s rate from Yahoo.com', 'woocommerce-jetpack' ), $currency_from . '/' . $currency_to ),
208
+ );
209
 
210
  /* $settings[] = array(
211
  'title' => '',
217
  'custom_attributes' => $custom_attributes,
218
  ); */
219
 
220
+ $settings[] = array(
221
+ 'title' => '',
222
  'desc' => __( 'Make empty price', 'woocommerce-jetpack' ),
223
+ 'id' => 'wcj_price_by_country_make_empty_price_group_' . $i,
224
  'default' => 'no',
225
  'type' => 'checkbox',
226
+ );
227
  }
228
 
229
  $settings[] = array( 'type' => 'sectionend', 'id' => 'wcj_price_by_country_exchange_rate_options' );
230
 
231
+ /* $settings = array_merge( $settings, array(
232
+
233
+ array(
234
+ 'title' => __( 'Country Select Box Customization', 'woocommerce-jetpack' ),
235
+ 'type' => 'title',
236
+ 'desc' => __( 'Only if "by user selection" method selected in "Customer Country Detection Method"', 'woocommerce-jetpack' ),
237
+ 'id' => 'wcj_price_by_country_country_selection_box_options',
238
+ ),
239
+
240
+ array(
241
+ 'title' => __( 'Position', 'woocommerce-jetpack' ),
242
+ 'id' => 'wcj_price_by_country_country_selection_box_position',
243
+ 'default' => 'woocommerce_get_price_html',
244
+ 'type' => 'select',
245
+ 'options' => array(
246
+ 'woocommerce_get_price_html' => __( 'woocommerce_get_price_html', 'woocommerce-jetpack' ),
247
+ ),
248
+ ),
249
+
250
+ array(
251
+ 'title' => __( 'Position Priority (Order)', 'woocommerce-jetpack' ),
252
+ 'id' => 'wcj_price_by_country_country_selection_box_priority',
253
+ 'default' => 10,
254
+ 'type' => 'number',
255
+ ),
256
+
257
+ array(
258
+ 'title' => __( 'Custom Class', 'woocommerce-jetpack' ),
259
+ 'id' => 'wcj_price_by_country_country_selection_box_class',
260
+ 'default' => '',
261
+ 'type' => 'text',
262
+ ),
263
+
264
+ array(
265
+ 'title' => __( 'Custom Style', 'woocommerce-jetpack' ),
266
+ 'id' => 'wcj_price_by_country_country_selection_box_style',
267
+ 'default' => '',
268
+ 'type' => 'text',
269
+ ),
270
+
271
+ array(
272
+ 'title' => __( 'Method (GET/POST)', 'woocommerce-jetpack' ),
273
+ 'id' => 'wcj_price_by_country_country_selection_box_method',
274
+ 'default' => 'get',
275
+ 'type' => 'select',
276
+ 'options' => array(
277
+ 'get' => __( 'GET', 'woocommerce-jetpack' ),
278
+ 'post' => __( 'POST', 'woocommerce-jetpack' ),
279
+ ),
280
+ ),
281
 
282
+ array(
283
+ 'type' => 'sectionend',
284
+ 'id' => 'wcj_price_by_country_country_selection_box_options'
285
+ ),
286
+ ) ); */
287
+
288
+ return $settings;
289
+ }
290
+
291
+ /**
292
+ * settings_section.
293
+ */
294
+ function settings_section( $sections ) {
295
+ $sections['price_by_country'] = __( 'Prices and Currencies by Country', 'woocommerce-jetpack' );
296
+ return $sections;
297
+ }
298
  }
299
 
300
  endif;
includes/class-wcj-related-products.php CHANGED
@@ -4,29 +4,31 @@
4
  *
5
  * The WooCommerce Jetpack Related Products class.
6
  *
7
- * @class WCJ_Related_Products
8
- * @version 1.0.0
9
- * @category Class
10
- * @author Algoritmika Ltd.
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
  if ( ! class_exists( 'WCJ_Related_Products' ) ) :
16
 
17
- class WCJ_Related_Products {
18
 
19
- /**
20
- * Constructor.
21
- */
22
- public function __construct() {
23
 
24
- // Main hooks
25
- if ( 'yes' === get_option( 'wcj_related_products_enabled' ) ) {
 
 
26
 
27
- add_filter( 'woocommerce_related_products_args', array( $this, 'related_products_limit' ), 100 );
28
 
29
- add_filter( 'woocommerce_output_related_products_args', array( $this, 'related_products_limit_args' ), 100 );
 
 
30
 
31
  if ( 'no' === get_option( 'wcj_product_info_related_products_relate_by_category' ) ) {
32
  apply_filters( 'woocommerce_product_related_posts_relate_by_category', false );
@@ -36,23 +38,7 @@ class WCJ_Related_Products {
36
  apply_filters( 'woocommerce_product_related_posts_relate_by_tag', false );
37
  }
38
  }
39
-
40
- // Settings hooks
41
- add_filter( 'wcj_settings_sections', array( $this, 'settings_section' ) );
42
- add_filter( 'wcj_settings_related_products', array( $this, 'get_settings' ), 100 );
43
- add_filter( 'wcj_features_status', array( $this, 'add_enabled_option' ), 100 );
44
- }
45
-
46
- /**
47
- * add_enabled_option.
48
- */
49
- public function add_enabled_option( $settings ) {
50
- $all_settings = $this->get_settings();
51
- $settings[] = $all_settings[1];
52
- return $settings;
53
- }
54
-
55
- // RELATED PRODUCTS //
56
 
57
  /**
58
  * Change number of related products on product page.
@@ -69,27 +55,24 @@ class WCJ_Related_Products {
69
  */
70
  function related_products_limit( $args ) {
71
  $args['posts_per_page'] = get_option( 'wcj_product_info_related_products_num' );
 
72
  $args['orderby'] = get_option( 'wcj_product_info_related_products_orderby' );
73
  if ( get_option( 'wcj_product_info_related_products_orderby' ) != 'rand' ) $args['order'] = get_option( 'wcj_product_info_related_products_order' );
74
  return $args;
75
  }
76
 
77
- /**
78
- * get_settings.
79
- */
80
- function get_settings() {
81
-
82
- $settings = array(
83
 
84
- array( 'title' => __( 'Related Products Options', 'woocommerce-jetpack' ), 'type' => 'title', 'desc' => '', 'id' => 'wcj_product_info_related_products_options' ),
85
 
86
  array(
87
- 'title' => __( 'Related Products', 'woocommerce-jetpack' ),
88
- 'desc' => '<strong>' . __( 'Enable Module', 'woocommerce-jetpack' ) . '</strong>',
89
- 'desc_tip' => __( 'Change displayed WooCommerce related products number, columns, order, relate by tag and/or category.', 'woocommerce-jetpack' ) . '</strong>',
90
- 'id' => 'wcj_related_products_enabled',//'wcj_product_info_related_products_enable'
91
- 'default' => 'no',
92
- 'type' => 'checkbox',
93
  ),
94
 
95
  array(
@@ -144,19 +127,22 @@ class WCJ_Related_Products {
144
  'type' => 'checkbox',
145
  ),
146
 
147
- array( 'type' => 'sectionend', 'id' => 'wcj_product_info_related_products_options' ),
148
- );
 
 
 
 
 
149
 
150
- return $settings;
151
- }
 
 
 
152
 
153
- /**
154
- * settings_section.
155
- */
156
- function settings_section( $sections ) {
157
- $sections['related_products'] = __( 'Related Products', 'woocommerce-jetpack' );
158
- return $sections;
159
- }
160
  }
161
 
162
  endif;
4
  *
5
  * The WooCommerce Jetpack Related Products class.
6
  *
7
+ * @version 2.2.1
8
+ * @author Algoritmika Ltd.
 
 
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
12
 
13
  if ( ! class_exists( 'WCJ_Related_Products' ) ) :
14
 
15
+ class WCJ_Related_Products extends WCJ_Module {
16
 
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
 
22
+ $this->id = 'related_products';
23
+ $this->short_desc = __( 'Related Products', 'woocommerce-jetpack' );
24
+ $this->desc = __( 'Change displayed WooCommerce related products number, columns, order, relate by tag and/or category, or hide related products completely.', 'woocommerce-jetpack' );
25
+ parent::__construct();
26
 
27
+ if ( $this->is_enabled() ) {
28
 
29
+ add_filter( 'woocommerce_related_products_args', array( $this, 'related_products_limit' ), PHP_INT_MAX );
30
+
31
+ add_filter( 'woocommerce_output_related_products_args', array( $this, 'related_products_limit_args' ), PHP_INT_MAX );
32
 
33
  if ( 'no' === get_option( 'wcj_product_info_related_products_relate_by_category' ) ) {
34
  apply_filters( 'woocommerce_product_related_posts_relate_by_category', false );
38
  apply_filters( 'woocommerce_product_related_posts_relate_by_tag', false );
39
  }
40
  }
41
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  /**
44
  * Change number of related products on product page.
55
  */
56
  function related_products_limit( $args ) {
57
  $args['posts_per_page'] = get_option( 'wcj_product_info_related_products_num' );
58
+ if ( 'yes' == get_option( 'wcj_product_info_related_products_hide' ) ) $args['post_type'] = '';
59
  $args['orderby'] = get_option( 'wcj_product_info_related_products_orderby' );
60
  if ( get_option( 'wcj_product_info_related_products_orderby' ) != 'rand' ) $args['order'] = get_option( 'wcj_product_info_related_products_order' );
61
  return $args;
62
  }
63
 
64
+ /**
65
+ * get_settings.
66
+ */
67
+ function get_settings() {
 
 
68
 
69
+ $settings = array(
70
 
71
  array(
72
+ 'title' => '',//__( 'Related Products Options', 'woocommerce-jetpack' ),
73
+ 'type' => 'title',
74
+ 'desc' => '',
75
+ 'id' => 'wcj_product_info_related_products_options'
 
 
76
  ),
77
 
78
  array(
127
  'type' => 'checkbox',
128
  ),
129
 
130
+ array(
131
+ 'title' => __( 'Hide Related Products', 'woocommerce-jetpack' ),
132
+ 'desc' => __( 'Hide', 'woocommerce-jetpack' ),
133
+ 'id' => 'wcj_product_info_related_products_hide',
134
+ 'default' => 'no',
135
+ 'type' => 'checkbox',
136
+ ),
137
 
138
+ array(
139
+ 'type' => 'sectionend',
140
+ 'id' => 'wcj_product_info_related_products_options'
141
+ ),
142
+ );
143
 
144
+ return $this->add_enable_module_setting( $settings );
145
+ }
 
 
 
 
 
146
  }
147
 
148
  endif;
includes/class-wcj-wholesale-price.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack Wholesale Price class.
6
  *
7
- * @version 2.2.0
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
@@ -15,57 +15,57 @@ if ( ! class_exists( 'WCJ_Wholesale_Price' ) ) :
15
 
16
  class WCJ_Wholesale_Price extends WCJ_Module {
17
 
18
- /**
19
- * Constructor.
20
- */
21
- function __construct() {
22
 
23
  $this->id = 'wholesale_price';
24
  $this->short_desc = __( 'Wholesale Price', 'woocommerce-jetpack' );
25
  $this->desc = __( 'Set WooCommerce wholesale pricing depending on product quantity in cart (buy more pay less).', 'woocommerce-jetpack' );
26
  parent::__construct();
27
 
28
- if ( $this->is_enabled() ) {
29
  add_filter( 'woocommerce_get_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
30
  add_filter( 'woocommerce_get_sale_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
31
  add_filter( 'woocommerce_get_regular_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
32
- }
33
- }
34
-
35
- /**
36
- * get_discount_percent_by_quantity.
37
- */
38
- private function get_discount_percent_by_quantity( $quantity ) {
39
-
40
  $max_qty_level = 1;
41
  $discount_percent = 0;
42
-
43
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
44
 
45
  $level_qty = get_option( 'wcj_wholesale_price_level_min_qty_' . $i, PHP_INT_MAX );
46
  if ( $quantity >= $level_qty && $level_qty >= $max_qty_level ) {
47
  $max_qty_level = $level_qty;
48
  $discount_percent = get_option( 'wcj_wholesale_price_level_discount_percent_' . $i, 0 );
49
- }
50
- }
51
-
52
  return $discount_percent;
53
  }
54
-
55
- /**
56
- * get_wholesale_price.
57
- */
58
- private function get_wholesale_price( $price, $quantity ) {
59
  $discount_percent = $this->get_discount_percent_by_quantity( $quantity );
60
  $discount_koef = 1.0 - ( $discount_percent / 100.0 );
61
- return $price * $discount_koef;
62
  }
63
 
64
- /**
65
- * wholesale_price.
66
- */
67
- function wholesale_price( $price, $product ) {
68
-
69
  if ( ! wcj_is_product_wholesale_enabled( $product->id ) ) return $price;
70
 
71
  // Show only on checkout and cart pages
@@ -91,21 +91,21 @@ class WCJ_Wholesale_Price extends WCJ_Module {
91
  }
92
  }
93
  return $price;
94
- }
 
 
 
 
 
95
 
96
- /**
97
- * get_settings.
98
- */
99
- function get_settings() {
100
-
101
  $products = apply_filters( 'wcj_get_products_filter', array() );
102
 
103
- $settings = array(
104
 
105
  array(
106
  'title' => __( 'Wholesale Price Levels Options', 'woocommerce-jetpack' ),
107
  'type' => 'title',
108
- 'desc' => __( 'Wholesale Price Levels Options.', 'woocommerce-jetpack' ),
109
  'id' => 'wcj_wholesale_price_level_options'
110
  ),
111
 
@@ -118,8 +118,8 @@ class WCJ_Wholesale_Price extends WCJ_Module {
118
  'class' => 'chosen_select',
119
  'css' => 'width: 450px;',
120
  'options' => $products,
121
- ),
122
-
123
  array(
124
  'title' => __( 'Levels Number', 'woocommerce-jetpack' ),
125
  'id' => 'wcj_wholesale_price_levels_number',
@@ -136,21 +136,23 @@ class WCJ_Wholesale_Price extends WCJ_Module {
136
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
137
 
138
  $settings[] = array(
139
- 'title' => __( 'Min Quantity', 'woocommerce-jetpack' ) . ' #' . $i,
140
  'desc' => __( 'Min quantity to apply discount', 'woocommerce-jetpack' ),
141
- 'id' => 'wcj_wholesale_price_level_min_qty_' . $i,
142
- 'default' => 0,
143
- 'type' => 'number',
144
  //'css' => 'width:50%;min-width:300px;height:100px;',
145
- );
 
146
  $settings[] = array(
147
- 'title' => __( 'Discount (%)', 'woocommerce-jetpack' ) . ' #' . $i,
148
  'desc' => __( 'Discount (%)', 'woocommerce-jetpack' ),
149
- 'id' => 'wcj_wholesale_price_level_discount_percent_' . $i,
150
- 'default' => 0,
151
- 'type' => 'number',
152
  //'css' => 'width:50%;min-width:300px;height:100px;',
153
- );
 
154
  }
155
 
156
  $settings[] = array(
@@ -158,8 +160,8 @@ class WCJ_Wholesale_Price extends WCJ_Module {
158
  'id' => 'wcj_wholesale_price_level_options'
159
  );
160
 
161
- return $this->add_enable_module_setting( $settings );
162
- }
163
  }
164
 
165
  endif;
4
  *
5
  * The WooCommerce Jetpack Wholesale Price class.
6
  *
7
+ * @version 2.2.1
8
  * @since 2.2.0
9
  * @author Algoritmika Ltd.
10
  */
15
 
16
  class WCJ_Wholesale_Price extends WCJ_Module {
17
 
18
+ /**
19
+ * Constructor.
20
+ */
21
+ function __construct() {
22
 
23
  $this->id = 'wholesale_price';
24
  $this->short_desc = __( 'Wholesale Price', 'woocommerce-jetpack' );
25
  $this->desc = __( 'Set WooCommerce wholesale pricing depending on product quantity in cart (buy more pay less).', 'woocommerce-jetpack' );
26
  parent::__construct();
27
 
28
+ if ( $this->is_enabled() ) {
29
  add_filter( 'woocommerce_get_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
30
  add_filter( 'woocommerce_get_sale_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
31
  add_filter( 'woocommerce_get_regular_price', array( $this, 'wholesale_price' ), PHP_INT_MAX, 2 );
32
+ }
33
+ }
34
+
35
+ /**
36
+ * get_discount_percent_by_quantity.
37
+ */
38
+ private function get_discount_percent_by_quantity( $quantity ) {
39
+
40
  $max_qty_level = 1;
41
  $discount_percent = 0;
42
+
43
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
44
 
45
  $level_qty = get_option( 'wcj_wholesale_price_level_min_qty_' . $i, PHP_INT_MAX );
46
  if ( $quantity >= $level_qty && $level_qty >= $max_qty_level ) {
47
  $max_qty_level = $level_qty;
48
  $discount_percent = get_option( 'wcj_wholesale_price_level_discount_percent_' . $i, 0 );
49
+ }
50
+ }
51
+
52
  return $discount_percent;
53
  }
54
+
55
+ /**
56
+ * get_wholesale_price.
57
+ */
58
+ private function get_wholesale_price( $price, $quantity ) {
59
  $discount_percent = $this->get_discount_percent_by_quantity( $quantity );
60
  $discount_koef = 1.0 - ( $discount_percent / 100.0 );
61
+ return $price * $discount_koef;
62
  }
63
 
64
+ /**
65
+ * wholesale_price.
66
+ */
67
+ function wholesale_price( $price, $product ) {
68
+
69
  if ( ! wcj_is_product_wholesale_enabled( $product->id ) ) return $price;
70
 
71
  // Show only on checkout and cart pages
91
  }
92
  }
93
  return $price;
94
+ }
95
+
96
+ /**
97
+ * get_settings.
98
+ */
99
+ function get_settings() {
100
 
 
 
 
 
 
101
  $products = apply_filters( 'wcj_get_products_filter', array() );
102
 
103
+ $settings = array(
104
 
105
  array(
106
  'title' => __( 'Wholesale Price Levels Options', 'woocommerce-jetpack' ),
107
  'type' => 'title',
108
+ 'desc' => __( 'Wholesale Price Levels Options. If you want to display prices table on frontend, use [wcj_product_wholesale_price_table] shortcode.', 'woocommerce-jetpack' ),
109
  'id' => 'wcj_wholesale_price_level_options'
110
  ),
111
 
118
  'class' => 'chosen_select',
119
  'css' => 'width: 450px;',
120
  'options' => $products,
121
+ ),
122
+
123
  array(
124
  'title' => __( 'Levels Number', 'woocommerce-jetpack' ),
125
  'id' => 'wcj_wholesale_price_levels_number',
136
  for ( $i = 1; $i <= apply_filters( 'wcj_get_option_filter', 1, get_option( 'wcj_wholesale_price_levels_number', 1 ) ); $i++ ) {
137
 
138
  $settings[] = array(
139
+ 'title' => __( 'Min Quantity', 'woocommerce-jetpack' ) . ' #' . $i,
140
  'desc' => __( 'Min quantity to apply discount', 'woocommerce-jetpack' ),
141
+ 'id' => 'wcj_wholesale_price_level_min_qty_' . $i,
142
+ 'default' => 0,
143
+ 'type' => 'number',
144
  //'css' => 'width:50%;min-width:300px;height:100px;',
145
+ 'custom_attributes' => array('step' => '1', 'min' => '0', ),
146
+ );
147
  $settings[] = array(
148
+ 'title' => __( 'Discount (%)', 'woocommerce-jetpack' ) . ' #' . $i,
149
  'desc' => __( 'Discount (%)', 'woocommerce-jetpack' ),
150
+ 'id' => 'wcj_wholesale_price_level_discount_percent_' . $i,
151
+ 'default' => 0,
152
+ 'type' => 'number',
153
  //'css' => 'width:50%;min-width:300px;height:100px;',
154
+ 'custom_attributes' => array('step' => '0.0001', 'min' => '0', ),
155
+ );
156
  }
157
 
158
  $settings[] = array(
160
  'id' => 'wcj_wholesale_price_level_options'
161
  );
162
 
163
+ return $this->add_enable_module_setting( $settings );
164
+ }
165
  }
166
 
167
  endif;
includes/classes/class-wcj-pdf-invoice.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * The WooCommerce Jetpack PDF Invoice class.
6
  *
7
- * @version 2.2.0
8
  * @author Algoritmika Ltd.
9
  */
10
 
@@ -13,7 +13,6 @@ if ( ! defined( 'ABSPATH' ) ) exit;
13
  if ( ! class_exists( 'WCJ_TCPDF' ) ) :
14
 
15
  // Include the main TCPDF library
16
- //require_once( WCJ()->plugin_path() . '/includes/lib/tcpdf_min/tcpdf.php' );
17
  require_once( wcj_plugin_path() . '/includes/lib/tcpdf_min/tcpdf.php' );
18
 
19
  class WCJ_TCPDF extends TCPDF {
@@ -22,27 +21,27 @@ class WCJ_TCPDF extends TCPDF {
22
  $this->invoice_type = $invoice_type;
23
  }
24
 
25
- /* //Page header
26
- public function Header() {
27
- // Logo
28
- $image_file = K_PATH_IMAGES.'logo_example.jpg';
29
- $this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
30
- // Set font
31
- $this->SetFont('helvetica', 'B', 20);
32
- // Title
33
- $this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');
34
- } */
35
-
36
- /**/ // Page footer
37
- public function Footer() {
38
- // Position at 15 mm from bottom
39
- //$this->SetY(-15);
40
- // Set font
41
- //$this->SetFont('helvetica', 'I', 8);
42
 
43
  $invoice_type = $this->invoice_type;
44
  $footer_text = apply_filters( 'wcj_get_option_filter', 'Page %page_number% / %total_pages%', get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text' ) );
45
- //$this->Cell( 0, 0, do_shortcode( $footer_text ), 0, false, 'L', 0, '', 0, false, 'T', 'M' );
46
  $footer_text = str_replace( '%page_number%', $this->getAliasNumPage(), $footer_text );
47
  $footer_text = str_replace( '%total_pages%', $this->getAliasNbPages(), $footer_text );
48
  $border_desc = array(
@@ -53,8 +52,8 @@ class WCJ_TCPDF extends TCPDF {
53
  );
54
  $footer_text_color_rgb = wcj_hex2rgb( get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text_color' ) );
55
  $this->SetTextColor( $footer_text_color_rgb[0], $footer_text_color_rgb[1], $footer_text_color_rgb[2] );
56
- $this->writeHTMLCell( 0, 0, '', '', do_shortcode( $footer_text ), $border_desc, 1, 0, true, '', true );
57
- } /**/
58
  }
59
 
60
  endif;
@@ -63,13 +62,13 @@ if ( ! class_exists( 'WCJ_PDF_Invoice' ) ) :
63
 
64
  class WCJ_PDF_Invoice extends WCJ_Invoice {
65
 
66
- /**
67
- * Constructor.
68
- */
69
- public function __construct( $order_id, $invoice_type ) {
70
 
71
  parent::__construct( $order_id, $invoice_type );
72
- }
73
 
74
  function prepare_pdf() {
75
 
@@ -126,8 +125,8 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
126
  }
127
 
128
  // Set Header and Footer fonts
129
- $pdf->setHeaderFont( Array( PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN ) );
130
- $pdf->setFooterFont( Array( PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA ) );
131
 
132
  // Set default monospaced font
133
  $pdf->SetDefaultMonospacedFont( PDF_FONT_MONOSPACED );
@@ -176,10 +175,10 @@ class WCJ_PDF_Invoice extends WCJ_Invoice {
176
  return $pdf;
177
  }
178
 
179
- /**
180
- * get_pdf.
181
- */
182
- //function get_pdf( $get_by_order_id = 0 ) {
183
  //function get_pdf( $order_id, $invoice_type, $name, $dest ) {
184
  function get_pdf( $dest ) {
185
 
4
  *
5
  * The WooCommerce Jetpack PDF Invoice class.
6
  *
7
+ * @version 2.2.1
8
  * @author Algoritmika Ltd.
9
  */
10
 
13
  if ( ! class_exists( 'WCJ_TCPDF' ) ) :
14
 
15
  // Include the main TCPDF library
 
16
  require_once( wcj_plugin_path() . '/includes/lib/tcpdf_min/tcpdf.php' );
17
 
18
  class WCJ_TCPDF extends TCPDF {
21
  $this->invoice_type = $invoice_type;
22
  }
23
 
24
+ /* //Page header
25
+ public function Header() {
26
+ // Logo
27
+ $image_file = K_PATH_IMAGES.'logo_example.jpg';
28
+ $this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
29
+ // Set font
30
+ $this->SetFont('helvetica', 'B', 20);
31
+ // Title
32
+ $this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');
33
+ } */
34
+
35
+ /**/ // Page footer
36
+ public function Footer() {
37
+ // Position at 15 mm from bottom
38
+ //$this->SetY(-15);
39
+ // Set font
40
+ //$this->SetFont('helvetica', 'I', 8);
41
 
42
  $invoice_type = $this->invoice_type;
43
  $footer_text = apply_filters( 'wcj_get_option_filter', 'Page %page_number% / %total_pages%', get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text' ) );
44
+ //$this->Cell( 0, 0, do_shortcode( $footer_text ), 0, false, 'L', 0, '', 0, false, 'T', 'M' );
45
  $footer_text = str_replace( '%page_number%', $this->getAliasNumPage(), $footer_text );
46
  $footer_text = str_replace( '%total_pages%', $this->getAliasNbPages(), $footer_text );
47
  $border_desc = array(
52
  );
53
  $footer_text_color_rgb = wcj_hex2rgb( get_option( 'wcj_invoicing_' . $invoice_type . '_footer_text_color' ) );
54
  $this->SetTextColor( $footer_text_color_rgb[0], $footer_text_color_rgb[1], $footer_text_color_rgb[2] );
55
+ $this->writeHTMLCell( 0, 0, '', '', do_shortcode( $footer_text ), $border_desc, 1, 0, true, '', true );
56
+ } /**/
57
  }
58
 
59
  endif;
62
 
63
  class WCJ_PDF_Invoice extends WCJ_Invoice {
64
 
65
+ /**
66
+ * Constructor.
67
+ */
68
+ public function __construct( $order_id, $invoice_type ) {
69
 
70
  parent::__construct( $order_id, $invoice_type );
71
+ }
72
 
73
  function prepare_pdf() {
74
 
125
  }
126
 
127
  // Set Header and Footer fonts
128
+ $pdf->setHeaderFont( Array( /* PDF_FONT_NAME_MAIN */get_option( 'wcj_invoicing_' . $invoice_type . '_general_font_family', 'dejavusans' ), '', PDF_FONT_SIZE_MAIN ) );
129
+ $pdf->setFooterFont( Array( /* PDF_FONT_NAME_DATA */get_option( 'wcj_invoicing_' . $invoice_type . '_general_font_family', 'dejavusans' ), '', PDF_FONT_SIZE_DATA ) );
130
 
131
  // Set default monospaced font
132
  $pdf->SetDefaultMonospacedFont( PDF_FONT_MONOSPACED );
175
  return $pdf;
176
  }
177
 
178
+ /**
179
+ * get_pdf.
180
+ */
181
+ //function get_pdf( $get_by_order_id = 0 ) {
182
  //function get_pdf( $order_id, $invoice_type, $name, $dest ) {
183
  function get_pdf( $dest ) {
184
 
includes/functions/wcj-functions.php CHANGED
@@ -317,8 +317,7 @@ if ( ! function_exists( 'wcj_get_shortcodes_atts_list' ) ) {
317
  if ( ! function_exists( 'wcj_get_shortcodes_list' ) ) {
318
  function wcj_get_shortcodes_list() {
319
  $the_array = apply_filters( 'wcj_shortcodes_list', array() );
320
- return implode( ', ', $the_array );
321
- //return implode( PHP_EOL, $the_array );
322
  }
323
  }
324
 
317
  if ( ! function_exists( 'wcj_get_shortcodes_list' ) ) {
318
  function wcj_get_shortcodes_list() {
319
  $the_array = apply_filters( 'wcj_shortcodes_list', array() );
320
+ return implode( ', ', $the_array )/* . ' (' . count( $the_array ) . ')' */;
 
321
  }
322
  }
323
 
includes/pdf-invoices/class-wcj-pdf-invoicing-renumerate-tool.php CHANGED
@@ -4,10 +4,8 @@
4
  *
5
  * The WooCommerce Jetpack PDF Invoices Renumerate Tool class.
6
  *
7
- * @class WCJ_PDF_Invoicing_Renumerate_Tool
8
- * @version 1.0.0
9
- * @category Class
10
- * @author Algoritmika Ltd.
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit;
@@ -16,36 +14,13 @@ if ( ! class_exists( 'WCJ_PDF_Invoicing_Renumerate_Tool' ) ) :
16
 
17
  class WCJ_PDF_Invoicing_Renumerate_Tool {
18
 
19
- /**
20
- * Constructor.
21
- */
22
- public function __construct() {
23
  add_filter( 'wcj_tools_tabs', array( $this, 'add_renumerate_invoices_tool_tab' ), 100 );
24
  add_action( 'wcj_tools_renumerate_invoices', array( $this, 'create_renumerate_invoices_tool' ), 100 );
25
  add_action( 'wcj_tools_dashboard', array( $this, 'add_renumerate_invoices_tool_info_to_tools_dashboard' ), 100 );
26
-
27
- //add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
28
- //add_action( 'admin_head', array( $this, 'add_datepicker_script' ) );
29
- }
30
-
31
- /**
32
- * enqueue_scripts.
33
- *
34
- public function enqueue_scripts() {
35
- wp_enqueue_script('jquery-ui-datepicker');
36
- wp_enqueue_style( 'jquery-ui-css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
37
- }
38
-
39
- public function add_datepicker_script() {
40
- ?>
41
- <script>
42
- jQuery(document).ready(function() {
43
- jQuery("input[display='date']").datepicker({
44
- dateFormat : '<?php echo wcj_date_format_php_to_js( get_option( 'date_format' ) ); ?>'
45
- });
46
- });
47
- </script>
48
- <?php
49
  }
50
 
51
  /**
@@ -73,7 +48,7 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
73
  );
74
  return $tabs;
75
  }
76
-
77
  function wcj_multi_selected( $selected, $current_multi ) {
78
  if ( ! is_array( $current_multi ) ) return selected( $selected, $current_multi, false );
79
  foreach( $current_multi as $current ) {
@@ -83,25 +58,25 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
83
  return '';
84
  }
85
 
86
- /**
87
- * Add Renumerate Invoices tool to WooCommerce menu (the content).
88
- */
89
  public function create_renumerate_invoices_tool() {
90
  $result_message = '';
91
  $renumerate_result = '';
92
-
93
  $the_invoice_type = ( ! empty( $_POST['invoice_type'] ) ) ? $_POST['invoice_type'] : 'invoice';
94
  $the_start_number = ( ! empty( $_POST['start_number'] ) ) ? $_POST['start_number'] : 0;
95
  $the_start_date = ( ! empty( $_POST['start_date'] ) ) ? $_POST['start_date'] : '';
96
  $the_order_statuses = ( ! empty( $_POST['order_statuses'] ) ) ? $_POST['order_statuses'] : array();
97
- $the_delete_all = ( isset( $_POST['delete_all'] ) ) ? true : false;
98
-
99
  if ( isset( $_POST['renumerate_invoices'] ) ) {
100
  if ( ! empty( $the_order_statuses ) ) {
101
  $renumerate_result = $this->renumerate_invoices( $the_invoice_type, $the_start_number, $the_start_date, $the_order_statuses, $the_delete_all );
102
  $result_message = '<div class="updated"><p><strong>' . __( 'Invoices successfully renumerated!', 'woocommerce-jetpack' ) . '</strong></p></div>';
103
  } else {
104
- $result_message = '<div class="error"><p><strong>' . __( 'Please select at leat one order status.', 'woocommerce-jetpack' ) . '</strong></p></div>';
105
  }
106
  //$result_message .= '<p>' . $renumerate_result . '</p>';
107
  }
@@ -111,28 +86,28 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
111
  <?php echo $result_message; ?>
112
  <p><form method="post" action="">
113
  <?php
114
-
115
  // Date
116
- $data[] = array(
117
- __( 'Start Date', 'woocommerce-jetpack' ),
118
- '<input class="input-text" display="date" type="text" name="start_date" value="' . $the_start_date . '">',
119
- '<em>' . __( 'Date to start renumerating. Leave blank to renumerate all invoices.', 'woocommerce-jetpack' ) . '</em>',
120
  );
121
-
122
  // Number
123
- $data[] = array(
124
- __( 'Start Number', 'woocommerce-jetpack' ),
125
- '<input class="input-text" type="text" name="start_number" value="' . $the_start_number . '">',
126
- '<em>' . __( 'Counter to start renumerating. Leave 0 to continue from current counter.', 'woocommerce-jetpack' ) . '</em>',
127
  );
128
-
129
- // Delete All
130
- $data[] = array(
131
- __( 'Delete All', 'woocommerce-jetpack' ),
132
- '<input type="checkbox" name="delete_all" value="" ' . checked( $the_delete_all, true, false ) . '>',
133
- '<em>' . __( 'Clear all invoices before renumerating.', 'woocommerce-jetpack' ) . '</em>',
134
  );
135
-
136
  // Type
137
  $invoice_type_select_html = '<select name="invoice_type">';
138
  //$invoice_types = wcj_get_invoice_types();
@@ -142,7 +117,7 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
142
  }
143
  $invoice_type_select_html .= '</select>';
144
  $data[] = array( __( 'Document Type', 'woocommerce-jetpack' ), $invoice_type_select_html, '', );
145
-
146
  // Statuses
147
  $order_statuses_select_html = '<select id="order_statuses" name="order_statuses[]" multiple size="5">';
148
  $order_statuses = wcj_get_order_statuses( false );
@@ -152,25 +127,25 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
152
  }
153
  $order_statuses_select_html .= '</select>';
154
  $data[] = array( __( 'Order Statuses', 'woocommerce-jetpack' ), $order_statuses_select_html, '', );
155
-
156
  // Print all
157
  echo wcj_get_table_html( $data, array( 'table_heading_type' => 'vertical', ) );
158
-
159
  ?>
160
  <input type="submit" name="renumerate_invoices" value="Renumerate invoices">
161
  </form></p>
162
- <?php
163
  if ( '' != $renumerate_result ) {
164
- echo '<h3>' . __( 'Results', 'woocommerce-jetpack' ) . '</h3>';
165
- echo '<p>' . $renumerate_result . '</p>';
166
  }
167
  ?>
168
  </div><?php
169
  }
170
 
171
- /**
172
- * Renumerate invoices function.
173
- */
174
  public function renumerate_invoices( $invoice_type, $start_number, $start_date, $order_statuses, $the_delete_all ) {
175
 
176
  $output = '';
@@ -180,11 +155,17 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
180
  }
181
 
182
  $args = array(
183
- 'post_type' => 'shop_order',
184
- 'post_status' => 'any',
185
- 'posts_per_page' => -1,
186
- 'orderby' => 'date',
187
- 'order' => 'ASC',
 
 
 
 
 
 
188
  );
189
 
190
  $loop = new WP_Query( $args );
@@ -195,22 +176,22 @@ class WCJ_PDF_Invoicing_Renumerate_Tool {
195
 
196
  $order_id = $loop->post->ID;
197
  if ( in_array( $loop->post->post_status, $order_statuses ) && strtotime( $loop->post->post_date ) >= strtotime( $start_date ) ) {
198
-
199
  $the_order = wc_get_order( $order_id );
200
  if ( 0 != $the_order->get_total() ) {
201
-
202
  wcj_create_invoice( $order_id, $invoice_type, strtotime( $loop->post->post_date ) );
203
  $created_invoices_counter++;
204
  }
205
  } else {
206
  if ( $the_delete_all && wcj_is_invoice_created( $order_id, $invoice_type ) ) {
207
  wcj_delete_invoice( $order_id, $invoice_type );
208
- $deleted_invoices_counter++;
209
  }
210
  }
211
 
212
  endwhile;
213
-
214
  $output .= '<p>' . sprintf( __( 'Total documents created: %d', 'woocommerce-jetpack' ), $created_invoices_counter ) . '</p>';
215
  $output .= '<p>' . sprintf( __( 'Total documents deleted: %d', 'woocommerce-jetpack' ), $deleted_invoices_counter ) . '</p>';
216
 
4
  *
5
  * The WooCommerce Jetpack PDF Invoices Renumerate Tool class.
6
  *
7
+ * @version 2.2.1
8
+ * @author Algoritmika Ltd.
 
 
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
  class WCJ_PDF_Invoicing_Renumerate_Tool {
16
 
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
  add_filter( 'wcj_tools_tabs', array( $this, 'add_renumerate_invoices_tool_tab' ), 100 );
22
  add_action( 'wcj_tools_renumerate_invoices', array( $this, 'create_renumerate_invoices_tool' ), 100 );
23
  add_action( 'wcj_tools_dashboard', array( $this, 'add_renumerate_invoices_tool_info_to_tools_dashboard' ), 100 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
 
26
  /**
48
  );
49
  return $tabs;
50
  }
51
+
52
  function wcj_multi_selected( $selected, $current_multi ) {
53
  if ( ! is_array( $current_multi ) ) return selected( $selected, $current_multi, false );
54
  foreach( $current_multi as $current ) {
58
  return '';
59
  }
60
 
61
+ /**
62
+ * Add Renumerate Invoices tool to WooCommerce menu (the content).
63
+ */
64
  public function create_renumerate_invoices_tool() {
65
  $result_message = '';
66
  $renumerate_result = '';
67
+
68
  $the_invoice_type = ( ! empty( $_POST['invoice_type'] ) ) ? $_POST['invoice_type'] : 'invoice';
69
  $the_start_number = ( ! empty( $_POST['start_number'] ) ) ? $_POST['start_number'] : 0;
70
  $the_start_date = ( ! empty( $_POST['start_date'] ) ) ? $_POST['start_date'] : '';
71
  $the_order_statuses = ( ! empty( $_POST['order_statuses'] ) ) ? $_POST['order_statuses'] : array();
72
+ $the_delete_all = ( isset( $_POST['delete_all'] ) ) ? true : false;
73
+
74
  if ( isset( $_POST['renumerate_invoices'] ) ) {
75
  if ( ! empty( $the_order_statuses ) ) {
76
  $renumerate_result = $this->renumerate_invoices( $the_invoice_type, $the_start_number, $the_start_date, $the_order_statuses, $the_delete_all );
77
  $result_message = '<div class="updated"><p><strong>' . __( 'Invoices successfully renumerated!', 'woocommerce-jetpack' ) . '</strong></p></div>';
78
  } else {
79
+ $result_message = '<div class="error"><p><strong>' . __( 'Please select at least one order status.', 'woocommerce-jetpack' ) . '</strong></p></div>';
80
  }
81
  //$result_message .= '<p>' . $renumerate_result . '</p>';
82
  }
86
  <?php echo $result_message; ?>
87
  <p><form method="post" action="">
88
  <?php
89
+
90
  // Date
91
+ $data[] = array(
92
+ __( 'Start Date', 'woocommerce-jetpack' ),
93
+ '<input class="input-text" display="date" type="text" name="start_date" value="' . $the_start_date . '">',
94
+ '<em>' . __( 'Date to start renumerating. Leave blank to renumerate all invoices.', 'woocommerce-jetpack' ) . '</em>',
95
  );
96
+
97
  // Number
98
+ $data[] = array(
99
+ __( 'Start Number', 'woocommerce-jetpack' ),
100
+ '<input class="input-text" type="text" name="start_number" value="' . $the_start_number . '">',
101
+ '<em>' . __( 'Counter to start renumerating. Leave 0 to continue from current counter.', 'woocommerce-jetpack' ) . '</em>',
102
  );
103
+
104
+ // Delete All
105
+ $data[] = array(
106
+ __( 'Delete All', 'woocommerce-jetpack' ),
107
+ '<input type="checkbox" name="delete_all" value="" ' . checked( $the_delete_all, true, false ) . '>',
108
+ '<em>' . __( 'Clear all invoices before renumerating.', 'woocommerce-jetpack' ) . '</em>',
109
  );
110
+
111
  // Type
112
  $invoice_type_select_html = '<select name="invoice_type">';
113
  //$invoice_types = wcj_get_invoice_types();
117
  }
118
  $invoice_type_select_html .= '</select>';
119
  $data[] = array( __( 'Document Type', 'woocommerce-jetpack' ), $invoice_type_select_html, '', );
120
+
121
  // Statuses
122
  $order_statuses_select_html = '<select id="order_statuses" name="order_statuses[]" multiple size="5">';
123
  $order_statuses = wcj_get_order_statuses( false );
127
  }
128
  $order_statuses_select_html .= '</select>';
129
  $data[] = array( __( 'Order Statuses', 'woocommerce-jetpack' ), $order_statuses_select_html, '', );
130
+
131
  // Print all
132
  echo wcj_get_table_html( $data, array( 'table_heading_type' => 'vertical', ) );
133
+
134
  ?>
135
  <input type="submit" name="renumerate_invoices" value="Renumerate invoices">
136
  </form></p>
137
+ <?php
138
  if ( '' != $renumerate_result ) {
139
+ echo '<h3>' . __( 'Results', 'woocommerce-jetpack' ) . '</h3>';
140
+ echo '<p>' . $renumerate_result . '</p>';
141
  }
142
  ?>
143
  </div><?php
144
  }
145
 
146
+ /**
147
+ * Renumerate invoices function.
148
+ */
149
  public function renumerate_invoices( $invoice_type, $start_number, $start_date, $order_statuses, $the_delete_all ) {
150
 
151
  $output = '';
155
  }
156
 
157
  $args = array(
158
+ 'post_type' => 'shop_order',
159
+ 'post_status' => 'any',
160
+ 'posts_per_page' => -1,
161
+ 'orderby' => 'date',
162
+ 'order' => 'ASC',
163
+ 'date_query' => array(
164
+ array(
165
+ 'after' => $start_date,
166
+ 'inclusive' => true,
167
+ ),
168
+ ),
169
  );
170
 
171
  $loop = new WP_Query( $args );
176
 
177
  $order_id = $loop->post->ID;
178
  if ( in_array( $loop->post->post_status, $order_statuses ) && strtotime( $loop->post->post_date ) >= strtotime( $start_date ) ) {
179
+
180
  $the_order = wc_get_order( $order_id );
181
  if ( 0 != $the_order->get_total() ) {
182
+
183
  wcj_create_invoice( $order_id, $invoice_type, strtotime( $loop->post->post_date ) );
184
  $created_invoices_counter++;
185
  }
186
  } else {
187
  if ( $the_delete_all && wcj_is_invoice_created( $order_id, $invoice_type ) ) {
188
  wcj_delete_invoice( $order_id, $invoice_type );
189
+ $deleted_invoices_counter++;
190
  }
191
  }
192
 
193
  endwhile;
194
+
195
  $output .= '<p>' . sprintf( __( 'Total documents created: %d', 'woocommerce-jetpack' ), $created_invoices_counter ) . '</p>';
196
  $output .= '<p>' . sprintf( __( 'Total documents deleted: %d', 'woocommerce-jetpack' ), $deleted_invoices_counter ) . '</p>';
197
 
includes/pdf-invoices/class-wcj-pdf-invoicing-report-tool.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Jetpack PDF Invoices Report Tool
4
+ *
5
+ * The WooCommerce Jetpack PDF Invoices Report Tool class.
6
+ *
7
+ * @version 2.2.1
8
+ * @since 2.2.1
9
+ * @author Algoritmika Ltd.
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) exit;
13
+
14
+ if ( ! class_exists( 'WCJ_PDF_Invoicing_Report_Tool' ) ) :
15
+
16
+ class WCJ_PDF_Invoicing_Report_Tool {
17
+
18
+ /**
19
+ * Constructor.
20
+ */
21
+ public function __construct() {
22
+ add_filter( 'wcj_tools_tabs', array( $this, 'add_invoices_report_tool_tab' ), 100 );
23
+ add_action( 'wcj_tools_invoices_report', array( $this, 'create_invoices_report_tool' ), 100 );
24
+ add_action( 'wcj_tools_dashboard', array( $this, 'add_invoices_report_tool_info_to_tools_dashboard' ), 100 );
25
+ }
26
+
27
+ /**
28
+ * add_invoices_report_tool_info_to_tools_dashboard.
29
+ */
30
+ public function add_invoices_report_tool_info_to_tools_dashboard() {
31
+ echo '<tr>';
32
+ if ( 'yes' === get_option( 'wcj_pdf_invoicing_enabled') )
33
+ $is_enabled = '<span style="color:green;font-style:italic;">' . __( 'enabled', 'woocommerce-jetpack' ) . '</span>';
34
+ else
35
+ $is_enabled = '<span style="color:gray;font-style:italic;">' . __( 'disabled', 'woocommerce-jetpack' ) . '</span>';
36
+ echo '<td>' . __( 'Invoices Report', 'woocommerce-jetpack' ) . '</td>';
37
+ echo '<td>' . $is_enabled . '</td>';
38
+ echo '<td>' . __( 'Invoices Monthly Reports.', 'woocommerce-jetpack' ) . '</td>';
39
+ echo '</tr>';
40
+ }
41
+
42
+ /**
43
+ * add_invoices_report_tool_tab.
44
+ */
45
+ public function add_invoices_report_tool_tab( $tabs ) {
46
+ $tabs[] = array(
47
+ 'id' => 'invoices_report',
48
+ 'title' => __( 'Invoices Report', 'woocommerce-jetpack' ),
49
+ );
50
+ return $tabs;
51
+ }
52
+
53
+ /**
54
+ * Add Invoices Report tool to WooCommerce menu (the content).
55
+ */
56
+ public function create_invoices_report_tool() {
57
+
58
+ $result_message = '';
59
+
60
+ $the_year = ( ! empty( $_POST['report_year'] ) ) ? $_POST['report_year'] : '';
61
+ $the_month = ( ! empty( $_POST['report_month'] ) ) ? $_POST['report_month'] : '';
62
+
63
+ if ( isset( $_POST['get_invoices_report'] ) ) {
64
+ if ( ! empty( $the_year ) && ! empty( $the_month ) ) {
65
+ $result_message = $this->get_invoices_report( $the_year, $the_month );
66
+ } else {
67
+ $result_message = '<div class="error"><p><strong>' . __( 'Please fill year and month values.', 'woocommerce-jetpack' ) . '</strong></p></div>';
68
+ }
69
+ }
70
+ ?><div>
71
+ <h2><?php echo __( 'WooCommerce Jetpack - Invoices Report', 'woocommerce-jetpack' ); ?></h2>
72
+ <p><?php echo __( 'Invoices Monthly Reports.', 'woocommerce-jetpack' ); ?></p>
73
+ <?php echo $result_message; ?>
74
+ <p><form method="post" action="">
75
+ <?php
76
+
77
+ // Year
78
+ $data[] = array(
79
+ __( 'Year', 'woocommerce-jetpack' ),
80
+ '<input class="input-text" type="text" name="report_year" value="' . $the_year . '">',
81
+ //'<em>' . __( 'Year.', 'woocommerce-jetpack' ) . '</em>',
82
+ );
83
+
84
+ // Month
85
+ $data[] = array(
86
+ __( 'Month', 'woocommerce-jetpack' ),
87
+ '<input class="input-text" type="text" name="report_month" value="' . $the_month . '">',
88
+ //'<em>' . __( 'Month.', 'woocommerce-jetpack' ) . '</em>',
89
+ );
90
+
91
+ // Print all
92
+ echo wcj_get_table_html( $data, array( 'table_heading_type' => 'vertical', ) );
93
+
94
+ ?>
95
+ <input type="submit" name="get_invoices_report" value="<?php _e( 'Get Report', 'woocommerce-jetpack' ); ?>">
96
+ </form></p>
97
+ </div><?php
98
+ }
99
+
100
+ /**
101
+ * Invoices Report function.
102
+ */
103
+ function get_invoices_report( $year, $month ) {
104
+
105
+ $output = '';
106
+
107
+ $data = array();
108
+ $data[] = array(
109
+ __( 'Invoice Nr.', 'woocommerce-jetpack' ),
110
+ __( 'Invoice Date', 'woocommerce-jetpack' ),
111
+ __( 'Order ID', 'woocommerce-jetpack' ),
112
+ __( 'Customer Country', 'woocommerce-jetpack' ),
113
+ __( 'Tax %', 'woocommerce-jetpack' ),
114
+ __( 'Order Total Tax Excl.', 'woocommerce-jetpack' ),
115
+ __( 'Order Taxes', 'woocommerce-jetpack' ),
116
+ __( 'Order Total', 'woocommerce-jetpack' ),
117
+ __( 'Order Currency', 'woocommerce-jetpack' ),
118
+ );
119
+
120
+ $total_sum = 0;
121
+ $total_sum_excl_tax = 0;
122
+ $total_tax = 0;
123
+
124
+ $args = array(
125
+ 'post_type' => 'shop_order',
126
+ 'post_status' => 'any',
127
+ 'posts_per_page' => -1,
128
+ 'orderby' => 'date',
129
+ 'order' => 'ASC',
130
+
131
+ 'year' => $year,
132
+ 'monthnum' => $month,
133
+ );
134
+ $loop = new WP_Query( $args );
135
+ while ( $loop->have_posts() ) : $loop->the_post();
136
+ $order_id = $loop->post->ID;
137
+ $invoice_type_id = 'invoice';
138
+
139
+
140
+ if ( wcj_is_invoice_created( $order_id, $invoice_type_id ) ) {
141
+
142
+ $the_order = wc_get_order( $order_id );
143
+
144
+ $user_meta = get_user_meta( $the_order->get_user_id() );
145
+ $billing_country = isset( $user_meta['billing_country'][0] ) ? $user_meta['billing_country'][0] : '';
146
+ $shipping_country = isset( $user_meta['shipping_country'][0] ) ? $user_meta['shipping_country'][0] : '';
147
+ $customer_country = ( '' == $billing_country ) ? $shipping_country : $billing_country;
148
+
149
+ $order_total = $the_order->get_total();
150
+
151
+ $order_tax = apply_filters( 'wcj_order_total_tax', $the_order->get_total_tax(), $the_order );
152
+ //$order_tax_percent = ( isset( $taxes_by_countries_eu[ $customer_country ] ) ) ? $taxes_by_countries_eu[ $customer_country ] : 0;
153
+ //$order_tax_percent /= 100;
154
+ //$order_tax = $order_total * $order_tax_percent;
155
+ $order_total_exlc_tax = $order_total - $order_tax;
156
+ $order_tax_percent = ( 0 == $order_total ) ? 0 : $order_tax / $order_total_exlc_tax;
157
+
158
+ $total_sum += $order_total;
159
+ $total_sum_excl_tax += $order_total_exlc_tax;
160
+ $total_tax += $order_tax;
161
+
162
+ //$order_tax_html = ( 0 == $order_tax ) ? '' : sprintf( '$ %.2f', $order_tax );
163
+ $order_tax_html = sprintf( '%.2f', $order_tax );
164
+
165
+ $data[] = array(
166
+ wcj_get_invoice_number( $order_id, $invoice_type_id ),
167
+ wcj_get_invoice_date( $order_id, $invoice_type_id, 0, get_option( 'date_format' ) ),
168
+ $order_id,
169
+ $customer_country,
170
+ sprintf( '%.0f %%', $order_tax_percent * 100 ),
171
+ sprintf( '%.2f', $order_total_exlc_tax ),
172
+ $order_tax_html,
173
+ sprintf( '%.2f', $order_total ),
174
+ $the_order->get_order_currency(),
175
+ );
176
+ }
177
+ endwhile;
178
+
179
+ /* $output .= '<h3>' . 'Total Sum Excl. Tax: ' . sprintf( '$ %.2f', $total_sum_excl_tax ) . '</h3>';
180
+ $output .= '<h3>' . 'Total Sum: ' . sprintf( '$ %.2f', $total_sum ) . '</h3>';
181
+ $output .= '<h3>' . 'Total Tax: ' . sprintf( '$ %.2f', $total_tax ) . '</h3>'; */
182
+ $output .= wcj_get_table_html( $data, array( 'table_class' => 'widefat', ) );
183
+ /**/
184
+
185
+ return $output;
186
+ }
187
+ /**/
188
+ }
189
+
190
+ endif;
191
+
192
+ return new WCJ_PDF_Invoicing_Report_Tool();
includes/price-by-country/class-wcj-price-by-country-core.php CHANGED
@@ -4,8 +4,8 @@
4
  *
5
  * The WooCommerce Jetpack Price by Country Core class.
6
  *
7
- * @version 2.2.0
8
- * @author Algoritmika Ltd.
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
@@ -14,19 +14,30 @@ if ( ! class_exists( 'WCJ_Price_by_Country_Core' ) ) :
14
 
15
  class WCJ_Price_by_Country_Core {
16
 
17
- /**
18
- * Constructor.
19
- */
20
- public function __construct() {
21
  $this->customer_country_group_id = null;
22
  add_action( 'init', array( $this, 'add_hooks' ) );
23
- }
24
 
25
  /**
26
  * add_hooks.
27
  */
28
  function add_hooks() {
29
 
 
 
 
 
 
 
 
 
 
 
 
30
  // Price hooks
31
  add_filter( 'woocommerce_get_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
32
  add_filter( 'woocommerce_get_sale_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
@@ -39,12 +50,50 @@ class WCJ_Price_by_Country_Core {
39
  add_filter( 'woocommerce_currency', array( $this, 'change_currency_code' ), PHP_INT_MAX, 1 );
40
 
41
  // Shipping
42
- add_filter( 'woocommerce_package_rates', array( $this, 'change_shipping_price_by_country' ), PHP_INT_MAX, 2 );
 
 
 
 
 
43
 
44
  // Debug
45
  // add_shortcode( 'wcj_debug_price_by_country', array( $this, 'get_debug_info' ) );
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  /**
49
  * change_shipping_price_by_country.
50
  */
@@ -135,13 +184,32 @@ class WCJ_Price_by_Country_Core {
135
  if ( isset( $_GET['country'] ) && '' != $_GET['country'] && is_super_admin() ) {
136
  $country = $_GET['country'];
137
  } else {
138
- // Get the country by IP
139
- $location = WC_Geolocation::geolocate_ip();
140
- // Base fallback
141
- if ( empty( $location['country'] ) ) {
142
- $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  }
144
- $country = ( isset( $location['country'] ) ) ? $location['country'] : null;
145
  }
146
 
147
  if ( null === $country ) {
4
  *
5
  * The WooCommerce Jetpack Price by Country Core class.
6
  *
7
+ * @version 2.2.1
8
+ * @author Algoritmika Ltd.
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
  class WCJ_Price_by_Country_Core {
16
 
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
  $this->customer_country_group_id = null;
22
  add_action( 'init', array( $this, 'add_hooks' ) );
23
+ }
24
 
25
  /**
26
  * add_hooks.
27
  */
28
  function add_hooks() {
29
 
30
+ if ( 'by_user_selection' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
31
+
32
+ if ( ! session_id() ) {
33
+ session_start();
34
+ }
35
+
36
+ if ( isset( $_REQUEST[ 'wcj-country' ] ) ) {
37
+ $_SESSION[ 'wcj-country' ] = $_REQUEST[ 'wcj-country' ];
38
+ }
39
+ }
40
+
41
  // Price hooks
42
  add_filter( 'woocommerce_get_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
43
  add_filter( 'woocommerce_get_sale_price', array( $this, 'change_price_by_country' ), PHP_INT_MAX, 2 );
50
  add_filter( 'woocommerce_currency', array( $this, 'change_currency_code' ), PHP_INT_MAX, 1 );
51
 
52
  // Shipping
53
+ add_filter( 'woocommerce_package_rates', array( $this, 'change_shipping_price_by_country' ), PHP_INT_MAX, 2 );
54
+
55
+ // Country selection box
56
+ /* if ( 'by_user_selection' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
57
+ add_filter( 'woocommerce_get_price_html', array( $this, 'add_country_selection_box' ), PHP_INT_MAX, 2 );
58
+ } */
59
 
60
  // Debug
61
  // add_shortcode( 'wcj_debug_price_by_country', array( $this, 'get_debug_info' ) );
62
  }
63
 
64
+ /**
65
+ * add_country_selection_box.
66
+ *
67
+ function add_country_selection_box( $price_html, $_product ) {
68
+ $html = '';
69
+
70
+ $form_method = get_option( 'wcj_price_by_country_country_selection_box_method', 'get' );
71
+ $select_class = get_option( 'wcj_price_by_country_country_selection_box_class', '' );
72
+ $select_style = get_option( 'wcj_price_by_country_country_selection_box_style', '' );
73
+
74
+ $html .= '<form action="" method="' . $form_method . '">';
75
+
76
+ $html .= '<select name="wcj-country" id="wcj-country" style="' . $select_style . '" class="' . $select_class . '" onchange="this.form.submit()">';
77
+ $countries = wcj_get_countries();
78
+
79
+ /* if ( 'get' == $form_method ) {
80
+ $selected_country = ( isset( $_GET[ 'wcj-country' ] ) ) ? $_GET[ 'wcj-country' ] : '';
81
+ } else {
82
+ $selected_country = ( isset( $_POST[ 'wcj-country' ] ) ) ? $_POST[ 'wcj-country' ] : '';
83
+ } *//*
84
+ $selected_country = ( isset( $_REQUEST[ 'wcj-country' ] ) ) ? $_REQUEST[ 'wcj-country' ] : '';
85
+
86
+ foreach ( $countries as $country_code => $country_name ) {
87
+
88
+ $html .= '<option value="' . $country_code . '" ' . selected( $country_code, $selected_country, false ) . '>' . $country_name . '</option>';
89
+ }
90
+ $html .= '</select>';
91
+
92
+ $html .= '</form>';
93
+
94
+ return $price_html . $html;
95
+ }
96
+
97
  /**
98
  * change_shipping_price_by_country.
99
  */
184
  if ( isset( $_GET['country'] ) && '' != $_GET['country'] && is_super_admin() ) {
185
  $country = $_GET['country'];
186
  } else {
187
+
188
+ if ( 'by_ip' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
189
+
190
+ // Get the country by IP
191
+ $location = WC_Geolocation::geolocate_ip();
192
+ // Base fallback
193
+ if ( empty( $location['country'] ) ) {
194
+ $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
195
+ }
196
+ $country = ( isset( $location['country'] ) ) ? $location['country'] : null;
197
+
198
+ } elseif ( 'by_user_selection' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
199
+
200
+ /* $form_method = get_option( 'wcj_price_by_country_country_selection_box_method', 'get' );
201
+ if ( 'get' == $form_method ) {
202
+ $country = ( isset( $_GET[ 'wcj-country' ] ) ) ? $_GET[ 'wcj-country' ] : null;
203
+ } else {
204
+ $country = ( isset( $_POST[ 'wcj-country' ] ) ) ? $_POST[ 'wcj-country' ] : null;
205
+ } */
206
+ $country = ( isset( $_SESSION[ 'wcj-country' ] ) ) ? $_SESSION[ 'wcj-country' ] : null;
207
+
208
+ } elseif ( 'by_wpml' === get_option( 'wcj_price_by_country_customer_country_detection_method', 'by_ip' ) ) {
209
+
210
+ $country = ( defined( 'ICL_LANGUAGE_CODE' ) ) ? ICL_LANGUAGE_CODE : null;
211
+
212
  }
 
213
  }
214
 
215
  if ( null === $country ) {
includes/shortcodes/class-wcj-general-shortcodes.php CHANGED
@@ -4,9 +4,8 @@
4
  *
5
  * The WooCommerce Jetpack General Shortcodes class.
6
  *
7
- * @class WCJ_General_Shortcodes
8
- * @version 2.2.0
9
- * @author Algoritmika Ltd.
10
  */
11
 
12
  if ( ! defined( 'ABSPATH' ) ) exit;
@@ -15,16 +14,18 @@ if ( ! class_exists( 'WCJ_General_Shortcodes' ) ) :
15
 
16
  class WCJ_General_Shortcodes extends WCJ_Shortcodes {
17
 
18
- /**
19
- * Constructor.
20
- */
21
- public function __construct() {
22
 
23
  $this->the_shortcodes = array(
24
  'wcj_current_date',
25
  //'wcj_image',
26
  'wcj_cart_items_total_weight',
27
  'wcj_wpml',
 
 
28
  );
29
 
30
  $this->the_atts = array(
@@ -34,45 +35,82 @@ class WCJ_General_Shortcodes extends WCJ_Shortcodes {
34
  'width' => '',
35
  'height' => '',*/
36
  'lang' => '',
 
 
 
37
  );
38
 
39
  parent::__construct();
40
 
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
- /**
44
- * wcj_wpml.
45
- */
 
 
 
 
 
 
 
 
 
 
 
46
  function wcj_wpml( $atts, $content ) {
47
  if ( '' == $atts['lang'] || ( defined( 'ICL_LANGUAGE_CODE' ) && ICL_LANGUAGE_CODE === $atts['lang'] ) ) return do_shortcode( $content );
48
  else return '';
49
  }
50
 
51
- /**
52
- * wcj_wpml_translate.
53
- */
54
  function wcj_wpml_translate( $atts, $content ) {
55
  return $this->wcj_wpml( $atts, $content );
56
  }
57
 
58
  /**
59
- * wcj_cart_items_total_weight.
60
- */
61
  function wcj_cart_items_total_weight( $atts ) {
62
  $the_cart = WC()->cart;
63
  return $the_cart->cart_contents_weight;
64
  }
65
 
66
- /**
67
- * wcj_current_date.
68
- */
69
  function wcj_current_date( $atts ) {
70
  return date_i18n( $atts['date_format'] );
71
  }
72
 
73
- /**
74
- * wcj_image.
75
- */
76
  /*function wcj_image( $atts ) {
77
  return '<img src="' . $atts['url'] . '" class="' . $atts['class'] . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '">';
78
  }*/
4
  *
5
  * The WooCommerce Jetpack General Shortcodes class.
6
  *
7
+ * @version 2.2.1
8
+ * @author Algoritmika Ltd.
 
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
  class WCJ_General_Shortcodes extends WCJ_Shortcodes {
16
 
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
 
22
  $this->the_shortcodes = array(
23
  'wcj_current_date',
24
  //'wcj_image',
25
  'wcj_cart_items_total_weight',
26
  'wcj_wpml',
27
+ 'wcj_wpml_translate',
28
+ 'wcj_country_select_drop_down_list',
29
  );
30
 
31
  $this->the_atts = array(
35
  'width' => '',
36
  'height' => '',*/
37
  'lang' => '',
38
+ 'form_method' => 'get',
39
+ 'class' => '',
40
+ 'style' => '',
41
  );
42
 
43
  parent::__construct();
44
 
45
+ }
46
+
47
+ /**
48
+ * wcj_country_select_drop_down_list.
49
+ */
50
+ function wcj_country_select_drop_down_list( $atts, $content ) {
51
+
52
+ $html = '';
53
+
54
+ $form_method = $atts['form_method'];//get_option( 'wcj_price_by_country_country_selection_box_method', 'get' );
55
+ $select_class = $atts['class'];//get_option( 'wcj_price_by_country_country_selection_box_class', '' );
56
+ $select_style = $atts['style'];//get_option( 'wcj_price_by_country_country_selection_box_style', '' );
57
+
58
+ $html .= '<form action="" method="' . $form_method . '">';
59
+
60
+ $html .= '<select name="wcj-country" id="wcj-country" style="' . $select_style . '" class="' . $select_class . '" onchange="this.form.submit()">';
61
+ $countries = wcj_get_countries();
62
+
63
+ /* if ( 'get' == $form_method ) {
64
+ $selected_country = ( isset( $_GET[ 'wcj-country' ] ) ) ? $_GET[ 'wcj-country' ] : '';
65
+ } else {
66
+ $selected_country = ( isset( $_POST[ 'wcj-country' ] ) ) ? $_POST[ 'wcj-country' ] : '';
67
+ } */
68
+ $selected_country = ( isset( $_SESSION[ 'wcj-country' ] ) ) ? $_SESSION[ 'wcj-country' ] : '';
69
 
70
+ foreach ( $countries as $country_code => $country_name ) {
71
+
72
+ $html .= '<option value="' . $country_code . '" ' . selected( $country_code, $selected_country, false ) . '>' . $country_name . '</option>';
73
+ }
74
+ $html .= '</select>';
75
+
76
+ $html .= '</form>';
77
+
78
+ return $html;
79
+ }
80
+
81
+ /**
82
+ * wcj_wpml.
83
+ */
84
  function wcj_wpml( $atts, $content ) {
85
  if ( '' == $atts['lang'] || ( defined( 'ICL_LANGUAGE_CODE' ) && ICL_LANGUAGE_CODE === $atts['lang'] ) ) return do_shortcode( $content );
86
  else return '';
87
  }
88
 
89
+ /**
90
+ * wcj_wpml_translate.
91
+ */
92
  function wcj_wpml_translate( $atts, $content ) {
93
  return $this->wcj_wpml( $atts, $content );
94
  }
95
 
96
  /**
97
+ * wcj_cart_items_total_weight.
98
+ */
99
  function wcj_cart_items_total_weight( $atts ) {
100
  $the_cart = WC()->cart;
101
  return $the_cart->cart_contents_weight;
102
  }
103
 
104
+ /**
105
+ * wcj_current_date.
106
+ */
107
  function wcj_current_date( $atts ) {
108
  return date_i18n( $atts['date_format'] );
109
  }
110
 
111
+ /**
112
+ * wcj_image.
113
+ */
114
  /*function wcj_image( $atts ) {
115
  return '<img src="' . $atts['url'] . '" class="' . $atts['class'] . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '">';
116
  }*/
includes/shortcodes/class-wcj-shortcodes.php CHANGED
@@ -4,10 +4,8 @@
4
  *
5
  * The WooCommerce Jetpack Shortcodes class.
6
  *
7
- * @class WCJ_Shortcodes
8
- * @version 1.0.0
9
- * @category Class
10
- * @author Algoritmika Ltd.
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) exit;
@@ -16,36 +14,36 @@ if ( ! class_exists( 'WCJ_Shortcodes' ) ) :
16
 
17
  class WCJ_Shortcodes {
18
 
19
- /**
20
- * Constructor.
21
- */
22
- public function __construct() {
23
 
24
  foreach( $this->the_shortcodes as $the_shortcode ) {
25
  add_shortcode( $the_shortcode, array( $this, 'wcj_shortcode' ) );
26
  }
27
 
28
  add_filter( 'wcj_shortcodes_list', array( $this, 'add_shortcodes_to_the_list' ) );
29
- }
30
 
31
- /**
32
- * add_extra_atts.
33
- */
34
  function add_extra_atts( $atts ) {
35
  $final_atts = array_merge( $this->the_atts, $atts );
36
  return $final_atts;
37
  }
38
 
39
- /**
40
- * init_atts.
41
- */
42
  function init_atts( $atts ) {
43
  return $atts;
44
  }
45
 
46
- /**
47
- * add_shortcodes_to_the_list.
48
- */
49
  function add_shortcodes_to_the_list( $shortcodes_list ) {
50
  foreach( $this->the_shortcodes as $the_shortcode ) {
51
  $shortcodes_list[] = $the_shortcode;
@@ -53,23 +51,46 @@ class WCJ_Shortcodes {
53
  return $shortcodes_list;
54
  }
55
 
56
- /**
57
- * wcj_shortcode.
58
- */
59
  function wcj_shortcode( $atts, $content, $shortcode ) {
60
 
61
  // Init
62
  if ( empty( $atts ) ) $atts = array();
63
  $global_defaults = array(
64
- 'before' => '',
65
- 'after' => '',
66
- 'visibility' => '',
 
 
 
67
  );
68
  $atts = array_merge( $global_defaults, $atts );
69
 
70
  // Check if privileges are ok
71
  if ( 'admin' === $atts['visibility'] && ! is_super_admin() ) return '';
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  // Add child class specific atts
74
  $atts = $this->add_extra_atts( $atts );
75
 
@@ -82,6 +103,22 @@ class WCJ_Shortcodes {
82
  return $atts['before'] . $result . $atts['after'];
83
  return '';
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
 
87
  endif;
4
  *
5
  * The WooCommerce Jetpack Shortcodes class.
6
  *
7
+ * @version 2.2.1
8
+ * @author Algoritmika Ltd.
 
 
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
  class WCJ_Shortcodes {
16
 
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
 
22
  foreach( $this->the_shortcodes as $the_shortcode ) {
23
  add_shortcode( $the_shortcode, array( $this, 'wcj_shortcode' ) );
24
  }
25
 
26
  add_filter( 'wcj_shortcodes_list', array( $this, 'add_shortcodes_to_the_list' ) );
27
+ }
28
 
29
+ /**
30
+ * add_extra_atts.
31
+ */
32
  function add_extra_atts( $atts ) {
33
  $final_atts = array_merge( $this->the_atts, $atts );
34
  return $final_atts;
35
  }
36
 
37
+ /**
38
+ * init_atts.
39
+ */
40
  function init_atts( $atts ) {
41
  return $atts;
42
  }
43
 
44
+ /**
45
+ * add_shortcodes_to_the_list.
46
+ */
47
  function add_shortcodes_to_the_list( $shortcodes_list ) {
48
  foreach( $this->the_shortcodes as $the_shortcode ) {
49
  $shortcodes_list[] = $the_shortcode;
51
  return $shortcodes_list;
52
  }
53
 
54
+ /**
55
+ * wcj_shortcode.
56
+ */
57
  function wcj_shortcode( $atts, $content, $shortcode ) {
58
 
59
  // Init
60
  if ( empty( $atts ) ) $atts = array();
61
  $global_defaults = array(
62
+ 'before' => '',
63
+ 'after' => '',
64
+ 'visibility' => '',//user_visibility
65
+ 'site_visibility' => '',
66
+ 'location' => '',//user_location
67
+ 'wpml_language' => '',
68
  );
69
  $atts = array_merge( $global_defaults, $atts );
70
 
71
  // Check if privileges are ok
72
  if ( 'admin' === $atts['visibility'] && ! is_super_admin() ) return '';
73
 
74
+ // Check if site visibility is ok
75
+ if ( '' != $atts['site_visibility'] ) {
76
+ if (
77
+ ( 'single' === $atts['site_visibility'] && ! is_single() ) ||
78
+ ( 'page' === $atts['site_visibility'] && ! is_page() ) ||
79
+ ( 'archive' === $atts['site_visibility'] && ! is_archive() )
80
+ ) {
81
+ return '';
82
+ }
83
+
84
+ }
85
+
86
+ // Check if location is ok
87
+ if ( '' != $atts['location'] && 'all' != $atts['location'] && $atts['location'] != $this->wcj_get_user_location() ) return '';
88
+
89
+ // Check if language is ok
90
+ if ( '' != $atts['wpml_language'] ) {
91
+ if ( ! defined( 'ICL_LANGUAGE_CODE' ) || ICL_LANGUAGE_CODE != $atts['wpml_language'] ) return '';
92
+ }
93
+
94
  // Add child class specific atts
95
  $atts = $this->add_extra_atts( $atts );
96
 
103
  return $atts['before'] . $result . $atts['after'];
104
  return '';
105
  }
106
+
107
+ function wcj_get_user_location() {
108
+ $country = '';
109
+ if ( isset( $_GET['country'] ) && '' != $_GET['country'] && is_super_admin() ) {
110
+ $country = $_GET['country'];
111
+ } else {
112
+ // Get the country by IP
113
+ $location = WC_Geolocation::geolocate_ip();
114
+ // Base fallback
115
+ if ( empty( $location['country'] ) ) {
116
+ $location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
117
+ }
118
+ $country = ( isset( $location['country'] ) ) ? $location['country'] : '';
119
+ }
120
+ return $country;
121
+ }
122
  }
123
 
124
  endif;
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,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.2
7
- Stable tag: 2.2.0
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -18,62 +18,62 @@ WooCommerce Jetpack is a WordPress plugin that supercharges your site with aweso
18
 
19
  **Prices & Currencies**
20
 
21
- * Bulk Price Converter - Multiply all WooCommerce products prices by set value.
22
- * Currencies - Add all world currencies to your WooCommerce store; change currency symbol.
23
- * Currency for External Products - Set different currency for external WooCommerce products.
24
- * Prices and Currencies by Country - Change WooCommerce product price and currency automatically by customer's country.
25
- * Wholesale Price - Set WooCommerce wholesale pricing depending on product quantity in cart (buy more pay less).
26
 
27
  **Price & Button Labels**
28
 
29
- * Add to Cart Labels - Change text for Add to Cart button by WooCommerce product type, by product category or for individual products.
30
- * Call for Price - Create any custom price label for all WooCommerce products with empty price.
31
- * Custom Price Labels - Create any custom price label for any WooCommerce product.
32
- * More Button Labels - Set WooCommerce "Place order" button label.
33
 
34
  **Products**
35
 
36
- * Product Add to Cart - Set any local url to redirect to on WooCommerce Add to Cart. Automatically add to cart on product visit.
37
- * Product Images - Customize WooCommerce products images, thumbnails and sale flashes.
38
- * Product Info - Add additional info to WooCommerce category and single product pages.
39
- * Product Input Fields - WooCommerce product input fields.
40
- * Product Listings - Change WooCommerce display options for shop and category pages: show/hide categories count, exclude categories, show/hide empty categories.
41
- * Product Purchase Costs Data - Save WooCommerce product purchase costs data for admin reports.
42
- * Product Tabs - Add custom product tabs - globally or per product. Customize or completely remove WooCommerce default product tabs.
43
- * Related Products - Change displayed WooCommerce related products number, columns, order, relate by tag and/or category.
44
- * SKU - Generate WooCommerce SKUs automatically.
45
- * Sorting - Add more WooCommerce sorting options or remove all sorting including default.
46
 
47
  **Cart & Checkout**
48
 
49
- * Cart - Add custom info to WooCommerce cart page. Add empty cart button.
50
- * Checkout Core Fields - Customize WooCommerce core checkout fields. Disable/enable fields, set required, change labels and/or placeholders.
51
- * Checkout Custom Fields - Add custom fields to WooCommerce checkout page.
52
- * Checkout Custom Info - Add custom info to WooCommerce checkout page.
53
- * Mini Cart - Customize WooCommerce mini cart widget.
54
- * Payment Gateways - Add custom payment gateway, change icons (images) for all default WooCommerce payment gateways.
55
 
56
  **Shipping & Orders**
57
 
58
- * Address Formats - Set address format in WooCommerce orders on per country basis. Force base country display.
59
- * Order Custom Statuses - Custom statuses for WooCommerce orders.
60
- * Order Numbers - WooCommerce sequential order numbering, custom order number prefix, suffix and number width.
61
- * Orders - Minimum WooCommerce order amount; orders auto-complete.
62
- * Shipping - Hide WooCommerce shipping when free is available.
63
- * Shipping Calculator - Customize WooCommerce shipping calculator on cart page.
64
 
65
  **PDF Invoicing & Packing Slips**
66
 
67
- * PDF Invoicing - WooCommerce Invoices, Proforma Invoices, Credit Notes and Packing Slips.
68
 
69
  **Emails & Misc.**
70
 
71
- * Admin Tools - Debug and log tools for WooCommerce Jetpack.
72
- * Emails - Add another email recipient(s) to all WooCommerce emails.
73
- * General - Separate custom CSS for front and back end.
74
- * Old Slugs - Remove old WooCommerce products slugs.
75
- * Reports - WooCommerce stock, sales, customers etc. reports.
76
- * WPML - Basic WPML support for WooCommerce Jetpack.
77
 
78
  = Feedback =
79
  * We are open to your suggestions and feedback - thank you for using or trying out one of our plugins!
@@ -104,7 +104,23 @@ To unlock all WooCommerce Jetpack features, please install additional <a href="h
104
 
105
  == Changelog ==
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  = 2.2.0 - 13/06/2015 =
 
108
  * Dev - All modules set to "off" on initial install.
109
  * Dev - Admin options reset option added. Only by arg.
110
  * Dev - Readme generator `woojetpack_readme`.
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.2
7
+ Stable tag: 2.2.1
8
  License: GNU General Public License v3.0
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
18
 
19
  **Prices & Currencies**
20
 
21
+ * *Bulk Price Converter* - Multiply all WooCommerce products prices by set value.
22
+ * *Currencies* - Add all world currencies to your WooCommerce store; change currency symbol.
23
+ * *Currency for External Products* - Set different currency for external WooCommerce products.
24
+ * *Prices and Currencies by Country* - Change WooCommerce product price and currency automatically by customer's country.
25
+ * *Wholesale Price* - Set WooCommerce wholesale pricing depending on product quantity in cart (buy more pay less).
26
 
27
  **Price & Button Labels**
28
 
29
+ * *Add to Cart Labels* - Change text for Add to Cart button by WooCommerce product type, by product category or for individual products.
30
+ * *Call for Price* - Create any custom price label for all WooCommerce products with empty price.
31
+ * *Custom Price Labels* - Create any custom price label for any WooCommerce product.
32
+ * *More Button Labels* - Set WooCommerce "Place order" button label.
33
 
34
  **Products**
35
 
36
+ * *Product Add to Cart* - Set any local url to redirect to on WooCommerce Add to Cart. Automatically add to cart on product visit.
37
+ * *Product Cost Price* - Save WooCommerce product purchase costs data for admin reports.
38
+ * *Product Images* - Customize WooCommerce products images, thumbnails and sale flashes.
39
+ * *Product Info* - Add additional info to WooCommerce category and single product pages.
40
+ * *Product Input Fields* - WooCommerce product input fields.
41
+ * *Product Listings* - Change WooCommerce display options for shop and category pages: show/hide categories count, exclude categories, show/hide empty categories.
42
+ * *Product Tabs* - Add custom product tabs - globally or per product. Customize or completely remove WooCommerce default product tabs.
43
+ * *Related Products* - Change displayed WooCommerce related products number, columns, order, relate by tag and/or category, or hide related products completely.
44
+ * *SKU* - Generate WooCommerce SKUs automatically.
45
+ * *Sorting* - Add more WooCommerce sorting options or remove all sorting including default.
46
 
47
  **Cart & Checkout**
48
 
49
+ * *Cart* - Add custom info to WooCommerce cart page. Add empty cart button.
50
+ * *Checkout Core Fields* - Customize WooCommerce core checkout fields. Disable/enable fields, set required, change labels and/or placeholders.
51
+ * *Checkout Custom Fields* - Add custom fields to WooCommerce checkout page.
52
+ * *Checkout Custom Info* - Add custom info to WooCommerce checkout page.
53
+ * *Mini Cart* - Customize WooCommerce mini cart widget.
54
+ * *Payment Gateways* - Add custom payment gateway, change icons (images) for all default WooCommerce payment gateways.
55
 
56
  **Shipping & Orders**
57
 
58
+ * *Address Formats* - Set address format in WooCommerce orders on per country basis. Force base country display.
59
+ * *Order Custom Statuses* - Custom statuses for WooCommerce orders.
60
+ * *Order Numbers* - WooCommerce sequential order numbering, custom order number prefix, suffix and number width.
61
+ * *Orders* - Minimum WooCommerce order amount; orders auto-complete.
62
+ * *Shipping* - Hide WooCommerce shipping when free is available.
63
+ * *Shipping Calculator* - Customize WooCommerce shipping calculator on cart page.
64
 
65
  **PDF Invoicing & Packing Slips**
66
 
67
+ * *PDF Invoicing* - WooCommerce Invoices, Proforma Invoices, Credit Notes and Packing Slips.
68
 
69
  **Emails & Misc.**
70
 
71
+ * *Admin Tools* - Debug and log tools for WooCommerce Jetpack.
72
+ * *Emails* - Add another email recipient(s) to all WooCommerce emails.
73
+ * *General* - Separate custom CSS for front and back end.
74
+ * *Old Slugs* - Remove old WooCommerce products slugs.
75
+ * *Reports* - WooCommerce stock, sales, customers etc. reports.
76
+ * *WPML* - Basic WPML support for WooCommerce Jetpack.
77
 
78
  = Feedback =
79
  * We are open to your suggestions and feedback - thank you for using or trying out one of our plugins!
104
 
105
  == Changelog ==
106
 
107
+ = 2.2.1 - 04/07/2015 =
108
+ * Dev - Shortcodes - `location`, `site_visibility`, `wpml_language` attributes added to all shortcodes.
109
+ * Dev - PRICES & CURRENCIES - Price by Country - "by user selection" option added. `[wcj_country_select_drop_down_list]` shortcode added.
110
+ * Fix - PRICES & CURRENCIES - Wholesale Price - decimal point in discount percent, fixed.
111
+ * Dev - PRODUCTS - Related Products - Separate option for hiding the related products added.
112
+ * Dev - CART & CHECKOUT - Empty Cart Button - "Confirmation by pop up box" option added.
113
+ * Dev - CART & CHECKOUT - Empty Cart Button - Initial module release.
114
+ * Dev - CART & CHECKOUT - Cart - Code refactoring.
115
+ * Dev - PDF Invoicing - Invoice report tool added.
116
+ * Dev - PDF Invoicing - PDF invoices Header and Footer font set as "general font" set in "Styling" section.
117
+ * Dev - PDF Invoicing - Renumerate Invoices Tool - `date_query` added (fix for "memory exhausted" message, on large number of total shop orders).
118
+ * Fix - EMAILS & MISC. - WPML - `wcj_wpml_translate` added to General Shortcodes list.
119
+ * Dev - EMAILS & MISC. - General - "Enable shortcodes in WordPress text widgets" option added.
120
+ * Dev - EMAILS & MISC. - General - Code refactoring.
121
+
122
  = 2.2.0 - 13/06/2015 =
123
+ * Dev - readme.txt features description updated.
124
  * Dev - All modules set to "off" on initial install.
125
  * Dev - Admin options reset option added. Only by arg.
126
  * Dev - Readme generator `woojetpack_readme`.
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.2.0
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2015 Algoritmika Ltd.
@@ -65,33 +65,38 @@ final class WC_Jetpack {
65
  */
66
  public function __construct() {
67
 
 
 
 
68
  // Include required files
69
  $this->includes();
70
 
71
- // HOOKS
72
  //register_activation_hook( __FILE__, array( $this, 'install' ) );
73
  //add_action( 'admin_init', array( $this, 'install' ) );
74
  add_action( 'init', array( $this, 'init' ), 0 );
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
- //add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 2 );
83
  }
84
 
85
  // Scripts
86
  if ( is_admin() ) {
87
  if ( 'yes' === get_option( 'wcj_purchase_data_enabled' ) || 'yes' === get_option( 'wcj_pdf_invoicing_enabled' ) ) {
88
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
89
- add_action( 'admin_head', array( $this, 'add_datepicker_script' ) );
90
  }
91
  }
92
 
93
  // Loaded action
94
  do_action( 'wcj_loaded' );
 
 
 
95
  }
96
 
97
  /**
@@ -269,6 +274,7 @@ final class WC_Jetpack {
269
  $settings[] = include_once( 'includes/class-wcj-more-button-labels.php' );
270
 
271
  $settings[] = include_once( 'includes/class-wcj-cart.php' );
 
272
  $settings[] = include_once( 'includes/class-wcj-mini-cart.php' );
273
  $settings[] = include_once( 'includes/class-wcj-checkout-core-fields.php' );
274
  $settings[] = include_once( 'includes/class-wcj-checkout-custom-fields.php' );
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.2.1
7
  Author: Algoritmika Ltd
8
  Author URI: http://www.algoritmika.com
9
  Copyright: © 2015 Algoritmika Ltd.
65
  */
66
  public function __construct() {
67
 
68
+ /* echo 'Constructor Start: memory_get_usage( false )' . number_format( memory_get_usage( false ), 0, '.', ',' );
69
+ echo 'Constructor Start: memory_get_usage( true )' . number_format( memory_get_usage( true ), 0, '.', ',' ); */
70
+
71
  // Include required files
72
  $this->includes();
73
 
 
74
  //register_activation_hook( __FILE__, array( $this, 'install' ) );
75
  //add_action( 'admin_init', array( $this, 'install' ) );
76
  add_action( 'init', array( $this, 'init' ), 0 );
77
 
78
  // Settings
79
  if ( is_admin() ) {
80
+ add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_wcj_settings_tab' ) );
81
+ add_filter( 'get_wc_jetpack_plus_message', array( $this, 'get_wcj_plus_message' ), 100, 2 );
82
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) );
83
+ add_action( 'admin_menu', array( $this, 'jetpack_menu' ), 100 );
84
+ // add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 2 );
85
  }
86
 
87
  // Scripts
88
  if ( is_admin() ) {
89
  if ( 'yes' === get_option( 'wcj_purchase_data_enabled' ) || 'yes' === get_option( 'wcj_pdf_invoicing_enabled' ) ) {
90
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
91
+ add_action( 'admin_head', array( $this, 'add_datepicker_script' ) );
92
  }
93
  }
94
 
95
  // Loaded action
96
  do_action( 'wcj_loaded' );
97
+
98
+ /* echo 'Constructor End: memory_get_usage( false )' . number_format( memory_get_usage( false ), 0, '.', ',' );
99
+ echo 'Constructor End: memory_get_usage( true )' . number_format( memory_get_usage( true ), 0, '.', ',' ); */
100
  }
101
 
102
  /**
274
  $settings[] = include_once( 'includes/class-wcj-more-button-labels.php' );
275
 
276
  $settings[] = include_once( 'includes/class-wcj-cart.php' );
277
+ $settings[] = include_once( 'includes/class-wcj-empty-cart-button.php' );
278
  $settings[] = include_once( 'includes/class-wcj-mini-cart.php' );
279
  $settings[] = include_once( 'includes/class-wcj-checkout-core-fields.php' );
280
  $settings[] = include_once( 'includes/class-wcj-checkout-custom-fields.php' );
wpml-config.xml CHANGED
@@ -43,6 +43,8 @@
43
  <key name="wcj_product_input_fields_required_message_global_2" />
44
  <key name="wcj_add_to_cart_per_category_text_single_group_1" />
45
  <key name="wcj_add_to_cart_per_category_text_archive_group_1" />
 
 
46
  <key name="wcj_add_to_cart_text_on_single_simple" />
47
  <key name="wcj_add_to_cart_text_on_archives_simple" />
48
  <key name="wcj_add_to_cart_text_on_single_zero_price_simple" />
@@ -75,7 +77,6 @@
75
  <key name="wcj_add_to_cart_text_on_archives_in_cart_other" />
76
  <key name="wcj_checkout_place_order_button_text" />
77
  <key name="wcj_cart_custom_info_content_1" />
78
- <key name="wcj_empty_cart_text" />
79
  <key name="wcj_mini_cart_custom_info_content_1" />
80
  <key name="wcj_mini_cart_custom_info_content_2" />
81
  <key name="wcj_checkout_fields_billing_country_label" />
@@ -124,6 +125,8 @@
124
  <key name="wcj_checkout_fields_order_comments_placeholder" />
125
  <key name="wcj_checkout_custom_field_label_1" />
126
  <key name="wcj_checkout_custom_field_placeholder_1" />
 
 
127
  <key name="wcj_checkout_custom_info_content_1" />
128
  <key name="wcj_order_minimum_amount_error_message" />
129
  <key name="wcj_order_minimum_amount_cart_notice_message" />
43
  <key name="wcj_product_input_fields_required_message_global_2" />
44
  <key name="wcj_add_to_cart_per_category_text_single_group_1" />
45
  <key name="wcj_add_to_cart_per_category_text_archive_group_1" />
46
+ <key name="wcj_add_to_cart_per_category_text_single_group_2" />
47
+ <key name="wcj_add_to_cart_per_category_text_archive_group_2" />
48
  <key name="wcj_add_to_cart_text_on_single_simple" />
49
  <key name="wcj_add_to_cart_text_on_archives_simple" />
50
  <key name="wcj_add_to_cart_text_on_single_zero_price_simple" />
77
  <key name="wcj_add_to_cart_text_on_archives_in_cart_other" />
78
  <key name="wcj_checkout_place_order_button_text" />
79
  <key name="wcj_cart_custom_info_content_1" />
 
80
  <key name="wcj_mini_cart_custom_info_content_1" />
81
  <key name="wcj_mini_cart_custom_info_content_2" />
82
  <key name="wcj_checkout_fields_billing_country_label" />
125
  <key name="wcj_checkout_fields_order_comments_placeholder" />
126
  <key name="wcj_checkout_custom_field_label_1" />
127
  <key name="wcj_checkout_custom_field_placeholder_1" />
128
+ <key name="wcj_checkout_custom_field_label_2" />
129
+ <key name="wcj_checkout_custom_field_placeholder_2" />
130
  <key name="wcj_checkout_custom_info_content_1" />
131
  <key name="wcj_order_minimum_amount_error_message" />
132
  <key name="wcj_order_minimum_amount_cart_notice_message" />